Authored by wangshusheng

修改

@@ -11,7 +11,7 @@ public interface CutDownPriceUserHelpMapper { @@ -11,7 +11,7 @@ public interface CutDownPriceUserHelpMapper {
11 11
12 void addHelpUserInfo(CutDownPriceProductHelpUser helpUser); 12 void addHelpUserInfo(CutDownPriceProductHelpUser helpUser);
13 13
14 - Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId); 14 + Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("startTime") Integer startTime);
15 15
16 List<CutDownPriceProductHelpUser> selectHelpInfoList(@Param("list") List<CutPriceHelpUserRequestBO> requestList); 16 List<CutDownPriceProductHelpUser> selectHelpInfoList(@Param("list") List<CutPriceHelpUserRequestBO> requestList);
17 17
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 where help_user_id = #{helpUserId,jdbcType=INTEGER} 41 where help_user_id = #{helpUserId,jdbcType=INTEGER}
42 AND activity_id = #{activityId,jdbcType=INTEGER} 42 AND activity_id = #{activityId,jdbcType=INTEGER}
43 AND product_skn = #{productSkn,jdbcType=INTEGER} 43 AND product_skn = #{productSkn,jdbcType=INTEGER}
44 - AND cut_record_id = #{cutRecordId,jdbcType=INTEGER} 44 + and create_time &gt;= #{startTime,jdbcType=INTEGER}
45 </select> 45 </select>
46 46
47 <select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List"> 47 <select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List">
@@ -50,7 +50,7 @@ import java.util.stream.Collectors; @@ -50,7 +50,7 @@ import java.util.stream.Collectors;
50 public class CutDownPriceServiceImpl implements ICutDownPriceService { 50 public class CutDownPriceServiceImpl implements ICutDownPriceService {
51 private static Logger logger = LoggerFactory.getLogger("cutPriceLog"); 51 private static Logger logger = LoggerFactory.getLogger("cutPriceLog");
52 private static final Integer SYSTEM_HELP_ID = 0; 52 private static final Integer SYSTEM_HELP_ID = 0;
53 - private static final Integer MAX_HELP_COUNT = 300; 53 + private static final Integer MAX_HELP_COUNT = 30;
54 private static final Integer TIME_24_HOUR = 24*3600; 54 private static final Integer TIME_24_HOUR = 24*3600;
55 55
56 private static final String SYSTEM_HELP_NAME = "有货"; 56 private static final String SYSTEM_HELP_NAME = "有货";
@@ -350,10 +350,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -350,10 +350,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
350 String userImgUrl = cutPriceHelpUserRequestBO.getUserImgUrl(); 350 String userImgUrl = cutPriceHelpUserRequestBO.getUserImgUrl();
351 String helpUserName = cutPriceHelpUserRequestBO.getHelpUserName(); 351 String helpUserName = cutPriceHelpUserRequestBO.getHelpUserName();
352 String helpUserImgUrl = cutPriceHelpUserRequestBO.getHelpUserImgUrl(); 352 String helpUserImgUrl = cutPriceHelpUserRequestBO.getHelpUserImgUrl();
353 - 353 + int startTime = DateUtils.getTodayZero();
354 // 每位用户每天最多可以帮好友砍3次价 354 // 每位用户每天最多可以帮好友砍3次价
355 if(!SYSTEM_HELP_ID.equals(helpUserId)){ 355 if(!SYSTEM_HELP_ID.equals(helpUserId)){
356 - int startTime = DateUtils.getTodayZero();  
357 int endTime = DateUtils.getTodayEnd(); 356 int endTime = DateUtils.getTodayEnd();
358 List<CutDownPriceProductHelpUser> existHelpUsers = cutPriceUserHelpMapper.selectHelpInfoListCurrentDay(helpUserId, startTime, endTime); 357 List<CutDownPriceProductHelpUser> existHelpUsers = cutPriceUserHelpMapper.selectHelpInfoListCurrentDay(helpUserId, startTime, endTime);
359 if(CollectionUtils.isNotEmpty(existHelpUsers) && existHelpUsers.size() >= MAX_HELP_COUNT){ 358 if(CollectionUtils.isNotEmpty(existHelpUsers) && existHelpUsers.size() >= MAX_HELP_COUNT){
@@ -383,9 +382,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { @@ -383,9 +382,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
383 throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_HAS_HELPED_FULL_ERROR); 382 throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_HAS_HELPED_FULL_ERROR);
384 } 383 }
385 384
386 - //判断用户是否已经针对该skn帮助砍价 385 + //判断用户是否已经针对该skn帮助砍价,当天24小时内只能帮砍一次
387 if(!SYSTEM_HELP_ID.equals(helpUserId)){ 386 if(!SYSTEM_HELP_ID.equals(helpUserId)){
388 - Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, recordDb.getId()); 387 + Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, startTime);
389 if (count>0){ 388 if (count>0){
390 logger.warn(" you have help only one time, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId); 389 logger.warn(" you have help only one time, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId);
391 throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_ERROR); 390 throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_ERROR);