| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.integral.IntegralTaskRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.integral.IntegralDetail;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralTaskService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | | |
| | | @Resource
|
| | | private IntegralTaskService integralTaskService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public Integer getTotalGoldCoin(long uid, Long cid, Integer dateType) {
|
| | |
| | | if (userInfoExtra == null)
|
| | | throw new IntegralTaskRecordException(1, "用户信息不全");
|
| | |
|
| | | int totalGoldCoin = integralTaskRecordMapper.countTotalGoldCoin(uid);
|
| | | if (totalGoldCoin > 0) {
|
| | | integralTaskRecordMapper.updateReceived(uid);
|
| | | |
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listNotReceived(Integer.MAX_VALUE, uid);
|
| | | if (list == null || list.size() == 0) |
| | | throw new IntegralTaskRecordException(1, "暂无可领取");
|
| | | |
| | | |
| | | Integer totalGoldCoin = 0;
|
| | | for (IntegralTaskRecord record : list) {
|
| | | Long uid2 = record.getUid();
|
| | | if (uid2 == null || uid.longValue() != uid2.longValue())
|
| | | continue; // 用户id不符合
|
| | |
|
| | | if (record.getState() != null && record.getState().intValue() == 1) {
|
| | | continue; // 已领取
|
| | | }
|
| | |
|
| | | IntegralTaskRecord taskRecord = new IntegralTaskRecord();
|
| | | taskRecord.setId(record.getId());
|
| | | taskRecord.setState(1); // 已领取
|
| | | taskRecord.setUpdateTime(new Date());
|
| | | integralTaskRecordMapper.updateByPrimaryKeySelective(taskRecord);
|
| | |
|
| | | |
| | | Long taskId = record.getTaskId();
|
| | | if (taskId == null) |
| | | continue;
|
| | | |
| | | |
| | | IntegralTask integralTask = integralTaskService.selectByPrimaryKey(taskId);
|
| | | if (integralTask == null)
|
| | | continue;
|
| | | |
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setUid(uid);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(record.getGoldCoin());
|
| | | detail.setTitle(integralTask.getName());
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | totalGoldCoin += record.getGoldCoin();
|
| | | }
|
| | |
|
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | |
| | | taskRecord.setUpdateTime(new Date());
|
| | | integralTaskRecordMapper.updateByPrimaryKeySelective(taskRecord);
|
| | |
|
| | | |
| | | Long taskId = record.getTaskId();
|
| | | if (taskId == null) |
| | | continue;
|
| | | |
| | | |
| | | IntegralTask integralTask = integralTaskService.selectByPrimaryKey(taskId);
|
| | | if (integralTask == null)
|
| | | continue;
|
| | | |
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setUid(uid);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(record.getGoldCoin());
|
| | | detail.setTitle(integralTask.getName());
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | totalGoldCoin += record.getGoldCoin();
|
| | | }
|
| | |
|