From 28cf328a098334b51a3e9d2d56f983fb8c862211 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 23 五月 2020 09:54:38 +0800
Subject: [PATCH] 足迹、收藏订单兼容新需求

---
 fanli/src/main/java/com/yeshi/fanli/job/order/OrderTeamDividentsJob.java |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/job/order/OrderTeamDividentsJob.java b/fanli/src/main/java/com/yeshi/fanli/job/order/OrderTeamDividentsJob.java
index e12099d..8bc02bb 100644
--- a/fanli/src/main/java/com/yeshi/fanli/job/order/OrderTeamDividentsJob.java
+++ b/fanli/src/main/java/com/yeshi/fanli/job/order/OrderTeamDividentsJob.java
@@ -10,15 +10,16 @@
 
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
-import com.yeshi.fanli.dto.order.dividents.UserDividentsDayDTO;
+import com.yeshi.fanli.dto.mq.UidDateDTO;
 import com.yeshi.fanli.entity.money.TeamEincomeRecord;
 import com.yeshi.fanli.service.inter.money.TeamEincomeRecordService;
-import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderService;
+import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceOrderUserMapService;
 import com.yeshi.fanli.service.inter.order.dividents.TeamDividentsSourceUserService;
 import com.yeshi.fanli.service.manger.money.TeamEincomeManager;
 import com.yeshi.fanli.service.manger.order.TeamDividentsManager;
-import com.yeshi.fanli.util.CMQManager;
+import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.util.cmq.order.TeamOrderCMQManager;
 
 //璁㈠崟鍥㈤槦鍒嗙孩
 @Component
@@ -27,8 +28,9 @@
 	@Resource
 	private TeamDividentsManager teamDividentsManager;
 
+
 	@Resource
-	private TeamDividentsSourceOrderService teamDividentsSourceOrderService;
+	private TeamDividentsSourceOrderUserMapService teamDividentsSourceOrderUserMapService;
 
 	@Resource
 	private TeamDividentsSourceUserService teamDividentsSourceUserService;
@@ -47,15 +49,20 @@
 	@XxlJob("startPreOrderTeamDividentsHandler")
 	public ReturnT<String> startPreDividents(String param) throws Exception {
 		String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM") + "-25";
+		if (!StringUtil.isNullOrEmpty(param)) {
+			day = param;
+		}
+
 		Date preSendTime = new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"));
 
-		long count = teamDividentsSourceOrderService.countCanSendUidByPreSendTime(preSendTime);
+		long count = teamDividentsSourceOrderUserMapService.countCanSendSourceUidByPreSendTime(preSendTime);
 		int pageSize = 500;
 		int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
 		for (int i = 0; i < totalPage; i++) {
-			List<Long> list = teamDividentsSourceOrderService.listCanSendUidByPreSendTime(preSendTime, i + 1, pageSize);
+			List<Long> list = teamDividentsSourceOrderUserMapService.listCanSendSourceUidByPreSendTime(preSendTime,
+					i + 1, pageSize);
 			for (Long uid : list) {
-				teamDividentsManager.startDividents(uid);
+				teamDividentsManager.startDividents(uid, preSendTime);
 			}
 		}
 		startAddDividentsRecord(preSendTime);
@@ -79,26 +86,29 @@
 		}
 
 		for (Long uid : targetUidList)
-			CMQManager.getInstance().addTeamDividentsMsg(new UserDividentsDayDTO(uid, preSendTime));
+			TeamOrderCMQManager.getInstance().addTeamDividentsPreMsg(new UidDateDTO(uid, preSendTime));
 	}
 
-	@XxlJob("addTeamIncomeTOUserAccountHandler")
+	@XxlJob("addTeamDividentsTOUserAccountHandler")
 	public ReturnT<String> addTeamIncomeTOUserAccount(String param) throws Exception {
 		String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM") + "-25";
+		if (!StringUtil.isNullOrEmpty(param)) {
+			day = param;
+		}
+
 		Date preSendTime = new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd"));
 
 		List<Integer> typeList = new ArrayList<>();
-		typeList.add(TeamEincomeRecord.TYPE_TEAM_REWARD);
-		typeList.add(TeamEincomeRecord.TYPE_TEAM_SUBSIDY);
+		typeList.add(TeamEincomeRecord.TYPE_TEAM_DIVIDENTS);
 
 		long count = teamEincomeRecordService.countCanRecieveUid(preSendTime, typeList);
 
 		int pageSize = 500;
 		int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
 		for (int i = 0; i < totalPage; i++) {
-			List<Long> list = teamEincomeRecordService.listCanRecieveUid(preSendTime, typeList, i * pageSize, pageSize);
+			List<Long> list = teamEincomeRecordService.listCanRecieveUid(preSendTime, typeList, i + 1, pageSize);
 			for (Long uid : list) {
-
+				TeamOrderCMQManager.getInstance().addTeamDividentsMsg(new UidDateDTO(uid, preSendTime));
 			}
 		}
 		return ReturnT.SUCCESS;

--
Gitblit v1.8.0