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

Commit ec5e7c15 authored by zhanggb's avatar zhanggb

+api:商品管理:藏品AR删除;

parent 19f07844
......@@ -2,11 +2,13 @@ package com.liquidnet.service.goblin.controller.manage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.common.exception.constant.ErrorCode;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArActionParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuArListVo;
......@@ -18,10 +20,12 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@ApiSupport(order = 149005)
@Api(tags = "商品管理:单品拓展信息")
......@@ -50,47 +54,47 @@ public class GoblinStoreMgtGoodsSkuExtraController {
return ResponseDto.success(goblinStoreMgtGoodsSkuExtraService.skuArList(mgtGoodsSkuArFilterParam));
}
// @ApiOperationSupport(order = 2)
// @ApiOperation(value = "藏品AR:管理")
// @PostMapping("ar_action")
// public ResponseDto<Object> action(@Valid @RequestBody GoblinStoreMgtGoodsSkuArActionParam mgtGoodsSkuArActionParam) {
// String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsSkuArActionParam.getStoreId();
// if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
// return ResponseDto.failure(ErrorMapping.get("149002"));
// }
// List<String> skuIdList = mgtGoodsSkuArActionParam.getSkuIdList();
// if (CollectionUtils.isEmpty(skuIdList)) {
// return ResponseDto.failure(ErrorMapping.get("149021"));
// }
// if (log.isDebugEnabled()) {
// log.debug("商品管理:藏品AR:管理[UID={},GoblinStoreMgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArActionParam));
// }
// boolean resultFlg;
// switch (mgtGoodsSkuArActionParam.getAction()) {
// case "REMOVE":
// for (String skuId : skuIdList) {
// GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
// if (null == mgtGoodsSkuInfoVo || !mgtGoodsSkuInfoVo.getDelFlg().equals("0")) {
// log.warn("商品管理:藏品AR:管理:藏品不存在或已删除[UID={},skuId={}]", currentUid, skuId);
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "藏品AR不存在或已删除");
// }
// if (mgtGoodsSkuInfoVo.getSkuType() != 1) {
// log.warn("商品管理:藏品AR:管理:非数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId);
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,非数字藏品");
// }
// if (!mgtGoodsSkuInfoVo.getStoreId().equals(storeId)) {
// log.warn("商品管理:藏品AR:管理:非本店铺藏品,无权操作[UID={},skuId={}]", currentUid, skuId);
// return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "非本店铺藏品,无权操作");
// }
// }
// resultFlg = goblinStoreMgtGoodsSkuExtraService.skuArDel(currentUid, skuIdList);
// break;
// default:
// log.warn("商品管理:藏品AR:管理:Invalid operation[UID={},GoblinStoreMgtGoodsSkuArActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArActionParam));
// return ResponseDto.failure(ErrorMapping.get("149001"));
// }
// return resultFlg ? ResponseDto.success() : ResponseDto.failure();
// }
@ApiOperationSupport(order = 2)
@ApiOperation(value = "藏品AR:管理")
@PostMapping("ar_action")
public ResponseDto<Object> action(@Valid @RequestBody GoblinStoreMgtGoodsSkuArActionParam mgtGoodsSkuArActionParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsSkuArActionParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
List<String> skuIdList = mgtGoodsSkuArActionParam.getSkuIdList();
if (CollectionUtils.isEmpty(skuIdList)) {
return ResponseDto.failure(ErrorMapping.get("149021"));
}
if (log.isDebugEnabled()) {
log.debug("商品管理:藏品AR:管理[UID={},GoblinStoreMgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArActionParam));
}
boolean resultFlg;
switch (mgtGoodsSkuArActionParam.getAction()) {
case "REMOVE":
for (String skuId : skuIdList) {
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
if (null == mgtGoodsSkuInfoVo || !mgtGoodsSkuInfoVo.getDelFlg().equals("0")) {
log.warn("商品管理:藏品AR:管理:藏品不存在或已删除[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "藏品AR不存在或已删除");
}
if (mgtGoodsSkuInfoVo.getSkuType() != 1) {
log.warn("商品管理:藏品AR:管理:非数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,非数字藏品");
}
if (!mgtGoodsSkuInfoVo.getStoreId().equals(storeId)) {
log.warn("商品管理:藏品AR:管理:非本店铺藏品,无权操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "非本店铺藏品,无权操作");
}
}
resultFlg = goblinStoreMgtGoodsSkuExtraService.skuArDel(currentUid, skuIdList);
break;
default:
log.warn("商品管理:藏品AR:管理:Invalid operation[UID={},GoblinStoreMgtGoodsSkuArActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArActionParam));
return ResponseDto.failure(ErrorMapping.get("149001"));
}
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
}
@ApiOperationSupport(order = 4)
@ApiOperation(value = "藏品AR:添加")
......
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