From d46dea27b6ec3e0fb32ec7d137699e9fc7d609b0 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 12 十二月 2019 14:18:11 +0800 Subject: [PATCH] 订单补贴消息修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 190 +++++++++++++++++++--------------------------- 1 files changed, 79 insertions(+), 111 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 17d190b..b117402 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,7 +3,6 @@ import java.io.PrintWriter; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,7 +28,6 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.user.ShamUser; import com.yeshi.fanli.entity.bus.user.UserInfo; -import com.yeshi.fanli.entity.bus.user.UserMoneyExtra; import com.yeshi.fanli.entity.goods.CollectionGoodsV2; import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.jd.JDGoods; @@ -38,6 +36,7 @@ import com.yeshi.fanli.entity.system.SystemClientParams; import com.yeshi.fanli.entity.taobao.ClientTBPid; import com.yeshi.fanli.entity.taobao.TLJBuyGoods; +import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoShop; import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig; @@ -56,20 +55,21 @@ 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.redpack.UserTaoLiJinNewbiesService; import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService; +import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService; import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService; import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; -import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; -import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService; import com.yeshi.fanli.service.inter.user.ShamUserService; import com.yeshi.fanli.service.inter.user.TBPidService; 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.integral.IntegralGetService; +import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.RedisManager; @@ -89,7 +89,6 @@ import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; -import com.yeshi.fanli.util.taobao.TaoLiJinUtil; import com.yeshi.fanli.vo.goods.CouponInfoVO; import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO; import com.yeshi.fanli.vo.goods.GoodsDetailVO; @@ -99,10 +98,9 @@ import com.yeshi.fanli.vo.goods.ShareVO; import com.yeshi.fanli.vo.goods.ShopInfoVO; import com.yeshi.fanli.vo.msg.ClientTextStyleVO; +import com.yeshi.fanli.vo.tlj.NewUserHongBao; import com.yeshi.fanli.vo.tlj.ReduceHongBao; -import com.yeshi.fanli.vo.tlj.SpreadHongBao; -import net.sf.json.JSON; import net.sf.json.JSONObject; @Controller @@ -155,13 +153,7 @@ private UserGoodsStorageService userGoodsStorageService; @Resource - private UserTaoLiJinOriginService userTaoLiJinOriginService; - - @Resource private ConfigTaoLiJinService configTaoLiJinService; - - @Resource - private UserTaoLiJinRecordService userTaoLiJinRecordService; @Resource private UserInfoExtraService userInfoExtraService; @@ -192,6 +184,15 @@ @Resource private JDGoodsClassService jdGoodsClassService; + + @Resource + private TLJFreeBuyGoodsService tljFreeBuyGoodsService; + + @Resource + private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; + + @Resource + private UserVIPInfoService userVIPInfoService; /** * 娣樺疂鍟嗗搧璇︽儏 @@ -355,8 +356,13 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼"+ TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPShareRate())); + } if (TaoBaoUtil.isYUShou(goods)) { if (!StringUtil.isNullOrEmpty(goods.getPresaleDiscountFeeText())) { @@ -442,87 +448,7 @@ boolean shareValid = true; int moneyType = 1; - // 鎺ㄥ箍绾㈠寘 - if (from != null && from.equals("taolijin")) { - // 璁$畻鎺ㄥ箍绾㈠寘 - String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date()); - BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods); - - // 鎺ㄥ箍绾㈠寘 涓嶈兘灏忎簬1 - if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) { - out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); - return; - } - - // 鍙栨秷鏂扮敤鎴疯嚜璐� - boolean isNewUser = false;// userInfoExtraService.isNewUser(uid); - if (isNewUser) { - // 鍒ゅ畾涓鸿�佺敤鎴凤細 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜�� - long countRecord = userTaoLiJinRecordService.countRecordByUid(uid); - if (countRecord > 0) { - isNewUser = false; - } - } - - SpreadHongBao spreadHongBao = new SpreadHongBao(); - if (isNewUser) { - spreadHongBao.setMoney("1"); - } else { - moneyType = 2; - fanliValid = false; - spreadHongBao.setMoney(spreadMoney.toString()); - - ClientTextStyleVO textStyleVO1 = new ClientTextStyleVO(); - textStyleVO1.setContent("鍒嗕韩"); - textStyleVO1.setColor("#666666"); - ClientTextStyleVO textStyleVO2 = new ClientTextStyleVO(); - textStyleVO2.setContent("璧氬閲�"); - textStyleVO2.setColor("#F14242"); - ClientTextStyleVO textStyleVO3 = new ClientTextStyleVO(); - textStyleVO3.setContent("锛屽ソ鍙�"); - textStyleVO3.setColor("#666666"); - ClientTextStyleVO textStyleVO4 = new ClientTextStyleVO(); - textStyleVO4.setContent("棰嗙孩鍖咃紒"); - textStyleVO4.setColor("#F14242"); - - List<ClientTextStyleVO> listText = new ArrayList<ClientTextStyleVO>(); - listText.add(textStyleVO1); - listText.add(textStyleVO2); - listText.add(textStyleVO3); - listText.add(textStyleVO4); - extraVO.setTip(listText); - } - - spreadHongBao.setName("鎺ㄥ箍绾㈠寘 "); - spreadHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); - OtherInfo otherInfo = new OtherInfo(); - 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) { - extraVO.setUserTLJ(new BigDecimal(0).setScale(2).toString()); - } else { - extraVO.setUserTLJ(userMoneyExtra.getTlj().setScale(2).toString()); - } - helpLink = configTaoLiJinService.getValueByKey("share_goods_help_link", new Date()); - - } else if (from != null && from.equals("taolijin_buy")) { + if (from != null && from.equals("taolijin_buy")) { // 鏌ヨ鍒嗕韩搴� TLJBuyGoods buyGoods = tljBuyGoodsService.selectByAuctionIdAndDay(id, TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); @@ -557,6 +483,37 @@ else goodsDetail.setZkPrice(goodsDetail.getZkPrice().subtract(tljHongBao)); } + } else if (from != null && from.equals("taolijin_free_buy")) { + TLJFreeBuyGoods freeGoods = tljFreeBuyGoodsService.selectByAuctionIdAndDay(id, + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); + if (freeGoods == null) { + out.print(JsonUtil.loadFalseResult(2, "鍏嶅崟鍟嗗搧宸蹭笅鏋�")); + return; + } + + fanliValid = true; + shareValid = false; + BigDecimal couponPrice = goodsDetail.getCouponPrice(); + if (couponPrice == null) + couponPrice = goodsDetail.getZkPrice(); + + NewUserHongBao newUserHongBao = new NewUserHongBao(); + newUserHongBao.setMoney(couponPrice.setScale(2).toString()); + newUserHongBao.setName("鏂颁汉绾㈠寘 "); + newUserHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); + newUserHongBao.setLeft(1); + newUserHongBao.setTotal(1); + + OtherInfo otherInfo = new OtherInfo(); + otherInfo.setReduceHongBao(newUserHongBao); + goodsDetail.setOtherInfo(otherInfo); + + // 涓撳睘鏍囩 + List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>(); + labels.add(new ClientTextStyleVO("鏂颁汉涓撳睘", "#FE0014")); + labels.add(new ClientTextStyleVO("瀹炰粯0鍏�", "#FF9600")); + goodsDetail.setLabels(labels); + } else {// 鏅�氳喘涔� OtherInfo otherInfo = new OtherInfo(); RewardCouponVO rewardCoupon = new RewardCouponVO(); @@ -564,8 +521,8 @@ JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); - rewardCoupon.setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate).add(MoneyBigDecimalUtil - .mul(TaoBaoUtil.getGoodsHongBaoMoney(goods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon + .setMaxMoney("楼" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardCoupon.setDesc("杩�"); params1.put("url", configService.get("vip_link")); @@ -653,8 +610,13 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼"+ JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPShareRate())); + } // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); @@ -673,14 +635,14 @@ jdGoods.setCommissionPlus(threeClass.getSelfComm()); // plus杩斿埄 BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods, fanLiRate); - otherInfo.setFanliMoneyPlus("浜笢plus浼氬憳杩斅�" + fanliMoneyPlus); + otherInfo.setFanliMoneyPlus("浜笢plus杩斅�" + fanliMoneyPlus); // 浣跨敤濂栧姳鍒告渶楂樿繑 if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { maxMoneyPlus = "锛堜含涓減lus杩斅�" + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + "锛�"; } else - maxMoneyPlus = "锛堜含涓減lus浼氬憳鏈�楂樿繑楼" + maxMoneyPlus = "锛堜含涓減lus鏈�楂樿繑楼" + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE)) + "锛�"; } @@ -694,8 +656,7 @@ JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); - rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate) - .add(MoneyBigDecimalUtil.mul(JDUtil.getGoodsFanLiMoney(jdGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon.setMaxMoney("楼" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardCoupon.setDesc("杩�"); params1.put("url", configService.get("vip_link")); @@ -841,8 +802,13 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); + if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { + goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); + goodsDetail.getMoneyInfo().setShareMoney("楼"+ PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPShareRate())); + } // 闄勫姞淇℃伅 OtherInfo otherInfo = new OtherInfo(); @@ -851,8 +817,8 @@ JSONObject params1 = new JSONObject(); params1.put("url", configService.get("special_guide_reward_coupon_link")); - rewardCoupon.setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate).add(MoneyBigDecimalUtil - .mul(PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, fanLiRate), Constant.MAX_REWARD_RATE))); + rewardCoupon + .setMaxMoney("楼" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { rewardCoupon.setDesc("杩�"); params1.put("url", configService.get("vip_link")); @@ -1006,7 +972,8 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); for (JDGoods goods : list) { @@ -1050,7 +1017,7 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, - Constant.MAX_REWARD_RATE); + Constant.MAX_REWARD_RATE, hongBaoManageService.getVIPFanLiRate()); for (PDDGoodsDetail goods : goodsList) { listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)); } @@ -1095,7 +1062,8 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE); + ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, + hongBaoManageService.getVIPFanLiRate()); goodsList.parallelStream().forEach(goods -> { if (goods != null) { @@ -1372,7 +1340,7 @@ Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>(); ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(), - hongBaoManageService.getShareRate(), new BigDecimal(80)); + hongBaoManageService.getShareRate(), new BigDecimal(80), hongBaoManageService.getVIPFanLiRate()); if (tbGoodsList.size() > 0) { List<TaoBaoGoodsBrief> goodsList = null; @@ -1393,14 +1361,14 @@ if (jdGoodsList.size() > 0) { List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList); for (JDGoods goods : goodsList) { - tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_TAOBAO, + tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_JD, GoodsDetailVOFactory.convertJDGoods(goods, params)); } } if (pddGoodsList.size() > 0) { List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList); for (PDDGoodsDetail goods : goodsList) { - tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_TAOBAO, + tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_PDD, GoodsDetailVOFactory.convertPDDGoods(goods, params)); } } -- Gitblit v1.8.0