From d1dccd08a249b830a95eeeb04af25f87d5c056be Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 03 九月 2019 11:13:04 +0800 Subject: [PATCH] 金币明细bug --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java | 101 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 66 insertions(+), 35 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java index 73ead00..6cc4ccc 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java @@ -32,15 +32,17 @@ 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.entity.integral.IntegralTask.TaskUniqueKeyEnum; import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum; import com.yeshi.fanli.entity.integral.IntegralTaskRecord; import com.yeshi.fanli.exception.integral.IntegralExchangeException; -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; @@ -104,6 +106,9 @@ @Resource private IntegralGetService integralGetService; + @Resource + private JumpDetailV2Service jumpDetailV2Service; + /** * 鑾峰彇浠诲姟鍒楄〃 * @@ -112,7 +117,7 @@ * @param page * @param out */ -// @RequestSerializableByKey(key="#acceptData.device") + // @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) { @@ -180,6 +185,19 @@ } for (IntegralTaskClassVO taskClassVO : list) { + UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey(); + + // 閭�璇峰ソ鍙嬶細鏄惁婵�娲婚個璇风爜 + if (uniqueKey == UniqueKeyEnum.inviteTeam) { + 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; @@ -188,7 +206,6 @@ if (taskNum == null) continue; - UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey(); if (uniqueKey == UniqueKeyEnum.dailySign) { if (signState == 0) { taskClassVO.setLightUp(true); // 绛惧埌澶辫触 @@ -216,8 +233,9 @@ taskClassVO.setLightUp(true); } - Integer dateType = 1; // 鏌ヨ褰撴棩 - if (uniqueKey == UniqueKeyEnum.orderReward) + // 鏌ヨ褰撴棩 + Integer dateType = 1; + if (uniqueKey == UniqueKeyEnum.orderReward || uniqueKey == UniqueKeyEnum.accountMaintain) dateType = null; // 鏌ヨ鍘嗗彶 Long id = taskClassVO.getId(); @@ -397,7 +415,6 @@ GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); Gson gson = gsonBuilder.create(); - JSONObject data = new JSONObject(); data.put("result", gson.toJson(exchange)); out.print(JsonUtil.loadTrueResult(data)); @@ -405,7 +422,6 @@ out.print(JsonUtil.loadFalseResult(1, e.getMsg())); } } - /** * 鍏戞崲閲戝竵 @@ -421,13 +437,13 @@ 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("userGoldCoin", extraVO.getGoldCoin()); + data.put("goldCoin", extraVO.getGoldCoin() + "鏋�"); out.print(JsonUtil.loadTrueResult(data)); } catch (IntegralExchangeException e) { out.print(JsonUtil.loadFalseResult(1, e.getMsg())); @@ -492,7 +508,7 @@ out.print(JsonUtil.loadFalseResult(1, "椤电爜涓嶆纭�")); return; } - + try { List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE); @@ -522,7 +538,7 @@ * @param out */ @RequestMapping(value = "pushEvent", method = RequestMethod.POST) - public void pushEvent(AcceptData acceptData, String event, Long uid, PrintWriter out) { + public void pushEvent(AcceptData acceptData, String event, Long uid, String data, PrintWriter out) { if (uid == null || uid == 0) { out.print(JsonUtil.loadFalseResult("鐢ㄦ埛灏氭湭鐧诲綍")); return; @@ -533,34 +549,49 @@ return; } IntegralTaskRecord record = null; - try { - record = integralGetService.addEventStatistic(uid, event, null); - } catch (IntegralGetException e) { - } - if (record == null) { - out.print(JsonUtil.loadFalseResult("娣诲姞澶辫触")); - return; + + if (TaskUniqueKeyEnum.recommendSearch.name().equalsIgnoreCase(event)) { + record = integralGetService.addRecommendSearch(uid); + } else if (TaskUniqueKeyEnum.shareInvite.name().equalsIgnoreCase(event)) { + record = integralGetService.addShareInvite(uid); + } else if (TaskUniqueKeyEnum.inShop.name().equalsIgnoreCase(event)) { + JSONObject json = JSONObject.fromObject(data); + record = integralGetService.addIntoShop(uid, StringUtil.Md5(json.optString("url"))); + } else if (TaskUniqueKeyEnum.scanPush.name().equalsIgnoreCase(event)) { + record = integralGetService.addScanPushHistory(uid); + } else if (TaskUniqueKeyEnum.scanGoods.name().equalsIgnoreCase(event)) { + JSONObject json = JSONObject.fromObject(data); + record = integralGetService.addScanGoodsDetail(uid, json.optInt("goodsType"), json.optLong("goodsId")); + } else if (TaskUniqueKeyEnum.scanHomeBanner.name().equalsIgnoreCase(event)) { + JSONObject json = JSONObject.fromObject(data); + record = integralGetService.addScanRecommendBanner(uid, json.optString("id")); + } else if (TaskUniqueKeyEnum.scanSpecial.name().equalsIgnoreCase(event)) { + JSONObject json = JSONObject.fromObject(data); + record = integralGetService.addScanRecommendSpecial(uid, json.optString("id")); + } else if (TaskUniqueKeyEnum.scanTBCart.name().equalsIgnoreCase(event)) { + record = integralGetService.addScanTaoBaoCart(uid); } - JSONObject data = new JSONObject(); - if ("recommendSearch".equalsIgnoreCase(event) || "scanGoods".equalsIgnoreCase(event) - || "scanTBCart".equalsIgnoreCase(event)) { - JSONObject notify = new JSONObject(); - switch (event) { - case "recommendSearch": - notify.put("name", "瀹屾垚涓�娆℃櫤鑳芥悳绱�"); - break; - case "scanGoods": - notify.put("name", "瀹屾垚涓�娆″晢鍝佹祻瑙�"); - break; - case "scanTBCart": - notify.put("name", "瀹屾垚涓�娆¤喘鐗╄溅娴忚"); - break; + if (record != null) { + JSONObject notifyData = new JSONObject(); + if (TaskUniqueKeyEnum.recommendSearch.name().equalsIgnoreCase(event) + || TaskUniqueKeyEnum.scanGoods.name().equalsIgnoreCase(event) + || TaskUniqueKeyEnum.scanTBCart.name().equalsIgnoreCase(event)) { + JSONObject notify = new JSONObject(); + if (TaskUniqueKeyEnum.recommendSearch.name().equalsIgnoreCase(event)) + notify.put("name", "瀹屾垚涓�娆℃櫤鑳芥悳绱�"); + else if (TaskUniqueKeyEnum.scanGoods.name().equalsIgnoreCase(event)) + notify.put("name", "瀹屾垚涓�娆″晢鍝佹祻瑙�"); + else if (TaskUniqueKeyEnum.scanTBCart.name().equalsIgnoreCase(event)) + notify.put("name", "瀹屾垚涓�娆¤喘鐗╄溅娴忚"); + + notify.put("score", String.format("+%s閲戝竵", record.getGoldCoin())); + notifyData.put("notify", notify); } - notify.put("score", String.format("+%s閲戝竵", record.getGoldCoin())); - data.put("notify", notify); + out.print(JsonUtil.loadTrueResult(notifyData)); + } else { + out.print(JsonUtil.loadFalseResult("")); } - out.print(JsonUtil.loadTrueResult(data)); } /** -- Gitblit v1.8.0