Showing
3 changed files
with
24 additions
and
5 deletions
@@ -11,7 +11,9 @@ public interface CutDownPriceUserHelpMapper { | @@ -11,7 +11,9 @@ 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("startTime") Integer startTime); | 14 | + Integer selectExistHelpInfoCurrentDay(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("startTime") Integer startTime); |
15 | + | ||
16 | + Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId); | ||
15 | 17 | ||
16 | List<CutDownPriceProductHelpUser> selectHelpInfoList(@Param("list") List<CutPriceHelpUserRequestBO> requestList); | 18 | List<CutDownPriceProductHelpUser> selectHelpInfoList(@Param("list") List<CutPriceHelpUserRequestBO> requestList); |
17 | 19 |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | ) | 36 | ) |
37 | </insert> | 37 | </insert> |
38 | 38 | ||
39 | - <select id="selectExistHelpInfo" resultType="java.lang.Integer"> | 39 | + <select id="selectExistHelpInfoCurrentDay" resultType="java.lang.Integer"> |
40 | select count(1) FROM cutdown_price_help_user | 40 | select count(1) FROM cutdown_price_help_user |
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} |
@@ -44,6 +44,14 @@ | @@ -44,6 +44,14 @@ | ||
44 | and create_time >= #{startTime,jdbcType=INTEGER} | 44 | and create_time >= #{startTime,jdbcType=INTEGER} |
45 | </select> | 45 | </select> |
46 | 46 | ||
47 | + <select id="selectExistHelpInfo" resultType="java.lang.Integer"> | ||
48 | + select count(1) FROM cutdown_price_help_user | ||
49 | + where help_user_id = #{helpUserId,jdbcType=INTEGER} | ||
50 | + AND activity_id = #{activityId,jdbcType=INTEGER} | ||
51 | + AND product_skn = #{productSkn,jdbcType=INTEGER} | ||
52 | + and cut_record_id = #{cutRecordId,jdbcType=INTEGER} | ||
53 | + </select> | ||
54 | + | ||
47 | <select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List"> | 55 | <select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List"> |
48 | select | 56 | select |
49 | <include refid="Base_Column_List" /> | 57 | <include refid="Base_Column_List" /> |
@@ -382,15 +382,24 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { | @@ -382,15 +382,24 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService { | ||
382 | throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_HAS_HELPED_FULL_ERROR); | 382 | throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_HAS_HELPED_FULL_ERROR); |
383 | } | 383 | } |
384 | 384 | ||
385 | - //判断用户是否已经针对该skn帮助砍价,当天24小时内只能帮砍一次 | 385 | + //判断用户是否已经针对该次分享帮助砍价 |
386 | if(!SYSTEM_HELP_ID.equals(helpUserId)){ | 386 | if(!SYSTEM_HELP_ID.equals(helpUserId)){ |
387 | - Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, startTime); | 387 | + Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, recordDb.getId()); |
388 | if (count>0){ | 388 | if (count>0){ |
389 | - logger.warn(" you have help only one time, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId); | 389 | + logger.warn(" you have help one time for this share, activityId is {}, productSkn is {}, helpUserId is {}, recordId is {}", activityId, productSkn, helpUserId, recordDb.getId()); |
390 | throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_ERROR); | 390 | throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_ERROR); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
394 | + //判断用户是否已经针对该skn帮助砍价,当天24小时内只能帮砍一次 | ||
395 | + if(!SYSTEM_HELP_ID.equals(helpUserId)){ | ||
396 | + Integer count = cutPriceUserHelpMapper.selectExistHelpInfoCurrentDay(helpUserId, activityId, productSkn, startTime); | ||
397 | + if (count>0){ | ||
398 | + logger.warn(" you have help one time today, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId); | ||
399 | + throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_SKN_ERROR); | ||
400 | + } | ||
401 | + } | ||
402 | + | ||
394 | // 查询已砍的价格 | 403 | // 查询已砍的价格 |
395 | List<CutDownPriceProductHelpUser> helpUsers = cutPriceUserHelpMapper.selectHelpInfo(userId, activityId, productSkn, recordDb.getId()); | 404 | List<CutDownPriceProductHelpUser> helpUsers = cutPriceUserHelpMapper.selectHelpInfo(userId, activityId, productSkn, recordDb.getId()); |
396 | 405 |
-
Please register or login to post a comment