| | |
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | | import com.yeshi.fanli.entity.integral.IntegralExchange;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
|
| | | import com.yeshi.fanli.exception.integral.IntegralExchangeException;
|
| | |
| | | list = new ArrayList<IntegralTaskClassVO>();
|
| | | }
|
| | | long count = integralTaskClassService.countTaskClass();
|
| | |
|
| | | |
| | | // 用户签到
|
| | | Integer signState = 0;
|
| | | if (page == 1) {
|
| | | |
| | | // 签到
|
| | | try { |
| | | signState = integralTaskClassService.finishedDailySign(uid);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid);
|
| | | if (extraVO == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户相关信息不存在"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "用户等级不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | boolean signState = false;
|
| | | IntegralTaskClass taskClass = integralTaskClassService.getByUniqueKey(UniqueKeyEnum.dailySign.name());
|
| | | if (taskClass != null)
|
| | | signState = integralTaskRecordService.isToDaySign(uid, taskClass.getId());
|
| | |
|
| | | // 签到日期
|
| | | |
| | | // 签到日期信息
|
| | | DailySignVO dailySignVO = integralTaskClassService.getDailySignList(uid, userRank.getId());
|
| | | data.put("signState", signState);
|
| | |
|
| | | boolean ejectSign = false;
|
| | | if (signState == 1) |
| | | ejectSign = true;
|
| | |
|
| | | data.put("signState", ejectSign);
|
| | | data.put("goldCoin", extraVO.getGoldCoin());
|
| | | data.put("portrait", userInfo.getPortrait());
|
| | | data.put("userRank", gson.toJson(userRank));
|
| | | data.put("dailySign", dailySignVO);
|
| | | }
|
| | |
|
| | | |
| | | for (IntegralTaskClassVO taskClassVO : list) {
|
| | | String progress = taskClassVO.getProgress();
|
| | | if (StringUtil.isNullOrEmpty(progress))
|
| | | continue;
|
| | | |
| | | Integer taskNum = taskClassVO.getTaskNum();
|
| | | if (taskNum == null)
|
| | | continue;
|
| | |
|
| | | UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey();
|
| | | if (uniqueKey == UniqueKeyEnum.dailySign) {
|
| | | if (signState == 0) {
|
| | | taskClassVO.setLightUp(true); // 签到失败
|
| | | } else if (signState == 1) {
|
| | | taskClassVO.setLightUp(false);
|
| | | } else if (signState == 2) {
|
| | | taskClassVO.setLightUp(false);
|
| | | }
|
| | | } else {
|
| | | taskClassVO.setLightUp(true);
|
| | | }
|
| | | |
| | | Integer dateType = 1; // 查询当日
|
| | | if (uniqueKey == UniqueKeyEnum.orderReward)
|
| | | dateType = null; // 查询历史
|
| | |
|
| | | Long id = taskClassVO.getId();
|
| | | int countFinished = 0;
|
| | | Integer totalGoldCoin = integralTaskRecordService.getTotalGoldCoin(uid, id, dateType);
|
| | | if (totalGoldCoin != null && totalGoldCoin > 0) {
|
| | | taskClassVO.setFinishedCoin("+" + totalGoldCoin);
|
| | | if (uniqueKey != UniqueKeyEnum.dailySign)
|
| | | countFinished = integralTaskRecordService.countFinished(uid, id, dateType);
|
| | | }
|
| | | progress = progress.replace("{已完成}", countFinished + "").replace("{总任务}", taskNum + "");
|
| | | |
| | | if (signState == 0 && uniqueKey == UniqueKeyEnum.dailySign) {
|
| | | progress = "未签到";
|
| | | taskClassVO.setBtnName("签到");
|
| | | } |
| | | taskClassVO.setProgress(progress);
|
| | | }
|
| | | |
| | | data.put("count", count);
|
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|