Authored by wangshusheng

砍价

... ... @@ -2,11 +2,17 @@ package com.yoho.activity.queue.constant;
public class CutPriceConstant {
// 1:砍价中 2:已成功 3:已失效(活动已过期、发起砍价24小时未成功、砍价成功后24小时内未下单)
// 1:砍价中
public static final Integer CUT_STATUS_ONGOING = 1;
// 2:已成功
public static final Integer CUT_STATUS_SUCCESS = 2;
// 3:已失效(活动已过期、发起砍价24小时未成功、砍价成功后24小时内未下单)
public static final Integer CUT_STATUS_EXPIRE = 3;
public static final Integer CUT_STATUS_END = 4;
// 0:不存在进行中的砍价,进详情页
public static final Integer NOT_EXIST_DOING_CUT = 0;
// 1:存在进行中的砍价,进我的砍价列表
public static final Integer EXIST_DOING_CUT = 1;
}
... ...
... ... @@ -87,6 +87,18 @@ public class CutDownProductPriceRest {
}
/**
* 列表页判断是否有进行的砍价,没有正在进行中的进详情页,有正在进行中的进我的砍价列表页
*/
@RequestMapping("/queryDoingCutPrice")
@ResponseBody
public Integer queryDoingCutPrice(@RequestBody CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
logger.info("CutDownProductPriceRest queryDoingCutPrice params is{}", cutPriceHelpUserRequestBO);
Integer result = cutDownPriceService.queryDoingCutPrice(cutPriceHelpUserRequestBO);
logger.info("CutDownProductPriceRest queryDoingCutPrice success params is{}, result is {}", cutPriceHelpUserRequestBO, result);
return result;
}
/**
* 好友帮忙砍价,并自动发起一个砍价
*/
@RequestMapping("/addCutPriceHelpUserInfo")
... ...
... ... @@ -18,6 +18,8 @@ public interface ICutDownPriceService {
CutDownPriceActivityProductBo queryCutProductInfo(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
Integer queryDoingCutPrice(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
CutDownPriceActivityProductBo queryCutProductInfoForOrder(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
BigDecimal addHelpUserInfo(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO);
... ...
... ... @@ -163,6 +163,39 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
}
@Override
public Integer queryDoingCutPrice(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
Integer activityId = cutPriceHelpUserRequestBO.getActivityId();
Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
Integer userId = cutPriceHelpUserRequestBO.getUserId();
// 查询活动信息
CutDownPriceActivityBo activityBo = cutDownActivityService.queryActivityInfo(activityId);
checkValidActivity(activityBo, activityId);
// 查询商品配置信息
CutDownPriceProductBo cutDownPriceProductBo = cutDownPriceProductService.queryCutDownPriceProductBo(activityId, productSkn);
if(cutDownPriceProductBo==null){
logger.warn(" the cutdown product not exist, activityId is {}, productSkn is {}", activityId, productSkn);
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_PRODUCT_NOTEXIST_ERROR);
}
Integer result = CutPriceConstant.NOT_EXIST_DOING_CUT;
// 组装信息
CutDownPriceActivityProductBo bo = buildCutDownPriceActivityProductBo(activityBo, cutDownPriceProductBo, null, null);
CutDownPriceUserRecord record = cutDownPriceUserRecordMapper.selectCutDownPriceUserRecord(userId, cutPriceHelpUserRequestBO.getActivityId(), cutPriceHelpUserRequestBO.getProductSkn());
if(record!=null){
bo.setCanUseCount(record.getUseCount());
bo.setHasJoinNum(record.getHelpCount());
bo.setCreateTime(record.getCreateTime());
buildCutStatus(bo);
if(bo.getCutStatus()==CutPriceConstant.CUT_STATUS_EXPIRE){
result = CutPriceConstant.NOT_EXIST_DOING_CUT;
}else if(bo.getCutStatus()==CutPriceConstant.CUT_STATUS_ONGOING || bo.getCutStatus()==CutPriceConstant.CUT_STATUS_SUCCESS){
result = CutPriceConstant.EXIST_DOING_CUT;
}
}
return result;
}
@Override
public CutDownPriceActivityProductBo queryCutProductInfoForOrder(CutPriceHelpUserRequestBO cutPriceHelpUserRequestBO) {
Integer activityId = cutPriceHelpUserRequestBO.getActivityId();
Integer productSkn = cutPriceHelpUserRequestBO.getProductSkn();
... ...
... ... @@ -47,6 +47,7 @@
<value>/addCutPriceUseRecord</value>
<value>/cancelCutPriceUseRecord</value>
<value>/queryEffectCutPriceActivity</value>
<value>/queryDoingCutPrice</value>
</list>
</property>
<property name="excludeMethods">
... ...