From f862a844ea7e212f8cc0622b858308e2b91dca2e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 04 七月 2020 16:35:50 +0800
Subject: [PATCH] 后台管理相关Controller注入系统
---
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 150 insertions(+), 8 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
index a9145d4..4be17c6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -48,6 +48,7 @@
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.order.HongBaoOrder;
import com.yeshi.fanli.entity.pdd.PDDOrder;
+import com.yeshi.fanli.entity.suning.SuningOrderInfo;
import com.yeshi.fanli.entity.taobao.PidUser;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
@@ -85,6 +86,7 @@
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
+import com.yeshi.fanli.service.manger.msg.RocketMQManager;
import com.yeshi.fanli.service.manger.order.HongBaoV2AddManager;
import com.yeshi.fanli.util.CMQManager;
import com.yeshi.fanli.util.Constant;
@@ -92,13 +94,14 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.TimeUtil;
-import com.yeshi.fanli.util.cmq.order.PlaceOrderCMQManager;
-import com.yeshi.fanli.util.cmq.order.TeamOrderCMQManager;
import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
+import com.yeshi.fanli.util.mq.cmq.order.PlaceOrderCMQManager;
+import com.yeshi.fanli.util.mq.cmq.order.TeamOrderCMQManager;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
import com.yeshi.fanli.util.rocketmq.MQTopicName;
+import com.yeshi.fanli.util.suning.SuningApiUtil;
import com.yeshi.fanli.util.vipshop.VipShopUtil;
@Service
@@ -167,8 +170,8 @@
@Resource(name = "orderTransactionProducer")
private TransactionProducer orderTransactionProducer;
- @Resource(name = "producer")
- private Producer producer;
+ @Resource
+ private RocketMQManager rocketMQManager;
@Resource
private OrderMoneySettleService orderMoneySettleService;
@@ -678,7 +681,7 @@
}
@Override
- @Transactional(rollbackFor = Exception.class)
+ // @Transactional(rollbackFor = Exception.class)
public void fanliPreInvaite(Long uid, Date maxPreGetTime) {
// 閭�璇疯禋鍒拌处
try {
@@ -1189,8 +1192,10 @@
@Override
public void processVipShopOrder(VipShopOrder order) {
+
if (order == null || order.getDetailList() == null || order.getDetailList().size() == 0)
return;
+
// 鏍规嵁ext1涓巗ubUnionId璺熷崟
String channelTag = order.getChannelTag();
@@ -1249,7 +1254,8 @@
order.setCreatetime(System.currentTimeMillis());
order.setOrderId(vipShopOrder.getOrderSn() + "");
order.setOrderType(Constant.SOURCE_TYPE_VIP);
- order.setState(invalidCount == vipShopOrder.getDetailList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU);
+ order.setState(
+ invalidCount == vipShopOrder.getDetailList().size() ? Order.STATE_SHIXIAO : Order.STATE_YIZHIFU);
order.setUserInfo(new UserInfo(uid));
order.setVersion(2);
order.setThirdCreateTime(new Date(vipShopOrder.getOrderTime()));
@@ -1314,6 +1320,142 @@
} catch (CommonOrderException e) {
try {
LogHelper.errorDetailInfo(e, "addJDOrder鎴朼ddHongBao鍑洪敊", "璁㈠崟鍙�:" + jdOrder.getOrderSn());
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊鑻忓畞璁㈠崟
+ */
+ @Override
+ public void processSuningOrder(SuningOrderInfo suningOrder) {
+ if (suningOrder == null)
+ return;
+ String uidStr = suningOrder.getChildAccountId();
+ Long uid = null;
+ if (!StringUtil.isNullOrEmpty(uidStr))
+ uid = Long.parseLong(uidStr);
+ String positionId = suningOrder.getPositionId();
+ if (SuningApiUtil.PID_BUY.equalsIgnoreCase(positionId))// 杩斿埄璁㈠崟
+ {
+ processFanLiSuningOrder(suningOrder, uid);
+ lostOrderService.processSuceess(suningOrder.getOrderCode(), Constant.SOURCE_TYPE_SUNING);
+ } else if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId)) {// 鍒嗕韩璁㈠崟
+ if (uid == null)// 鍒嗕韩璁㈠崟涓嶅厑璁告壘鍥�
+ return;
+ processShareSuningOrder(suningOrder, uid);
+ } else {// 澶勭悊鏄惁鏈夎鍗曟壘鍥炵殑鐘舵��
+ processFanLiSuningOrder(suningOrder, null);
+ }
+ }
+
+ /**
+ * 澶勭悊鎷煎澶氳嚜璐繑鍒╄鍗�
+ *
+ * @param pddOrder
+ * @param uid
+ */
+ @Transactional
+ private void processFanLiSuningOrder(SuningOrderInfo suningOrder, Long uid) {
+ int orderState = 0;
+
+ // 绛夊緟浠樻锛涙敮浠樺畬鎴愶紱閫�娆撅紱璁㈠崟宸插彇娑堬紱纭鏀惰揣
+
+ if ("璁㈠崟宸插彇娑�".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc())
+ || "閫�娆�".equalsIgnoreCase(suningOrder.getOrderLineStatusDesc()))
+ orderState = Order.STATE_SHIXIAO;
+ else
+ orderState = Order.STATE_YIZHIFU;
+
+ BigDecimal totalMoney = new BigDecimal(suningOrder.getPayAmount());
+
+ // 鍔犲叆璁㈠崟
+ Order oldOrder = orderMapper.selectOrderByOrderIdAndOrderType(suningOrder.getOrderCode(),
+ Constant.SOURCE_TYPE_SUNING);
+ if (uid == null && oldOrder != null && oldOrder.getBeizhu() != null && oldOrder.getBeizhu().contains("琛ュ崟"))
+ uid = oldOrder.getUserInfo().getId();
+
+ if (uid == null)
+ return;
+
+ if (oldOrder == null)// 鏂板
+ {
+ Order order = new Order();
+ order.setBeizhu("鑻忓畞杩斿埄璁㈠崟");
+ order.setCreatetime(System.currentTimeMillis());
+ order.setOrderId(suningOrder.getOrderCode());
+ order.setOrderType(Constant.SOURCE_TYPE_SUNING);
+ order.setState(orderState);
+ order.setUserInfo(new UserInfo(uid));
+ order.setVersion(2);
+ order.setThirdCreateTime(
+ new Date(TimeUtil.convertToTimeTemp(suningOrder.getOrderSubmitTime(), "yyyy-MM-dd HH:mm:ss")));
+ order.setMoney(totalMoney);
+ // 鍔犲叆鍒拌鍗曡〃
+ orderMapper.insertSelective(order);
+ } else {
+ Order updateOrder = new Order();
+ updateOrder.setId(oldOrder.getId());
+ updateOrder.setMoney(totalMoney);
+ orderMapper.updateByPrimaryKeySelective(updateOrder);
+ }
+
+ try {
+ List<SuningOrderInfo> pddOrderList = new ArrayList<>();
+ pddOrderList.add(suningOrder);
+ List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(pddOrderList, uid);
+ addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING,
+ HongBaoV2.TYPE_ZIGOU);
+ if (isCommonOrderAllAdd(commonOrderList)) {
+ Order order = new Order();
+ order.setOrderId(suningOrder.getOrderCode());
+ order.setOrderType(Constant.SOURCE_TYPE_SUNING);
+ order.setUserInfo(new UserInfo(uid));
+ try {
+ if (Constant.ENABLE_MQ)
+ PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
+ } catch (Exception e) {
+ }
+ }
+ } catch (CommonOrderException e) {
+ try {
+ LogHelper.errorDetailInfo(e, "addPDDOrder鎴朼ddHongBao鍑洪敊", "璁㈠崟鍙�:" + suningOrder.getOrderCode());
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊鎷煎澶氬垎浜鍗�
+ *
+ * @param order
+ * @param uid
+ */
+ @Transactional
+ private void processShareSuningOrder(SuningOrderInfo suningOrder, Long uid) {
+ try {
+ List<SuningOrderInfo> suningOrderList = new ArrayList<>();
+ suningOrderList.add(suningOrder);
+ List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addSuningOrder(suningOrderList, uid);
+ addHongBaoWithMQ(commonOrderList, suningOrder.getOrderCode(), uid, Constant.SOURCE_TYPE_SUNING,
+ HongBaoV2.TYPE_SHARE_GOODS);
+ if (isCommonOrderAllAdd(commonOrderList)) {
+ Order order = new Order();
+ order.setOrderId(suningOrder.getOrderCode());
+ order.setOrderType(Constant.SOURCE_TYPE_SUNING);
+ order.setUserInfo(new UserInfo(uid));
+ try {
+ if (Constant.ENABLE_MQ)
+ PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
+ } catch (Exception e) {
+ }
+ }
+ } catch (CommonOrderException e) {
+ try {
+ LogHelper.errorDetailInfo(e, "addJDOrder鎴朼ddHongBao鍑洪敊", "璁㈠崟鍙�:" + suningOrder.getOrderCode());
} catch (Exception e1) {
e1.printStackTrace();
}
@@ -1556,9 +1698,9 @@
if (!Constant.IS_TEST)
if (result.getResultCode() == HongBaoAddResult.CODE_ADD) {// 鍙彂閫佹柊澧炴秷鎭�
OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD,
- isCommonOrderValid(coList), 0, new Date(), result.isMiandan());
+ isCommonOrderValid(coList), 0, new Date(), result.isMiandan(),coList.get(0).getThirdCreateTime());
Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic, mqMsg);
- producer.send(msg);
+ rocketMQManager.sendNormalMsg(msg, null);
}
}
--
Gitblit v1.8.0