From a481da100d823bdebc63ddd11ba23da2f84c38ca Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 21 八月 2019 10:43:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 110 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 88 insertions(+), 22 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 8247182..066ec25 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,6 +53,8 @@
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;
@@ -64,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;
@@ -327,6 +331,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) {
@@ -374,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) {
@@ -390,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) {
@@ -398,17 +415,41 @@
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);
+ }
}
}
}
@@ -495,10 +536,6 @@
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);
@@ -511,13 +548,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);
}
}
@@ -540,7 +577,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;
@@ -608,6 +645,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);
@@ -630,6 +670,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); // 椤甸潰璺宠浆
@@ -801,9 +844,17 @@
goods = JDUtil.getGoodsFromWeb(itemOrder.getSkuId());
}
+ if (goods == null) {
+ goods = new JDGoods();
+ goods.setSkuName(itemOrder.getSkuName());
+ goods.setPrice(itemOrder.getPrice());
+ goods.setSkuId(itemOrder.getSkuId());
+ }
+
if (goods != null) {
cog = CommonOrderGoodsFactory.create(goods);
}
+
cog.setCreateTime(new Date());
cog.setUpdateTime(new Date());
commonOrderGoodsMapper.insertSelective(cog);
@@ -855,10 +906,9 @@
if (!StringUtil.isNullOrEmpty(commonOrder.getTradeId()))
oldCommonOrder = commonOrderMapper.selectBySourceTypeAndTradeId(commonOrder.getSourceType(),
commonOrder.getTradeId());
- else
- oldCommonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(commonOrder.getOrderNo(),
- commonOrder.getSourceType(), commonOrder.getOrderBy());
-
+ else {
+ throw new CommonOrderException(10, "浜ゆ槗ID涓虹┖");
+ }
if (oldCommonOrder == null)// 鏂板
{
commonOrder.setCreateTime(new Date());
@@ -870,6 +920,7 @@
} else {// 淇敼
// 宸茬粡缁撶畻锛屽凡缁忓け鏁堬紝鐘舵�佹湭鏀瑰彉鐨勮鍗曚笉澶勭悊
if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX
+ || oldCommonOrder.getState() == CommonOrder.STATE_WQ
|| (oldCommonOrder.getState().intValue() == commonOrder.getState())) {
return oldCommonOrder;
}
@@ -985,8 +1036,14 @@
Integer type, Integer orderState, String startTime, String endTime, Integer source)
throws CommonOrderException {
- List<CommonOrderVO> list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState,
- startTime, endTime, source);
+ List<CommonOrderVO> list = null;
+
+ if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 鎼滅储妗嗘棤鍊兼垨鑰呮寜璁㈠崟鍙锋悳绱㈡椂閮藉彧鎼滅储涓昏鍗�
+ list = commonOrderMapper.listQueryWithNoChild(start, count, keyType, key, state, type, orderState,
+ startTime, endTime, source);
+ } else
+ list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime,
+ source);
if (list == null) {
list = new ArrayList<CommonOrderVO>();
@@ -1117,6 +1174,8 @@
|| CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)) {
if (UserSystemCouponRecord.STATE_SUCCESS == couponState) {
// 鍏嶅崟鎴愬姛
+ order.setOtherState(2);
+ } else if (UserSystemCouponRecord.STATE_FREE_ON == couponState) {
order.setOtherState(1);
}
}
@@ -1132,6 +1191,8 @@
|| CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)) {
if (UserSystemCouponRecord.STATE_SUCCESS == couponState) {
// 鍏嶅崟鎴愬姛
+ order.setOtherState(2);
+ } else if (UserSystemCouponRecord.STATE_FREE_ON == couponState) {
order.setOtherState(1);
}
}
@@ -1147,6 +1208,8 @@
|| CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)) {
if (UserSystemCouponRecord.STATE_SUCCESS == couponState) {
// 鍏嶅崟鎴愬姛
+ order.setOtherState(2);
+ } else if (UserSystemCouponRecord.STATE_FREE_ON == couponState) {
order.setOtherState(1);
}
}
@@ -1163,7 +1226,11 @@
@Override
public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
String startTime, String endTime, Integer source) throws CommonOrderException {
- return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source);
+ if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 鎼滅储妗嗘棤鍊兼垨鑰呮寜璁㈠崟鍙锋悳绱㈡椂閮藉彧鎼滅储涓昏鍗�
+ return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime,
+ source);
+ } else
+ return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source);
}
@Override
@@ -1341,5 +1408,4 @@
return commonOrderMapper.listBySourceTypeAndStateAndThirdCrateTime(sourceType, state, minTime, maxTime,
(page - 1) * pageSize, pageSize);
}
-
}
--
Gitblit v1.8.0