Authored by wangshusheng

修改

... ... @@ -11,7 +11,7 @@ public interface CutDownPriceUserHelpMapper {
void addHelpUserInfo(CutDownPriceProductHelpUser helpUser);
Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("cutRecordId") Integer cutRecordId);
Integer selectExistHelpInfo(@Param("helpUserId") Integer helpUserId, @Param("activityId") Integer activityId, @Param("productSkn") Integer productSkn, @Param("startTime") Integer startTime);
List<CutDownPriceProductHelpUser> selectHelpInfoList(@Param("list") List<CutPriceHelpUserRequestBO> requestList);
... ...
... ... @@ -41,7 +41,7 @@
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}
and create_time &gt;= #{startTime,jdbcType=INTEGER}
</select>
<select id="selectHelpInfoList" resultMap="BaseResultMap" parameterType="java.util.List">
... ...
... ... @@ -50,7 +50,7 @@ import java.util.stream.Collectors;
public class CutDownPriceServiceImpl implements ICutDownPriceService {
private static Logger logger = LoggerFactory.getLogger("cutPriceLog");
private static final Integer SYSTEM_HELP_ID = 0;
private static final Integer MAX_HELP_COUNT = 300;
private static final Integer MAX_HELP_COUNT = 30;
private static final Integer TIME_24_HOUR = 24*3600;
private static final String SYSTEM_HELP_NAME = "有货";
... ... @@ -350,10 +350,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
String userImgUrl = cutPriceHelpUserRequestBO.getUserImgUrl();
String helpUserName = cutPriceHelpUserRequestBO.getHelpUserName();
String helpUserImgUrl = cutPriceHelpUserRequestBO.getHelpUserImgUrl();
int startTime = DateUtils.getTodayZero();
// 每位用户每天最多可以帮好友砍3次价
if(!SYSTEM_HELP_ID.equals(helpUserId)){
int startTime = DateUtils.getTodayZero();
int endTime = DateUtils.getTodayEnd();
List<CutDownPriceProductHelpUser> existHelpUsers = cutPriceUserHelpMapper.selectHelpInfoListCurrentDay(helpUserId, startTime, endTime);
if(CollectionUtils.isNotEmpty(existHelpUsers) && existHelpUsers.size() >= MAX_HELP_COUNT){
... ... @@ -383,9 +382,9 @@ public class CutDownPriceServiceImpl implements ICutDownPriceService {
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_HAS_HELPED_FULL_ERROR);
}
//判断用户是否已经针对该skn帮助砍价
//判断用户是否已经针对该skn帮助砍价,当天24小时内只能帮砍一次
if(!SYSTEM_HELP_ID.equals(helpUserId)){
Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, recordDb.getId());
Integer count = cutPriceUserHelpMapper.selectExistHelpInfo(helpUserId, activityId, productSkn, startTime);
if (count>0){
logger.warn(" you have help only one time, activityId is {}, productSkn is {}, helpUserId is {}", activityId, productSkn, helpUserId);
throw new ServiceException(ServiceError.ACTIVITY_CUTDOWNPRICE_YOU_HAS_HELPED_ERROR);
... ...