Commit f7e28cbd authored by hezhen's avatar hezhen

修改领取优惠卷

parent a6794c9d
...@@ -2,6 +2,8 @@ package com.xxfc.platform.activity.biz; ...@@ -2,6 +2,8 @@ package com.xxfc.platform.activity.biz;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.activity.entity.ActivityRule; import com.xxfc.platform.activity.entity.ActivityRule;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -53,11 +55,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -53,11 +55,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
} }
//领取优惠卷 //领取优惠卷
public void receiveCoupn(Integer userId) { public ObjectRestResponse receiveCoupn(Integer userId) {
ActivityRule rule = ruleBiz.getActity(); ActivityRule rule = ruleBiz.getActity();
if (rule == null) { if (rule == null) {
log.error("----没有开启的活动----"); log.error("----没有开启的活动----");
return; return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"没有开启的活动");
} }
Integer activityId = rule.getId(); Integer activityId = rule.getId();
ActivityUserJoin userJoin = new ActivityUserJoin(); ActivityUserJoin userJoin = new ActivityUserJoin();
...@@ -66,11 +68,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -66,11 +68,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
userJoin= selectOne(userJoin); userJoin= selectOne(userJoin);
if (userJoin == null ) { if (userJoin == null ) {
log.error("----用户没有此参与活动----userId====" + userId); log.error("----用户没有此参与活动----userId====" + userId);
return; return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"不是新用户,无法参与此活动");
} }
if(userJoin.getStatus()!=0){ if(userJoin.getStatus()!=0){
log.error("----用户已领取----userId====" + userId); log.error("----用户已领取----userId====" + userId);
return; return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"用户已领取");
} }
String value=rule.getValue(); String value=rule.getValue();
JSONObject json=JSONObject.parseObject(value); JSONObject json=JSONObject.parseObject(value);
...@@ -88,6 +90,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity ...@@ -88,6 +90,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
} }
userJoin.setStatus(1); userJoin.setStatus(1);
updateById(userJoin); updateById(userJoin);
return ObjectRestResponse.succ();
} }
......
...@@ -82,8 +82,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz> ...@@ -82,8 +82,7 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
if (userId == null) { if (userId == null) {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
joinBiz.receiveCoupn(userId); return joinBiz.receiveCoupn(userId);
return ObjectRestResponse.succ();
} }
......
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