Commit 102a2913 authored by hezhen's avatar hezhen

123

parent cabb1410
......@@ -93,6 +93,29 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
return ObjectRestResponse.succ();
}
//判断用户是否已领取或无法领取优惠卷
public ObjectRestResponse checkUserCoupon(Integer userId){
ActivityRule rule = ruleBiz.getActity();
if (rule == null) {
log.error("----没有开启的活动----");
return ObjectRestResponse.createFailedResult(101,"无有效活动");
}
Integer activityId = rule.getId();
ActivityUserJoin userJoin = new ActivityUserJoin();
userJoin.setActivityId(activityId);
userJoin.setUserId(userId);
userJoin= selectOne(userJoin);
if (userJoin == null ) {
log.error("----用户没有此参与活动----userId====" + userId);
return ObjectRestResponse.createFailedResult(102,"不是新用户,无法参与此活动");
}
if(userJoin.getStatus()!=0){
log.error("----用户已领取----userId====" + userId);
return ObjectRestResponse.createFailedResult(103,"用户已领取");
}
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
......@@ -85,6 +85,17 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
return joinBiz.receiveCoupn(userId);
}
@ApiOperation("检查用户是否可领取")
@RequestMapping(value = "/coupon/check", method = RequestMethod.GET)
public ObjectRestResponse check() {
AppUserDTO userInfo = getUserInfo();
Integer userId = userInfo.getUserid();
if (userId == null) {
return ObjectRestResponse.createDefaultFail();
}
return joinBiz.checkUserCoupon(userId);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment