## 商品发布去掉新直销SKU不需要字段;
This commit is contained in:
parent
6e97181986
commit
3c794b4416
|
@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNodeConfig;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.hzs.common.core.annotation.AccessPermissions;
|
||||
import com.hzs.common.core.annotation.Log;
|
||||
import com.hzs.common.core.constant.WaresConstants;
|
||||
|
@ -35,11 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 商品分类列表
|
||||
* @Author: yuhui
|
||||
* @Time: 2022/9/5 10:57
|
||||
* @Classname: BdAreaClassifyController
|
||||
* @PackageName: com.hzs.sale.product.controller.manage
|
||||
* 商品分类列表
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
@ -47,9 +43,9 @@ import java.util.List;
|
|||
public class BdAreaClassifyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IBdAreaClassifyService areaClassifyService;
|
||||
private IBdAreaClassifyService iBdAreaClassifyService;
|
||||
@Autowired
|
||||
private IBdAreaClassifySpecialAreaService areaClassifySpecialAreaService;
|
||||
private IBdAreaClassifySpecialAreaService iBdAreaClassifySpecialAreaService;
|
||||
@Autowired
|
||||
private UserTokenService userTokenService;
|
||||
|
||||
|
@ -60,22 +56,22 @@ public class BdAreaClassifyController extends BaseController {
|
|||
*/
|
||||
@AccessPermissions("GoodsClassify")
|
||||
@Log(module = EOperationModule.AREA_CLASSIFY, business = EOperationBusiness.AREA_CLASSIFY, method = EOperationMethod.SELECT)
|
||||
@GetMapping("list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AreaClassifyParam areaClassifyParam) {
|
||||
startPage();
|
||||
areaClassifyParam.setPkCountry(SecurityUtils.getPkCountry());
|
||||
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
for (AreaClassifyVo areaClassifyVo : list) {
|
||||
QueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("PK_AREA_CLASSIFY", areaClassifyVo.getPkId());
|
||||
LambdaQueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdAreaClassifySpecialArea::getPkAreaClassify, areaClassifyVo.getPkId());
|
||||
List<Integer> specialValue = new ArrayList<>();
|
||||
List<BdAreaClassifySpecialArea> specialList = areaClassifySpecialAreaService.list(queryWrapper);
|
||||
List<BdAreaClassifySpecialArea> specialList = iBdAreaClassifySpecialAreaService.list(queryWrapper);
|
||||
for (BdAreaClassifySpecialArea cps : specialList) {
|
||||
specialValue.add(cps.getSpecialArea());
|
||||
}
|
||||
QueryWrapper<BdAreaClassify> qw = new QueryWrapper<>();
|
||||
qw.eq("PK_PARENT", areaClassifyVo.getPkId());
|
||||
int count = areaClassifyService.count(qw);
|
||||
LambdaQueryWrapper<BdAreaClassify> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(BdAreaClassify::getPkParent, areaClassifyVo.getPkId());
|
||||
int count = iBdAreaClassifyService.count(qw);
|
||||
if (areaClassifyVo.getIsRecommend() == null) {
|
||||
areaClassifyVo.setIsRecommend(EYesNo.NO.getIntValue());
|
||||
}
|
||||
|
@ -91,15 +87,15 @@ public class BdAreaClassifyController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@Log(module = EOperationModule.AREA_CLASSIFY_SAVE, method = EOperationMethod.INSERT)
|
||||
@PostMapping("save")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody AreaClassifyParam areaClassifyParam) {
|
||||
if (StringUtils.isBlank(areaClassifyParam.getClassifyName())) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SPECIAL_AREA_CLASSIFY_REQUIRED));
|
||||
}
|
||||
QueryWrapper<BdAreaClassify> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("CLASSIFY_NAME", areaClassifyParam.getClassifyName());
|
||||
wrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry());
|
||||
int areaClassifyCount = areaClassifyService.count(wrapper);
|
||||
LambdaQueryWrapper<BdAreaClassify> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BdAreaClassify::getClassifyName, areaClassifyParam.getClassifyName());
|
||||
wrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
int areaClassifyCount = iBdAreaClassifyService.count(wrapper);
|
||||
if (areaClassifyCount > 0) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.CLASSIFY_NAME_REPEAT));
|
||||
}
|
||||
|
@ -112,19 +108,18 @@ public class BdAreaClassifyController extends BaseController {
|
|||
// 表示第一级
|
||||
areaClassifyParam.setHierarchy(0);
|
||||
} else {
|
||||
BdAreaClassify areaClassify = areaClassifyService.getById(areaClassifyParam.getPkParent());
|
||||
BdAreaClassify areaClassify = iBdAreaClassifyService.getById(areaClassifyParam.getPkParent());
|
||||
areaClassifyParam.setHierarchy(areaClassify.getHierarchy() + 1);
|
||||
}
|
||||
|
||||
QueryWrapper<BdAreaClassify> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("SORT", areaClassifyParam.getSort());
|
||||
queryWrapper.eq("HIERARCHY", areaClassifyParam.getHierarchy());
|
||||
queryWrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry());
|
||||
int count = areaClassifyService.count(queryWrapper);
|
||||
LambdaQueryWrapper<BdAreaClassify> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdAreaClassify::getSort, areaClassifyParam.getSort());
|
||||
queryWrapper.eq(BdAreaClassify::getHierarchy, areaClassifyParam.getHierarchy());
|
||||
queryWrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
int count = iBdAreaClassifyService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_REPEAT));
|
||||
}
|
||||
areaClassifyService.saveAreaClassify(areaClassifyParam, userTokenService.getLoginUser());
|
||||
iBdAreaClassifyService.saveAreaClassify(areaClassifyParam, userTokenService.getLoginUser());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
@ -135,7 +130,7 @@ public class BdAreaClassifyController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@Log(module = EOperationModule.AREA_CLASSIFY_UPDATE, method = EOperationMethod.UPDATE)
|
||||
@PostMapping("update")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody AreaClassifyParam areaClassifyParam) {
|
||||
if (areaClassifyParam.getHierarchy() == EYesNo.YES.getIntValue()) {
|
||||
// 一级
|
||||
|
@ -154,11 +149,11 @@ public class BdAreaClassifyController extends BaseController {
|
|||
if (StringUtils.isBlank(areaClassifyParam.getClassifyName())) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SPECIAL_AREA_CLASSIFY_REQUIRED));
|
||||
}
|
||||
QueryWrapper<BdAreaClassify> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("CLASSIFY_NAME", areaClassifyParam.getClassifyName());
|
||||
wrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry());
|
||||
wrapper.notIn("PK_ID", areaClassifyParam.getPkId());
|
||||
int areaClassifyCount = areaClassifyService.count(wrapper);
|
||||
LambdaQueryWrapper<BdAreaClassify> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BdAreaClassify::getClassifyName, areaClassifyParam.getClassifyName());
|
||||
wrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
wrapper.notIn(BdAreaClassify::getPkId, areaClassifyParam.getPkId());
|
||||
int areaClassifyCount = iBdAreaClassifyService.count(wrapper);
|
||||
if (areaClassifyCount > 0) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.CLASSIFY_NAME_REPEAT));
|
||||
}
|
||||
|
@ -166,16 +161,16 @@ public class BdAreaClassifyController extends BaseController {
|
|||
// 排序值超出限制
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_VALUES_OVERLIMIT));
|
||||
}
|
||||
QueryWrapper<BdAreaClassify> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("SORT", areaClassifyParam.getSort());
|
||||
queryWrapper.eq("HIERARCHY", areaClassifyParam.getHierarchy());
|
||||
queryWrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry());
|
||||
queryWrapper.notIn("PK_ID", areaClassifyParam.getPkId());
|
||||
int count = areaClassifyService.count(queryWrapper);
|
||||
LambdaQueryWrapper<BdAreaClassify> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdAreaClassify::getSort, areaClassifyParam.getSort());
|
||||
queryWrapper.eq(BdAreaClassify::getHierarchy, areaClassifyParam.getHierarchy());
|
||||
queryWrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
queryWrapper.notIn(BdAreaClassify::getPkId, areaClassifyParam.getPkId());
|
||||
int count = iBdAreaClassifyService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_REPEAT));
|
||||
}
|
||||
areaClassifyService.updateAreaClassify(areaClassifyParam, userTokenService.getLoginUser());
|
||||
iBdAreaClassifyService.updateAreaClassify(areaClassifyParam, userTokenService.getLoginUser());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
@ -187,16 +182,16 @@ public class BdAreaClassifyController extends BaseController {
|
|||
@Log(module = EOperationModule.AREA_CLASSIFY_DELETE, method = EOperationMethod.DELETE)
|
||||
@DeleteMapping("/{pkId}")
|
||||
public AjaxResult remove(@PathVariable Integer pkId) {
|
||||
BdAreaClassify areaClassify = areaClassifyService.getAreaClassify(pkId);
|
||||
BdAreaClassify areaClassify = iBdAreaClassifyService.getAreaClassify(pkId);
|
||||
if (areaClassify.getHierarchy() == 0) {
|
||||
QueryWrapper<BdAreaClassify> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("PK_PARENT", pkId);
|
||||
int count = areaClassifyService.count(queryWrapper);
|
||||
LambdaQueryWrapper<BdAreaClassify> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdAreaClassify::getPkParent, pkId);
|
||||
int count = iBdAreaClassifyService.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.THIS_CLASSIFY_EXIST_BELOW));
|
||||
}
|
||||
}
|
||||
areaClassifyService.deleteAreaClassify(pkId);
|
||||
iBdAreaClassifyService.deleteAreaClassify(pkId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
@ -215,22 +210,22 @@ public class BdAreaClassifyController extends BaseController {
|
|||
areaClassify.setPkId(pkId);
|
||||
areaClassify.setPkModified(SecurityUtils.getUserId());
|
||||
areaClassify.setModifiedTime(new Date());
|
||||
areaClassifyService.updateById(areaClassify);
|
||||
iBdAreaClassifyService.updateById(areaClassify);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@GetMapping("detail")
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(Integer pkId) {
|
||||
BdAreaClassify areaClassify = areaClassifyService.getById(pkId);
|
||||
BdAreaClassify areaClassify = iBdAreaClassifyService.getById(pkId);
|
||||
AreaClassifyParam areaClassifyParam = BeanUtil.copyProperties(areaClassify, AreaClassifyParam.class);
|
||||
|
||||
List<Integer> specialAreaList = new ArrayList<>();
|
||||
QueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("PK_AREA_CLASSIFY", pkId);
|
||||
List<BdAreaClassifySpecialArea> list = areaClassifySpecialAreaService.list(queryWrapper);
|
||||
LambdaQueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdAreaClassifySpecialArea::getPkAreaClassify, pkId);
|
||||
List<BdAreaClassifySpecialArea> list = iBdAreaClassifySpecialAreaService.list(queryWrapper);
|
||||
for (BdAreaClassifySpecialArea acs : list) {
|
||||
specialAreaList.add(acs.getSpecialArea());
|
||||
}
|
||||
|
@ -241,10 +236,10 @@ public class BdAreaClassifyController extends BaseController {
|
|||
/**
|
||||
* 查询第一层分类
|
||||
*/
|
||||
@GetMapping("get-first-classify")
|
||||
@GetMapping("/get-first-classify")
|
||||
public AjaxResult getFirstClassify(AreaClassifyParam areaClassifyParam) {
|
||||
areaClassifyParam.setHierarchy(0);
|
||||
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
@ -254,12 +249,12 @@ public class BdAreaClassifyController extends BaseController {
|
|||
* @param areaClassifyParam
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("get-hierarchy-list")
|
||||
@GetMapping("/get-hierarchy-list")
|
||||
public AjaxResult getLevelList(AreaClassifyParam areaClassifyParam) {
|
||||
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
|
||||
treeNodeConfig.setDeep(4);
|
||||
areaClassifyParam.setPkCountry(SecurityUtils.getPkCountry());
|
||||
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
List<Tree<String>> build = TreeUtil.build(list, "0", treeNodeConfig,
|
||||
(treeNode, tree) -> {
|
||||
tree.setId(treeNode.getPkId().toString());
|
||||
|
@ -284,15 +279,15 @@ public class BdAreaClassifyController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@Log(module = EOperationModule.AREA_CLASSIFY_LIST, method = EOperationMethod.SELECT)
|
||||
@GetMapping("find-all")
|
||||
@GetMapping("/find-all")
|
||||
public AjaxResult findAll(AreaClassifyParam areaClassifyParam) {
|
||||
|
||||
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
|
||||
for (AreaClassifyVo areaClassifyVo : list) {
|
||||
QueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("PK_AREA_CLASSIFY", areaClassifyVo.getPkId());
|
||||
LambdaQueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdAreaClassifySpecialArea::getPkAreaClassify, areaClassifyVo.getPkId());
|
||||
List<Integer> specialValue = new ArrayList<>();
|
||||
List<BdAreaClassifySpecialArea> specialList = areaClassifySpecialAreaService.list(queryWrapper);
|
||||
List<BdAreaClassifySpecialArea> specialList = iBdAreaClassifySpecialAreaService.list(queryWrapper);
|
||||
for (BdAreaClassifySpecialArea cps : specialList) {
|
||||
specialValue.add(cps.getSpecialArea());
|
||||
}
|
||||
|
@ -306,12 +301,12 @@ public class BdAreaClassifyController extends BaseController {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("classify-recommend")
|
||||
@PostMapping("/classify-recommend")
|
||||
public AjaxResult classifyRecommend(@RequestBody AreaClassifyParam areaClassifyParam) {
|
||||
BdAreaClassify bdAreaClassify = new BdAreaClassify();
|
||||
bdAreaClassify.setPkId(areaClassifyParam.getPkId());
|
||||
bdAreaClassify.setIsRecommend(areaClassifyParam.getIsRecommend());
|
||||
areaClassifyService.updateById(bdAreaClassify);
|
||||
iBdAreaClassifyService.updateById(bdAreaClassify);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,11 +32,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 规格分类controller
|
||||
* @Author: yuhui
|
||||
* @Time: 2022/8/29 10:59
|
||||
* @Classname: BdClassifyController
|
||||
* @PackageName: com.hzs.sale.product.controller.manage
|
||||
* 规格分类controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
@ -46,12 +42,12 @@ public class BdClassifyController extends BaseController {
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private IBdProductService productService;
|
||||
private IBdProductService iBdProductService;
|
||||
@Autowired
|
||||
private IBdClassifyService classifyService;
|
||||
private IBdClassifyService iBdClassifyService;
|
||||
|
||||
@DubboReference
|
||||
ITransactionServiceApi transactionServiceApi;
|
||||
ITransactionServiceApi iTransactionServiceApi;
|
||||
|
||||
/**
|
||||
* 查询规格分类
|
||||
|
@ -61,7 +57,7 @@ public class BdClassifyController extends BaseController {
|
|||
*/
|
||||
@AccessPermissions("cpfl")
|
||||
@Log(module = EOperationModule.SPECIFICATIONS_CONFIG, business = EOperationBusiness.PRODUCT_CLASSIFY, method = EOperationMethod.SELECT)
|
||||
@GetMapping("list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ClassIfyVo classIfyVo) {
|
||||
LambdaQueryWrapper<BdClassify> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(classIfyVo.getName())) {
|
||||
|
@ -72,7 +68,7 @@ public class BdClassifyController extends BaseController {
|
|||
}
|
||||
queryWrapper.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
startPage();
|
||||
List<BdClassify> list = classifyService.list(queryWrapper);
|
||||
List<BdClassify> list = iBdClassifyService.list(queryWrapper);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -82,21 +78,21 @@ public class BdClassifyController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@Log(module = EOperationModule.CLASSIFY_SAVE, method = EOperationMethod.INSERT)
|
||||
@PostMapping("save")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody BdClassify classify) {
|
||||
classify.setPkCreator(SecurityUtils.getUserId());
|
||||
classify.setCreationTime(new Date());
|
||||
classify.setPkCountry(SecurityUtils.getPkCountry());
|
||||
R<Integer> transaction = transactionServiceApi.createTransaction(SecurityUtils.getPkCountry(), ETransactionKey.SPEC, classify.getName(), EYesNo.NO, EYesNo.NO);
|
||||
R<Integer> transaction = iTransactionServiceApi.createTransaction(SecurityUtils.getPkCountry(), ETransactionKey.SPEC, classify.getName(), EYesNo.NO, EYesNo.NO);
|
||||
classify.setPkTransactionKey(transaction.getData());
|
||||
LambdaQueryWrapper<BdClassify> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(BdClassify::getName, classify.getName());
|
||||
qw.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
int count = classifyService.count(qw);
|
||||
int count = iBdClassifyService.count(qw);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(WaresMsgConstants.CLASSIFICATION_DUPLICATION);
|
||||
}
|
||||
return AjaxResult.success(classifyService.save(classify));
|
||||
return AjaxResult.success(iBdClassifyService.save(classify));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,14 +101,14 @@ public class BdClassifyController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@Log(module = EOperationModule.CLASSIFY_UPDATE, method = EOperationMethod.UPDATE)
|
||||
@PostMapping("update")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody BdClassify classify) {
|
||||
classify.setPkModified(SecurityUtils.getUserId());
|
||||
classify.setModifiedTime(new Date());
|
||||
classify.setPkCountry(SecurityUtils.getPkCountry());
|
||||
String redisKey = CacheConstants.BD_CLASSIFY + classify.getPkId();
|
||||
redisService.deleteObject(redisKey);
|
||||
return AjaxResult.success(classifyService.updateById(classify));
|
||||
return AjaxResult.success(iBdClassifyService.updateById(classify));
|
||||
}
|
||||
|
||||
|
||||
|
@ -135,11 +131,11 @@ public class BdClassifyController extends BaseController {
|
|||
redisService.deleteObject(redisKey);
|
||||
LambdaQueryWrapper<BdProduct> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(BdProduct::getPkClassify, pkId);
|
||||
int count = productService.count(qw);
|
||||
int count = iBdProductService.count(qw);
|
||||
if (count > 0) {
|
||||
return AjaxResult.error(WaresMsgConstants.WARES_CLASSIFY_IS_USE);
|
||||
}
|
||||
return toAjax(classifyService.update(updateWrapper));
|
||||
return toAjax(iBdClassifyService.update(updateWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +146,7 @@ public class BdClassifyController extends BaseController {
|
|||
*/
|
||||
@GetMapping("detail")
|
||||
public AjaxResult detail(Long classifyId) {
|
||||
return AjaxResult.success(classifyService.getById(classifyId));
|
||||
return AjaxResult.success(iBdClassifyService.getById(classifyId));
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,7 +163,7 @@ public class BdClassifyController extends BaseController {
|
|||
classify.setPkId(pkId);
|
||||
classify.setPkModified(SecurityUtils.getUserId());
|
||||
classify.setModifiedTime(new Date());
|
||||
return toAjax(classifyService.updateById(classify));
|
||||
return toAjax(iBdClassifyService.updateById(classify));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,11 +171,11 @@ public class BdClassifyController extends BaseController {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("find-all")
|
||||
@GetMapping("/find-all")
|
||||
public AjaxResult findAll() {
|
||||
LambdaQueryWrapper<BdClassify> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry());
|
||||
return AjaxResult.success(classifyService.list(queryWrapper));
|
||||
return AjaxResult.success(iBdClassifyService.list(queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,7 +192,7 @@ public class BdClassifyController extends BaseController {
|
|||
queryWrapper.eq(BdClassify::getName, classify.getName());
|
||||
}
|
||||
List<ClassIfyVo> resultList = new ArrayList<>();
|
||||
List<BdClassify> list = classifyService.list(queryWrapper);
|
||||
List<BdClassify> list = iBdClassifyService.list(queryWrapper);
|
||||
for (BdClassify bdClassify : list) {
|
||||
ClassIfyVo classIfyVo = new ClassIfyVo();
|
||||
classIfyVo.setCreationTime(bdClassify.getCreationTime());
|
||||
|
|
|
@ -81,7 +81,7 @@ public class BdProductController extends BaseController {
|
|||
*/
|
||||
@AccessPermissions("ProductList")
|
||||
@Log(module = EOperationModule.PRODUCT_LIST, business = EOperationBusiness.PRODUCT_LIST, method = EOperationMethod.SELECT)
|
||||
@GetMapping("list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProductParams productParams) {
|
||||
if (productParams.getShippingType() != null) {
|
||||
if (productParams.getShippingType() == 1) {
|
||||
|
@ -133,7 +133,7 @@ public class BdProductController extends BaseController {
|
|||
* 新增商品信息
|
||||
*/
|
||||
@Log(module = EOperationModule.PRODUCT_SAVE, method = EOperationMethod.INSERT, business = EOperationBusiness.PRODUCT_RELEASE)
|
||||
@PostMapping("save")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody ProductParams productParams) {
|
||||
if (StringUtils.isBlank(productParams.getProductName())) {
|
||||
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.PRODUCT_NAME_REQUIRED));
|
||||
|
@ -222,7 +222,7 @@ public class BdProductController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@Log(module = EOperationModule.PRODUCT_UPDATE, method = EOperationMethod.UPDATE, business = EOperationBusiness.PRODUCT_UPDATE)
|
||||
@PostMapping("update")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody ProductParams productParams) {
|
||||
// 查询订单编号是否重复
|
||||
BdProduct product = iBdProductService.getById(productParams.getPkId());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.hzs.sale.product.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hzs.common.domain.sale.product.BdAreaClassify;
|
||||
import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
|
||||
|
@ -10,9 +9,7 @@ import com.hzs.system.sys.dto.LoginUser;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品分类 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-09-05
|
||||
|
@ -21,6 +18,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
|
|||
|
||||
/**
|
||||
* 新增商品分类
|
||||
*
|
||||
* @param areaClassifyParam
|
||||
* @param loginUser
|
||||
*/
|
||||
|
@ -28,6 +26,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
|
|||
|
||||
/**
|
||||
* 修改商品分类
|
||||
*
|
||||
* @param areaClassifyParam
|
||||
* @param loginUser
|
||||
*/
|
||||
|
@ -35,6 +34,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
|
|||
|
||||
/**
|
||||
* 根据主键查询商品分类
|
||||
*
|
||||
* @param areaClassifyId
|
||||
* @return
|
||||
*/
|
||||
|
@ -42,6 +42,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
|
|||
|
||||
/**
|
||||
* 查询商品分类列表
|
||||
*
|
||||
* @param areaClassifyParam
|
||||
* @return
|
||||
*/
|
||||
|
@ -49,6 +50,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
|
|||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pkId
|
||||
*/
|
||||
void deleteAreaClassify(Integer pkId);
|
||||
|
|
|
@ -3,22 +3,20 @@ package com.hzs.sale.product.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hzs.common.domain.sale.classify.BdClassify;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格分类 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface IBdClassifyService extends IService<BdClassify> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据id 查询详情
|
||||
*
|
||||
* @param classifyId
|
||||
* @return
|
||||
*/
|
||||
BdClassify getClassify(Integer classifyId);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,11 +8,8 @@ import com.hzs.system.sys.dto.LoginUser;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格类型表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-08-27
|
||||
|
@ -21,18 +18,21 @@ public interface IBdSpecsTypeService extends IService<BdSpecsType> {
|
|||
|
||||
/**
|
||||
* 根据id 查询规格分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
BdSpecsType getSpecsType(Integer specsTypeId);
|
||||
|
||||
/**
|
||||
* 新增规格分类
|
||||
*
|
||||
* @param specsTypeParam
|
||||
*/
|
||||
void saveSpecsType(SpecsTypeParam specsTypeParam, LoginUser loginUser);
|
||||
|
||||
/**
|
||||
* 修改规格分类
|
||||
*
|
||||
* @param specsTypeParam
|
||||
* @param loginUser
|
||||
*/
|
||||
|
@ -40,6 +40,7 @@ public interface IBdSpecsTypeService extends IService<BdSpecsType> {
|
|||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param specsType
|
||||
* @return
|
||||
*/
|
||||
|
@ -47,7 +48,8 @@ public interface IBdSpecsTypeService extends IService<BdSpecsType> {
|
|||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pkId
|
||||
*/
|
||||
void deleteBySpecsTypeId(Integer pkId,LoginUser loginUser);
|
||||
void deleteBySpecsTypeId(Integer pkId, LoginUser loginUser);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package com.hzs.sale.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hzs.common.core.constant.CacheConstants;
|
||||
import com.hzs.common.core.domain.R;
|
||||
import com.hzs.common.core.enums.EDelFlag;
|
||||
import com.hzs.common.core.enums.ETransactionKey;
|
||||
import com.hzs.common.core.enums.EYesNo;
|
||||
import com.hzs.common.core.service.RedisService;
|
||||
import com.hzs.common.domain.sale.product.BdAreaClassify;
|
||||
import com.hzs.common.domain.sale.product.BdAreaClassifySpecialArea;
|
||||
import com.hzs.common.security.utils.SecurityUtils;
|
||||
|
@ -30,28 +28,17 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 商品分类 服务实现类
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-09-05
|
||||
*/
|
||||
@Service
|
||||
public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper, BdAreaClassify> implements IBdAreaClassifyService {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
private IBdAreaClassifyService iBdAreaClassifyService;
|
||||
@Autowired
|
||||
private IBdAreaClassifyService areaClassifyService;
|
||||
@Autowired
|
||||
private IBdAreaClassifySpecialAreaService areaClassifySpecialAreaService;
|
||||
private IBdAreaClassifySpecialAreaService iBdAreaClassifySpecialAreaService;
|
||||
@DubboReference
|
||||
ITransactionServiceApi transactionServiceApi;
|
||||
ITransactionServiceApi iTransactionServiceApi;
|
||||
|
||||
/**
|
||||
* 新增商品分类
|
||||
*
|
||||
* @param areaClassifyParam 分类对象
|
||||
* @param loginUser 登录用户
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveAreaClassify(AreaClassifyParam areaClassifyParam, LoginUser loginUser) {
|
||||
|
@ -59,7 +46,7 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
|
|||
areaClassify.setPkCreator(loginUser.getUserId());
|
||||
areaClassify.setCreationTime(new Date());
|
||||
areaClassify.setPkCountry(loginUser.getDataCountry());
|
||||
R<Integer> transaction = transactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, areaClassify.getClassifyName(), EYesNo.NO, EYesNo.NO);
|
||||
R<Integer> transaction = iTransactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, areaClassify.getClassifyName(), EYesNo.NO, EYesNo.NO);
|
||||
areaClassify.setPkTransactionKey(transaction.getData());
|
||||
baseMapper.insert(areaClassify);
|
||||
List<BdAreaClassifySpecialArea> list = new ArrayList<>();
|
||||
|
@ -76,28 +63,21 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
|
|||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
areaClassifySpecialAreaService.saveBatch(list);
|
||||
iBdAreaClassifySpecialAreaService.saveBatch(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品分类
|
||||
*
|
||||
* @param areaClassifyParam 分类对象
|
||||
* @param loginUser 当前登录用户
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAreaClassify(AreaClassifyParam areaClassifyParam, LoginUser loginUser) {
|
||||
BdAreaClassify areaClassify = BeanUtil.copyProperties(areaClassifyParam, BdAreaClassify.class);
|
||||
areaClassify.setPkModified(loginUser.getUserId());
|
||||
areaClassify.setModifiedTime(new Date());
|
||||
R<Integer> transaction = transactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, areaClassify.getClassifyName(), EYesNo.NO, EYesNo.NO);
|
||||
R<Integer> transaction = iTransactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, areaClassify.getClassifyName(), EYesNo.NO, EYesNo.NO);
|
||||
areaClassify.setPkTransactionKey(transaction.getData());
|
||||
baseMapper.updateById(areaClassify);
|
||||
// 清空 中间表数据重新添加
|
||||
areaClassifySpecialAreaService.deleteByAreaClassifyPk(areaClassify.getPkId());
|
||||
iBdAreaClassifySpecialAreaService.deleteByAreaClassifyPk(areaClassify.getPkId());
|
||||
List<BdAreaClassifySpecialArea> list = new ArrayList<>();
|
||||
if (areaClassifyParam.getSpecialAreaList() != null) {
|
||||
for (Integer number : areaClassifyParam.getSpecialAreaList()) {
|
||||
|
@ -111,38 +91,15 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
|
|||
}
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
areaClassifySpecialAreaService.saveBatch(list);
|
||||
iBdAreaClassifySpecialAreaService.saveBatch(list);
|
||||
}
|
||||
// 删除缓存
|
||||
String redisKey = CacheConstants.BD_AREA_CLASSIFY + areaClassify.getPkId();
|
||||
redisService.deleteObject(redisKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键查询商品分类
|
||||
*
|
||||
* @param areaClassifyId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BdAreaClassify getAreaClassify(Integer areaClassifyId) {
|
||||
String redisKey = CacheConstants.BD_AREA_CLASSIFY + areaClassifyId;
|
||||
BdAreaClassify areaClassify = redisService.getCacheObject(redisKey);
|
||||
if (null == areaClassify) {
|
||||
areaClassify = baseMapper.selectById(areaClassifyId);
|
||||
if (null != areaClassify) {
|
||||
redisService.setCacheObject(redisKey, areaClassify);
|
||||
}
|
||||
}
|
||||
return areaClassify;
|
||||
return baseMapper.selectById(areaClassifyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品分类列表
|
||||
*
|
||||
* @param areaClassifyParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AreaClassifyVo> selectByAreaClassifyList(AreaClassifyParam areaClassifyParam) {
|
||||
return baseMapper.selectByAreaClassifyList(areaClassifyParam);
|
||||
|
@ -151,18 +108,15 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAreaClassify(Integer pkId) {
|
||||
LambdaUpdateWrapper<BdAreaClassify> bdAreaClassify = new LambdaUpdateWrapper<>();
|
||||
bdAreaClassify.eq(BdAreaClassify::getPkId, pkId);
|
||||
bdAreaClassify.set(BdAreaClassify::getPkModified, SecurityUtils.getUserId());
|
||||
bdAreaClassify.set(BdAreaClassify::getModifiedTime, new Date());
|
||||
bdAreaClassify.set(BdAreaClassify::getDelFlag, EDelFlag.DELETE.getValue());
|
||||
iBdAreaClassifyService.update(bdAreaClassify);
|
||||
|
||||
UpdateWrapper<BdAreaClassify> bdAreaClassify = new UpdateWrapper<>();
|
||||
bdAreaClassify.eq("PK_ID", pkId);
|
||||
bdAreaClassify.set("PK_MODIFIED", SecurityUtils.getUserId());
|
||||
bdAreaClassify.set("MODIFIED_TIME", new Date());
|
||||
bdAreaClassify.set("DEL_FLAG", EDelFlag.DELETE.getValue());
|
||||
areaClassifyService.update(bdAreaClassify);
|
||||
|
||||
// 删除缓存
|
||||
String redisKey = CacheConstants.BD_AREA_CLASSIFY + pkId;
|
||||
redisService.deleteObject(redisKey);
|
||||
// 清空 中间表数据重新添加
|
||||
areaClassifySpecialAreaService.deleteByAreaClassifyPk(pkId);
|
||||
iBdAreaClassifySpecialAreaService.deleteByAreaClassifyPk(pkId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,16 +4,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.hzs.common.core.constant.CacheConstants;
|
||||
import com.hzs.common.core.service.RedisService;
|
||||
import com.hzs.common.domain.sale.classify.BdClassify;
|
||||
import com.hzs.common.domain.sale.postage.BdPostage;
|
||||
import com.hzs.sale.product.mapper.BdClassifyMapper;
|
||||
import com.hzs.sale.product.service.IBdClassifyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格分类 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-08-26
|
||||
|
@ -23,8 +20,10 @@ public class BdClassifyServiceImpl extends ServiceImpl<BdClassifyMapper, BdClass
|
|||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 根据id 查询详情
|
||||
*
|
||||
* @param classifyId
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -31,25 +31,23 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格类型表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-08-27
|
||||
*/
|
||||
@Service
|
||||
public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpecsType> implements IBdSpecsTypeService {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private IBdSpecsTypeService iBdSpecsTypeService;
|
||||
@Autowired
|
||||
private IBdSpecsService iBdSpecsService;
|
||||
@DubboReference
|
||||
private ITransactionServiceApi transactionServiceApi;
|
||||
@Autowired
|
||||
private IBdSpecsTypeService specsTypeService;
|
||||
@Autowired
|
||||
private IBdSpecsService specsService;
|
||||
ITransactionServiceApi iTransactionServiceApi;
|
||||
|
||||
/**
|
||||
* 根据id 查询规格分类
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
@ -75,7 +73,7 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
|
|||
bdSpecsType.setCreationTime(new Date());
|
||||
bdSpecsType.setSort(specsTypeParam.getSort());
|
||||
bdSpecsType.setPkCountry(loginUser.getDataCountry());
|
||||
R<Integer> transaction = transactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, specsTypeParam.getTypeName(), EYesNo.NO,EYesNo.NO);
|
||||
R<Integer> transaction = iTransactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, specsTypeParam.getTypeName(), EYesNo.NO, EYesNo.NO);
|
||||
bdSpecsType.setPkTransactionKey(transaction.getData());
|
||||
baseMapper.insert(bdSpecsType);
|
||||
List<BdSpecs> specsList = new ArrayList<>();
|
||||
|
@ -86,18 +84,19 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
|
|||
bdSpecs.setPkCreator(SecurityUtils.getUserId());
|
||||
bdSpecs.setCreationTime(new Date());
|
||||
bdSpecs.setPkCountry(SecurityUtils.getPkCountry());
|
||||
R<Integer> trans = transactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, bdSpecs.getSpecsName(), EYesNo.NO,EYesNo.NO);
|
||||
R<Integer> trans = iTransactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, bdSpecs.getSpecsName(), EYesNo.NO, EYesNo.NO);
|
||||
bdSpecs.setPkTransactionKey(trans.getData());
|
||||
specsList.add(bdSpecs);
|
||||
}
|
||||
|
||||
specsService.saveBatch(specsList);
|
||||
iBdSpecsService.saveBatch(specsList);
|
||||
String redisKey = CacheConstants.BD_SPECS_TYPE + bdSpecsType.getPkId();
|
||||
redisService.deleteObject(redisKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改规格分类
|
||||
*
|
||||
* @param specsTypeParam
|
||||
* @param loginUser
|
||||
*/
|
||||
|
@ -111,48 +110,49 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
|
|||
bdSpecsType.setPkModified(loginUser.getUserId());
|
||||
bdSpecsType.setTypeName(specsTypeParam.getTypeName());
|
||||
bdSpecsType.setSort(specsTypeParam.getSort());
|
||||
transactionServiceApi.updateTransaction(loginUser.getDataCountry(),specsTypeParam.getTypeName(),st.getPkTransactionKey(),true );
|
||||
// bdSpecsType.setPkTransactionKey(transaction.getData());
|
||||
iTransactionServiceApi.updateTransaction(loginUser.getDataCountry(), specsTypeParam.getTypeName(), st.getPkTransactionKey(), true);
|
||||
baseMapper.updateById(bdSpecsType);
|
||||
|
||||
List<Integer> specsId = new ArrayList<>();
|
||||
for (SpecsParam specsParam : specsTypeParam.getSpecsList()) {
|
||||
if (specsParam.getSpecsId() != null){
|
||||
if (specsParam.getSpecsId() != null) {
|
||||
specsId.add(specsParam.getSpecsId());
|
||||
}
|
||||
}
|
||||
specsService.remove(new QueryWrapper<BdSpecs>().notIn("PK_ID",specsId).eq("PK_SPECS_TYPE",specsTypeParam.getPkId()));
|
||||
iBdSpecsService.remove(new QueryWrapper<BdSpecs>().notIn("PK_ID", specsId).eq("PK_SPECS_TYPE", specsTypeParam.getPkId()));
|
||||
List<BdSpecs> specsList = new ArrayList<>();
|
||||
for (SpecsParam specs : specsTypeParam.getSpecsList()) {
|
||||
BdSpecs bdSpecs = new BdSpecs();
|
||||
if (specs.getSpecsId() != null){
|
||||
BdSpecs sp = specsService.getById(specs.getSpecsId());
|
||||
sp.setSpecsName(specs.getValue());
|
||||
sp.setModifiedTime(new Date());
|
||||
sp.setPkModified(SecurityUtils.getUserId());
|
||||
sp.setDelFlag(EDelFlag.UN_DELETE.getValue());
|
||||
specsService.updateById(sp);
|
||||
}else {
|
||||
bdSpecs.setPkSpecsType(bdSpecsType.getPkId());
|
||||
bdSpecs.setSpecsName(specs.getValue());
|
||||
bdSpecs.setPkCreator(SecurityUtils.getUserId());
|
||||
bdSpecs.setCreationTime(new Date());
|
||||
bdSpecs.setPkCountry(SecurityUtils.getPkCountry());
|
||||
R<Integer> trans = transactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, bdSpecs.getSpecsName(),EYesNo.NO,EYesNo.NO);
|
||||
bdSpecs.setPkTransactionKey(trans.getData());
|
||||
specsList.add(bdSpecs);
|
||||
}
|
||||
if (specs.getSpecsId() != null) {
|
||||
BdSpecs sp = iBdSpecsService.getById(specs.getSpecsId());
|
||||
sp.setSpecsName(specs.getValue());
|
||||
sp.setModifiedTime(new Date());
|
||||
sp.setPkModified(SecurityUtils.getUserId());
|
||||
sp.setDelFlag(EDelFlag.UN_DELETE.getValue());
|
||||
iBdSpecsService.updateById(sp);
|
||||
} else {
|
||||
bdSpecs.setPkSpecsType(bdSpecsType.getPkId());
|
||||
bdSpecs.setSpecsName(specs.getValue());
|
||||
bdSpecs.setPkCreator(SecurityUtils.getUserId());
|
||||
bdSpecs.setCreationTime(new Date());
|
||||
bdSpecs.setPkCountry(SecurityUtils.getPkCountry());
|
||||
R<Integer> trans = iTransactionServiceApi.createTransaction(loginUser.getDataCountry(), ETransactionKey.SPEC, bdSpecs.getSpecsName(), EYesNo.NO, EYesNo.NO);
|
||||
bdSpecs.setPkTransactionKey(trans.getData());
|
||||
specsList.add(bdSpecs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (specsList.size() > 0){
|
||||
specsService.saveBatch(specsList);
|
||||
if (specsList.size() > 0) {
|
||||
iBdSpecsService.saveBatch(specsList);
|
||||
}
|
||||
String redisKey = CacheConstants.BD_SPECS_TYPE + bdSpecsType.getPkId();
|
||||
redisService.deleteObject(redisKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param specsType
|
||||
* @return
|
||||
*/
|
||||
|
@ -161,25 +161,27 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
|
|||
return baseMapper.selectSpecsTypeList(specsType);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pkId
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteBySpecsTypeId(Integer pkId,LoginUser loginUser) {
|
||||
public void deleteBySpecsTypeId(Integer pkId, LoginUser loginUser) {
|
||||
UpdateWrapper<BdSpecsType> updateWrapper = new UpdateWrapper();
|
||||
updateWrapper.eq("PK_ID",pkId);
|
||||
updateWrapper.set("DEL_FLAG",EDelFlag.DELETE.getValue());
|
||||
updateWrapper.set("MODIFIED_TIME",new Date());
|
||||
updateWrapper.set("PK_MODIFIED",loginUser.getUserId());
|
||||
specsTypeService.update(updateWrapper);
|
||||
updateWrapper.eq("PK_ID", pkId);
|
||||
updateWrapper.set("DEL_FLAG", EDelFlag.DELETE.getValue());
|
||||
updateWrapper.set("MODIFIED_TIME", new Date());
|
||||
updateWrapper.set("PK_MODIFIED", loginUser.getUserId());
|
||||
iBdSpecsTypeService.update(updateWrapper);
|
||||
UpdateWrapper<BdSpecs> updateSpecsWrapper = new UpdateWrapper<>();
|
||||
updateSpecsWrapper.eq("PK_SPECS_TYPE",pkId);
|
||||
updateSpecsWrapper.set("MODIFIED_TIME",new Date());
|
||||
updateSpecsWrapper.set("PK_MODIFIED",loginUser.getUserId());
|
||||
updateSpecsWrapper.eq("PK_SPECS_TYPE", pkId);
|
||||
updateSpecsWrapper.set("MODIFIED_TIME", new Date());
|
||||
updateSpecsWrapper.set("PK_MODIFIED", loginUser.getUserId());
|
||||
updateSpecsWrapper.set("DEL_FLAG", EDelFlag.DELETE.getValue());
|
||||
specsService.update(updateSpecsWrapper);
|
||||
iBdSpecsService.update(updateSpecsWrapper);
|
||||
String redisKey = CacheConstants.BD_SPECS_TYPE + pkId;
|
||||
redisService.deleteObject(redisKey);
|
||||
}
|
||||
|
|
|
@ -53,22 +53,15 @@ import java.util.*;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yuhui
|
||||
* @Time: 2022/9/8 17:04
|
||||
* @Classname: BdWaresController
|
||||
* @PackageName: com.hzs.sale.wares.controller.manage
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/manage/wares")
|
||||
public class BdWaresController extends BaseController {
|
||||
|
||||
@DubboReference
|
||||
ICurrencyServiceApi currencyServiceApi;
|
||||
ICurrencyServiceApi iCurrencyServiceApi;
|
||||
@DubboReference
|
||||
IRangeServiceApi rangeServiceApi;
|
||||
IRangeServiceApi iRangeServiceApi;
|
||||
|
||||
@Autowired
|
||||
private IBdWaresAuthorizeService waresAuthorizeService;
|
||||
|
@ -122,7 +115,7 @@ public class BdWaresController extends BaseController {
|
|||
waresParams.setPkCountry(SecurityUtils.getPkCountry());
|
||||
List<WaresVo> resultList = waresService.selectByWaresInfo(waresParams);
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
R<CurrencyDTO> currencyDto = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
|
||||
resultList.parallelStream().forEach(waresVo -> {
|
||||
WaresAuthorityVo waresAuthorityVo = waresService.getWaresAuthorityFirst(waresVo.getPkWares());
|
||||
|
@ -156,7 +149,7 @@ public class BdWaresController extends BaseController {
|
|||
List<WaresVo> resultList = waresService.selectByWaresInfo(waresParams);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
R<CurrencyDTO> currencyDto = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
// 获取需要翻译的枚举翻译
|
||||
Map<String, String> transactionMap = iTransactionCommonService.exportEnumTransaction(ESpecialArea.values(), EYesNo.values(), ESupplyWay.values(), EPresaleStatus.values());
|
||||
|
||||
|
@ -851,7 +844,7 @@ public class BdWaresController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(Long pkId) {
|
||||
R<List<BdRangeExt>> rangeDto = rangeServiceApi.queryRange(SecurityUtils.getPkCountry());
|
||||
R<List<BdRangeExt>> rangeDto = iRangeServiceApi.queryRange(SecurityUtils.getPkCountry());
|
||||
List<BdRangeExt> rsList = rangeDto.getData();
|
||||
Map<Integer, BdRangeExt> rangeMap = rsList.stream().collect(Collectors.toMap(BdRangeExt::getPkId, Function.identity()));
|
||||
|
||||
|
@ -909,7 +902,7 @@ public class BdWaresController extends BaseController {
|
|||
waresParams.setSortStatus(wares.getSortStatus());
|
||||
waresParams.setSystemType(waresExtend.getSystemType());
|
||||
if (waresExtend.getMakerIncome() != null) {
|
||||
R<CurrencyDTO> currencyDto = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
|
||||
waresParams.setMakerIncome(waresExtend.getMakerIncome().multiply(currencyDto.getData().getInExchangeRate()));
|
||||
}
|
||||
|
||||
|
@ -996,7 +989,6 @@ public class BdWaresController extends BaseController {
|
|||
specsSkuParams.setIsPutOn(bdWaresSpecsSku.getIsPutOn());
|
||||
specsSkuParams.setVipPrice(bdWaresSpecsSku.getVipPrice());
|
||||
specsSkuParams.setRetailPrice(bdWaresSpecsSku.getRetailPrice());
|
||||
specsSkuParams.setSkuCode(bdWaresSpecsSku.getSkuCode());
|
||||
// 每个规格的sku键值对
|
||||
List<BdWaresSpecs> waresSpecsList = new ArrayList<>();
|
||||
LambdaQueryWrapper<BdWaresSpecsRelation> waresSpecsRelation = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
package com.hzs.sale.wares.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.hzs.common.domain.sale.wares.BdWaresSpecs;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: yuhui
|
||||
* @Time: 2022/11/7 15:54
|
||||
* @Classname: WaresSpecsParams
|
||||
* @PackageName: com.hzs.sale.wares.param
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
public class WaresSpecsSkuParams {
|
||||
|
||||
|
@ -56,7 +46,7 @@ public class WaresSpecsSkuParams {
|
|||
private BigDecimal assAchieve;
|
||||
|
||||
/**
|
||||
/**
|
||||
* /**
|
||||
* 规格明细表
|
||||
*/
|
||||
private List<BdWaresSpecs> waresSpecsList;
|
||||
|
@ -73,5 +63,4 @@ public class WaresSpecsSkuParams {
|
|||
*/
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
private String skuCode;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,6 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
bdWaresSpecsSku.setAssAchieve(waresSpecsSkuParams.getAssAchieve());
|
||||
bdWaresSpecsSku.setVipPrice(waresSpecsSkuParams.getVipPrice());
|
||||
bdWaresSpecsSku.setRetailPrice(waresSpecsSkuParams.getRetailPrice());
|
||||
bdWaresSpecsSku.setSkuCode(waresSpecsSkuParams.getSkuCode());
|
||||
iBdWaresSpecsSkuService.save(bdWaresSpecsSku);
|
||||
// 生成规格明细表
|
||||
List<BdWaresSpecs> waresSpecsList = waresSpecsSkuParams.getWaresSpecsList();
|
||||
|
@ -519,7 +518,6 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
} else {
|
||||
sku.setIsPutOn(EYesNo.YES.getIntValue());
|
||||
}
|
||||
sku.setSkuCode(waresSpecsSkuParams.getSkuCode());
|
||||
iBdWaresSpecsSkuService.updateBySkuId(sku);
|
||||
redisService.deleteObject(CacheConstants.BD_WARES_SPECS_RELATION + bdWaresSpecsSku.getPkId());
|
||||
}
|
||||
|
|
|
@ -137,11 +137,6 @@ public class CacheConstants {
|
|||
*/
|
||||
public static final String BD_POSTAGE = CACHE_PREFIX + "postage:";
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
public static final String BD_AREA_CLASSIFY = CACHE_PREFIX + "area:classify:";
|
||||
|
||||
/**
|
||||
* 规格分类
|
||||
*/
|
||||
|
@ -237,11 +232,6 @@ public class CacheConstants {
|
|||
*/
|
||||
public static final String BD_BONUS_ITEMS = CACHE_PREFIX + "bonus:items:";
|
||||
|
||||
/**
|
||||
* 配送中心配置
|
||||
*/
|
||||
public static final String BD_SHOP = CACHE_PREFIX + "shop:";
|
||||
|
||||
/**
|
||||
* 极差配置
|
||||
*/
|
||||
|
|
|
@ -12,9 +12,7 @@ import lombok.EqualsAndHashCode;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 规格sku表
|
||||
* </p>
|
||||
*
|
||||
* @author hzs
|
||||
* @since 2022-09-09
|
||||
|
@ -88,9 +86,4 @@ public class BdWaresSpecsSku extends BaseEntity {
|
|||
@TableField("RETAIL_PRICE")
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/**
|
||||
* sku编码
|
||||
*/
|
||||
@TableField("SKU_CODE")
|
||||
private String skuCode;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue