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

Commit d571786d authored by dongchun's avatar dongchun

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents 97cc8824 755bfc72
......@@ -64,6 +64,7 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_BUY_COUNT = PREFIX.concat("uid:");//用户sku购买数量 key:uid:skuId:$skuId
public static final String REDIS_GOBLIN_SALE_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$skuId
public static final String REDIS_GOBLIN_SALE_SPU_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$spuId
public static final String REDIS_GOBLIN_ORDER = PREFIX.concat("order:");//用户sku购买数量 key:$orderId
public static final String REDIS_GOBLIN_ORDER_BACK = PREFIX.concat("order:back:");//用户sku购买数量 key:$backOrderId
public static final String REDIS_GOBLIN_ORDER_SKU = PREFIX.concat("orderSku:");//用户sku购买数量 key:$orderSkuId
......
......@@ -15,4 +15,6 @@ public class GoblinInsertZhengzaiParam {
private String storeId;
@ApiModelProperty(required = true, value = "显示时间")
private String showTime;
@ApiModelProperty(required = true, value = "是否删除[0-否|1-是]")
private Integer delTag;
}
......@@ -113,20 +113,11 @@ public class GoblinSelfZhengzaiController extends BaseController {
return goblinZhengzaiMarketService.zhengzaiStore(params);
}
@PostMapping("zhengzai/store/insert")
@ApiOperation("活动详情-正在下单-配置店铺")
@PostMapping("zhengzai/store/update")
@ApiOperation("活动详情-正在下单-修改店铺")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "showTime", value = "显示时间", example = "0"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integet", name = "delTag", value = "是否删除[0-否|1-是]", example = "0"),
})
public ResponseDto<Boolean> purchasingStore(@RequestParam("marketId") @Valid String marketId,
@RequestParam("storeId") @Valid String storeId,
@RequestParam("showTime") @Valid String showTime,
@RequestParam("delTag") @Valid Integer delTag) {
return goblinZhengzaiMarketService.zhengzaiStore(marketId, storeId, showTime, delTag);
public ResponseDto<Boolean> purchasingStoreUpdate(@RequestBody List<GoblinInsertZhengzaiParam> params) {
return goblinZhengzaiMarketService.zhengzaiStore(params);
}
......
......@@ -102,11 +102,9 @@ public interface IGoblinZhengzaiMarketService {
/**
* 编辑正在下单 可参与活动店铺
*
* @param marketId
* @param storeId
* @return
*/
ResponseDto<Boolean> zhengzaiStore(String marketId, String storeId, String showTime, Integer delTag);
ResponseDto<Boolean> zhengzaiStoreUpdate(List<GoblinInsertZhengzaiParam> params);
/**
* 查看详情(参加活动的商品列表)
......
......@@ -217,32 +217,38 @@ public class GoblinZhengzaiMarketServiceImpl implements IGoblinZhengzaiMarketSer
}
@Override
public ResponseDto<Boolean> zhengzaiStore(String marketId, String storeId, String showTime, Integer delTag) {
if (delTag == 0) {
GoblinMarketingZhengzaiRelation entity = GoblinMarketingZhengzaiRelation.getNew();
entity.setShowTime(LocalDateTime.parse(showTime, DTF_YMD_HMS));
entity.setUpdatedAt(LocalDateTime.now());
//mysql
goblinMarketingZhengzaiRelationMapper.update(entity, Wrappers.lambdaUpdate(GoblinMarketingZhengzaiRelation.getNew()).eq(GoblinMarketingZhengzaiRelation::getSelfMarketId, marketId).eq(GoblinMarketingZhengzaiRelation::getStoreId, storeId));
//mongo
GoblinMarketingZhengzaiRelationVo vo = GoblinMarketingZhengzaiRelationVo.getNew();
BeanUtils.copyProperties(entity, vo);
vo.setShowTime(showTime);
goblinMongoUtils.updateZhengzaiRelation(marketId, storeId, vo);
//redis
goblinRedisUtils.setZhengzaiRelation(marketId, vo);
goblinRedisUtils.addStoreSelfRelation(marketId, storeId);
} else if (delTag == 1) {
GoblinMarketingZhengzaiRelation entity = GoblinMarketingZhengzaiRelation.getNew();
entity.setDelTag(1);
entity.setUpdatedAt(LocalDateTime.now());
//mysql
goblinMarketingZhengzaiRelationMapper.update(entity, Wrappers.lambdaUpdate(GoblinMarketingZhengzaiRelation.getNew()).eq(GoblinMarketingZhengzaiRelation::getSelfMarketId, marketId).eq(GoblinMarketingZhengzaiRelation::getStoreId, storeId));
//mongo
goblinMongoUtils.delZhengzaiRelation(marketId, storeId);
//redis
goblinRedisUtils.delZhengzaiRelation(marketId, storeId);
goblinRedisUtils.delStoreSelfRelation(marketId, storeId);
public ResponseDto<Boolean> zhengzaiStoreUpdate(List<GoblinInsertZhengzaiParam> params) {
for (GoblinInsertZhengzaiParam item:params) {
int delTag = item.getDelTag();
String showTime = item.getShowTime();
String marketId = item.getMarketId();
String storeId = item.getStoreId();
if (delTag == 0) {
GoblinMarketingZhengzaiRelation entity = GoblinMarketingZhengzaiRelation.getNew();
entity.setShowTime(LocalDateTime.parse(showTime, DTF_YMD_HMS));
entity.setUpdatedAt(LocalDateTime.now());
//mysql
goblinMarketingZhengzaiRelationMapper.update(entity, Wrappers.lambdaUpdate(GoblinMarketingZhengzaiRelation.getNew()).eq(GoblinMarketingZhengzaiRelation::getSelfMarketId, marketId).eq(GoblinMarketingZhengzaiRelation::getStoreId, storeId));
//mongo
GoblinMarketingZhengzaiRelationVo vo = GoblinMarketingZhengzaiRelationVo.getNew();
BeanUtils.copyProperties(entity, vo);
vo.setShowTime(showTime);
goblinMongoUtils.updateZhengzaiRelation(marketId, storeId, vo);
//redis
goblinRedisUtils.setZhengzaiRelation(marketId, vo);
goblinRedisUtils.addStoreSelfRelation(marketId, storeId);
} else if (delTag == 1) {
GoblinMarketingZhengzaiRelation entity = GoblinMarketingZhengzaiRelation.getNew();
entity.setDelTag(1);
entity.setUpdatedAt(LocalDateTime.now());
//mysql
goblinMarketingZhengzaiRelationMapper.update(entity, Wrappers.lambdaUpdate(GoblinMarketingZhengzaiRelation.getNew()).eq(GoblinMarketingZhengzaiRelation::getSelfMarketId, marketId).eq(GoblinMarketingZhengzaiRelation::getStoreId, storeId));
//mongo
goblinMongoUtils.delZhengzaiRelation(marketId, storeId);
//redis
goblinRedisUtils.delZhengzaiRelation(marketId, storeId);
goblinRedisUtils.delStoreSelfRelation(marketId, storeId);
}
}
return ResponseDto.success();
}
......
......@@ -579,7 +579,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (String orderSkuVoIds : skuList) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuVoIds);
//增加销量
redisUtils.incrSkuSaleCount(orderSkuVo.getSkuId(), orderSkuVo.getNum());
redisUtils.incrSkuSaleCount(orderSkuVo.getSpuId(),orderSkuVo.getSkuId(), orderSkuVo.getNum());
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_2.getValue());
//redis
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
......
......@@ -484,14 +484,39 @@ public class GoblinRedisUtils {
}
// 增加 sku销量
public int incrSkuSaleCount(String skuId, int number) {
public int incrSkuSaleCount(String spuId,String skuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_COUNT.concat(skuId);
incrSpuSaleCount(spuId,number);
return (int) redisUtil.incr(redisKey, number);
}
// 减少 sku销量
public int decrSkuSaleCount(String skuId, int number) {
public int decrSkuSaleCount(String spuId,String skuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_COUNT.concat(skuId);
decrSpuSaleCount(spuId,number);
return (int) redisUtil.decr(redisKey, number);
}
//获取 spu销量
public Integer getSpuSaleCount(String spuId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_SPU_COUNT.concat(spuId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
} else {
return (Integer) obj;
}
}
// 增加 spu销量
private int incrSpuSaleCount(String spuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_SPU_COUNT.concat(spuId);
return (int) redisUtil.incr(redisKey, number);
}
// 减少 spu销量
private int decrSpuSaleCount(String spuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_SPU_COUNT.concat(spuId);
return (int) redisUtil.decr(redisKey, number);
}
......
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