From 654b2ed3f9ee289ae4be884ddde7f8d1da28cbf3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 12 五月 2020 15:41:42 +0800
Subject: [PATCH] 增加邀请关系详细表同步
---
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java | 44 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 36 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 78c3830..433fb55 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
@@ -35,6 +35,7 @@
import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
+import com.yeshi.fanli.dto.order.HongBaoAddResult;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
@@ -75,6 +76,7 @@
import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
import com.yeshi.fanli.service.inter.order.OrderProcessService;
import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
+import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService;
@@ -131,6 +133,9 @@
@Resource
private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
+
+ @Resource
+ private UserOrderMsgNotificationService userOrderMsgNotificationService;
@Resource
private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
@@ -428,6 +433,11 @@
public void fanli(HongBaoV2 hb1) throws TaoBaoWeiQuanException {
// 鏌ヨ鏈�鏂扮殑绾㈠寘鏁版嵁
hb1 = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb1.getId());
+
+ if (hb1 == null || hb1.getState() != HongBaoV2.STATE_KELINGQU || hb1.getPreGetTime() == null
+ || hb1.getPreGetTime().getTime() > System.currentTimeMillis())
+ return;
+
// 姝e父鐢ㄦ埛鎵嶈兘鍒拌处
UserInfo mainUser = userInfoMapper.selectAvailableByPrimaryKey(hb1.getUserInfo().getId());
if (mainUser == null || mainUser.getState() != UserInfo.STATE_NORMAL) {
@@ -1240,6 +1250,23 @@
@Transactional(rollbackFor = Exception.class)
public void invalidHongBaoV2AndGiveGodenCorn(Long hongBaoId, Long uid, String orderId, int sourceType,
String beiZhu) throws Exception {
+ HongBaoOrder hongbaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBaoId);
+ if (hongbaoOrder != null) {
+ CommonOrder commonOrder = commonOrderService.selectByPrimaryKey(hongbaoOrder.getCommonOrder().getId());
+ if (commonOrder != null) {
+ if (commonOrder.getState() == CommonOrder.STATE_FK) {
+ CommonOrder updateOrder = new CommonOrder(commonOrder.getId());
+ updateOrder.setState(CommonOrder.STATE_SX);
+ updateOrder.setUpdateTime(new Date());
+ commonOrderService.updateByPrimaryKeySelective(updateOrder);
+ }
+ }
+ }
+
+ HongBaoV2 hongBao = hongBaoV2Service.selectByPrimaryKey(hongBaoId);
+ if (hongBao == null || hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
+ return;
+
HongBaoV2 v2 = new HongBaoV2(hongBaoId);
v2.setState(HongBaoV2.STATE_SHIXIAO);
v2.setBeizhu(beiZhu);
@@ -1254,9 +1281,10 @@
update.setUpdateTime(new Date());
hongBaoV2Service.updateByPrimaryKeySelective(update);
}
- // TODO 鍟嗗鍏冲簵璺戣矾闇�瑕佽禒閫侀噾甯�
- // userSystemCouponService.systemGiveRewardCoupon(uid, 1, orderId,
- // sourceType, "鍥犲晢瀹惰繚绾︽湭鑳界粨绠楄繑鍒╂垨鍟嗗宸茬粡鍏冲簵");
+
+ if (hongBao.getType() == HongBaoV2.TYPE_ZIGOU || hongBao.getType() == HongBaoV2.TYPE_SHARE_GOODS) {
+ userOrderMsgNotificationService.orderInvalidToBusinessRunning(uid, orderId, sourceType, hongBao.getType());
+ }
}
@Transactional
@@ -1365,16 +1393,16 @@
private void addHongBaoWithMQ(List<CommonOrderAddResultDTO> commonOrderList, String orderId, Long uid,
int sourceType, int hongBaoType) {
final List<CommonOrder> coList = convertCommonOrder(commonOrderList);
- int resultCode = 0;
+ HongBaoAddResult result = null;
try {
long time = TimeUtil.convertToTimeTemp("2019-12-06", "yyyy-MM-dd");
if (!Constant.IS_TEST)
time = TimeUtil.convertToTimeTemp("2019-12-20", "yyyy-MM-dd");
if (coList.get(0).getThirdCreateTime().getTime() < time)
- resultCode = hongBaoV2Service.addHongBao(coList, hongBaoType);
+ result = hongBaoV2Service.addHongBao(coList, hongBaoType);
else
- resultCode = hongBaoV2AddManager.addHongBao(coList, hongBaoType);
+ result = hongBaoV2AddManager.addHongBao(coList, hongBaoType);
} catch (HongBaoException e) {
try {
LogHelper.errorDetailInfo(e, "addJDOrder鎴朼ddHongBao鍑洪敊", "璁㈠崟鍙�:" + orderId);
@@ -1385,9 +1413,9 @@
}
if (!Constant.IS_TEST)
- if (resultCode == 1) {// 鍙彂閫佹柊澧炴秷鎭�
+ if (result.getResultCode() == HongBaoAddResult.CODE_ADD) {// 鍙彂閫佹柊澧炴秷鎭�
OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD,
- isCommonOrderValid(coList), 0, new Date());
+ isCommonOrderValid(coList), 0, new Date(), result.isMiandan());
Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic, mqMsg);
producer.send(msg);
}
--
Gitblit v1.8.0