|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
import com.hai.dao.HighActivityUserLotteryNumMapper; |
|
|
|
import com.hai.dao.HighActivityUserLotteryNumMapper; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.enum_type.ActivityInfoStatus; |
|
|
|
import com.hai.enum_type.ActivityInfoStatus; |
|
|
@ -42,6 +43,9 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighDiscountUserRelService highDiscountUserRelService; |
|
|
|
private HighDiscountUserRelService highDiscountUserRelService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private SecConfigService secConfigService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class, |
|
|
|
@Transactional(rollbackFor = Exception.class, |
|
|
|
propagation= Propagation.REQUIRES_NEW, |
|
|
|
propagation= Propagation.REQUIRES_NEW, |
|
|
@ -110,6 +114,7 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void minusLotteryNum(Long activityId, Long userId) { |
|
|
|
public void minusLotteryNum(Long activityId, Long userId) { |
|
|
|
HighActivityUserLotteryNum detail = getDetail(activityId, userId); |
|
|
|
HighActivityUserLotteryNum detail = getDetail(activityId, userId); |
|
|
@ -133,9 +138,31 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Integer getLotteryNum(Long activityId, Long userId) { |
|
|
|
public Integer getLotteryNum(Long activityId, Long userId) { |
|
|
|
HighActivityUserLotteryNum detail = getDetail(activityId, userId); |
|
|
|
HighActivityUserLotteryNum detail = getDetail(activityId, userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// todo 临时代码 查询制定活动
|
|
|
|
|
|
|
|
SecConfig secConfig = secConfigService.findByCodeType(activityId.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否有不购买活动
|
|
|
|
|
|
|
|
if (secConfig != null) { |
|
|
|
|
|
|
|
// 判断是否活动为空
|
|
|
|
|
|
|
|
if (detail == null) { |
|
|
|
|
|
|
|
addLotteryNum(activityId , userId , 3); |
|
|
|
|
|
|
|
return 3; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (!DateUtil.isNow(detail.getUpdateTime())) { |
|
|
|
|
|
|
|
detail.setLotteryNum(3); |
|
|
|
|
|
|
|
detail.setUpdateTime(new Date()); |
|
|
|
|
|
|
|
highActivityUserLotteryNumMapper.updateByPrimaryKey(detail); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
if (detail == null) { |
|
|
|
if (detail == null) { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return detail.getLotteryNum(); |
|
|
|
return detail.getLotteryNum(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|