From 2012b3b5db3c6b06535a68f775bcc81b16151b90 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 06 九月 2019 16:54:00 +0800 Subject: [PATCH] 加入任务 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java | 125 +++++++++++++++++++++++------------------ 1 files changed, 69 insertions(+), 56 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java index 7ae24ce..b684185 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java @@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.yeshi.utils.JsonUtil; +import com.fasterxml.jackson.core.util.VersionUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; @@ -240,7 +241,7 @@ if (todayUse == null || todayUse.compareTo(zero) > 0) { todayUse = zero; } - + BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2); if (yesterdayUse == null || yesterdayUse.compareTo(zero) > 0) { yesterdayUse = zero; @@ -253,13 +254,13 @@ if (lastMonthUse == null || lastMonthUse.compareTo(zero) > 0) { lastMonthUse = zero; } - + String giveMin = configTaoLiJinService.getValueByKey("give_min_amount"); - + JSONObject data = new JSONObject(); data.put("tlj", tlj.setScale(2).toString()); data.put("giveMin", giveMin); - data.put("giveTip", "娉�:璧犻�佹帹骞跨孩鍖呴噾棰濊嚦灏�"+ giveMin +"鍏�"); + data.put("giveTip", "娉�:璧犻�佹帹骞跨孩鍖呴噾棰濊嚦灏�" + giveMin + "鍏�"); data.put("helpLink", configTaoLiJinService.getValueByKey("hongbao_help_link")); data.put("countShare", countShare); data.put("todayWin", todayWin.setScale(2).toString()); @@ -399,7 +400,7 @@ // 宸查鍙� money = deviceRecord.getMoney(); } else { - String value = configTaoLiJinService.getValueByKey("hongbao_newbies"); + String value = configTaoLiJinService.getValueByKey("hongbao_newbies", null); if (StringUtil.isNullOrEmpty(value)) { out.print(JsonUtil.loadFalseResult(1, "绯荤粺绾㈠寘涓嶅瓨鍦�")); return; @@ -409,7 +410,7 @@ } JSONObject data = new JSONObject(); - data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon")); + data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null)); data.put("title", "鏂颁汉绾㈠寘"); data.put("content", "鑷喘鐩存帴鎶电幇锛屼紭鎯犵湡瀹炲彲瑙侊紒"); data.put("type", 1); @@ -417,8 +418,8 @@ data.put("usage", "棰嗗彇鎴愬姛锛屽凡瀛樺叆鈥滄垜鐨�-鎺ㄥ箍绾㈠寘鈥�"); data.put("jumpName", "鍘讳娇鐢�"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot")); - data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip")); - data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link")); + data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null)); + data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null)); out.print(JsonUtil.loadTrueResult(data)); return; @@ -427,7 +428,7 @@ // 鐧诲綍鐢ㄦ埛 boolean isReceive = false; JSONObject data = new JSONObject(); - data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon")); + data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null)); if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) { BigDecimal hasMoney = null; @@ -451,8 +452,8 @@ data.put("usage", "棰嗗彇鎴愬姛锛屽凡瀛樺叆鈥滄垜鐨�-鎺ㄥ箍绾㈠寘鈥�"); data.put("jumpName", "鍘讳娇鐢�"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot")); - data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip")); - data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link")); + data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null)); + data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null)); } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) { boolean isRank = false; @@ -488,8 +489,8 @@ data.put("money", "鏈湀璐︽埛绛夌骇鏈揪鍒癨r\n缁х画鍔犳补"); data.put("jumpName", "鍘绘煡鐪�"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank")); - data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip")); - data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link")); + data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip", null)); + data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null)); out.print(JsonUtil.loadTrueResult(data)); return; } else { @@ -504,8 +505,8 @@ } data.put("jumpName", "鍘讳娇鐢�"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot")); - data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip")); - data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link")); + data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip", null)); + data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null)); } } else { @@ -549,7 +550,7 @@ } } - BigDecimal proportion = hongBaoManageService.getFanLiRate(); + BigDecimal proportion = hongBaoManageService.getTLJShareRate(System.currentTimeMillis()); for (ShareHotGoods hotGoods : listHot) { TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods(); if (taoBaoGoodsBrief == null) { @@ -557,7 +558,7 @@ } // 璁$畻鎺ㄥ箍绾㈠寘 - String warningRate = configTaoLiJinService.getValueByKey("warning_value"); + String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date()); BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief); // 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1 @@ -581,8 +582,8 @@ array.add(gson.toJson(extra)); } - /*// 杩囨湡 -鍙栨秷鏀跺洖 - * executor.execute(new Runnable() { + /* + * // 杩囨湡 -鍙栨秷鏀跺洖 executor.execute(new Runnable() { * * @Override public void run() { * userTaoLiJinOriginService.overdueHongBao(uid); } }); @@ -593,10 +594,10 @@ data.put("list", array); out.print(JsonUtil.loadTrueResult(data)); } - - + /** * 鍒嗕韩鐖嗘鍟嗗搧-闄愪簬娣樼ぜ閲� + * * @param acceptData * @param uid * @param out @@ -607,19 +608,19 @@ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); return; } - + String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis()); List<ShareHotGoods> listHot = shareHotGoodsService.listByDay(day); if (listHot == null) { - listHot = new ArrayList<ShareHotGoods>(); + listHot = new ArrayList<ShareHotGoods>(); } - - + JSONArray array = new JSONArray(); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); - - boolean isNewUser = userInfoExtraService.isNewUser(uid); + + // 鍙栨秷鏂颁汉鑷喘 + boolean isNewUser = false;// userInfoExtraService.isNewUser(uid); if (isNewUser) { // 鍒ゅ畾涓鸿�佺敤鎴凤細 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜�� long countRecord = userTaoLiJinRecordService.countRecordByUid(uid); @@ -627,33 +628,41 @@ isNewUser = false; } } - - - BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); - BigDecimal shareRate = hongBaoManageService.getShareRate(); + + BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis()); + BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis()); for (ShareHotGoods hotGoods : listHot) { TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods(); if (taoBaoGoodsBrief == null) { continue; } - + // 璁$畻鎺ㄥ箍绾㈠寘 - String warningRate = configTaoLiJinService.getValueByKey("warning_value"); + String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date()); BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief); - + // 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1 if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) { continue; } - + GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate); + + // 澶т簬1.6.5鐨勬墠浼氭樉绀虹鍒╀环 + if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0) + detailVO.setCouponPrice(detailVO.getCouponPrice().subtract(spreadMoney)); + else + detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney)); + } + // 鍘绘帀鏍囩 detailVO.setLabels(null); - + MoneyInfoVO moneyInfo = detailVO.getMoneyInfo(); OtherInfo otherInfo = new OtherInfo(); SpreadHongBao spreadHongBao = new SpreadHongBao(); - + // 鏄剧ず绫诲瀷 if (isNewUser) { moneyInfo.setMoneyType(1); @@ -667,25 +676,23 @@ detailVO.setMoneyInfo(moneyInfo); otherInfo.setSpreadHongBao(spreadHongBao); detailVO.setOtherInfo(otherInfo); - + array.add(gson.toJson(detailVO)); } - + /* * executor.execute(new Runnable() { * * @Override public void run() { // 杩囨湡 * userTaoLiJinOriginService.overdueHongBao(uid); } }); */ - + JSONObject data = new JSONObject(); data.put("count", array.size()); data.put("list", array); out.print(JsonUtil.loadTrueResult(data)); } - - /** * 鍒嗕韩鐖嗘鍟嗗搧-闄愪簬娣樼ぜ閲� * @@ -749,18 +756,17 @@ data.put("list", array); if (page == 1) { List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner"); - + if (bannerList != null && bannerList.size() > 0) data.put("topPicture", bannerList.get(0).getSrc()); else data.put("topPicture", ""); - + data.put("ruleUrl", configService.get("zigoulijian_rule")); } out.print(JsonUtil.loadTrueResult(data)); } - - + /** * 鍒嗕韩鐖嗘鍟嗗搧-闄愪簬娣樼ぜ閲� * @@ -796,16 +802,23 @@ continue; } - GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion); + + // 澶т簬1.6.5鐨勬墠浼氭樉绀虹鍒╀环 + if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0) + detailVO.setCouponPrice(detailVO.getCouponPrice().subtract(spreadMoney)); + else + detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney)); + } + // 鍘绘帀鏍囩 detailVO.setLabels(null); - MoneyInfoVO moneyInfo = detailVO.getMoneyInfo(); moneyInfo.setMoneyType(2); detailVO.setMoneyInfo(moneyInfo); - + String hongBao = spreadMoney.toString(); ReduceHongBao vo = new ReduceHongBao(); vo.setLeft(hotGoods.getLeftHongBaoCount()); @@ -813,11 +826,11 @@ vo.setName("浠樻绔嬪噺 "); vo.setTip(""); vo.setTotal(hotGoods.getTotalHongBaoCount()); - + OtherInfo otherInfo = new OtherInfo(); otherInfo.setReduceHongBao(vo); detailVO.setOtherInfo(otherInfo); - + array.add(gson.toJson(detailVO)); } @@ -829,20 +842,20 @@ data.put("list", array); if (page == 1) { List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner"); - + if (bannerList != null && bannerList.size() > 0) data.put("topPicture", bannerList.get(0).getSrc()); else data.put("topPicture", ""); - + data.put("ruleUrl", configService.get("zigoulijian_rule")); } out.print(JsonUtil.loadTrueResult(data)); } - - + /** * 璧犻�佹窐绀奸噾 + * * @param acceptData * @param uid * @param amount @@ -854,7 +867,7 @@ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); return; } - + try { String tips = userTaoLiJinRecordService.giveTaolijin(uid, amount); out.print(JsonUtil.loadTrueResult(tips)); -- Gitblit v1.8.0