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

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

~api:SKU管理-数字藏品+售罄处理;

parent 4a08bbdc
...@@ -151,6 +151,7 @@ public class GoblinStoreMgtDigitalGoodsAddSkuParam implements Serializable { ...@@ -151,6 +151,7 @@ public class GoblinStoreMgtDigitalGoodsAddSkuParam implements Serializable {
initVo.setVirtualFlg("1"); initVo.setVirtualFlg("1");
initVo.setStatus("3"); initVo.setStatus("3");
initVo.setShelvesStatus("0"); initVo.setShelvesStatus("0");
initVo.setSoldoutStatus("0");
initVo.setDelFlg("0"); initVo.setDelFlg("0");
initVo.setUnbox(notUnboxFlg ? "0" : "1"); initVo.setUnbox(notUnboxFlg ? "0" : "1");
......
...@@ -94,6 +94,8 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable { ...@@ -94,6 +94,8 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
private String reason; private String reason;
@ApiModelProperty(position = 32, value = "单品上架状态[0-待上架|1-下架|2-违规|3-上架]") @ApiModelProperty(position = 32, value = "单品上架状态[0-待上架|1-下架|2-违规|3-上架]")
private String shelvesStatus; private String shelvesStatus;
@ApiModelProperty(position = 32, value = "是否售罄[0-否|1-是]")
private String soldoutStatus;
@ApiModelProperty(position = 33, value = "是否隐藏[0-默认展示|1-隐藏]") @ApiModelProperty(position = 33, value = "是否隐藏[0-默认展示|1-隐藏]")
private String skuAppear; private String skuAppear;
@ApiModelProperty(position = 33, value = "是否购买[0-否|1-是]") @ApiModelProperty(position = 33, value = "是否购买[0-否|1-是]")
......
...@@ -182,6 +182,11 @@ public class GoblinGoodsSku implements Serializable { ...@@ -182,6 +182,11 @@ public class GoblinGoodsSku implements Serializable {
*/ */
private String shelvesStatus; private String shelvesStatus;
/**
* 是否售罄[0-否|1-是]
*/
private String soldoutStatus;
/** /**
* 是否隐藏[0-默认展示|1-隐藏] * 是否隐藏[0-默认展示|1-隐藏]
*/ */
......
...@@ -23,8 +23,9 @@ alter table goblin_goods_sku add shelves_time datetime null comment '预约上 ...@@ -23,8 +23,9 @@ alter table goblin_goods_sku add shelves_time datetime null comment '预约上
alter table goblin_goods_sku add sale_start_time datetime null comment '开售时间' after shelves_time; alter table goblin_goods_sku add sale_start_time datetime null comment '开售时间' after shelves_time;
alter table goblin_goods_sku add sale_stop_time datetime null comment '停售时间' after sale_start_time; alter table goblin_goods_sku add sale_stop_time datetime null comment '停售时间' after sale_start_time;
alter table goblin_goods_sku add soldout_status char default '0' not null comment '是否售罄[0-否|1-是]' after shelves_status;
alter table goblin_goods_sku add sku_canbuy char null comment '是否购买[0-否|1-是]' after sku_appear; alter table goblin_goods_sku add sku_canbuy char null comment '是否购买[0-否|1-是]' after sku_appear;
alter table goblin_goods_sku add unbox char default '0' null comment '是否盲盒[0-否|1-是]' after sku_canbuy; alter table goblin_goods_sku add unbox char default '0' not null null comment '是否盲盒[0-否|1-是]' after sku_canbuy;
alter table goblin_goods_sku add hit_ratio decimal(3, 2) null comment '盲盒命中率[0.01~100%]' after unbox; alter table goblin_goods_sku add hit_ratio decimal(3, 2) null comment '盲盒命中率[0.01~100%]' after unbox;
alter table goblin_goods_sku add opening_time datetime null comment '盲盒开启时间' after hit_ratio; alter table goblin_goods_sku add opening_time datetime null comment '盲盒开启时间' after hit_ratio;
alter table goblin_goods_sku add opening_limit int default 0 comment '盲盒开启时限[单位秒]' after opening_time; alter table goblin_goods_sku add opening_limit int default 0 comment '盲盒开启时限[单位秒]' after opening_time;
......
...@@ -242,8 +242,8 @@ public class GoblinStoreMgtGoodsController { ...@@ -242,8 +242,8 @@ public class GoblinStoreMgtGoodsController {
log.warn("商品管理:SPU管理:上架警告:非法操作,参数有误[UID={},skuId={}]", currentUid, skuId); log.warn("商品管理:SPU管理:上架警告:非法操作,参数有误[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "参数有误"); return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "参数有误");
} }
if (goodsSkuInfoVo.getShelvesStatus().equals("3")) { if ("3".equals(goodsSkuInfoVo.getShelvesStatus())) {
log.warn("商品管理:SPU管理:上架警告:请先将商品下架后操作[UID={},skuId={}]", currentUid, skuId); log.warn("商品管理:SPU管理:上架警告:无效操作,商品已上架[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品已上架"); return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品已上架");
} }
if (goodsSkuInfoVo.getSkuType() == 0) { if (goodsSkuInfoVo.getSkuType() == 0) {
...@@ -276,6 +276,10 @@ public class GoblinStoreMgtGoodsController { ...@@ -276,6 +276,10 @@ public class GoblinStoreMgtGoodsController {
log.warn("商品管理:SPU管理:售罄警告:数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId); log.warn("商品管理:SPU管理:售罄警告:数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品非数字藏品"); return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品非数字藏品");
} }
if ("1".equals(goodsSkuInfoVo.getSoldoutStatus())) {
log.warn("商品管理:SPU管理:售罄警告:无效操作,商品已置为售罄[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品已置为售罄");
}
} }
resultFlg = goblinstoreMgtGoodsService.goodsSkuSoldOutProcessing(mgtGoodsSkuActionParam, currentUid); resultFlg = goblinstoreMgtGoodsService.goodsSkuSoldOutProcessing(mgtGoodsSkuActionParam, currentUid);
break; break;
......
...@@ -1191,9 +1191,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -1191,9 +1191,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
@Override @Override
public boolean goodsSkuShelvesProcessing(GoblinStoreMgtGoodsSkuActionParam mgtGoodsSkuActionParam, String uid, boolean shelvesFlg) { public boolean goodsSkuShelvesProcessing(GoblinStoreMgtGoodsSkuActionParam mgtGoodsSkuActionParam, String uid, boolean shelvesFlg) {
LocalDateTime now = LocalDateTime.now();
String storeId = mgtGoodsSkuActionParam.getStoreId(), spuId = mgtGoodsSkuActionParam.getSpuId(); String storeId = mgtGoodsSkuActionParam.getStoreId(), spuId = mgtGoodsSkuActionParam.getSpuId();
List<String> skuIdList = mgtGoodsSkuActionParam.getSkuIdList(); List<String> skuIdList = mgtGoodsSkuActionParam.getSkuIdList();
LocalDateTime now = LocalDateTime.now();
if (goblinMongoUtils.updateGoodsSkuInfoVoByShelvesSku(storeId, skuIdList, shelvesFlg, uid, now)) { if (goblinMongoUtils.updateGoodsSkuInfoVoByShelvesSku(storeId, skuIdList, shelvesFlg, uid, now)) {
log.info("藏品管理:SKU管理:上下架处理[UID={},SHELVES={},PARAMS={}]", uid, shelvesFlg, JsonUtils.toJson(mgtGoodsSkuActionParam)); log.info("藏品管理:SKU管理:上下架处理[UID={},SHELVES={},PARAMS={}]", uid, shelvesFlg, JsonUtils.toJson(mgtGoodsSkuActionParam));
...@@ -1351,6 +1351,26 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi ...@@ -1351,6 +1351,26 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
@Override @Override
public boolean goodsSkuSoldOutProcessing(GoblinStoreMgtGoodsSkuActionParam mgtGoodsSkuActionParam, String uid) { public boolean goodsSkuSoldOutProcessing(GoblinStoreMgtGoodsSkuActionParam mgtGoodsSkuActionParam, String uid) {
List<String> skuIdList = mgtGoodsSkuActionParam.getSkuIdList();
LocalDateTime now = LocalDateTime.now();
String soldoutStatus = "1";
if (goblinMongoUtils.updateGoodsSkuInfoVoBySoldoutSku(mgtGoodsSkuActionParam.getStoreId(), skuIdList, soldoutStatus, uid, now)) {
log.info("藏品管理:SKU管理:售罄处理[UID={},PARAMS={}]", uid, JsonUtils.toJson(mgtGoodsSkuActionParam));
skuIdList.forEach(skuId -> {
goblinRedisUtils.delGoodsSkuInfoVo(skuId);
goblinRedisUtils.delGoodsSkuInfoVoByUnShelves(skuId);
});
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_soldout"));
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
skuIdList.forEach(skuId -> updateGoodsSkuObjs.add(new Object[]{soldoutStatus, uid, now, skuId}));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, updateGoodsSkuObjs));
return true;
}
return false; return false;
} }
} }
...@@ -645,6 +645,12 @@ public class GoblinMongoUtils { ...@@ -645,6 +645,12 @@ public class GoblinMongoUtils {
GoblinGoodsSkuInfoVo.class.getSimpleName()).getModifiedCount() > 0; GoblinGoodsSkuInfoVo.class.getSimpleName()).getModifiedCount() > 0;
} }
public boolean updateGoodsSkuInfoVoBySoldoutSku(String storeId, List<String> skuIdList, String soldoutStatus, String uid, LocalDateTime time) {
return mongoTemplate.updateMulti(Query.query(Criteria.where("storeId").is(storeId).and("delFlg").is("0").and("skuId").in(skuIdList)),
Update.update("soldoutStatus", soldoutStatus).set("updatedBy", uid).set("updatedAt", time),
GoblinGoodsSkuInfoVo.class.getSimpleName()).getModifiedCount() > 0;
}
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/** /**
......
...@@ -53,7 +53,8 @@ goblin_goods_sku.update_by_edit=UPDATE goblin_goods_sku SET name=?,sku_pic=?,sel ...@@ -53,7 +53,8 @@ goblin_goods_sku.update_by_edit=UPDATE goblin_goods_sku SET name=?,sku_pic=?,sel
goblin_goods_sku.update_by_edit_for_digital=UPDATE goblin_goods_sku SET hit_ratio=?,buy_factor=?,buy_limit=?,sku_appear=?,sku_canbuy=?,shelves_handle=?,shelves_time=?,sale_start_time=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0' goblin_goods_sku.update_by_edit_for_digital=UPDATE goblin_goods_sku SET hit_ratio=?,buy_factor=?,buy_limit=?,sku_appear=?,sku_canbuy=?,shelves_handle=?,shelves_time=?,sale_start_time=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_box_digital=UPDATE goblin_goods_sku SET name=?,subtitle=?,sku_pic=?,sku_watch=?,watch_type=?,price=?,price_member=?,intro=?,details=?,shelves_handle=?,shelves_time=?,sale_start_time=?,opening_time=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0' goblin_goods_sku.update_by_edit_box_digital=UPDATE goblin_goods_sku SET name=?,subtitle=?,sku_pic=?,sku_watch=?,watch_type=?,price=?,price_member=?,intro=?,details=?,shelves_handle=?,shelves_time=?,sale_start_time=?,opening_time=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_spu=UPDATE goblin_goods_sku SET sku_no=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0' goblin_goods_sku.update_by_edit_spu=UPDATE goblin_goods_sku SET sku_no=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_shelves=UPDATE goblin_goods_sku SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE spu_id=? AND store_id=? AND del_flg='0' goblin_goods_sku.update_by_shelves=UPDATE goblin_goods_sku SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE sku_id=? AND store_id=? AND del_flg='0'
goblin_goods_sku.update_by_soldout=UPDATE goblin_goods_sku SET soldout_status=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_del_store=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=? AND del_flg='0' goblin_goods_sku.update_by_del_store=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=? AND del_flg='0'
goblin_goods_sku.update_by_del_spu=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND del_flg='0' goblin_goods_sku.update_by_del_spu=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE sku_id=? AND del_flg='0' goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE sku_id=? AND del_flg='0'
......
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