From 0cf8c0bf5649b0b7269f78f6eae7c09cffea75cd Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 12 十一月 2019 16:01:22 +0800 Subject: [PATCH] 券退回消息处理 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 162 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 143 insertions(+), 19 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java index dc15224..89b75a2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java @@ -3,6 +3,7 @@ import java.io.PrintWriter; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Date; import java.util.List; import javax.annotation.Resource; @@ -15,6 +16,8 @@ import org.yeshi.utils.JsonUtil; import org.yeshi.utils.taobao.TbImgUtil; +import com.yeshi.fanli.dto.ConfigParamsDTO; +import com.yeshi.fanli.dto.jd.JDCategoryInfo; import com.yeshi.fanli.dto.jd.JDCouponInfo; import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; import com.yeshi.fanli.dto.pdd.PDDGoodsResult; @@ -26,6 +29,7 @@ import com.yeshi.fanli.entity.bus.user.UserMoneyExtra; import com.yeshi.fanli.entity.goods.CollectionGoodsV2; import com.yeshi.fanli.entity.jd.JDGoods; +import com.yeshi.fanli.entity.jd.JDGoodsClass; import com.yeshi.fanli.entity.system.BusinessSystem; import com.yeshi.fanli.entity.system.SystemClientParams; import com.yeshi.fanli.entity.taobao.ClientTBPid; @@ -38,13 +42,16 @@ import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException; import com.yeshi.fanli.log.LogHelper; +import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.config.SystemClientParamsService; import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service; import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service; import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; -import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; +import com.yeshi.fanli.service.inter.jd.JDGoodsClassService; +import com.yeshi.fanli.service.inter.money.UserMoneyExtraService; +import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService; import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; @@ -58,8 +65,9 @@ import com.yeshi.fanli.service.inter.user.UserGoodsStorageService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; -import com.yeshi.fanli.service.inter.user.UserMoneyExtraService; +import com.yeshi.fanli.service.inter.user.integral.IntegralGetService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TaoBaoConstant; @@ -82,6 +90,7 @@ import com.yeshi.fanli.vo.goods.GoodsDetailVO; import com.yeshi.fanli.vo.goods.MoneyInfoVO; import com.yeshi.fanli.vo.goods.OtherInfo; +import com.yeshi.fanli.vo.goods.RewardCouponVO; import com.yeshi.fanli.vo.goods.ShareVO; import com.yeshi.fanli.vo.goods.ShopInfoVO; import com.yeshi.fanli.vo.msg.ClientTextStyleVO; @@ -169,6 +178,15 @@ @Resource private PinDuoDuoCacheUtil pinDuoDuoCacheUtil; + @Resource + private IntegralGetService integralGetService; + + @Resource + private JumpDetailV2Service jumpDetailV2Service; + + @Resource + private JDGoodsClassService jdGoodsClassService; + /** * 娣樺疂鍟嗗搧璇︽儏 * @@ -248,7 +266,6 @@ taoBaoGoodsUpdateService.offlineTaoBaoGoods(id); } }); - } } else { @@ -332,7 +349,17 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); + + if (TaoBaoUtil.isYUShou(goods)) { + if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { + if (goodsDetail.getLabels() == null) + goodsDetail.setLabels(new ArrayList<>()); + goodsDetail.getLabels().add(new ClientTextStyleVO(goods.getPresaleDiscountFeeText(), "#FF2B4E")); + } + } + // 鍦ㄦ爣棰樻坊鍔犱紭鎯犱俊鎭� // 搴楅摵淇℃伅 TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId()); @@ -412,7 +439,7 @@ // 鎺ㄥ箍绾㈠寘 if (from != null && from.equals("taolijin")) { // 璁$畻鎺ㄥ箍绾㈠寘 - String warningRate = configTaoLiJinService.getValueByKey("warning_value"); + String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date()); BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods); // 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1 @@ -421,8 +448,8 @@ return; } - // 鏄惁涓烘柊鐢ㄦ埛 - boolean isNewUser = userInfoExtraService.isNewUser(uid); + // 鍙栨秷鏂扮敤鎴疯嚜璐� + boolean isNewUser = false;// userInfoExtraService.isNewUser(uid); if (isNewUser) { // 鍒ゅ畾涓鸿�佺敤鎴凤細 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜�� long countRecord = userTaoLiJinRecordService.countRecordByUid(uid); @@ -466,6 +493,20 @@ otherInfo.setSpreadHongBao(spreadHongBao); goodsDetail.setOtherInfo(otherInfo); + // 1.6.5鍚庢敼涓虹鍒╀环 + if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + if (goodsDetail.getCouponPrice() != null + && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0) + goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(spreadMoney)); + else + goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(spreadMoney)); + } + + goodsDetail.getMoneyInfo().setFanliMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, + hongBaoManageService.getTLJShareRate(System.currentTimeMillis()))); + goodsDetail.getMoneyInfo().setShareMoney(TaoBaoUtil.getGoodsHongBaoInfo(goods, + hongBaoManageService.getTLJShareRate(System.currentTimeMillis()))); + // 鐢ㄦ埛娣樼ぜ閲� UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid); if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) { @@ -473,7 +514,7 @@ } else { extraVO.setUserTLJ(userMoneyExtra.getTlj().setScale(2).toString()); } - helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link"); + helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", new Date()); } else if (from != null && from.equals("taolijin_buy")) { // 鏌ヨ鍒嗕韩搴� @@ -489,17 +530,38 @@ shareValid = false; helpLink = configService.get("zigoulijian_nofanli_help"); - String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString(); + BigDecimal tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE); ReduceHongBao reduceHongBao = new ReduceHongBao(); reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount()); - reduceHongBao.setMoney(tljHongBao); + reduceHongBao.setMoney(tljHongBao.toString()); reduceHongBao.setName("浠樻绔嬪噺 "); reduceHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount()); OtherInfo otherInfo = new OtherInfo(); otherInfo.setReduceHongBao(reduceHongBao); + goodsDetail.setOtherInfo(otherInfo); + + // 1.6.5鍚庢敼涓虹鍒╀环 + if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) { + if (goodsDetail.getCouponPrice() != null + && goodsDetail.getCouponPrice().compareTo(new BigDecimal(0)) > 0) + goodsDetail.setCouponPrice(goodsDetail.getCouponPrice().subtract(tljHongBao)); + else + goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao)); + } + } else {// 鏅�氳喘涔� + OtherInfo otherInfo = new OtherInfo(); + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); + params1.put("url", configService.get("special_guide_reward_coupon_link")); + rewardCoupon.setParams(params1.toString()); + rewardCoupon.setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil + .mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + otherInfo.setRewardCoupon(rewardCoupon); goodsDetail.setOtherInfo(otherInfo); } extraVO.setFanliValid(fanliValid); @@ -579,7 +641,47 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, fanLiRate, shareRate); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); + + // 闄勫姞淇℃伅 + OtherInfo otherInfo = new OtherInfo(); + + // 浜笢plus杩斿埄 + String maxMoneyPlus = null; + JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo(); + if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) { + Long cid3 = categoryInfo.getCid3(); + JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString())); + if (threeClass != null && threeClass.getSelfComm() != null + && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) { + BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare(); + // plus姣斾緥 灏忎簬姝e父姣斾緥 + if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) { + jdGoods.setCommissionPlus(threeClass.getSelfComm()); + // plus杩斿埄 + BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate); + otherInfo.setFanliMoneyPlus("浜笢plus浼氬憳杩斅�" + fanliMoneyPlus); + // 浣跨敤濂栧姳鍒告渶楂樿繑 + maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼" + + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + + "锛�"; + } + } + } + + // 濂栧姳鍒歌繑鍒� + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); + params1.put("url", configService.get("special_guide_reward_coupon_link")); + rewardCoupon.setParams(params1.toString()); + rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate) + .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + otherInfo.setRewardCoupon(rewardCoupon); + goodsDetail.setOtherInfo(otherInfo); CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); if (couponInfo != null) { @@ -714,7 +816,22 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); + + // 闄勫姞淇℃伅 + OtherInfo otherInfo = new OtherInfo(); + RewardCouponVO rewardCoupon = new RewardCouponVO(); + rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); + JSONObject params1 = new JSONObject(); + params1.put("url", configService.get("special_guide_reward_coupon_link")); + rewardCoupon.setParams(params1.toString()); + rewardCoupon.setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil + .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon.setDesc("鐢ㄨ繑鍒╁鍔卞埜鏈�楂樿繑"); + otherInfo.setRewardCoupon(rewardCoupon); + goodsDetail.setOtherInfo(otherInfo); + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); PDDPromotionUrl convertUrl = null; if (couponInfo != null) { @@ -808,7 +925,7 @@ extraVO.setShare(shareInfoVO); if (convertUrl != null) { - extraVO.setCouponJumpLink(convertUrl.getShortUrl()); + extraVO.setCouponJumpLink(convertUrl.getUrl()); extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); } @@ -858,10 +975,11 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); for (JDGoods goods : list) { - listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)); } // 鍙栧伓鏁颁釜鏁版嵁 @@ -900,8 +1018,9 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); for (PDDGoodsDetail goods : goodsList) { - listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); } } } @@ -937,16 +1056,15 @@ try { goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids); } catch (TaoKeApiException e1) { - e1.printStackTrace(); } catch (TaobaoGoodsDownException e1) { - e1.printStackTrace(); } if (goodsList != null && goodsList.size() > 0) { BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + goodsList.parallelStream().forEach(goods -> { if (goods != null) { // 鑾峰彇璇︽儏 @@ -967,7 +1085,7 @@ if (taoBaoGoodsBrief != null) { listExtra.add( - GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate)); + GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO)); } } }); @@ -1042,6 +1160,9 @@ data.put("native", true); data.put("jumpLink", jumpLink); out.print(JsonUtil.loadTrueResult(data)); + + // 鑾峰緱閲戝竵 + integralGetService.addCouponRebate(uid); } /** @@ -1084,6 +1205,9 @@ data.put("jumpLink", convertUrl.getUrl()); data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); out.print(JsonUtil.loadTrueResult(data)); + + // 鑾峰緱閲戝竵 + integralGetService.addCouponRebate(uid); } /** -- Gitblit v1.8.0