## 商品发布去掉新直销SKU不需要字段;

This commit is contained in:
cabbage 2025-04-29 13:36:21 +08:00
parent 6e97181986
commit 3c794b4416
14 changed files with 169 additions and 259 deletions

View File

@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig; import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil; 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.AccessPermissions;
import com.hzs.common.core.annotation.Log; import com.hzs.common.core.annotation.Log;
import com.hzs.common.core.constant.WaresConstants; import com.hzs.common.core.constant.WaresConstants;
@ -35,11 +35,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @Description: 商品分类列表 * 商品分类列表
* @Author: yuhui
* @Time: 2022/9/5 10:57
* @Classname: BdAreaClassifyController
* @PackageName: com.hzs.sale.product.controller.manage
*/ */
@Slf4j @Slf4j
@RestController @RestController
@ -47,9 +43,9 @@ import java.util.List;
public class BdAreaClassifyController extends BaseController { public class BdAreaClassifyController extends BaseController {
@Autowired @Autowired
private IBdAreaClassifyService areaClassifyService; private IBdAreaClassifyService iBdAreaClassifyService;
@Autowired @Autowired
private IBdAreaClassifySpecialAreaService areaClassifySpecialAreaService; private IBdAreaClassifySpecialAreaService iBdAreaClassifySpecialAreaService;
@Autowired @Autowired
private UserTokenService userTokenService; private UserTokenService userTokenService;
@ -60,22 +56,22 @@ public class BdAreaClassifyController extends BaseController {
*/ */
@AccessPermissions("GoodsClassify") @AccessPermissions("GoodsClassify")
@Log(module = EOperationModule.AREA_CLASSIFY, business = EOperationBusiness.AREA_CLASSIFY, method = EOperationMethod.SELECT) @Log(module = EOperationModule.AREA_CLASSIFY, business = EOperationBusiness.AREA_CLASSIFY, method = EOperationMethod.SELECT)
@GetMapping("list") @GetMapping("/list")
public TableDataInfo list(AreaClassifyParam areaClassifyParam) { public TableDataInfo list(AreaClassifyParam areaClassifyParam) {
startPage(); startPage();
areaClassifyParam.setPkCountry(SecurityUtils.getPkCountry()); areaClassifyParam.setPkCountry(SecurityUtils.getPkCountry());
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam); List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
for (AreaClassifyVo areaClassifyVo : list) { for (AreaClassifyVo areaClassifyVo : list) {
QueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq("PK_AREA_CLASSIFY", areaClassifyVo.getPkId()); queryWrapper.eq(BdAreaClassifySpecialArea::getPkAreaClassify, areaClassifyVo.getPkId());
List<Integer> specialValue = new ArrayList<>(); List<Integer> specialValue = new ArrayList<>();
List<BdAreaClassifySpecialArea> specialList = areaClassifySpecialAreaService.list(queryWrapper); List<BdAreaClassifySpecialArea> specialList = iBdAreaClassifySpecialAreaService.list(queryWrapper);
for (BdAreaClassifySpecialArea cps : specialList) { for (BdAreaClassifySpecialArea cps : specialList) {
specialValue.add(cps.getSpecialArea()); specialValue.add(cps.getSpecialArea());
} }
QueryWrapper<BdAreaClassify> qw = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassify> qw = new LambdaQueryWrapper<>();
qw.eq("PK_PARENT", areaClassifyVo.getPkId()); qw.eq(BdAreaClassify::getPkParent, areaClassifyVo.getPkId());
int count = areaClassifyService.count(qw); int count = iBdAreaClassifyService.count(qw);
if (areaClassifyVo.getIsRecommend() == null) { if (areaClassifyVo.getIsRecommend() == null) {
areaClassifyVo.setIsRecommend(EYesNo.NO.getIntValue()); areaClassifyVo.setIsRecommend(EYesNo.NO.getIntValue());
} }
@ -91,15 +87,15 @@ public class BdAreaClassifyController extends BaseController {
* @return * @return
*/ */
@Log(module = EOperationModule.AREA_CLASSIFY_SAVE, method = EOperationMethod.INSERT) @Log(module = EOperationModule.AREA_CLASSIFY_SAVE, method = EOperationMethod.INSERT)
@PostMapping("save") @PostMapping("/save")
public AjaxResult save(@RequestBody AreaClassifyParam areaClassifyParam) { public AjaxResult save(@RequestBody AreaClassifyParam areaClassifyParam) {
if (StringUtils.isBlank(areaClassifyParam.getClassifyName())) { if (StringUtils.isBlank(areaClassifyParam.getClassifyName())) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SPECIAL_AREA_CLASSIFY_REQUIRED)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SPECIAL_AREA_CLASSIFY_REQUIRED));
} }
QueryWrapper<BdAreaClassify> wrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassify> wrapper = new LambdaQueryWrapper<>();
wrapper.eq("CLASSIFY_NAME", areaClassifyParam.getClassifyName()); wrapper.eq(BdAreaClassify::getClassifyName, areaClassifyParam.getClassifyName());
wrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry()); wrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
int areaClassifyCount = areaClassifyService.count(wrapper); int areaClassifyCount = iBdAreaClassifyService.count(wrapper);
if (areaClassifyCount > 0) { if (areaClassifyCount > 0) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.CLASSIFY_NAME_REPEAT)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.CLASSIFY_NAME_REPEAT));
} }
@ -112,19 +108,18 @@ public class BdAreaClassifyController extends BaseController {
// 表示第一级 // 表示第一级
areaClassifyParam.setHierarchy(0); areaClassifyParam.setHierarchy(0);
} else { } else {
BdAreaClassify areaClassify = areaClassifyService.getById(areaClassifyParam.getPkParent()); BdAreaClassify areaClassify = iBdAreaClassifyService.getById(areaClassifyParam.getPkParent());
areaClassifyParam.setHierarchy(areaClassify.getHierarchy() + 1); areaClassifyParam.setHierarchy(areaClassify.getHierarchy() + 1);
} }
LambdaQueryWrapper<BdAreaClassify> queryWrapper = new LambdaQueryWrapper<>();
QueryWrapper<BdAreaClassify> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(BdAreaClassify::getSort, areaClassifyParam.getSort());
queryWrapper.eq("SORT", areaClassifyParam.getSort()); queryWrapper.eq(BdAreaClassify::getHierarchy, areaClassifyParam.getHierarchy());
queryWrapper.eq("HIERARCHY", areaClassifyParam.getHierarchy()); queryWrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
queryWrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry()); int count = iBdAreaClassifyService.count(queryWrapper);
int count = areaClassifyService.count(queryWrapper);
if (count > 0) { if (count > 0) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_REPEAT)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_REPEAT));
} }
areaClassifyService.saveAreaClassify(areaClassifyParam, userTokenService.getLoginUser()); iBdAreaClassifyService.saveAreaClassify(areaClassifyParam, userTokenService.getLoginUser());
return AjaxResult.success(); return AjaxResult.success();
} }
@ -135,7 +130,7 @@ public class BdAreaClassifyController extends BaseController {
* @return * @return
*/ */
@Log(module = EOperationModule.AREA_CLASSIFY_UPDATE, method = EOperationMethod.UPDATE) @Log(module = EOperationModule.AREA_CLASSIFY_UPDATE, method = EOperationMethod.UPDATE)
@PostMapping("update") @PostMapping("/update")
public AjaxResult update(@RequestBody AreaClassifyParam areaClassifyParam) { public AjaxResult update(@RequestBody AreaClassifyParam areaClassifyParam) {
if (areaClassifyParam.getHierarchy() == EYesNo.YES.getIntValue()) { if (areaClassifyParam.getHierarchy() == EYesNo.YES.getIntValue()) {
// 一级 // 一级
@ -154,11 +149,11 @@ public class BdAreaClassifyController extends BaseController {
if (StringUtils.isBlank(areaClassifyParam.getClassifyName())) { if (StringUtils.isBlank(areaClassifyParam.getClassifyName())) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SPECIAL_AREA_CLASSIFY_REQUIRED)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SPECIAL_AREA_CLASSIFY_REQUIRED));
} }
QueryWrapper<BdAreaClassify> wrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassify> wrapper = new LambdaQueryWrapper<>();
wrapper.eq("CLASSIFY_NAME", areaClassifyParam.getClassifyName()); wrapper.eq(BdAreaClassify::getClassifyName, areaClassifyParam.getClassifyName());
wrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry()); wrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
wrapper.notIn("PK_ID", areaClassifyParam.getPkId()); wrapper.notIn(BdAreaClassify::getPkId, areaClassifyParam.getPkId());
int areaClassifyCount = areaClassifyService.count(wrapper); int areaClassifyCount = iBdAreaClassifyService.count(wrapper);
if (areaClassifyCount > 0) { if (areaClassifyCount > 0) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.CLASSIFY_NAME_REPEAT)); 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)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_VALUES_OVERLIMIT));
} }
QueryWrapper<BdAreaClassify> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassify> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq("SORT", areaClassifyParam.getSort()); queryWrapper.eq(BdAreaClassify::getSort, areaClassifyParam.getSort());
queryWrapper.eq("HIERARCHY", areaClassifyParam.getHierarchy()); queryWrapper.eq(BdAreaClassify::getHierarchy, areaClassifyParam.getHierarchy());
queryWrapper.eq("PK_COUNTRY", SecurityUtils.getPkCountry()); queryWrapper.eq(BdAreaClassify::getPkCountry, SecurityUtils.getPkCountry());
queryWrapper.notIn("PK_ID", areaClassifyParam.getPkId()); queryWrapper.notIn(BdAreaClassify::getPkId, areaClassifyParam.getPkId());
int count = areaClassifyService.count(queryWrapper); int count = iBdAreaClassifyService.count(queryWrapper);
if (count > 0) { if (count > 0) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_REPEAT)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.SORT_REPEAT));
} }
areaClassifyService.updateAreaClassify(areaClassifyParam, userTokenService.getLoginUser()); iBdAreaClassifyService.updateAreaClassify(areaClassifyParam, userTokenService.getLoginUser());
return AjaxResult.success(); return AjaxResult.success();
} }
@ -187,16 +182,16 @@ public class BdAreaClassifyController extends BaseController {
@Log(module = EOperationModule.AREA_CLASSIFY_DELETE, method = EOperationMethod.DELETE) @Log(module = EOperationModule.AREA_CLASSIFY_DELETE, method = EOperationMethod.DELETE)
@DeleteMapping("/{pkId}") @DeleteMapping("/{pkId}")
public AjaxResult remove(@PathVariable Integer pkId) { public AjaxResult remove(@PathVariable Integer pkId) {
BdAreaClassify areaClassify = areaClassifyService.getAreaClassify(pkId); BdAreaClassify areaClassify = iBdAreaClassifyService.getAreaClassify(pkId);
if (areaClassify.getHierarchy() == 0) { if (areaClassify.getHierarchy() == 0) {
QueryWrapper<BdAreaClassify> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassify> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq("PK_PARENT", pkId); queryWrapper.eq(BdAreaClassify::getPkParent, pkId);
int count = areaClassifyService.count(queryWrapper); int count = iBdAreaClassifyService.count(queryWrapper);
if (count > 0) { if (count > 0) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.THIS_CLASSIFY_EXIST_BELOW)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.THIS_CLASSIFY_EXIST_BELOW));
} }
} }
areaClassifyService.deleteAreaClassify(pkId); iBdAreaClassifyService.deleteAreaClassify(pkId);
return AjaxResult.success(); return AjaxResult.success();
} }
@ -215,22 +210,22 @@ public class BdAreaClassifyController extends BaseController {
areaClassify.setPkId(pkId); areaClassify.setPkId(pkId);
areaClassify.setPkModified(SecurityUtils.getUserId()); areaClassify.setPkModified(SecurityUtils.getUserId());
areaClassify.setModifiedTime(new Date()); areaClassify.setModifiedTime(new Date());
areaClassifyService.updateById(areaClassify); iBdAreaClassifyService.updateById(areaClassify);
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 查询详情 * 查询详情
*/ */
@GetMapping("detail") @GetMapping("/detail")
public AjaxResult detail(Integer pkId) { public AjaxResult detail(Integer pkId) {
BdAreaClassify areaClassify = areaClassifyService.getById(pkId); BdAreaClassify areaClassify = iBdAreaClassifyService.getById(pkId);
AreaClassifyParam areaClassifyParam = BeanUtil.copyProperties(areaClassify, AreaClassifyParam.class); AreaClassifyParam areaClassifyParam = BeanUtil.copyProperties(areaClassify, AreaClassifyParam.class);
List<Integer> specialAreaList = new ArrayList<>(); List<Integer> specialAreaList = new ArrayList<>();
QueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq("PK_AREA_CLASSIFY", pkId); queryWrapper.eq(BdAreaClassifySpecialArea::getPkAreaClassify, pkId);
List<BdAreaClassifySpecialArea> list = areaClassifySpecialAreaService.list(queryWrapper); List<BdAreaClassifySpecialArea> list = iBdAreaClassifySpecialAreaService.list(queryWrapper);
for (BdAreaClassifySpecialArea acs : list) { for (BdAreaClassifySpecialArea acs : list) {
specialAreaList.add(acs.getSpecialArea()); 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) { public AjaxResult getFirstClassify(AreaClassifyParam areaClassifyParam) {
areaClassifyParam.setHierarchy(0); areaClassifyParam.setHierarchy(0);
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam); List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@ -254,12 +249,12 @@ public class BdAreaClassifyController extends BaseController {
* @param areaClassifyParam * @param areaClassifyParam
* @return * @return
*/ */
@GetMapping("get-hierarchy-list") @GetMapping("/get-hierarchy-list")
public AjaxResult getLevelList(AreaClassifyParam areaClassifyParam) { public AjaxResult getLevelList(AreaClassifyParam areaClassifyParam) {
TreeNodeConfig treeNodeConfig = new TreeNodeConfig(); TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
treeNodeConfig.setDeep(4); treeNodeConfig.setDeep(4);
areaClassifyParam.setPkCountry(SecurityUtils.getPkCountry()); 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, List<Tree<String>> build = TreeUtil.build(list, "0", treeNodeConfig,
(treeNode, tree) -> { (treeNode, tree) -> {
tree.setId(treeNode.getPkId().toString()); tree.setId(treeNode.getPkId().toString());
@ -284,15 +279,15 @@ public class BdAreaClassifyController extends BaseController {
* @return * @return
*/ */
@Log(module = EOperationModule.AREA_CLASSIFY_LIST, method = EOperationMethod.SELECT) @Log(module = EOperationModule.AREA_CLASSIFY_LIST, method = EOperationMethod.SELECT)
@GetMapping("find-all") @GetMapping("/find-all")
public AjaxResult findAll(AreaClassifyParam areaClassifyParam) { public AjaxResult findAll(AreaClassifyParam areaClassifyParam) {
List<AreaClassifyVo> list = areaClassifyService.selectByAreaClassifyList(areaClassifyParam); List<AreaClassifyVo> list = iBdAreaClassifyService.selectByAreaClassifyList(areaClassifyParam);
for (AreaClassifyVo areaClassifyVo : list) { for (AreaClassifyVo areaClassifyVo : list) {
QueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new QueryWrapper<>(); LambdaQueryWrapper<BdAreaClassifySpecialArea> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq("PK_AREA_CLASSIFY", areaClassifyVo.getPkId()); queryWrapper.eq(BdAreaClassifySpecialArea::getPkAreaClassify, areaClassifyVo.getPkId());
List<Integer> specialValue = new ArrayList<>(); List<Integer> specialValue = new ArrayList<>();
List<BdAreaClassifySpecialArea> specialList = areaClassifySpecialAreaService.list(queryWrapper); List<BdAreaClassifySpecialArea> specialList = iBdAreaClassifySpecialAreaService.list(queryWrapper);
for (BdAreaClassifySpecialArea cps : specialList) { for (BdAreaClassifySpecialArea cps : specialList) {
specialValue.add(cps.getSpecialArea()); specialValue.add(cps.getSpecialArea());
} }
@ -306,12 +301,12 @@ public class BdAreaClassifyController extends BaseController {
* *
* @return * @return
*/ */
@PostMapping("classify-recommend") @PostMapping("/classify-recommend")
public AjaxResult classifyRecommend(@RequestBody AreaClassifyParam areaClassifyParam) { public AjaxResult classifyRecommend(@RequestBody AreaClassifyParam areaClassifyParam) {
BdAreaClassify bdAreaClassify = new BdAreaClassify(); BdAreaClassify bdAreaClassify = new BdAreaClassify();
bdAreaClassify.setPkId(areaClassifyParam.getPkId()); bdAreaClassify.setPkId(areaClassifyParam.getPkId());
bdAreaClassify.setIsRecommend(areaClassifyParam.getIsRecommend()); bdAreaClassify.setIsRecommend(areaClassifyParam.getIsRecommend());
areaClassifyService.updateById(bdAreaClassify); iBdAreaClassifyService.updateById(bdAreaClassify);
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -32,11 +32,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @Description: 规格分类controller * 规格分类controller
* @Author: yuhui
* @Time: 2022/8/29 10:59
* @Classname: BdClassifyController
* @PackageName: com.hzs.sale.product.controller.manage
*/ */
@Slf4j @Slf4j
@RestController @RestController
@ -46,12 +42,12 @@ public class BdClassifyController extends BaseController {
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Autowired @Autowired
private IBdProductService productService; private IBdProductService iBdProductService;
@Autowired @Autowired
private IBdClassifyService classifyService; private IBdClassifyService iBdClassifyService;
@DubboReference @DubboReference
ITransactionServiceApi transactionServiceApi; ITransactionServiceApi iTransactionServiceApi;
/** /**
* 查询规格分类 * 查询规格分类
@ -61,7 +57,7 @@ public class BdClassifyController extends BaseController {
*/ */
@AccessPermissions("cpfl") @AccessPermissions("cpfl")
@Log(module = EOperationModule.SPECIFICATIONS_CONFIG, business = EOperationBusiness.PRODUCT_CLASSIFY, method = EOperationMethod.SELECT) @Log(module = EOperationModule.SPECIFICATIONS_CONFIG, business = EOperationBusiness.PRODUCT_CLASSIFY, method = EOperationMethod.SELECT)
@GetMapping("list") @GetMapping("/list")
public TableDataInfo list(ClassIfyVo classIfyVo) { public TableDataInfo list(ClassIfyVo classIfyVo) {
LambdaQueryWrapper<BdClassify> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BdClassify> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(classIfyVo.getName())) { if (StringUtils.isNotBlank(classIfyVo.getName())) {
@ -72,7 +68,7 @@ public class BdClassifyController extends BaseController {
} }
queryWrapper.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry()); queryWrapper.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry());
startPage(); startPage();
List<BdClassify> list = classifyService.list(queryWrapper); List<BdClassify> list = iBdClassifyService.list(queryWrapper);
return getDataTable(list); return getDataTable(list);
} }
@ -82,21 +78,21 @@ public class BdClassifyController extends BaseController {
* @return * @return
*/ */
@Log(module = EOperationModule.CLASSIFY_SAVE, method = EOperationMethod.INSERT) @Log(module = EOperationModule.CLASSIFY_SAVE, method = EOperationMethod.INSERT)
@PostMapping("save") @PostMapping("/save")
public AjaxResult save(@RequestBody BdClassify classify) { public AjaxResult save(@RequestBody BdClassify classify) {
classify.setPkCreator(SecurityUtils.getUserId()); classify.setPkCreator(SecurityUtils.getUserId());
classify.setCreationTime(new Date()); classify.setCreationTime(new Date());
classify.setPkCountry(SecurityUtils.getPkCountry()); 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()); classify.setPkTransactionKey(transaction.getData());
LambdaQueryWrapper<BdClassify> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BdClassify> qw = new LambdaQueryWrapper<>();
qw.eq(BdClassify::getName, classify.getName()); qw.eq(BdClassify::getName, classify.getName());
qw.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry()); qw.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry());
int count = classifyService.count(qw); int count = iBdClassifyService.count(qw);
if (count > 0) { if (count > 0) {
return AjaxResult.error(WaresMsgConstants.CLASSIFICATION_DUPLICATION); 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 * @return
*/ */
@Log(module = EOperationModule.CLASSIFY_UPDATE, method = EOperationMethod.UPDATE) @Log(module = EOperationModule.CLASSIFY_UPDATE, method = EOperationMethod.UPDATE)
@PostMapping("update") @PostMapping("/update")
public AjaxResult update(@RequestBody BdClassify classify) { public AjaxResult update(@RequestBody BdClassify classify) {
classify.setPkModified(SecurityUtils.getUserId()); classify.setPkModified(SecurityUtils.getUserId());
classify.setModifiedTime(new Date()); classify.setModifiedTime(new Date());
classify.setPkCountry(SecurityUtils.getPkCountry()); classify.setPkCountry(SecurityUtils.getPkCountry());
String redisKey = CacheConstants.BD_CLASSIFY + classify.getPkId(); String redisKey = CacheConstants.BD_CLASSIFY + classify.getPkId();
redisService.deleteObject(redisKey); 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); redisService.deleteObject(redisKey);
LambdaQueryWrapper<BdProduct> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BdProduct> qw = new LambdaQueryWrapper<>();
qw.eq(BdProduct::getPkClassify, pkId); qw.eq(BdProduct::getPkClassify, pkId);
int count = productService.count(qw); int count = iBdProductService.count(qw);
if (count > 0) { if (count > 0) {
return AjaxResult.error(WaresMsgConstants.WARES_CLASSIFY_IS_USE); 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") @GetMapping("detail")
public AjaxResult detail(Long classifyId) { 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.setPkId(pkId);
classify.setPkModified(SecurityUtils.getUserId()); classify.setPkModified(SecurityUtils.getUserId());
classify.setModifiedTime(new Date()); classify.setModifiedTime(new Date());
return toAjax(classifyService.updateById(classify)); return toAjax(iBdClassifyService.updateById(classify));
} }
/** /**
@ -175,11 +171,11 @@ public class BdClassifyController extends BaseController {
* *
* @return * @return
*/ */
@GetMapping("find-all") @GetMapping("/find-all")
public AjaxResult findAll() { public AjaxResult findAll() {
LambdaQueryWrapper<BdClassify> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BdClassify> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BdClassify::getPkCountry, SecurityUtils.getPkCountry()); 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()); queryWrapper.eq(BdClassify::getName, classify.getName());
} }
List<ClassIfyVo> resultList = new ArrayList<>(); List<ClassIfyVo> resultList = new ArrayList<>();
List<BdClassify> list = classifyService.list(queryWrapper); List<BdClassify> list = iBdClassifyService.list(queryWrapper);
for (BdClassify bdClassify : list) { for (BdClassify bdClassify : list) {
ClassIfyVo classIfyVo = new ClassIfyVo(); ClassIfyVo classIfyVo = new ClassIfyVo();
classIfyVo.setCreationTime(bdClassify.getCreationTime()); classIfyVo.setCreationTime(bdClassify.getCreationTime());

View File

@ -81,7 +81,7 @@ public class BdProductController extends BaseController {
*/ */
@AccessPermissions("ProductList") @AccessPermissions("ProductList")
@Log(module = EOperationModule.PRODUCT_LIST, business = EOperationBusiness.PRODUCT_LIST, method = EOperationMethod.SELECT) @Log(module = EOperationModule.PRODUCT_LIST, business = EOperationBusiness.PRODUCT_LIST, method = EOperationMethod.SELECT)
@GetMapping("list") @GetMapping("/list")
public TableDataInfo list(ProductParams productParams) { public TableDataInfo list(ProductParams productParams) {
if (productParams.getShippingType() != null) { if (productParams.getShippingType() != null) {
if (productParams.getShippingType() == 1) { 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) @Log(module = EOperationModule.PRODUCT_SAVE, method = EOperationMethod.INSERT, business = EOperationBusiness.PRODUCT_RELEASE)
@PostMapping("save") @PostMapping("/save")
public AjaxResult save(@RequestBody ProductParams productParams) { public AjaxResult save(@RequestBody ProductParams productParams) {
if (StringUtils.isBlank(productParams.getProductName())) { if (StringUtils.isBlank(productParams.getProductName())) {
return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.PRODUCT_NAME_REQUIRED)); return AjaxResult.error(TransactionUtils.getContent(ProductMsgConstants.PRODUCT_NAME_REQUIRED));
@ -222,7 +222,7 @@ public class BdProductController extends BaseController {
* @return * @return
*/ */
@Log(module = EOperationModule.PRODUCT_UPDATE, method = EOperationMethod.UPDATE, business = EOperationBusiness.PRODUCT_UPDATE) @Log(module = EOperationModule.PRODUCT_UPDATE, method = EOperationMethod.UPDATE, business = EOperationBusiness.PRODUCT_UPDATE)
@PostMapping("update") @PostMapping("/update")
public AjaxResult update(@RequestBody ProductParams productParams) { public AjaxResult update(@RequestBody ProductParams productParams) {
// 查询订单编号是否重复 // 查询订单编号是否重复
BdProduct product = iBdProductService.getById(productParams.getPkId()); BdProduct product = iBdProductService.getById(productParams.getPkId());

View File

@ -1,6 +1,5 @@
package com.hzs.sale.product.service; package com.hzs.sale.product.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hzs.common.domain.sale.product.BdAreaClassify; import com.hzs.common.domain.sale.product.BdAreaClassify;
import com.hzs.sale.product.controller.manage.params.AreaClassifyParam; import com.hzs.sale.product.controller.manage.params.AreaClassifyParam;
@ -10,9 +9,7 @@ import com.hzs.system.sys.dto.LoginUser;
import java.util.List; import java.util.List;
/** /**
* <p>
* 商品分类 服务类 * 商品分类 服务类
* </p>
* *
* @author hzs * @author hzs
* @since 2022-09-05 * @since 2022-09-05
@ -21,6 +18,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
/** /**
* 新增商品分类 * 新增商品分类
*
* @param areaClassifyParam * @param areaClassifyParam
* @param loginUser * @param loginUser
*/ */
@ -28,6 +26,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
/** /**
* 修改商品分类 * 修改商品分类
*
* @param areaClassifyParam * @param areaClassifyParam
* @param loginUser * @param loginUser
*/ */
@ -35,6 +34,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
/** /**
* 根据主键查询商品分类 * 根据主键查询商品分类
*
* @param areaClassifyId * @param areaClassifyId
* @return * @return
*/ */
@ -42,6 +42,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
/** /**
* 查询商品分类列表 * 查询商品分类列表
*
* @param areaClassifyParam * @param areaClassifyParam
* @return * @return
*/ */
@ -49,6 +50,7 @@ public interface IBdAreaClassifyService extends IService<BdAreaClassify> {
/** /**
* 删除 * 删除
*
* @param pkId * @param pkId
*/ */
void deleteAreaClassify(Integer pkId); void deleteAreaClassify(Integer pkId);

View File

@ -3,22 +3,20 @@ package com.hzs.sale.product.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hzs.common.domain.sale.classify.BdClassify; import com.hzs.common.domain.sale.classify.BdClassify;
/** /**
* <p>
* 规格分类 服务类 * 规格分类 服务类
* </p>
* *
* @author hzs * @author hzs
* @since 2022-08-26 * @since 2022-08-26
*/ */
public interface IBdClassifyService extends IService<BdClassify> { public interface IBdClassifyService extends IService<BdClassify> {
/** /**
* 根据id 查询详情 * 根据id 查询详情
*
* @param classifyId * @param classifyId
* @return * @return
*/ */
BdClassify getClassify(Integer classifyId); BdClassify getClassify(Integer classifyId);
} }

View File

@ -8,11 +8,8 @@ import com.hzs.system.sys.dto.LoginUser;
import java.util.List; import java.util.List;
/** /**
* <p>
* 规格类型表 服务类 * 规格类型表 服务类
* </p>
* *
* @author hzs * @author hzs
* @since 2022-08-27 * @since 2022-08-27
@ -21,18 +18,21 @@ public interface IBdSpecsTypeService extends IService<BdSpecsType> {
/** /**
* 根据id 查询规格分类 * 根据id 查询规格分类
*
* @return * @return
*/ */
BdSpecsType getSpecsType(Integer specsTypeId); BdSpecsType getSpecsType(Integer specsTypeId);
/** /**
* 新增规格分类 * 新增规格分类
*
* @param specsTypeParam * @param specsTypeParam
*/ */
void saveSpecsType(SpecsTypeParam specsTypeParam, LoginUser loginUser); void saveSpecsType(SpecsTypeParam specsTypeParam, LoginUser loginUser);
/** /**
* 修改规格分类 * 修改规格分类
*
* @param specsTypeParam * @param specsTypeParam
* @param loginUser * @param loginUser
*/ */
@ -40,6 +40,7 @@ public interface IBdSpecsTypeService extends IService<BdSpecsType> {
/** /**
* 查询列表 * 查询列表
*
* @param specsType * @param specsType
* @return * @return
*/ */
@ -47,7 +48,8 @@ public interface IBdSpecsTypeService extends IService<BdSpecsType> {
/** /**
* 删除 * 删除
*
* @param pkId * @param pkId
*/ */
void deleteBySpecsTypeId(Integer pkId,LoginUser loginUser); void deleteBySpecsTypeId(Integer pkId, LoginUser loginUser);
} }

View File

@ -1,14 +1,12 @@
package com.hzs.sale.product.service.impl; package com.hzs.sale.product.service.impl;
import cn.hutool.core.bean.BeanUtil; 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.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.domain.R;
import com.hzs.common.core.enums.EDelFlag; import com.hzs.common.core.enums.EDelFlag;
import com.hzs.common.core.enums.ETransactionKey; import com.hzs.common.core.enums.ETransactionKey;
import com.hzs.common.core.enums.EYesNo; 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.BdAreaClassify;
import com.hzs.common.domain.sale.product.BdAreaClassifySpecialArea; import com.hzs.common.domain.sale.product.BdAreaClassifySpecialArea;
import com.hzs.common.security.utils.SecurityUtils; import com.hzs.common.security.utils.SecurityUtils;
@ -30,28 +28,17 @@ import java.util.List;
/** /**
* 商品分类 服务实现类 * 商品分类 服务实现类
*
* @author hzs
* @since 2022-09-05
*/ */
@Service @Service
public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper, BdAreaClassify> implements IBdAreaClassifyService { public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper, BdAreaClassify> implements IBdAreaClassifyService {
@Autowired @Autowired
private RedisService redisService; private IBdAreaClassifyService iBdAreaClassifyService;
@Autowired @Autowired
private IBdAreaClassifyService areaClassifyService; private IBdAreaClassifySpecialAreaService iBdAreaClassifySpecialAreaService;
@Autowired
private IBdAreaClassifySpecialAreaService areaClassifySpecialAreaService;
@DubboReference @DubboReference
ITransactionServiceApi transactionServiceApi; ITransactionServiceApi iTransactionServiceApi;
/**
* 新增商品分类
*
* @param areaClassifyParam 分类对象
* @param loginUser 登录用户
*/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void saveAreaClassify(AreaClassifyParam areaClassifyParam, LoginUser loginUser) { public void saveAreaClassify(AreaClassifyParam areaClassifyParam, LoginUser loginUser) {
@ -59,7 +46,7 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
areaClassify.setPkCreator(loginUser.getUserId()); areaClassify.setPkCreator(loginUser.getUserId());
areaClassify.setCreationTime(new Date()); areaClassify.setCreationTime(new Date());
areaClassify.setPkCountry(loginUser.getDataCountry()); 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()); areaClassify.setPkTransactionKey(transaction.getData());
baseMapper.insert(areaClassify); baseMapper.insert(areaClassify);
List<BdAreaClassifySpecialArea> list = new ArrayList<>(); List<BdAreaClassifySpecialArea> list = new ArrayList<>();
@ -76,28 +63,21 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
} }
if (list.size() > 0) { if (list.size() > 0) {
areaClassifySpecialAreaService.saveBatch(list); iBdAreaClassifySpecialAreaService.saveBatch(list);
} }
} }
/**
* 修改商品分类
*
* @param areaClassifyParam 分类对象
* @param loginUser 当前登录用户
*/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateAreaClassify(AreaClassifyParam areaClassifyParam, LoginUser loginUser) { public void updateAreaClassify(AreaClassifyParam areaClassifyParam, LoginUser loginUser) {
BdAreaClassify areaClassify = BeanUtil.copyProperties(areaClassifyParam, BdAreaClassify.class); BdAreaClassify areaClassify = BeanUtil.copyProperties(areaClassifyParam, BdAreaClassify.class);
areaClassify.setPkModified(loginUser.getUserId()); areaClassify.setPkModified(loginUser.getUserId());
areaClassify.setModifiedTime(new Date()); 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()); areaClassify.setPkTransactionKey(transaction.getData());
baseMapper.updateById(areaClassify); baseMapper.updateById(areaClassify);
// 清空 中间表数据重新添加 // 清空 中间表数据重新添加
areaClassifySpecialAreaService.deleteByAreaClassifyPk(areaClassify.getPkId()); iBdAreaClassifySpecialAreaService.deleteByAreaClassifyPk(areaClassify.getPkId());
List<BdAreaClassifySpecialArea> list = new ArrayList<>(); List<BdAreaClassifySpecialArea> list = new ArrayList<>();
if (areaClassifyParam.getSpecialAreaList() != null) { if (areaClassifyParam.getSpecialAreaList() != null) {
for (Integer number : areaClassifyParam.getSpecialAreaList()) { for (Integer number : areaClassifyParam.getSpecialAreaList()) {
@ -111,38 +91,15 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
} }
} }
if (list.size() > 0) { 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 @Override
public BdAreaClassify getAreaClassify(Integer areaClassifyId) { public BdAreaClassify getAreaClassify(Integer areaClassifyId) {
String redisKey = CacheConstants.BD_AREA_CLASSIFY + areaClassifyId; return baseMapper.selectById(areaClassifyId);
BdAreaClassify areaClassify = redisService.getCacheObject(redisKey);
if (null == areaClassify) {
areaClassify = baseMapper.selectById(areaClassifyId);
if (null != areaClassify) {
redisService.setCacheObject(redisKey, areaClassify);
}
}
return areaClassify;
} }
/**
* 查询商品分类列表
*
* @param areaClassifyParam
* @return
*/
@Override @Override
public List<AreaClassifyVo> selectByAreaClassifyList(AreaClassifyParam areaClassifyParam) { public List<AreaClassifyVo> selectByAreaClassifyList(AreaClassifyParam areaClassifyParam) {
return baseMapper.selectByAreaClassifyList(areaClassifyParam); return baseMapper.selectByAreaClassifyList(areaClassifyParam);
@ -151,18 +108,15 @@ public class BdAreaClassifyServiceImpl extends ServiceImpl<BdAreaClassifyMapper,
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteAreaClassify(Integer pkId) { 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);
} }
} }

View File

@ -4,16 +4,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.CacheConstants; import com.hzs.common.core.constant.CacheConstants;
import com.hzs.common.core.service.RedisService; import com.hzs.common.core.service.RedisService;
import com.hzs.common.domain.sale.classify.BdClassify; 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.mapper.BdClassifyMapper;
import com.hzs.sale.product.service.IBdClassifyService; import com.hzs.sale.product.service.IBdClassifyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* <p>
* 规格分类 服务实现类 * 规格分类 服务实现类
* </p>
* *
* @author hzs * @author hzs
* @since 2022-08-26 * @since 2022-08-26
@ -23,8 +20,10 @@ public class BdClassifyServiceImpl extends ServiceImpl<BdClassifyMapper, BdClass
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
/** /**
* 根据id 查询详情 * 根据id 查询详情
*
* @param classifyId * @param classifyId
* @return * @return
*/ */

View File

@ -31,25 +31,23 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* <p>
* 规格类型表 服务实现类 * 规格类型表 服务实现类
* </p>
*
* @author hzs
* @since 2022-08-27
*/ */
@Service @Service
public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpecsType> implements IBdSpecsTypeService { public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpecsType> implements IBdSpecsTypeService {
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@Autowired
private IBdSpecsTypeService iBdSpecsTypeService;
@Autowired
private IBdSpecsService iBdSpecsService;
@DubboReference @DubboReference
private ITransactionServiceApi transactionServiceApi; ITransactionServiceApi iTransactionServiceApi;
@Autowired
private IBdSpecsTypeService specsTypeService;
@Autowired
private IBdSpecsService specsService;
/** /**
* 根据id 查询规格分类 * 根据id 查询规格分类
*
* @return * @return
*/ */
@Override @Override
@ -75,7 +73,7 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
bdSpecsType.setCreationTime(new Date()); bdSpecsType.setCreationTime(new Date());
bdSpecsType.setSort(specsTypeParam.getSort()); bdSpecsType.setSort(specsTypeParam.getSort());
bdSpecsType.setPkCountry(loginUser.getDataCountry()); 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()); bdSpecsType.setPkTransactionKey(transaction.getData());
baseMapper.insert(bdSpecsType); baseMapper.insert(bdSpecsType);
List<BdSpecs> specsList = new ArrayList<>(); List<BdSpecs> specsList = new ArrayList<>();
@ -86,18 +84,19 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
bdSpecs.setPkCreator(SecurityUtils.getUserId()); bdSpecs.setPkCreator(SecurityUtils.getUserId());
bdSpecs.setCreationTime(new Date()); bdSpecs.setCreationTime(new Date());
bdSpecs.setPkCountry(SecurityUtils.getPkCountry()); 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()); bdSpecs.setPkTransactionKey(trans.getData());
specsList.add(bdSpecs); specsList.add(bdSpecs);
} }
specsService.saveBatch(specsList); iBdSpecsService.saveBatch(specsList);
String redisKey = CacheConstants.BD_SPECS_TYPE + bdSpecsType.getPkId(); String redisKey = CacheConstants.BD_SPECS_TYPE + bdSpecsType.getPkId();
redisService.deleteObject(redisKey); redisService.deleteObject(redisKey);
} }
/** /**
* 修改规格分类 * 修改规格分类
*
* @param specsTypeParam * @param specsTypeParam
* @param loginUser * @param loginUser
*/ */
@ -111,48 +110,49 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
bdSpecsType.setPkModified(loginUser.getUserId()); bdSpecsType.setPkModified(loginUser.getUserId());
bdSpecsType.setTypeName(specsTypeParam.getTypeName()); bdSpecsType.setTypeName(specsTypeParam.getTypeName());
bdSpecsType.setSort(specsTypeParam.getSort()); bdSpecsType.setSort(specsTypeParam.getSort());
transactionServiceApi.updateTransaction(loginUser.getDataCountry(),specsTypeParam.getTypeName(),st.getPkTransactionKey(),true ); iTransactionServiceApi.updateTransaction(loginUser.getDataCountry(), specsTypeParam.getTypeName(), st.getPkTransactionKey(), true);
// bdSpecsType.setPkTransactionKey(transaction.getData());
baseMapper.updateById(bdSpecsType); baseMapper.updateById(bdSpecsType);
List<Integer> specsId = new ArrayList<>(); List<Integer> specsId = new ArrayList<>();
for (SpecsParam specsParam : specsTypeParam.getSpecsList()) { for (SpecsParam specsParam : specsTypeParam.getSpecsList()) {
if (specsParam.getSpecsId() != null){ if (specsParam.getSpecsId() != null) {
specsId.add(specsParam.getSpecsId()); 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<>(); List<BdSpecs> specsList = new ArrayList<>();
for (SpecsParam specs : specsTypeParam.getSpecsList()) { for (SpecsParam specs : specsTypeParam.getSpecsList()) {
BdSpecs bdSpecs = new BdSpecs(); BdSpecs bdSpecs = new BdSpecs();
if (specs.getSpecsId() != null){ if (specs.getSpecsId() != null) {
BdSpecs sp = specsService.getById(specs.getSpecsId()); BdSpecs sp = iBdSpecsService.getById(specs.getSpecsId());
sp.setSpecsName(specs.getValue()); sp.setSpecsName(specs.getValue());
sp.setModifiedTime(new Date()); sp.setModifiedTime(new Date());
sp.setPkModified(SecurityUtils.getUserId()); sp.setPkModified(SecurityUtils.getUserId());
sp.setDelFlag(EDelFlag.UN_DELETE.getValue()); sp.setDelFlag(EDelFlag.UN_DELETE.getValue());
specsService.updateById(sp); iBdSpecsService.updateById(sp);
}else { } else {
bdSpecs.setPkSpecsType(bdSpecsType.getPkId()); bdSpecs.setPkSpecsType(bdSpecsType.getPkId());
bdSpecs.setSpecsName(specs.getValue()); bdSpecs.setSpecsName(specs.getValue());
bdSpecs.setPkCreator(SecurityUtils.getUserId()); bdSpecs.setPkCreator(SecurityUtils.getUserId());
bdSpecs.setCreationTime(new Date()); bdSpecs.setCreationTime(new Date());
bdSpecs.setPkCountry(SecurityUtils.getPkCountry()); 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()); bdSpecs.setPkTransactionKey(trans.getData());
specsList.add(bdSpecs); specsList.add(bdSpecs);
} }
} }
if (specsList.size() > 0){ if (specsList.size() > 0) {
specsService.saveBatch(specsList); iBdSpecsService.saveBatch(specsList);
} }
String redisKey = CacheConstants.BD_SPECS_TYPE + bdSpecsType.getPkId(); String redisKey = CacheConstants.BD_SPECS_TYPE + bdSpecsType.getPkId();
redisService.deleteObject(redisKey); redisService.deleteObject(redisKey);
} }
/** /**
* 查询列表 * 查询列表
*
* @param specsType * @param specsType
* @return * @return
*/ */
@ -161,25 +161,27 @@ public class BdSpecsTypeServiceImpl extends ServiceImpl<BdSpecsTypeMapper, BdSpe
return baseMapper.selectSpecsTypeList(specsType); return baseMapper.selectSpecsTypeList(specsType);
} }
/** /**
* 删除 * 删除
*
* @param pkId * @param pkId
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteBySpecsTypeId(Integer pkId,LoginUser loginUser) { public void deleteBySpecsTypeId(Integer pkId, LoginUser loginUser) {
UpdateWrapper<BdSpecsType> updateWrapper = new UpdateWrapper(); UpdateWrapper<BdSpecsType> updateWrapper = new UpdateWrapper();
updateWrapper.eq("PK_ID",pkId); updateWrapper.eq("PK_ID", pkId);
updateWrapper.set("DEL_FLAG",EDelFlag.DELETE.getValue()); updateWrapper.set("DEL_FLAG", EDelFlag.DELETE.getValue());
updateWrapper.set("MODIFIED_TIME",new Date()); updateWrapper.set("MODIFIED_TIME", new Date());
updateWrapper.set("PK_MODIFIED",loginUser.getUserId()); updateWrapper.set("PK_MODIFIED", loginUser.getUserId());
specsTypeService.update(updateWrapper); iBdSpecsTypeService.update(updateWrapper);
UpdateWrapper<BdSpecs> updateSpecsWrapper = new UpdateWrapper<>(); UpdateWrapper<BdSpecs> updateSpecsWrapper = new UpdateWrapper<>();
updateSpecsWrapper.eq("PK_SPECS_TYPE",pkId); updateSpecsWrapper.eq("PK_SPECS_TYPE", pkId);
updateSpecsWrapper.set("MODIFIED_TIME",new Date()); updateSpecsWrapper.set("MODIFIED_TIME", new Date());
updateSpecsWrapper.set("PK_MODIFIED",loginUser.getUserId()); updateSpecsWrapper.set("PK_MODIFIED", loginUser.getUserId());
updateSpecsWrapper.set("DEL_FLAG", EDelFlag.DELETE.getValue()); updateSpecsWrapper.set("DEL_FLAG", EDelFlag.DELETE.getValue());
specsService.update(updateSpecsWrapper); iBdSpecsService.update(updateSpecsWrapper);
String redisKey = CacheConstants.BD_SPECS_TYPE + pkId; String redisKey = CacheConstants.BD_SPECS_TYPE + pkId;
redisService.deleteObject(redisKey); redisService.deleteObject(redisKey);
} }

View File

@ -53,22 +53,15 @@ import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* @Description:
* @Author: yuhui
* @Time: 2022/9/8 17:04
* @Classname: BdWaresController
* @PackageName: com.hzs.sale.wares.controller.manage
*/
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/manage/wares") @RequestMapping("/manage/wares")
public class BdWaresController extends BaseController { public class BdWaresController extends BaseController {
@DubboReference @DubboReference
ICurrencyServiceApi currencyServiceApi; ICurrencyServiceApi iCurrencyServiceApi;
@DubboReference @DubboReference
IRangeServiceApi rangeServiceApi; IRangeServiceApi iRangeServiceApi;
@Autowired @Autowired
private IBdWaresAuthorizeService waresAuthorizeService; private IBdWaresAuthorizeService waresAuthorizeService;
@ -122,7 +115,7 @@ public class BdWaresController extends BaseController {
waresParams.setPkCountry(SecurityUtils.getPkCountry()); waresParams.setPkCountry(SecurityUtils.getPkCountry());
List<WaresVo> resultList = waresService.selectByWaresInfo(waresParams); List<WaresVo> resultList = waresService.selectByWaresInfo(waresParams);
if (CollectionUtil.isNotEmpty(resultList)) { if (CollectionUtil.isNotEmpty(resultList)) {
R<CurrencyDTO> currencyDto = currencyServiceApi.getCurrency(SecurityUtils.getPkCountry()); R<CurrencyDTO> currencyDto = iCurrencyServiceApi.getCurrency(SecurityUtils.getPkCountry());
resultList.parallelStream().forEach(waresVo -> { resultList.parallelStream().forEach(waresVo -> {
WaresAuthorityVo waresAuthorityVo = waresService.getWaresAuthorityFirst(waresVo.getPkWares()); WaresAuthorityVo waresAuthorityVo = waresService.getWaresAuthorityFirst(waresVo.getPkWares());
@ -156,7 +149,7 @@ public class BdWaresController extends BaseController {
List<WaresVo> resultList = waresService.selectByWaresInfo(waresParams); List<WaresVo> resultList = waresService.selectByWaresInfo(waresParams);
if (CollectionUtil.isNotEmpty(resultList)) { 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()); 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") @GetMapping("/detail")
public AjaxResult detail(Long pkId) { 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(); List<BdRangeExt> rsList = rangeDto.getData();
Map<Integer, BdRangeExt> rangeMap = rsList.stream().collect(Collectors.toMap(BdRangeExt::getPkId, Function.identity())); 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.setSortStatus(wares.getSortStatus());
waresParams.setSystemType(waresExtend.getSystemType()); waresParams.setSystemType(waresExtend.getSystemType());
if (waresExtend.getMakerIncome() != null) { 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())); waresParams.setMakerIncome(waresExtend.getMakerIncome().multiply(currencyDto.getData().getInExchangeRate()));
} }
@ -996,7 +989,6 @@ public class BdWaresController extends BaseController {
specsSkuParams.setIsPutOn(bdWaresSpecsSku.getIsPutOn()); specsSkuParams.setIsPutOn(bdWaresSpecsSku.getIsPutOn());
specsSkuParams.setVipPrice(bdWaresSpecsSku.getVipPrice()); specsSkuParams.setVipPrice(bdWaresSpecsSku.getVipPrice());
specsSkuParams.setRetailPrice(bdWaresSpecsSku.getRetailPrice()); specsSkuParams.setRetailPrice(bdWaresSpecsSku.getRetailPrice());
specsSkuParams.setSkuCode(bdWaresSpecsSku.getSkuCode());
// 每个规格的sku键值对 // 每个规格的sku键值对
List<BdWaresSpecs> waresSpecsList = new ArrayList<>(); List<BdWaresSpecs> waresSpecsList = new ArrayList<>();
LambdaQueryWrapper<BdWaresSpecsRelation> waresSpecsRelation = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BdWaresSpecsRelation> waresSpecsRelation = new LambdaQueryWrapper<>();

View File

@ -1,21 +1,11 @@
package com.hzs.sale.wares.param; package com.hzs.sale.wares.param;
import com.baomidou.mybatisplus.annotation.TableField;
import com.hzs.common.domain.sale.wares.BdWaresSpecs; import com.hzs.common.domain.sale.wares.BdWaresSpecs;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
/**
* @Description:
* @Author: yuhui
* @Time: 2022/11/7 15:54
* @Classname: WaresSpecsParams
* @PackageName: com.hzs.sale.wares.param
*/
@Data @Data
public class WaresSpecsSkuParams { public class WaresSpecsSkuParams {
@ -56,7 +46,7 @@ public class WaresSpecsSkuParams {
private BigDecimal assAchieve; private BigDecimal assAchieve;
/** /**
/** * /**
* 规格明细表 * 规格明细表
*/ */
private List<BdWaresSpecs> waresSpecsList; private List<BdWaresSpecs> waresSpecsList;
@ -73,5 +63,4 @@ public class WaresSpecsSkuParams {
*/ */
private BigDecimal retailPrice; private BigDecimal retailPrice;
private String skuCode;
} }

View File

@ -457,7 +457,6 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
bdWaresSpecsSku.setAssAchieve(waresSpecsSkuParams.getAssAchieve()); bdWaresSpecsSku.setAssAchieve(waresSpecsSkuParams.getAssAchieve());
bdWaresSpecsSku.setVipPrice(waresSpecsSkuParams.getVipPrice()); bdWaresSpecsSku.setVipPrice(waresSpecsSkuParams.getVipPrice());
bdWaresSpecsSku.setRetailPrice(waresSpecsSkuParams.getRetailPrice()); bdWaresSpecsSku.setRetailPrice(waresSpecsSkuParams.getRetailPrice());
bdWaresSpecsSku.setSkuCode(waresSpecsSkuParams.getSkuCode());
iBdWaresSpecsSkuService.save(bdWaresSpecsSku); iBdWaresSpecsSkuService.save(bdWaresSpecsSku);
// 生成规格明细表 // 生成规格明细表
List<BdWaresSpecs> waresSpecsList = waresSpecsSkuParams.getWaresSpecsList(); List<BdWaresSpecs> waresSpecsList = waresSpecsSkuParams.getWaresSpecsList();
@ -519,7 +518,6 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
} else { } else {
sku.setIsPutOn(EYesNo.YES.getIntValue()); sku.setIsPutOn(EYesNo.YES.getIntValue());
} }
sku.setSkuCode(waresSpecsSkuParams.getSkuCode());
iBdWaresSpecsSkuService.updateBySkuId(sku); iBdWaresSpecsSkuService.updateBySkuId(sku);
redisService.deleteObject(CacheConstants.BD_WARES_SPECS_RELATION + bdWaresSpecsSku.getPkId()); redisService.deleteObject(CacheConstants.BD_WARES_SPECS_RELATION + bdWaresSpecsSku.getPkId());
} }

View File

@ -137,11 +137,6 @@ public class CacheConstants {
*/ */
public static final String BD_POSTAGE = CACHE_PREFIX + "postage:"; 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_BONUS_ITEMS = CACHE_PREFIX + "bonus:items:";
/**
* 配送中心配置
*/
public static final String BD_SHOP = CACHE_PREFIX + "shop:";
/** /**
* 极差配置 * 极差配置
*/ */

View File

@ -12,9 +12,7 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* <p>
* 规格sku表 * 规格sku表
* </p>
* *
* @author hzs * @author hzs
* @since 2022-09-09 * @since 2022-09-09
@ -88,9 +86,4 @@ public class BdWaresSpecsSku extends BaseEntity {
@TableField("RETAIL_PRICE") @TableField("RETAIL_PRICE")
private BigDecimal retailPrice; private BigDecimal retailPrice;
/**
* sku编码
*/
@TableField("SKU_CODE")
private String skuCode;
} }