| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | | import com.yeshi.fanli.entity.integral.IntegralExchange;
|
| | | import com.yeshi.fanli.entity.integral.IntegralTask;
|
| | |
| | | import com.yeshi.fanli.exception.integral.IntegralGetException;
|
| | | import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.integral.CodePublishRecordService;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralDetailService;
|
| | |
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | /**
|
| | | * 获取任务列表
|
| | | *
|
| | |
| | | * @param page
|
| | | * @param out
|
| | | */
|
| | | // @RequestSerializableByKey(key="#acceptData.device")
|
| | | @RequestMapping(value = "getTaskList", method = RequestMethod.POST)
|
| | | public void getTaskList(AcceptData acceptData, Long uid, Integer page, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | |
| | |
|
| | | // 用户签到
|
| | | Integer signState = 0;
|
| | | int signDays = 1;
|
| | | if (page == 1) {
|
| | |
|
| | | // 签到
|
| | |
| | |
|
| | | // 签到日期信息
|
| | | DailySignVO dailySignVO = integralTaskClassService.getDailySignList(uid, userRank.getId());
|
| | | if (dailySignVO != null) {
|
| | | signDays = dailySignVO.getDays();
|
| | | }
|
| | |
|
| | | boolean ejectSign = false;
|
| | | if (signState == 1)
|
| | |
| | | }
|
| | |
|
| | | for (IntegralTaskClassVO taskClassVO : list) {
|
| | | UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey();
|
| | |
|
| | | UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid);
|
| | | if (extraVO == null || StringUtil.isNullOrEmpty(extraVO.getInviteCode())) {
|
| | | JumpDetailV2 jumpDetailV2 = jumpDetailV2Service.getByTypeCache("invite_activate",
|
| | | Constant.getPlatformCode(acceptData.getPlatform()),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | taskClassVO.setJumpDetail(jumpDetailV2);
|
| | | }
|
| | |
|
| | | String progress = taskClassVO.getProgress();
|
| | | if (StringUtil.isNullOrEmpty(progress))
|
| | | continue;
|
| | |
| | | if (taskNum == null)
|
| | | continue;
|
| | |
|
| | | UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey();
|
| | | if (uniqueKey == UniqueKeyEnum.dailySign) {
|
| | | if (signState == 0) {
|
| | | taskClassVO.setLightUp(true); // 签到失败
|
| | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", gson.toJson(exchange));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | try {
|
| | | IntegralExchange exchange = integralExchangeService.exchange(uid, id);
|
| | |
|
| | | UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", gson.toJson(exchange));
|
| | | data.put("goldCoin", extraVO.getGoldCoin() + "枚");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralExchangeException e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | |
| | | @RequestMapping(value = "exchangeInviteCode", method = RequestMethod.POST)
|
| | | public void exchangeInviteCode(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | try {
|
| | | integralExchangeService.exchangeInviteCode(uid, id);
|
| | | out.print(JsonUtil.loadTrueResult("邀请码激活成功"));
|
| | | String inviteCode = integralExchangeService.exchangeInviteCode(uid, id);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("msg", "兑换成功,金币已消耗 ");
|
| | | data.put("inviteCode", inviteCode);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralExchangeException e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE,
|
| | | Constant.PAGE_SIZE);
|
| | | if (list == null) {
|
| | | list = new ArrayList<CodePublishRecord>();
|
| | | try {
|
| | | List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE,
|
| | | Constant.PAGE_SIZE);
|
| | | if (list == null) {
|
| | | list = new ArrayList<CodePublishRecord>();
|
| | | }
|
| | |
|
| | | long count = codePublishRecordService.countValid();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", getGson().toJson(list));
|
| | | data.put("helpLink", configService.get("publish_list_help_link"));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "获取失败"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = codePublishRecordService.countValid();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", getGson().toJson(list));
|
| | | data.put("helpLink", configService.get("publish_list_help_link"));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | | IntegralTaskRecord record = null;
|
| | | try {
|
| | | record = integralGetService.addEventStatistic(uid, event, null);
|
| | | record = integralGetService.addEventStatistic(uid, event);
|
| | | } catch (IntegralGetException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (record == null) {
|
| | | out.print(JsonUtil.loadFalseResult("添加失败"));
|