From a6e138ae919e6048fa26472c31336123f3d78106 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期五, 09 八月 2019 15:56:24 +0800 Subject: [PATCH] 积分 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 75 ++++++++++++++++++++++++++++++------- 1 files changed, 60 insertions(+), 15 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java index 5df9321..5575df9 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java @@ -1,6 +1,7 @@ package com.yeshi.fanli.service.impl.order; import java.math.BigDecimal; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -52,10 +53,13 @@ import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.account.UserUtil; import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory; import com.yeshi.fanli.util.factory.goods.CommonOrderFactory; import com.yeshi.fanli.util.jd.JDApiUtil; +import com.yeshi.fanli.util.jd.JDUtil; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; @@ -63,6 +67,7 @@ import com.yeshi.fanli.vo.msg.ClientTextStyleVO; import com.yeshi.fanli.vo.order.CommonOrderGoodsVO; import com.yeshi.fanli.vo.order.CommonOrderVO; +import com.yeshi.fanli.vo.order.WeiQuanInfo; import net.sf.json.JSONObject; @@ -325,6 +330,14 @@ // 鏄惁瀛樺湪濂栧姳鍒� boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid); + + // 2019.8.1寮�濮嬭繑鍥炵淮鏉冧俊鎭� + Date august = null; + try { + august = TimeUtil.parse("2019-08-01"); + } catch (ParseException e) { + e.printStackTrace(); + } /* 缁勭粐璁㈠崟鐘舵�� 绛変俊鎭� */ for (CommonOrderVO order : listOrder) { @@ -373,6 +386,11 @@ } } + BigDecimal hongBao = order.getHongBao(); + if (hongBao == null) { + hongBao = new BigDecimal(0); + } + if (CommonOrder.STATE_FK == orderState) { orderStateContent = "宸蹭粯娆�"; } else if (CommonOrder.STATE_JS == orderState) { @@ -389,7 +407,7 @@ .selectListByOrderIdAndState(order.getOrderNo(), "缁存潈鎴愬姛"); boolean isPart = false;// 榛樿澶辨晥 - + BigDecimal weiQuanMoney = new BigDecimal(0); if (listWQ != null && listWQ.size() > 0) { BigDecimal fanTotalMoney = new BigDecimal(0); for (TaoBaoWeiQuanOrder weiQuanOrder : listWQ) { @@ -397,17 +415,38 @@ if (fanMoney != null) { fanTotalMoney = MoneyBigDecimalUtil.add(fanTotalMoney, fanMoney); } + weiQuanMoney = MoneyBigDecimalUtil.add(weiQuanOrder.getMoney(), weiQuanMoney); } - if (fanTotalMoney.compareTo(order.getHongBao()) < 0) { + if (fanTotalMoney.compareTo(hongBao) < 0) { isPart = true; } } - - if (isPart) { - hongBaoState = HongBaoV2.STATE_BUFENSHIXIAO; // 閮ㄥ垎澶辨晥 + + if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { + if (isPart) { + hongBaoState = HongBaoV2.STATE_BUFENSHIXIAO; // 閮ㄥ垎澶辨晥 + } else { + hongBaoState = HongBaoV2.STATE_SHIXIAO; // 鍏ㄩ儴澶辨晥 + } } else { - hongBaoState = HongBaoV2.STATE_SHIXIAO; // 鍏ㄩ儴澶辨晥 + // 2019.8.1 杩斿洖缁存潈淇℃伅 + if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) { + orderStateContent = "缁存潈鎴愬姛"; + WeiQuanInfo weiQuanInfo = new WeiQuanInfo(); + weiQuanInfo.setOldHongBao("楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); + if (isPart) { + // 缁存潈澶辨晥閲戦=缁存潈鐨勯噾棰�*鑾峰緱鐨勭孩鍖�/缁撶畻閲戦 + BigDecimal settlement = order.getSettlement(); + BigDecimal wqHongbao = MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(hongBao, settlement), settlement); + weiQuanInfo.setWqHongBao("缁存潈锛�-楼" + wqHongbao.setScale(2, BigDecimal.ROUND_DOWN).toString()); + hongBao = MoneyBigDecimalUtil.sub(hongBao, wqHongbao); + } else { + weiQuanInfo.setWqHongBao("缁存潈锛�-楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); + hongBao = new BigDecimal(0); + } + order.setWeiQuanInfo(weiQuanInfo); + } } } } @@ -494,10 +533,7 @@ hongbaoInfo = hongBaoState_Str + hongbaoInfo; - BigDecimal hongBao = order.getHongBao(); - if (hongBao == null) { - hongBao = new BigDecimal(0); - } + Map<String, String> hongBaoMap = new HashMap<String, String>(); hongBaoMap.put("content", hongbaoInfo + " 楼" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); hongBaoMap.put("fontColor", hongbaoInfoFontColor); @@ -510,13 +546,13 @@ } else { // 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍 if (sourceType == null) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, null, signList); + setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, null, signList, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, signList); + setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, signList, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_JD) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, signList); + setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, signList, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, signList); + setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, signList, acceptData); } } @@ -539,7 +575,7 @@ * @param signList */ public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, - Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList) { + Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList, AcceptData acceptData) { // 鏄惁鍏嶅崟鍟嗗搧 boolean freeOrder = false; @@ -607,6 +643,9 @@ Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); + if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { + jumpLink.put("goodsType", order.getSourceType()); + } Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", type); @@ -629,6 +668,9 @@ Map<String, Object> jumpLink = new HashMap<String, Object>(); jumpLink.put("orderNo", order.getOrderNo()); + if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) { + jumpLink.put("goodsType", order.getSourceType()); + } Map<String, Object> jump = new HashMap<String, Object>(); jump.put("type", 1); // 椤甸潰璺宠浆 @@ -816,7 +858,10 @@ } else { if (!Constant.IS_OUTNET) { JDGoods goods = JDApiUtil.getGoodsDetail(itemOrder.getSkuId()); + if(goods==null) + goods=JDUtil.getGoodsFromWeb(itemOrder.getSkuId()); commonGoodsList.get(0).setTitle(goods.getSkuName()); + commonGoodsList.get(0).setPicture(goods.getPicUrl()); commonOrderGoodsMapper.updateByPrimaryKeySelective(commonGoodsList.get(0)); } } -- Gitblit v1.8.0