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/user/invite/ThreeSaleSerivceImpl.java |   91 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 74 insertions(+), 17 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
index 668c9ce..9145d84 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -8,6 +8,7 @@
 
 import javax.annotation.Resource;
 
+import com.yeshi.fanli.util.SystemInfoUtil;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.core.task.TaskExecutor;
 import org.springframework.stereotype.Service;
@@ -23,15 +24,18 @@
 import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.exception.user.ThreeSaleException;
+import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
 import com.yeshi.fanli.service.inter.user.UserActiveLogService;
 import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
 import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
+import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService;
 import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
 import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
 import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
+import com.yeshi.fanli.service.manger.msg.RocketMQManager;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
@@ -73,12 +77,17 @@
 	@Lazy
 	@Resource
 	private IntegralGetService integralGetService;
+	
+	@Lazy
+	@Resource
+	private TeamFansInfoService teamFansInfoService;
+	
 
 	@Resource(name = "taskExecutor")
 	private TaskExecutor executor;
 
-	@Resource(name = "producer")
-	private Producer producer;
+	@Resource
+	private RocketMQManager rocketMQManager;
 
 	public UserInfo getBoss(final long uid) {
 		return threeSaleMapper.selectBoss(uid);
@@ -92,7 +101,7 @@
 		if (worker.getId() == null)// 璇ョ敤鎴疯繕涓嶅瓨鍦�
 		{
 			// 淇濆瓨鐢ㄦ埛
-			UserInfo inviteeUser = userInfoService.addUser(worker, Constant.APPID);
+			UserInfo inviteeUser = userInfoService.addUser(worker,worker.getSystem());
 			if (inviteeUser == null)
 				throw new ThreeSaleException(2, "鍒涘缓鐢ㄦ埛澶辫触");
 			// 淇濆瓨鍏崇郴
@@ -257,21 +266,21 @@
 
 	@Override
 	public JSONObject getMyFirstTeam(long start, int count, Long uid) {
-		List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid);
+		List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid, null);
 		if (list == null) {
 			list = new ArrayList<ThreeSale>();
 		}
-		long countTotal = threeSaleMapper.countFirstTeam(uid);
+		long countTotal = threeSaleMapper.countFirstTeam(uid, null);
 		return organizeTeam(countTotal, list);
 	}
 
 	@Override
 	public JSONObject getMySecondTeam(long start, int count, Long uid) {
-		List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid);
+		List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid, null);
 		if (list == null) {
 			list = new ArrayList<ThreeSale>();
 		}
-		long countTotal = threeSaleMapper.countSecondTeam(uid);
+		long countTotal = threeSaleMapper.countSecondTeam(uid, null);
 		return organizeTeam(countTotal, list);
 	}
 
@@ -426,11 +435,15 @@
 	 */
 	@Transactional
 	private void inviteSuccess(Long workerId, Long bossId) {
+		// 鍚屾绮変笣娑堟伅
+		teamFansInfoService.addFansInfo(workerId, bossId, new Date());
+		
 		if (!Constant.IS_TEST) {
 			UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(),
 					UserInviteMQMsg.STATE_SUCCESS);
 			Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
-			producer.send(message);
+			message.setStartDeliverTime(java.lang.System.currentTimeMillis() + 5000);
+			rocketMQManager.sendNormalMsg(message,5000L, null);
 		}
 
 		executor.execute(new Runnable() {
@@ -439,9 +452,10 @@
 				try { // 閭�璇烽噾甯�
 					integralGetService.addInviteLevelOne(bossId, workerId);
 				} catch (Exception e) {
-					e.printStackTrace();
+					LogHelper.error(e);
 				}
-
+				
+				// 閭�璇锋垚鍔熸秷鎭�
 				try {
 					// 鐩存帴绮変笣閭�璇锋垚鍔�
 					UserInfo invitee = userInfoService.selectByPKey(workerId);
@@ -456,7 +470,7 @@
 								boss.getNickName(), invitee.getNickName(), invitee.getPortrait(), new Date());
 					}
 				} catch (Exception e) {
-					e.printStackTrace();
+					LogHelper.error(e);
 				}
 			}
 		});
@@ -490,22 +504,52 @@
 
 	@Override
 	public List<ThreeSale> listFirstTeam(long start, int count, Long uid) {
-		return threeSaleMapper.listFirstTeam(start, count, uid);
+		return threeSaleMapper.listFirstTeam(start, count, uid, null);
 	}
 
 	@Override
 	public List<ThreeSale> listSecondTeam(long start, int count, Long uid) {
-		return threeSaleMapper.listSecondTeam(start, count, uid);
+		return threeSaleMapper.listSecondTeam(start, count, uid, null);
+	}
+
+	@Override
+	public List<ThreeSale> listFirstTeam(long start, int count, Long uid, List<Long> listId) {
+		return threeSaleMapper.listFirstTeam(start, count, uid, listId);
+	}
+
+	@Override
+	public List<ThreeSale> listSecondTeam(long start, int count, Long uid, List<Long> listId) {
+		return threeSaleMapper.listSecondTeam(start, count, uid, listId);
 	}
 
 	@Override
 	public long countFirstTeam(Long uid) {
-		return threeSaleMapper.countFirstTeam(uid);
+		return threeSaleMapper.countFirstTeam(uid, null);
 	}
 
 	@Override
 	public long countSecondTeam(Long uid) {
-		return threeSaleMapper.countSecondTeam(uid);
+		return threeSaleMapper.countSecondTeam(uid, null);
+	}
+
+	@Override
+	public long countFirstTeam(Long uid, List<Long> listId) {
+		return threeSaleMapper.countFirstTeam(uid, listId);
+	}
+
+	@Override
+	public long countSecondTeam(Long uid, List<Long> listId) {
+		return threeSaleMapper.countSecondTeam(uid, listId);
+	}
+
+	@Override
+	public long countFirstTeamByDate(Long uid, int dayType) {
+		return threeSaleMapper.countFirstTeamByDate(uid, dayType);
+	}
+
+	@Override
+	public long countSecondTeamByDate(Long uid, int dayType) {
+		return threeSaleMapper.countSecondTeamByDate(uid, dayType);
 	}
 
 	@Override
@@ -565,8 +609,21 @@
 	}
 
 	@Override
-	public List<ThreeSale> listAll(int page, int pageSize) {
-		return threeSaleMapper.listAll((page-1)*pageSize, pageSize);
+	public List<ThreeSale> listAll(Date minTime, Date maxTime, int page, int pageSize) {
+		return threeSaleMapper.listAll(minTime == null ? null : minTime.getTime(),
+				maxTime == null ? null : maxTime.getTime(), (page - 1) * pageSize, pageSize);
+	}
+
+	@Override
+	public long countAll(Date minTime, Date maxTime) {
+		return threeSaleMapper.countAll(minTime == null ? null : minTime.getTime(),
+				maxTime == null ? null : maxTime.getTime());
+	}
+
+	
+	@Override
+	public List<Long> getAllBossId(){
+		return threeSaleMapper.getAllBossId();
 	}
 
 }

--
Gitblit v1.8.0