Authored by wangshusheng

砍价成功

@@ -26,4 +26,5 @@ public interface CutDownPriceUserRecordMapper { @@ -26,4 +26,5 @@ public interface CutDownPriceUserRecordMapper {
26 26
27 int updateIncreaseUseCount(@Param("userId") Integer userId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId); 27 int updateIncreaseUseCount(@Param("userId") Integer userId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId);
28 28
  29 + int updateCutSuccess(@Param("id") Integer id);
29 } 30 }
@@ -97,4 +97,11 @@ @@ -97,4 +97,11 @@
97 and id = #{cutRecordId,jdbcType=INTEGER} 97 and id = #{cutRecordId,jdbcType=INTEGER}
98 and use_count=0 98 and use_count=0
99 </update> 99 </update>
  100 +
  101 + <update id="updateCutSuccess" >
  102 + update cutdown_price_user_record
  103 + set status=1, update_time= UNIX_TIMESTAMP()
  104 + where 1=1
  105 + and id = #{id,jdbcType=INTEGER}
  106 + </update>
100 </mapper> 107 </mapper>
@@ -2,6 +2,8 @@ package com.yoho.activity.queue.constant; @@ -2,6 +2,8 @@ package com.yoho.activity.queue.constant;
2 2
3 3
4 public class CutPriceConstant { 4 public class CutPriceConstant {
  5 + // 1:未发起砍价
  6 + public static final Integer CUT_STATUS_NOT_CREATE = 0;
5 // 1:砍价中 7 // 1:砍价中
6 public static final Integer CUT_STATUS_ONGOING = 1; 8 public static final Integer CUT_STATUS_ONGOING = 1;
7 // 2:已成功 9 // 2:已成功
@@ -430,6 +430,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -430,6 +430,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
430 clearCache(activityId, productSkn, userId, recordDb.getId()); 430 clearCache(activityId, productSkn, userId, recordDb.getId());
431 // 砍价成功时,给用户推送砍价成功消息 431 // 砍价成功时,给用户推送砍价成功消息
432 if(helpUsers!=null && (helpUsers.size()+1) == cutDownPriceProductBo.getJoinNum()){ 432 if(helpUsers!=null && (helpUsers.size()+1) == cutDownPriceProductBo.getJoinNum()){
  433 + // 修改砍价成功状态
  434 + cutDownPriceUserRecordMapper.updateCutSuccess(recordDb.getId());
  435 + // 给用户推送砍价成功消息
433 pushSuccessMessage(userId, activityBo, cutDownPriceProductBo); 436 pushSuccessMessage(userId, activityBo, cutDownPriceProductBo);
434 } 437 }
435 438
@@ -763,7 +766,8 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -763,7 +766,8 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
763 // 活动已结束 766 // 活动已结束
764 bo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE); 767 bo.setCutStatus(CutPriceConstant.CUT_STATUS_EXPIRE);
765 }else{ 768 }else{
766 - // 活动进行中 769 + // 活动进行中,是否已经发起砍价
  770 + if(null!=bo.getCreateTime()){
767 // 砍价成功、失败 771 // 砍价成功、失败
768 if(bo.getHasJoinNum() > bo.getJoinNum()){ 772 if(bo.getHasJoinNum() > bo.getJoinNum()){
769 // 砍价已成功 773 // 砍价已成功
@@ -786,6 +790,10 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -786,6 +790,10 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
786 bo.setCutEndTime(bo.getCreateTime()+TIME_24_HOUR); 790 bo.setCutEndTime(bo.getCreateTime()+TIME_24_HOUR);
787 } 791 }
788 } 792 }
  793 + }else{
  794 + bo.setCutStatus(CutPriceConstant.CUT_STATUS_NOT_CREATE);
  795 + }
  796 +
789 } 797 }
790 } 798 }
791 799