记得上下班打卡 | git大法好,push需谨慎

Commit b842a542 authored by 张国柄's avatar 张国柄

~API:完善逻辑校验;

parent 806f4d06
...@@ -95,8 +95,9 @@ public interface IGoblinstoreMgtGoodsService { ...@@ -95,8 +95,9 @@ public interface IGoblinstoreMgtGoodsService {
* @param uid UID * @param uid UID
* @param shelvesFlg true:上架|false:下架 * @param shelvesFlg true:上架|false:下架
* @param spuNoList 操作SPUID对应SPUNO列表 * @param spuNoList 操作SPUID对应SPUNO列表
* @return boolean
*/ */
void goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, boolean shelvesFlg, List<String> spuNoList); boolean goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, boolean shelvesFlg, List<String> spuNoList);
/** /**
* 商品管理:删除商品 * 商品管理:删除商品
...@@ -104,6 +105,7 @@ public interface IGoblinstoreMgtGoodsService { ...@@ -104,6 +105,7 @@ public interface IGoblinstoreMgtGoodsService {
* @param mgtGoodsActionParam GoblinStoreMgtGoodsActionParam * @param mgtGoodsActionParam GoblinStoreMgtGoodsActionParam
* @param uid UID * @param uid UID
* @param spuNoList 操作SPUID对应SPUNO列表 * @param spuNoList 操作SPUID对应SPUNO列表
* @return boolean
*/ */
void goodsRemove(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, List<String> spuNoList); boolean goodsRemove(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, List<String> spuNoList);
} }
...@@ -88,7 +88,8 @@ public class GoblinStoreMgtCertificationController { ...@@ -88,7 +88,8 @@ public class GoblinStoreMgtCertificationController {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("店铺认证[UID={},GoblinStoreMgtCompleteParam:{}]", currentUid, JsonUtils.toJson(completeParam)); log.debug("店铺认证[UID={},GoblinStoreMgtCompleteParam:{}]", currentUid, JsonUtils.toJson(completeParam));
} }
return ResponseDto.success(goblinStoreMgtCertificationService.certificationCompleteProcessing(completeParam, storeInfoVo)); boolean resultFlg = goblinStoreMgtCertificationService.certificationCompleteProcessing(completeParam, storeInfoVo);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
} }
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
...@@ -122,6 +123,7 @@ public class GoblinStoreMgtCertificationController { ...@@ -122,6 +123,7 @@ public class GoblinStoreMgtCertificationController {
return ResponseDto.success();// 店铺认证通过后不允许删除 return ResponseDto.success();// 店铺认证通过后不允许删除
} }
log.info("删除店铺[UID={},storeId={}]", currentUid, storeId); log.info("删除店铺[UID={},storeId={}]", currentUid, storeId);
return ResponseDto.success(goblinStoreMgtCertificationService.certificationCancelProcessing(storeId, currentUid)); boolean resultFlg = goblinStoreMgtCertificationService.certificationCancelProcessing(storeId, currentUid);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
} }
} }
...@@ -186,7 +186,8 @@ public class GoblinStoreMgtController { ...@@ -186,7 +186,8 @@ public class GoblinStoreMgtController {
log.warn("店铺管理:店铺设置:编辑[UID={},param={}],无效操作:无效配置", currentUid, JsonUtils.toJson(param)); log.warn("店铺管理:店铺设置:编辑[UID={},param={}],无效操作:无效配置", currentUid, JsonUtils.toJson(param));
return ResponseDto.failure(ErrorMapping.get("149001")); return ResponseDto.failure(ErrorMapping.get("149001"));
} }
return ResponseDto.success(goblinStoreMgtService.updateStoreMgtConfig(currentUid, storeId, updateConfMap)); boolean resultFlg = goblinStoreMgtService.updateStoreMgtConfig(currentUid, storeId, updateConfMap);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
} }
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
...@@ -275,7 +276,9 @@ public class GoblinStoreMgtController { ...@@ -275,7 +276,9 @@ public class GoblinStoreMgtController {
updateStoreNoticeVo.setStatus(updateStoreNoticeVo.getReleaseTime().compareTo(now) > 0 ? "0" : "1"); updateStoreNoticeVo.setStatus(updateStoreNoticeVo.getReleaseTime().compareTo(now) > 0 ? "0" : "1");
updateStoreNoticeVo.setUpdatedBy(currentUid); updateStoreNoticeVo.setUpdatedBy(currentUid);
updateStoreNoticeVo.setUpdatedAt(now); updateStoreNoticeVo.setUpdatedAt(now);
return ResponseDto.success(goblinStoreMgtNoticeService.editSave(updateStoreNoticeVo));
boolean resultFlg = goblinStoreMgtNoticeService.editSave(updateStoreNoticeVo);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
} }
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
......
...@@ -113,7 +113,7 @@ public class GoblinStoreMgtCouponController { ...@@ -113,7 +113,7 @@ public class GoblinStoreMgtCouponController {
if (null != servletOutputStream) { if (null != servletOutputStream) {
try { try {
servletOutputStream.close(); servletOutputStream.close();
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
} }
......
...@@ -70,6 +70,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -70,6 +70,7 @@ public class GoblinStoreMgtGoodsController {
public ResponseDto<PagedResult<GoblinStoreMgtGoodsListVo>> list(@Valid @RequestBody GoblinStoreMgtGoodsFilterParam storeMgtGoodsFilterParam) { public ResponseDto<PagedResult<GoblinStoreMgtGoodsListVo>> list(@Valid @RequestBody GoblinStoreMgtGoodsFilterParam storeMgtGoodsFilterParam) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, storeMgtGoodsFilterParam.getStoreId())) { if (!goblinRedisUtils.hasStoreId(currentUid, storeMgtGoodsFilterParam.getStoreId())) {
log.warn("商品管理:SPU列表:无权操作该店铺,请核实[UID={},GoblinStoreMgtGoodsFilterParam={}]", currentUid, JsonUtils.toJson(storeMgtGoodsFilterParam));
return ResponseDto.success(); return ResponseDto.success();
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
...@@ -112,7 +113,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -112,7 +113,7 @@ public class GoblinStoreMgtGoodsController {
if (null != servletOutputStream) { if (null != servletOutputStream) {
try { try {
servletOutputStream.close(); servletOutputStream.close();
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
} }
...@@ -133,6 +134,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -133,6 +134,7 @@ public class GoblinStoreMgtGoodsController {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("商品管理:SPU管理:[UID={},GoblinStoreMgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsActionParam)); log.debug("商品管理:SPU管理:[UID={},GoblinStoreMgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsActionParam));
} }
boolean resultFlg;
List<String> spuNoList = CollectionUtil.arrayListString(); List<String> spuNoList = CollectionUtil.arrayListString();
switch (mgtGoodsActionParam.getAction()) { switch (mgtGoodsActionParam.getAction()) {
case "ONSHELVES": case "ONSHELVES":
...@@ -152,7 +154,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -152,7 +154,7 @@ public class GoblinStoreMgtGoodsController {
} }
spuNoList.add(goodsInfoVo.getSpuNo()); spuNoList.add(goodsInfoVo.getSpuNo());
} }
goblinstoreMgtGoodsService.goodsShelvesProcessing(mgtGoodsActionParam, currentUid, true, spuNoList); resultFlg = goblinstoreMgtGoodsService.goodsShelvesProcessing(mgtGoodsActionParam, currentUid, true, spuNoList);
break; break;
case "UNSHELVE": case "UNSHELVE":
for (String spuId : spuIdList) { for (String spuId : spuIdList) {
...@@ -171,7 +173,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -171,7 +173,7 @@ public class GoblinStoreMgtGoodsController {
} }
spuNoList.add(goodsInfoVo.getSpuNo()); spuNoList.add(goodsInfoVo.getSpuNo());
} }
goblinstoreMgtGoodsService.goodsShelvesProcessing(mgtGoodsActionParam, currentUid, false, spuNoList); resultFlg = goblinstoreMgtGoodsService.goodsShelvesProcessing(mgtGoodsActionParam, currentUid, false, spuNoList);
break; break;
case "REMOVE": case "REMOVE":
for (String spuId : spuIdList) { for (String spuId : spuIdList) {
...@@ -190,13 +192,13 @@ public class GoblinStoreMgtGoodsController { ...@@ -190,13 +192,13 @@ public class GoblinStoreMgtGoodsController {
} }
spuNoList.add(goodsInfoVo.getSpuNo()); spuNoList.add(goodsInfoVo.getSpuNo());
} }
goblinstoreMgtGoodsService.goodsRemove(mgtGoodsActionParam, currentUid, spuNoList); resultFlg = goblinstoreMgtGoodsService.goodsRemove(mgtGoodsActionParam, currentUid, spuNoList);
break; break;
default: default:
log.warn("商品管理:SPU管理:Invalid operation[UID={},mgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsActionParam)); log.warn("商品管理:SPU管理:Invalid operation[UID={},mgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsActionParam));
return ResponseDto.failure(ErrorMapping.get("149001")); return ResponseDto.failure(ErrorMapping.get("149001"));
} }
return ResponseDto.success(); return resultFlg ? ResponseDto.success() : ResponseDto.failure();
} }
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
...@@ -412,7 +414,8 @@ public class GoblinStoreMgtGoodsController { ...@@ -412,7 +414,8 @@ public class GoblinStoreMgtGoodsController {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(mgtGoodsAddParam)); log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(mgtGoodsAddParam));
} }
return ResponseDto.success(goblinstoreMgtGoodsService.goodsEditSpu(currentUid, mgtGoodsAddParam, mgtGoodsInfoVo)); boolean resultFlg = goblinstoreMgtGoodsService.goodsEditSpu(currentUid, mgtGoodsAddParam, mgtGoodsInfoVo);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
} }
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
...@@ -745,6 +748,7 @@ public class GoblinStoreMgtGoodsController { ...@@ -745,6 +748,7 @@ public class GoblinStoreMgtGoodsController {
// if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeId)) { // if (!goblinRedisUtils.hasStoreId(CurrentUtil.getCurrentUid(), storeId)) {
// return ResponseDto.failure(ErrorMapping.get("149002")); // return ResponseDto.failure(ErrorMapping.get("149002"));
// } // }
// return ResponseDto.success(goblinstoreMgtGoodsService.goodsEditSkuBat(spuId, batField, batFieldVal)); // goblinstoreMgtGoodsService.goodsEditSkuBat(spuId, batField, batFieldVal)
// return ResponseDto.success();
// } // }
} }
...@@ -76,7 +76,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe ...@@ -76,7 +76,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe
}); });
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.gets(toMqSqls, initStoreInfoObjs, initStoreCertificationObjs)); SqlMapping.gets(toMqSqls, initStoreInfoObjs, initStoreCertificationObjs));
return storeInfoVo;
} else { } else {
storeInfoVo.setStatus("0"); storeInfoVo.setStatus("0");
storeInfoVo.setStoreType("0"); storeInfoVo.setStoreType("0");
...@@ -108,7 +107,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe ...@@ -108,7 +107,6 @@ public class GoblinStoreMgtCertificationServiceImpl implements IGoblinStoreMgtCe
}); });
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.gets(toMqSqls, updateStoreInfoObjs, updateStoreCertificationObjs)); SqlMapping.gets(toMqSqls, updateStoreInfoObjs, updateStoreCertificationObjs));
return storeInfoVo;
} }
} }
return storeInfoVo; return storeInfoVo;
......
...@@ -875,7 +875,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -875,7 +875,7 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
// } // }
@Override @Override
public void goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, boolean shelvesFlg, List<String> spuNoList) { public boolean goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, boolean shelvesFlg, List<String> spuNoList) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String storeId = mgtGoodsActionParam.getStoreId(); String storeId = mgtGoodsActionParam.getStoreId();
List<String> spuIdList = mgtGoodsActionParam.getSpuIdList(); List<String> spuIdList = mgtGoodsActionParam.getSpuIdList();
...@@ -889,7 +889,6 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -889,7 +889,6 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
spuIdList.addAll(goblinMongoUtils.getMgtSpuIdsForMarketBySpuNos(spuNoList, "3")); spuIdList.addAll(goblinMongoUtils.getMgtSpuIdsForMarketBySpuNos(spuNoList, "3"));
} }
if (goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) { if (goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
if (goblinMongoUtils.updateGoodsSkuInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) { if (goblinMongoUtils.updateGoodsSkuInfoVoByShelves(storeId, spuIdList, shelvesFlg, uid, now)) {
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法 goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
...@@ -915,14 +914,16 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -915,14 +914,16 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, updateGoodsObjs, updateGoodsSkuObjs)); SqlMapping.gets(toMqSqls, updateGoodsObjs, updateGoodsSkuObjs));
return true;
} else { } else {
goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, !shelvesFlg, uid, now); goblinMongoUtils.updateGoodsInfoVoByShelves(storeId, spuIdList, !shelvesFlg, uid, now);
} }
} }
return false;
} }
@Override @Override
public void goodsRemove(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, List<String> spuNoList) { public boolean goodsRemove(GoblinStoreMgtGoodsActionParam mgtGoodsActionParam, String uid, List<String> spuNoList) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String storeId = mgtGoodsActionParam.getStoreId(); String storeId = mgtGoodsActionParam.getStoreId();
List<String> spuIdList = mgtGoodsActionParam.getSpuIdList(); List<String> spuIdList = mgtGoodsActionParam.getSpuIdList();
...@@ -953,6 +954,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -953,6 +954,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, updateGoodsObjs, updateGoodsSkuObjs)); SqlMapping.gets(toMqSqls, updateGoodsObjs, updateGoodsSkuObjs));
return true;
} }
return false;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment