Authored by wangshusheng

增加错误场景

... ... @@ -11,7 +11,9 @@ public interface CutDownPriceUserHelpMapper {
void addHelpUserInfo(CutDownPriceProductHelpUser helpUser);
Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("startTime") Integer startTime);
Integer selectExistHelpInfoCurrentDay(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("startTime") Integer startTime);
Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId);
List<CutDownPriceProductHelpUser> selectHelpInfoList(@Param("list") List<CutPriceHelpUserRequestBO> requestList);
... ...
... ... @@ -36,7 +36,7 @@
)
</insert>
<select id="selectExistHelpInfo" resultType="java.lang.Integer">
<select id="selectExistHelpInfoCurrentDay" resultType="java.lang.Integer">
select count(1) FROM cutdown_price_help_user
where help_user_id = #{helpUserId,jdbcType=INTEGER}
AND activity_id = #{activityId,jdbcType=INTEGER}
... ... @@ -44,6 +44,14 @@
and create_time &gt;= #{startTime,jdbcType=INTEGER}
</select>
<select id="selectExistHelpInfo" resultType="java.lang.Integer">
select count(1) FROM cutdown_price_help_user
where help_user_id = #{helpUserId,jdbcType=INTEGER}
AND activity_id = #{activityId,jdbcType=INTEGER}
AND product_skn = #{productSkn,jdbcType=INTEGER}
and cut_record_id = #{cutRecordId,jdbcType=INTEGER}
</select>
<select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List">
select
<include refid="Base_Column_List" />
... ...
... ... @@ -382,15 +382,24 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_HAS_HELPED_FULL_ERROR);
}
//判断用户是否已经针对该skn帮助砍价,当天24小时内只能帮砍一次
//判断用户是否已经针对该次分享帮助砍价
if(!SYSTEM_HELP_ID.equals(helpUserId)){
Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, startTime);
Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, recordDb.getId());
if (count>0){
logger.warn(" you have help only one time, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId);
logger.warn(" you have help one time for this share, activityId is {}, productSkn is {}, helpUserId is {}, recordId is {}", activityId, productSkn, helpUserId, recordDb.getId());
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_ERROR);
}
}
//判断用户是否已经针对该skn帮助砍价,当天24小时内只能帮砍一次
if(!SYSTEM_HELP_ID.equals(helpUserId)){
Integer count = cutPriceUserHelpMapper.selectExistHelpInfoCurrentDay(helpUserId, activityId, productSkn, startTime);
if (count>0){
logger.warn(" you have help one time today, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId);
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_SKN_ERROR);
}
}
// 查询已砍的价格
List<CutDownPriceProductHelpUser> helpUsers = cutPriceUserHelpMapper.selectHelpInfo(userId, activityId, productSkn, recordDb.getId());
... ...