Authored by wangshusheng

砍价成功

... ... @@ -26,4 +26,5 @@ public interface CutDownPriceUserRecordMapper {
int updateIncreaseUseCount(@Param("userId") Integer userId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId);
int updateCutSuccess(@Param("id") Integer id);
}
... ...
... ... @@ -97,4 +97,11 @@
and id = #{cutRecordId,jdbcType=INTEGER}
and use_count=0
</update>
<update id="updateCutSuccess" >
update cutdown_price_user_record
set status=1, update_time= UNIX_TIMESTAMP()
where 1=1
and id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -2,6 +2,8 @@ package com.yoho.activity.queue.constant;
public class CutPriceConstant {
// 1:未发起砍价
public static final Integer CUT_STATUS_NOT_CREATE = 0;
// 1:砍价中
public static final Integer CUT_STATUS_ONGOING = 1;
// 2:已成功
... ...
... ... @@ -430,6 +430,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
clearCache(activityId, productSkn, userId, recordDb.getId());
// 砍价成功时,给用户推送砍价成功消息
if(helpUsers!=null && (helpUsers.size()+1) == cutDownPriceProductBo.getJoinNum()){
// 修改砍价成功状态
cutDownPriceUserRecordMapper.updateCutSuccess(recordDb.getId());
// 给用户推送砍价成功消息
pushSuccessMessage(userId, activityBo, cutDownPriceProductBo);
}
... ... @@ -763,29 +766,34 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
// 活动已结束
bo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE);
}else{
// 活动进行中
// 砍价成功、失败
if(bo.getHasJoinNum() > bo.getJoinNum()){
// 砍价已成功
// 是否24小时内下单
if(bo.getCanUseCount()>0 && bo.getCutTime()!=null && (currentTime - bo.getCutTime()>TIME_24_HOUR)){//标识未下单
// 活动进行中,是否已经发起砍价
if(null!=bo.getCreateTime()){
// 砍价成功、失败
if(bo.getHasJoinNum() > bo.getJoinNum()){
// 砍价已成功
// 是否24小时内下单
if(bo.getCanUseCount()>0 && bo.getCutTime()!=null && (currentTime - bo.getCutTime()>TIME_24_HOUR)){//标识未下单
bo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE);
}else{
bo.setCutStatus(CutPriceConstant.CUT_STATUS_SUCCESS);
}
}else if(currentTime - bo.getCreateTime()>TIME_24_HOUR){
// 砍价未成功,发起已超过24小时,已失效
bo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE);
}else{
bo.setCutStatus(CutPriceConstant.CUT_STATUS_SUCCESS);
// 未成功,发起24小时内,砍价中
bo.setCutStatus(CutPriceConstant.CUT_STATUS_ONGOING);
// 砍价截止时间,发起砍价后24小时,或者活动截止时间
if(bo.getCreateTime()+TIME_24_HOUR > bo.getEndTime()){
bo.setCutEndTime(bo.getEndTime());
}else{
bo.setCutEndTime(bo.getCreateTime()+TIME_24_HOUR);
}
}
}else if(currentTime - bo.getCreateTime()>TIME_24_HOUR){
// 砍价未成功,发起已超过24小时,已失效
bo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE);
}else{
// 未成功,发起24小时内,砍价中
bo.setCutStatus(CutPriceConstant.CUT_STATUS_ONGOING);
// 砍价截止时间,发起砍价后24小时,或者活动截止时间
if(bo.getCreateTime()+TIME_24_HOUR > bo.getEndTime()){
bo.setCutEndTime(bo.getEndTime());
}else{
bo.setCutEndTime(bo.getCreateTime()+TIME_24_HOUR);
}
bo.setCutStatus(CutPriceConstant.CUT_STATUS_NOT_CREATE);
}
}
}
... ...