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

Commit d5db5bb1 authored by 姜秀龙's avatar 姜秀龙

Merge branch 'refs/heads/jxl-settlementPrice' into test-ecs

parents cba3e8df f88315a8
......@@ -34,6 +34,8 @@ public class GoblinFrontGoodDetailVo implements Serializable {
@ApiModelProperty(value = "条码识别到的SKUID列表", notes = "仅当条码识别时有效")
private List<String> hitSkuIdList;
@ApiModelProperty(value = "当前用户是否已购买本场演出门票(与收钱吧下单换购价校验一致);仅收钱吧商品(spuType=33)且传入 performancesId 时返回 true/false,其他情况为 null;未登录为 false")
private Boolean boughtPerformance;
private static final long serialVersionUID = 1L;
......
......@@ -77,7 +77,7 @@ public class GoblinFrontController {
@GetMapping("getGoodsDetail")
@ApiOperation("获得商品详情")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", required = false, dataType = "String", name = "performancesId", value = "演出ID,可选;收钱吧商品(spuType=33)时传入则仅返回该演出已关联的 SKU")
@ApiImplicitParam(paramType = "query", required = false, dataType = "String", name = "performancesId", value = "演出ID,可选;收钱吧商品(spuType=33)时传入则仅返回该演出已关联的 SKU,并返回 boughtPerformance 是否已购本场票")
})
public ResponseDto<GoblinFrontGoodDetailVo> getGoodsDetail(
@RequestParam(name = "spuId", required = true) String spuId,
......
......@@ -533,6 +533,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
*/
public GoblinFrontGoodDetailVo getGoodsDetail(String spuId, String performancesId) {
GoblinFrontGoodDetailVo goblinFrontGoodDetailVo = GoblinFrontGoodDetailVo.getNew();
goblinFrontGoodDetailVo.setBoughtPerformance(null);
GoblinGoodsInfoVo goblinGoodsInfoVo = goblinRedisUtils.getGoodsInfoVo(spuId);
GoblinGoodsInfoDetailVo goblinGoodsInfoDetailVo = GoblinGoodsInfoDetailVo.getNew();
//skuIdList
......@@ -558,6 +559,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
goblinFrontGoodDetailVo.setStoreName(goblinStoreInfoVo.getStoreName());
}
goblinFrontGoodDetailVo.setGoblinGoodsSkuInfoVolist(list);
fillBoughtPerformanceFlag(goblinFrontGoodDetailVo, goblinGoodsInfoVo, performancesId);
} else {
return null;
}
......@@ -566,6 +568,23 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
return goblinFrontGoodDetailVo;
}
/**
* 详情页:是否已购本场演出门票(仅 SQB + performancesId;与下单换购价逻辑同源)
*/
private void fillBoughtPerformanceFlag(GoblinFrontGoodDetailVo detailVo, GoblinGoodsInfoVo goodsInfoVo,
String performancesId) {
if (detailVo == null || !isSqbSpuGoods(goodsInfoVo) || StringUtil.isBlank(performancesId)) {
return;
}
String userId = CurrentUtil.getCurrentUid();
if (StringUtils.isBlank(userId)) {
detailVo.setBoughtPerformance(false);
return;
}
int buyCount = goblinRedisUtils.getUserPerformanceBuyCount(userId, performancesId.trim());
detailVo.setBoughtPerformance(buyCount > 0);
}
/**
* 根据条码获得商品详情
*/
......@@ -592,6 +611,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
Integer buyCount = 0;
GoblinFrontGoodDetailVo goblinFrontGoodDetailVo = GoblinFrontGoodDetailVo.getNew();
goblinFrontGoodDetailVo.setBoughtPerformance(null);
GoblinGoodsInfoVo goblinGoodsInfoVo = goblinRedisUtils.getGoodsInfoVo(spuId);
GoblinGoodsInfoDetailVo goblinGoodsInfoDetailVo = GoblinGoodsInfoDetailVo.getNew();
//skuIdList
......
......@@ -3092,6 +3092,29 @@ public class GoblinRedisUtils {
return performanceData;
}
/**
* 用户维度本场演出已购票数量(与 order {@code DataUtils#getUserPBuyCount} 一致)
*/
public int getUserPerformanceBuyCount(String userId, String performanceId) {
if (!StringUtils.hasText(userId) || !StringUtils.hasText(performanceId)) {
return 0;
}
try {
String key = KylinRedisConst.USERID_BUY_INFO + userId.trim() + ":"
+ KylinRedisConst.PERFORMANCE_ID + ":" + performanceId.trim();
Object val = redisUtil.get(key);
if (val == null) {
return 0;
}
if (val instanceof Number) {
return ((Number) val).intValue();
}
return Integer.parseInt(String.valueOf(val));
} catch (Exception e) {
return 0;
}
}
public void setSqbPerformanceGoodsListCache(String performancesId, List<GoblinSqbPerformanceGoods> relations) {
String key = GoblinRedisConst.SQB_PERFORMANCE_GOODS.concat(performancesId);
redisUtil.set(key, relations, RedisKeyExpireConst.SQB_PERFORMANCE_GOODS_EXPIRE);
......
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