From b2901a0793cfe3a1eb04318c1f8786c988e83108 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期五, 16 八月 2019 14:28:14 +0800 Subject: [PATCH] 的 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java | 145 +++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 124 insertions(+), 21 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 8516a70..7ae24ce 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 @@ -39,6 +39,7 @@ import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; +import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.goods.ShareGoodsService; @@ -72,6 +73,7 @@ import com.yeshi.fanli.vo.goods.OtherInfo; import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO; import com.yeshi.fanli.vo.msg.ClientTextStyleVO; +import com.yeshi.fanli.vo.tlj.ReduceHongBao; import com.yeshi.fanli.vo.tlj.SpreadHongBao; import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO; import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO; @@ -211,8 +213,8 @@ return; } - // 杩囨湡 - userTaoLiJinOriginService.overdueHongBao(uid); + // 杩囨湡 -鍙栨秷鏀跺洖 + // userTaoLiJinOriginService.overdueHongBao(uid); // 鎴戠殑娣樼ぜ閲� BigDecimal tlj = null; @@ -252,13 +254,13 @@ lastMonthUse = zero; } - - // 闂彿閾炬帴 - String helpLink = configTaoLiJinService.getValueByKey("hongbao_help_link"); - + String giveMin = configTaoLiJinService.getValueByKey("give_min_amount"); + JSONObject data = new JSONObject(); data.put("tlj", tlj.setScale(2).toString()); - data.put("helpLink", helpLink); + data.put("giveMin", giveMin); + data.put("giveTip", "娉�:璧犻�佹帹骞跨孩鍖呴噾棰濊嚦灏�"+ giveMin +"鍏�"); + data.put("helpLink", configTaoLiJinService.getValueByKey("hongbao_help_link")); data.put("countShare", countShare); data.put("todayWin", todayWin.setScale(2).toString()); data.put("yesterdayWin", yesterdayWin.setScale(2).toString()); @@ -579,13 +581,12 @@ array.add(gson.toJson(extra)); } - executor.execute(new Runnable() { - @Override - public void run() { - // 杩囨湡 - userTaoLiJinOriginService.overdueHongBao(uid); - } - }); + /*// 杩囨湡 -鍙栨秷鏀跺洖 + * executor.execute(new Runnable() { + * + * @Override public void run() { + * userTaoLiJinOriginService.overdueHongBao(uid); } }); + */ JSONObject data = new JSONObject(); data.put("count", array.size()); @@ -670,13 +671,12 @@ array.add(gson.toJson(detailVO)); } - executor.execute(new Runnable() { - @Override - public void run() { - // 杩囨湡 - userTaoLiJinOriginService.overdueHongBao(uid); - } - }); + /* + * executor.execute(new Runnable() { + * + * @Override public void run() { // 杩囨湡 + * userTaoLiJinOriginService.overdueHongBao(uid); } }); + */ JSONObject data = new JSONObject(); data.put("count", array.size()); @@ -759,5 +759,108 @@ } out.print(JsonUtil.loadTrueResult(data)); } + + + /** + * 鍒嗕韩鐖嗘鍟嗗搧-闄愪簬娣樼ぜ閲� + * + * @param acceptData + * @param uid + * @param out + */ + @RequestMapping(value = "getBuyGoodsV2", method = RequestMethod.POST) + public void getBuyGoodsV2(AcceptData acceptData, int page, PrintWriter out) { + + String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis()); + List<TLJBuyGoods> listHot = tljBuyGoodsService.listByDay(day); + if (listHot == null) { + listHot = new ArrayList<TLJBuyGoods>(); + } + + JSONArray array = new JSONArray(); + Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) + .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create(); + + BigDecimal proportion = TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE; + for (TLJBuyGoods hotGoods : listHot) { + TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods(); + if (taoBaoGoodsBrief == null) { + continue; + } + + // 璁$畻鎺ㄥ箍绾㈠寘 + BigDecimal spreadMoney = TaoBaoUtil.getGoodsHongBaoMoney(taoBaoGoodsBrief, proportion); + + // 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1 + if (spreadMoney.compareTo(new BigDecimal(1.0)) < 0) { + continue; + } + + + GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, proportion, proportion); + // 鍘绘帀鏍囩 + 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()); + vo.setMoney(" 楼" + hongBao); + vo.setName("浠樻绔嬪噺 "); + vo.setTip(""); + vo.setTotal(hotGoods.getTotalHongBaoCount()); + + OtherInfo otherInfo = new OtherInfo(); + otherInfo.setReduceHongBao(vo); + detailVO.setOtherInfo(otherInfo); + + array.add(gson.toJson(detailVO)); + } + + if (page > 1) + array.clear(); + + JSONObject data = new JSONObject(); + data.put("count", array.size()); + 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 + * @param out + */ + @RequestMapping(value = "giveTLJ", method = RequestMethod.POST) + public void giveTLJ(AcceptData acceptData, Long uid, BigDecimal amount, PrintWriter out) { + if (uid == null || uid <= 0) { + out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); + return; + } + + try { + String tips = userTaoLiJinRecordService.giveTaolijin(uid, amount); + out.print(JsonUtil.loadTrueResult(tips)); + } catch (UserTaoLiJinRecordException e) { + out.print(JsonUtil.loadFalseResult(1, e.getMsg())); + } + } } -- Gitblit v1.8.0