Authored by wangshusheng

砍价

@@ -2,11 +2,17 @@ package com.yoho.activity.queue.constant; @@ -2,11 +2,17 @@ package com.yoho.activity.queue.constant;
2 2
3 3
4 public class CutPriceConstant { 4 public class CutPriceConstant {
5 - // 1:砍价中 2:已成功 3:已失效(活动已过期、发起砍价24小时未成功、砍价成功后24小时内未下单) 5 + // 1:砍价中
6 public static final Integer CUT_STATUS_ONGOING = 1; 6 public static final Integer CUT_STATUS_ONGOING = 1;
  7 + // 2:已成功
7 public static final Integer CUT_STATUS_SUCCESS = 2; 8 public static final Integer CUT_STATUS_SUCCESS = 2;
  9 + // 3:已失效(活动已过期、发起砍价24小时未成功、砍价成功后24小时内未下单)
8 public static final Integer CUT_STATUS_EXPIRE = 3; 10 public static final Integer CUT_STATUS_EXPIRE = 3;
9 - public static final Integer CUT_STATUS_END = 4;  
10 11
  12 + // 0:不存在进行中的砍价,进详情页
  13 + public static final Integer NOT_EXIST_DOING_CUT = 0;
  14 +
  15 + // 1:存在进行中的砍价,进我的砍价列表
  16 + public static final Integer EXIST_DOING_CUT = 1;
11 17
12 } 18 }
@@ -87,6 +87,18 @@ public class CutDownProductPriceRest { @@ -87,6 +87,18 @@ public class CutDownProductPriceRest {
87 } 87 }
88 88
89 /** 89 /**
  90 + * 列表页判断是否有进行的砍价,没有正在进行中的进详情页,有正在进行中的进我的砍价列表页
  91 + */
  92 + @RequestMapping("/queryDoingCutPrice")
  93 + @ResponseBody
  94 + public Integer queryDoingCutPrice(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
  95 + logger.info("CutDownProductPriceRest queryDoingCutPrice params is{}", cutPriceHelpUserRequestBO);
  96 + Integer result = cutDownPriceService.queryDoingCutPrice(cutPriceHelpUserRequestBO);
  97 + logger.info("CutDownProductPriceRest queryDoingCutPrice success params is{}, result is {}", cutPriceHelpUserRequestBO, result);
  98 + return result;
  99 + }
  100 +
  101 + /**
90 * 好友帮忙砍价,并自动发起一个砍价 102 * 好友帮忙砍价,并自动发起一个砍价
91 */ 103 */
92 @RequestMapping("/addCutPriceHelpUserInfo") 104 @RequestMapping("/addCutPriceHelpUserInfo")
@@ -18,6 +18,8 @@ public interface ICutDownPriceService { @@ -18,6 +18,8 @@ public interface ICutDownPriceService {
18 18
19 CutDownPriceActivityProductBo queryCutProductInfo(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO); 19 CutDownPriceActivityProductBo queryCutProductInfo(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
20 20
  21 + Integer queryDoingCutPrice(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
  22 +
21 CutDownPriceActivityProductBo queryCutProductInfoForOrder(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO); 23 CutDownPriceActivityProductBo queryCutProductInfoForOrder(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
22 24
23 BigDecimal addHelpUserInfo(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO); 25 BigDecimal addHelpUserInfo(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
@@ -163,6 +163,39 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -163,6 +163,39 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
163 } 163 }
164 164
165 @Override 165 @Override
  166 + public Integer queryDoingCutPrice(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
  167 + Integer activityId = cutPriceHelpUserRequestBO.getActivityId();
  168 + Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
  169 + Integer userId = cutPriceHelpUserRequestBO.getUserId();
  170 + // 查询活动信息
  171 + CutDownPriceActivityBo activityBo = cutDownActivityService.queryActivityInfo(activityId);
  172 + checkValidActivity(activityBo, activityId);
  173 + // 查询商品配置信息
  174 + CutDownPriceProductBo cutDownPriceProductBo = cutDownPriceProductService.queryCutDownPriceProductBo(activityId, productSkn);
  175 + if(cutDownPriceProductBo==null){
  176 + logger.warn(" the cutdown product not exist, activityId is {}, productSkn is {}", activityId, productSkn);
  177 + throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_PRODUCT_NOTEXIST_ERROR);
  178 + }
  179 + Integer result = CutPriceConstant.NOT_EXIST_DOING_CUT;
  180 + // 组装信息
  181 + CutDownPriceActivityProductBo bo = buildCutDownPriceActivityProductBo(activityBo, cutDownPriceProductBo, null, null);
  182 + CutDownPriceUserRecord record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecord(userId, cutPriceHelpUserRequestBO.getActivityId(), cutPriceHelpUserRequestBO.getProductSkn());
  183 + if(record!=null){
  184 + bo.setCanUseCount(record.getUseCount());
  185 + bo.setHasJoinNum(record.getHelpCount());
  186 + bo.setCreateTime(record.getCreateTime());
  187 + buildCutStatus(bo);
  188 + if(bo.getCutStatus()==CutPriceConstant.CUT_STATUS_EXPIRE){
  189 + result = CutPriceConstant.NOT_EXIST_DOING_CUT;
  190 + }else if(bo.getCutStatus()==CutPriceConstant.CUT_STATUS_ONGOING || bo.getCutStatus()==CutPriceConstant.CUT_STATUS_SUCCESS){
  191 + result = CutPriceConstant.EXIST_DOING_CUT;
  192 + }
  193 + }
  194 +
  195 + return result;
  196 + }
  197 +
  198 + @Override
166 public CutDownPriceActivityProductBo queryCutProductInfoForOrder(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) { 199 public CutDownPriceActivityProductBo queryCutProductInfoForOrder(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
167 Integer activityId = cutPriceHelpUserRequestBO.getActivityId(); 200 Integer activityId = cutPriceHelpUserRequestBO.getActivityId();
168 Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn(); 201 Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
@@ -47,6 +47,7 @@ @@ -47,6 +47,7 @@
47 <value>/addCutPriceUseRecord</value> 47 <value>/addCutPriceUseRecord</value>
48 <value>/cancelCutPriceUseRecord</value> 48 <value>/cancelCutPriceUseRecord</value>
49 <value>/queryEffectCutPriceActivity</value> 49 <value>/queryEffectCutPriceActivity</value>
  50 + <value>/queryDoingCutPrice</value>
50 </list> 51 </list>
51 </property> 52 </property>
52 <property name="excludeMethods"> 53 <property name="excludeMethods">