| @@ -141,20 +141,12 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||||
| return new ResultData(ErrorCode.ACTIVITY_JOINED); | return new ResultData(ErrorCode.ACTIVITY_JOINED); | ||||
| } | } | ||||
| WxCUser user = wxCUserMapper.selectByPrimaryKey(wxActivityJoin.getUserId()); | WxCUser user = wxCUserMapper.selectByPrimaryKey(wxActivityJoin.getUserId()); | ||||
| //保存到报名表中 | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxActivityJoin.setId(idWorker.nextId()); | |||||
| wxActivityJoin.setPhone(user.getPhone()); | |||||
| Date date = new Date(); | |||||
| wxActivityJoin.setCreateTime(date); | |||||
| wxActivityJoin.setUpdateTime(date); | |||||
| wxActivityJoinMapper.insertSelective(wxActivityJoin); | |||||
| //查询是否消耗积分 | //查询是否消耗积分 | ||||
| WxActivity wxActivity = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | WxActivity wxActivity = wxActivityMapper.selectByPrimaryKey(wxActivityJoin.getActivityId()); | ||||
| if (wxActivity.getUseCredit().equals(EnumActivityUseCreditStatus.YES.getCode())) { | if (wxActivity.getUseCredit().equals(EnumActivityUseCreditStatus.YES.getCode())) { | ||||
| Integer userCredit = user.getCredit(); | Integer userCredit = user.getCredit(); | ||||
| Integer credit = wxActivity.getCredit(); | Integer credit = wxActivity.getCredit(); | ||||
| Map<String, Object> data = new HashMap<>(); | |||||
| Map<String, Object> data = new HashMap<>(2); | |||||
| if (credit > userCredit) { | if (credit > userCredit) { | ||||
| data.put("useCredit", credit); | data.put("useCredit", credit); | ||||
| data.put("totalCredit", userCredit); | data.put("totalCredit", userCredit); | ||||
| @@ -165,8 +157,15 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||||
| wxCUserMapper.updateByPrimaryKeySelective(user); | wxCUserMapper.updateByPrimaryKeySelective(user); | ||||
| data.put("useCredit", credit); | data.put("useCredit", credit); | ||||
| data.put("totalCredit", userCredit); | data.put("totalCredit", userCredit); | ||||
| return new ResultData(data); | |||||
| } | } | ||||
| //保存到报名表中 | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxActivityJoin.setId(idWorker.nextId()); | |||||
| wxActivityJoin.setPhone(user.getPhone()); | |||||
| Date date = new Date(); | |||||
| wxActivityJoin.setCreateTime(date); | |||||
| wxActivityJoin.setUpdateTime(date); | |||||
| wxActivityJoinMapper.insertSelective(wxActivityJoin); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||