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

Commit 15696cb6 authored by 胡佳晨's avatar 胡佳晨

提交 显示秒杀

parent 6d011830
...@@ -21,7 +21,7 @@ public class GoblinStorePurchaseCommonParam { ...@@ -21,7 +21,7 @@ public class GoblinStorePurchaseCommonParam {
@ApiModelProperty(required = true, value = "spuId", example = "1") @ApiModelProperty(required = true, value = "spuId", example = "1")
@NotBlank(message = "spuId不能空") @NotBlank(message = "spuId不能空")
private String spuId; private String spuId;
@ApiModelProperty(required = true, value = "相关配置", example = "1") @ApiModelProperty(required = true, value = "相关配置")
private List<GoblinStorePurchaseItemParam> goblinStorePurchaseItemParam; private List<GoblinStorePurchaseItemParam> goblinStorePurchaseItemParam;
} }
......
...@@ -18,7 +18,7 @@ public class GoblinStorePurchaseItemParam { ...@@ -18,7 +18,7 @@ public class GoblinStorePurchaseItemParam {
private BigDecimal priceMarketing; private BigDecimal priceMarketing;
@ApiModelProperty(required = true, value = "活动库存", example = "1.00") @ApiModelProperty(required = true, value = "活动库存", example = "1.00")
@NotBlank(message = "活动库存不能为空") @NotBlank(message = "活动库存不能为空")
private String stockMarketing; private Integer stockMarketing;
@ApiModelProperty(required = true, value = "用户限购[0-不限购|x-限购数量]", example = "1") @ApiModelProperty(required = true, value = "用户限购[0-不限购|x-限购数量]", example = "1")
@NotBlank(message = "用户限购类型不能为空") @NotBlank(message = "用户限购类型不能为空")
private Integer buyLimit; private Integer buyLimit;
......
...@@ -30,9 +30,9 @@ public class GoblinStorePurchaseSkuVo implements Serializable, Cloneable { ...@@ -30,9 +30,9 @@ public class GoblinStorePurchaseSkuVo implements Serializable, Cloneable {
@ApiModelProperty(position = 6, value = "限量[0-无限制|X:限购数量]") @ApiModelProperty(position = 6, value = "限量[0-无限制|X:限购数量]")
private Integer buyLimit; private Integer buyLimit;
@ApiModelProperty(position = 7, value = "购买限制[0-全部用户|1-仅会员|2-指定用户]") @ApiModelProperty(position = 7, value = "购买限制[0-全部用户|1-仅会员|2-指定用户]")
private Integer buyFactor; private String buyFactor;
@ApiModelProperty(position = 8, value = "购买限制人员名单[购买限制为2-指定用户时必填]") @ApiModelProperty(position = 8, value = "购买限制人员名单[购买限制为2-指定用户时必填]")
private Integer buyRoster; private String buyRoster;
......
...@@ -104,8 +104,8 @@ public interface IGoblinStorePurchasingService { ...@@ -104,8 +104,8 @@ public interface IGoblinStorePurchasingService {
* 删除活动内sku * 删除活动内sku
* *
* @param marketId 活动秒杀id * @param marketId 活动秒杀id
* @param skuId skuId * @param spuId spuId
* @return * @return
*/ */
ResponseDto<Boolean> purchasingSkuDel(String marketId, String storeId,String spuId); ResponseDto<Boolean> purchasingSpuDel(String marketId, String storeId, String spuId);
} }
...@@ -131,18 +131,18 @@ public class GoblinStorePurchasingController { ...@@ -131,18 +131,18 @@ public class GoblinStorePurchasingController {
return goblinStorePurchasingService.purchasingSkuUpdate(params); return goblinStorePurchasingService.purchasingSkuUpdate(params);
} }
@DeleteMapping("purchasing/sku") @DeleteMapping("purchasing/spu")
@ApiOperation("活动详情-限时秒杀-sku删除") @ApiOperation("活动详情-限时秒杀-spu删除")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动id", example = "1"), @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 = "storeId", value = "商铺id", example = "1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "spuId", example = "1") @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuId", value = "spuId", example = "1")
}) })
public ResponseDto<Boolean> purchasingSkuDel(@RequestParam("marketId") @Valid String marketId, public ResponseDto<Boolean> purchasingSpuDel(@RequestParam("marketId") @Valid String marketId,
@RequestParam("storeId") @Valid String storeId, @RequestParam("storeId") @Valid String storeId,
@RequestParam("spuId") @Valid String spuId) { @RequestParam("spuId") @Valid String spuId) {
return goblinStorePurchasingService.purchasingSkuDel(marketId, storeId, spuId); return goblinStorePurchasingService.purchasingSpuDel(marketId, storeId, spuId);
} }
} }
...@@ -47,7 +47,9 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -47,7 +47,9 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
HashMap<String, Object> map = goblinMongoUtils.getStoreMarketList(page, purchaseName, status, st, et, ct); HashMap<String, Object> map = goblinMongoUtils.getStoreMarketList(page, purchaseName, status, st, et, ct);
List<GoblinStoreMarketVo> list = (List<GoblinStoreMarketVo>) map.get("data"); List<GoblinStoreMarketVo> list = (List<GoblinStoreMarketVo>) map.get("data");
for (GoblinStoreMarketVo item : list) { for (GoblinStoreMarketVo item : list) {
if (LocalDateTime.parse(item.getStartTime(), DTF_YMD_HMS).isAfter(now)) { if (item.getStatus().equals(7)) {
item.setStatus(7);
} else if (LocalDateTime.parse(item.getStartTime(), DTF_YMD_HMS).isAfter(now)) {
item.setStatus(0); item.setStatus(0);
} else if (LocalDateTime.parse(item.getEndTime(), DTF_YMD_HMS).isBefore(now)) { } else if (LocalDateTime.parse(item.getEndTime(), DTF_YMD_HMS).isBefore(now)) {
item.setStatus(2); item.setStatus(2);
...@@ -178,7 +180,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -178,7 +180,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
GoblinMarketSpuListVo vo = GoblinMarketSpuListVo.getNew(); GoblinMarketSpuListVo vo = GoblinMarketSpuListVo.getNew();
String marketSpuId = marketSpuList.get(i); String marketSpuId = marketSpuList.get(i);
GoblinGoodsInfoVo spuVo = goblinRedisUtils.getGoodsInfoVo(marketSpuId); GoblinGoodsInfoVo spuVo = goblinRedisUtils.getGoodsInfoVo(marketSpuId);
vo.setMarketSpuId(marketSpuId); vo.setMarketSpuId(marketSpuId.split(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue())[0]);
vo.setCoverPic(spuVo.getCoverPic()); vo.setCoverPic(spuVo.getCoverPic());
vo.setName(spuVo.getName()); vo.setName(spuVo.getName());
vo.setPriceGe(spuVo.getPriceGe()); vo.setPriceGe(spuVo.getPriceGe());
...@@ -204,9 +206,9 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -204,9 +206,9 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
vo.setSkuStock(skuVo.getSkuStock()); vo.setSkuStock(skuVo.getSkuStock());
vo.setPriceMarketing(marketSkuVo.getPrice()); vo.setPriceMarketing(marketSkuVo.getPrice());
vo.setStockMarketing(marketSkuVo.getSkuStock()); vo.setStockMarketing(marketSkuVo.getSkuStock());
vo.setBuyFactor(vo.getBuyFactor()); vo.setBuyFactor(marketSkuVo.getBuyFactor());
vo.setBuyLimit(vo.getBuyLimit()); vo.setBuyLimit(marketSkuVo.getBuyLimit());
vo.setBuyRoster(vo.getBuyRoster()); vo.setBuyRoster(marketSkuVo.getBuyRoster());
voList.add(vo); voList.add(vo);
} }
return ResponseDto.success(voList); return ResponseDto.success(voList);
...@@ -224,6 +226,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -224,6 +226,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
sqls.add(SqlMapping.get("goblin.store.market.insertRelation")); sqls.add(SqlMapping.get("goblin.store.market.insertRelation"));
LinkedList<Object[]> sqlsData = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> sqlsData = CollectionUtil.linkedListObjectArr();
for (GoblinStorePurchaseItemParam item : params.getGoblinStorePurchaseItemParam()) { for (GoblinStorePurchaseItemParam item : params.getGoblinStorePurchaseItemParam()) {
//todo 修改 相关vo 修改库存 判断库存
String purchaseId = IDGenerator.nextMilliId2(); String purchaseId = IDGenerator.nextMilliId2();
GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew(); GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew();
bean.setStoreId(params.getStoreId()); bean.setStoreId(params.getStoreId());
...@@ -232,7 +235,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -232,7 +235,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
bean.setPurchaseId(purchaseId); bean.setPurchaseId(purchaseId);
bean.setSkuId(item.getSkuId()); bean.setSkuId(item.getSkuId());
bean.setPriceMarketing(item.getPriceMarketing()); bean.setPriceMarketing(item.getPriceMarketing());
bean.setStockMarketing(item.hashCode()); bean.setStockMarketing(item.getStockMarketing());
bean.setBuyLimit(item.getBuyLimit()); bean.setBuyLimit(item.getBuyLimit());
bean.setBuyFactor(item.getBuyFactor()); bean.setBuyFactor(item.getBuyFactor());
bean.setBuyRoster(item.getBuyRoster()); bean.setBuyRoster(item.getBuyRoster());
...@@ -249,6 +252,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -249,6 +252,7 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
skuVo.setBuyRoster(bean.getBuyRoster()); skuVo.setBuyRoster(bean.getBuyRoster());
skuVo.setBuyFactor(bean.getBuyFactor().toString()); skuVo.setBuyFactor(bean.getBuyFactor().toString());
skuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId())); skuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId()));
goblinMongoUtils.setGoodsSkuInfoVo(skuVo);
//redis //redis
goblinRedisUtils.setGoodsSkuInfoVo(skuVo); goblinRedisUtils.setGoodsSkuInfoVo(skuVo);
//mysql //mysql
...@@ -279,13 +283,15 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -279,13 +283,15 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
public ResponseDto<Boolean> purchasingSkuUpdate(GoblinStorePurchaseCommonParam params) { public ResponseDto<Boolean> purchasingSkuUpdate(GoblinStorePurchaseCommonParam params) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String marketSpuId = params.getSpuId().concat(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue()).concat(IDGenerator.marketGoodId(params.getStoreMarketId())); String marketSpuId = params.getSpuId().concat(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue()).concat(IDGenerator.marketGoodId(params.getStoreMarketId()));
List<String> marketSkuList = CollectionUtil.arrayListString();
LinkedList<String> sqls = CollectionUtil.linkedListString(); LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("goblin.store.market.updateRelation")); sqls.add(SqlMapping.get("goblin.store.market.updateRelation"));
LinkedList<Object[]> sqlsData = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> sqlsData = CollectionUtil.linkedListObjectArr();
for (GoblinStorePurchaseItemParam item : params.getGoblinStorePurchaseItemParam()) { for (GoblinStorePurchaseItemParam item : params.getGoblinStorePurchaseItemParam()) {
//todo 修改 相关vo 修改库存 判断库存
GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew(); GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew();
bean.setPriceMarketing(item.getPriceMarketing()); bean.setPriceMarketing(item.getPriceMarketing());
bean.setStockMarketing(item.hashCode()); bean.setStockMarketing(item.getStockMarketing());
bean.setBuyLimit(item.getBuyLimit()); bean.setBuyLimit(item.getBuyLimit());
bean.setBuyFactor(item.getBuyFactor()); bean.setBuyFactor(item.getBuyFactor());
bean.setBuyRoster(item.getBuyRoster()); bean.setBuyRoster(item.getBuyRoster());
...@@ -300,17 +306,20 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -300,17 +306,20 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
skuVo.setBuyRoster(bean.getBuyRoster()); skuVo.setBuyRoster(bean.getBuyRoster());
skuVo.setBuyFactor(bean.getBuyFactor().toString()); skuVo.setBuyFactor(bean.getBuyFactor().toString());
skuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId())); skuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId()));
goblinMongoUtils.updateGoodsSkuInfoVo(skuVo);
//redis //redis
goblinRedisUtils.setGoodsSkuInfoVo(skuVo); goblinRedisUtils.setGoodsSkuInfoVo(skuVo);
//mysql //mysql
sqlsData.add(new Object[]{bean.getPriceMarketing(), sqlsData.add(new Object[]{bean.getPriceMarketing(),
bean.getStockMarketing(), bean.getBuyFactor(), bean.getBuyRoster(), bean.getBuyLimit(), bean.getUpdatedAt(), params.getStoreMarketId(), params.getStoreId()}); bean.getStockMarketing(), bean.getBuyFactor(), bean.getBuyRoster(), bean.getBuyLimit(), bean.getUpdatedAt(), params.getStoreMarketId(), params.getStoreId()});
marketSkuList.add(skuVo.getSkuId());
} }
//mongo //mongo
GoblinGoodsInfoVo spuVo = goblinRedisUtils.getGoodsInfoVo(params.getSpuId()); GoblinGoodsInfoVo spuVo = goblinRedisUtils.getGoodsInfoVo(params.getSpuId());
spuVo.setSpuId(marketSpuId); spuVo.setSpuId(marketSpuId);
spuVo.setSkuIdList(marketSkuList);
spuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId())); spuVo.setMarketId(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue().concat(params.getStoreMarketId()));
goblinMongoUtils.setGoodsInfoVo(spuVo); goblinMongoUtils.updateGoodsInfoVo(spuVo);
//redis //redis
goblinRedisUtils.setGoodsInfoVo(spuVo); goblinRedisUtils.setGoodsInfoVo(spuVo);
// 执行sql // 执行sql
...@@ -321,7 +330,8 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS ...@@ -321,7 +330,8 @@ public class GoblinStorePurchasingServiceImpl implements IGoblinStorePurchasingS
} }
@Override @Override
public ResponseDto<Boolean> purchasingSkuDel(String marketId, String storeId, String spuId) { public ResponseDto<Boolean> purchasingSpuDel(String marketId, String storeId, String spuId) {
//todo 修改 相关vo 修改库存 判断库存
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String marketSpuId = spuId.concat(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue()).concat(IDGenerator.marketGoodId(marketId)); String marketSpuId = spuId.concat(GoblinStatusConst.MarketPreStatus.MARKET_PRE_PURCHASE.getValue()).concat(IDGenerator.marketGoodId(marketId));
GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew(); GoblinStoreMarketPurchasing bean = GoblinStoreMarketPurchasing.getNew();
......
...@@ -146,7 +146,7 @@ public class GoblinMongoUtils { ...@@ -146,7 +146,7 @@ public class GoblinMongoUtils {
public boolean updateGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) { public boolean updateGoodsSkuInfoVo(GoblinGoodsSkuInfoVo vo) {
return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName()) return mongoTemplate.getCollection(GoblinGoodsSkuInfoVo.class.getSimpleName())
.updateOne( .updateOne(
Query.query(Criteria.where("skuId").is(vo.getSpuId())).getQueryObject(), Query.query(Criteria.where("skuId").is(vo.getSkuId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo)) ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0; ).getModifiedCount() > 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