From c338aa60df58bee9f4c25afedf94fe6930a119c1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 29 七月 2020 19:01:56 +0800
Subject: [PATCH] SpringContext中的循环任务优化,添加业务监控

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
index 6844eb2..7265bbb 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -11,6 +11,7 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import com.yeshi.fanli.entity.SystemEnum;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -71,7 +72,7 @@
 import com.yeshi.fanli.util.RedisKeyEnum;
 import com.yeshi.fanli.util.RedisManager;
 import com.yeshi.fanli.util.StringUtil;
-import com.yeshi.fanli.util.TimeUtil;
+import org.yeshi.utils.TimeUtil;
 import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
 import com.yeshi.fanli.util.user.UserLevelUtil;
@@ -249,7 +250,6 @@
 	 * 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ
 	 * 
 	 * @param acceptData
-	 * @param id
 	 * @param out
 	 */
 	@RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
@@ -299,7 +299,6 @@
 	/**
 	 * 缁勭粐鏁版嵁
 	 * 
-	 * @param count
 	 * @param list
 	 * @param uid
 	 * @param type
@@ -395,7 +394,6 @@
 	/**
 	 * 鍔犲伐鏁版嵁
 	 * 
-	 * @param count
 	 * @param list
 	 * @param uid
 	 * @param type  鏌ヨ绮変笣绫诲瀷 1鐩存帴 2闂存帴
@@ -544,7 +542,6 @@
 	 * 鐢ㄦ埛闃熷憳缁熻- IOS
 	 * 
 	 * @param acceptData
-	 * @param id
 	 * @param out
 	 */
 	@RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
@@ -559,12 +556,12 @@
 		resultData.put("firstTeamTotal", firstTeam);
 		resultData.put("secondTeam", countSecond);
 		resultData.put("secondTeamTotal", countSecond);
-		resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
+		resultData.put("helpLink", configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(),acceptData.getSystem()));
 
 		boolean hasTeam = true;
 		if (firstTeam <= 0) {
 			hasTeam = false;
-			resultData.put("invitelink", configService.get(ConfigKeyEnum.inviteActivationUrl.getKey()));
+			resultData.put("invitelink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem()));
 		}
 		resultData.put("hasTeam", hasTeam);
 
@@ -583,7 +580,7 @@
 		resultData.put("hasCode", hasCode);
 		if (!hasCode) {
 			List<String> tipCode = new ArrayList<String>();
-			resultData.put("helpLinkActivate", configService.get(ConfigKeyEnum.teamHelpUrl.getKey()));
+			resultData.put("helpLinkActivate", configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(),acceptData.getSystem()));
 			tipCode.add("婵�娲婚個璇峰姛鑳藉悗鎵嶅彲浠ラ個璇风矇涓濓紝鐩存帴绮変笣鏄敱浣犵洿鎺ラ個璇凤紝闂存帴绮変笣鏄敱浣犵殑鐩存帴绮変笣閭�璇枫��");
 			tipCode.add("閭�璇锋縺娲诲姛鑳斤紝蹇呴』瑕佹湁閭�璇风爜锛岄個璇风爜鍙互閫氳繃閲戝竵鍏戞崲锛屼篃鍙互鍏ㄧ綉鎼滅储銆�");
 			resultData.put("tipCode", tipCode);
@@ -622,7 +619,6 @@
 	/**
 	 * 涓婄骇淇℃伅缁勭粐
 	 * 
-	 * @param acceptData
 	 * @param uid
 	 * @param threeSale
 	 * @return
@@ -655,8 +651,9 @@
 			}
 			bossData.put("inviteTime", "浣犱簬 " + sdf.format(inviteTime) + "鎺ュ彈浜員A鐨勯個璇�");
 		} else {
+			SystemEnum system= userInfoService.getUserSystem(uid);
 			bossData.put("hasBoss", false);
-			bossData.put("helpLink", configService.get(ConfigKeyEnum.inviteCodeHlepLink.getKey()));
+			bossData.put("helpLink", configService.getValue(ConfigKeyEnum.inviteCodeHlepLink.getKey(),system));
 			bossData.put("weiXinTip", "鎭枩浣狅紝鎴戜滑鐨勪紭璐ㄧ敤鎴凤紱\r\n浣犲苟娌℃湁閭�璇蜂汉锛屼絾浣犵殑閭�璇锋縺娲诲姛鑳芥槸琚粯璁ゅ紑鍚殑锛沑r\n浣犳嫢鏈夌嫭鐗圭殑鏃犻個璇蜂汉婵�娲荤爜銆�");
 		}
 		return bossData;
@@ -724,7 +721,7 @@
 		try {
 			List<String> listIOS = new ArrayList<String>();
 			List<String> listAndroid = new ArrayList<String>();
-			pushService.pushZNX(remindId, title, content, listIOS, listAndroid);
+			pushService.pushZNX(remindId, title, content, listIOS, listAndroid,acceptData.getSystem());
 
 			userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.common, title, content,
 					UserSystemMsg.TIME_TAG_COMMON, null);
@@ -796,7 +793,7 @@
 			JSONObject data = new JSONObject();
 			data.put("count", spreadImgService.countAll());
 			data.put("inviteCode", inviteCode);
-			data.put("helpLink", configService.get(ConfigKeyEnum.inviteHelpLink.getKey()));
+			data.put("helpLink", configService.getValue(ConfigKeyEnum.inviteHelpLink.getKey(),acceptData.getSystem()));
 			data.put("inviteRules", values.getValue().replace("\n", "<br><br>"));
 			data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
 			data.put("inviteLink", Constant.YINGYONGBAO_LINK);
@@ -812,7 +809,6 @@
 	 * 
 	 * @param acceptData
 	 * @param uid
-	 * @param inviteId
 	 * @param out
 	 */
 	@RequestMapping(value = "tailorCode")
@@ -839,7 +835,6 @@
 	 * 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ
 	 * 
 	 * @param acceptData
-	 * @param id
 	 * @param out
 	 */
 	@RequestMapping(value = "getMyTeamV2", method = RequestMethod.POST)
@@ -894,7 +889,7 @@
 
 		// 缁熻H5閾炬帴
 		if (page == 1) {
-			result.put("link", configService.get(ConfigKeyEnum.teamStatisticsLink.getKey()));
+			result.put("link", configService.getValue(ConfigKeyEnum.teamStatisticsLink.getKey(),acceptData.getSystem()));
 		}
 		out.print(JsonUtil.loadTrueResult(result));
 	}
@@ -920,7 +915,6 @@
 	 * 鐢ㄦ埛闃熷憳缁熻
 	 * 
 	 * @param acceptData
-	 * @param id
 	 * @param out
 	 */
 	@RequestMapping(value = "countMyTeamV2")
@@ -1040,7 +1034,6 @@
 			int darenMonth = 0;
 			int highVIPMonth = 0;
 			int superVIPMonth = 0;
-			Date date = new Date();
 			Date minTime = TimeUtil.parseYYYYMMDD(firstday);
 			Date maxTime = TimeUtil.parseYYYYMMDD_HHMMSS(lastday + " 23:59:59");
 			List<TeamDailyRecord> listMonth = teamDailyRecordService.sumGroupByYearMonth(uid, minTime, maxTime);
@@ -1202,14 +1195,24 @@
 		if (directNum > 0) {
 			indirectNum = threeSaleSerivce.countSecondTeam(workerId);
 		}
-
+		data.put("fansNum", "鐩存帴绮変笣锛� " + directNum + "浜篭n" + "闂存帴绮変笣锛� " + indirectNum + "浜�");
+		
 		// 璁㈠崟缁熻
 		long countTB = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_TAOBAO, 60);
 		long countJD = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_JD, 60);
 		long countPDD = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_PDD, 60);
-
-		data.put("fansNum", "鐩存帴绮変笣锛� " + directNum + "浜篭n" + "闂存帴绮変笣锛� " + indirectNum + "浜�");
-		data.put("orderInfo", "娣樺疂 (" + countTB + "绗�)\n" + "浜笢 (" + countJD + "绗�)\n" + "鎷煎澶� (" + countPDD + "绗�)");
+		
+		StringBuilder builder = new StringBuilder();
+		builder.append("娣樺疂 (" + countTB + "绗�)");
+		builder.append("\n浜笢 (" + countJD + "绗�)");
+		builder.append("\n鎷煎澶� (" + countPDD + "绗�)");
+		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
+			long countVip = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_VIP, 60);
+			long countSL = commonOrderCountService.countOrderBySourceAndNearDay(workerId, Constant.SOURCE_TYPE_SUNING, 60);
+			builder.append("\n鍞搧浼� (" + countVip + "绗�)");
+			builder.append("\n鑻忓畞 (" + countSL + "绗�)");
+		}
+		data.put("orderInfo", builder.toString());
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 
@@ -1335,14 +1338,24 @@
 		if (directNum > 0) {
 			indirectNum = threeSaleSerivce.countSecondTeam(fansId);
 		}
+		data.put("fansNum", "鐩存帴绮変笣锛� " + directNum + "浜篭n" + "闂存帴绮変笣锛� " + indirectNum + "浜�");
 
 		// 璁㈠崟缁熻
 		long countTB = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_TAOBAO, 60);
 		long countJD = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_JD, 60);
 		long countPDD = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_PDD, 60);
 
-		data.put("fansNum", "鐩存帴绮変笣锛� " + directNum + "浜篭n" + "闂存帴绮変笣锛� " + indirectNum + "浜�");
-		data.put("orderInfo", "娣樺疂 (" + countTB + "绗�)\n" + "浜笢 (" + countJD + "绗�)\n" + "鎷煎澶� (" + countPDD + "绗�)");
+		StringBuilder builder = new StringBuilder();
+		builder.append("娣樺疂 (" + countTB + "绗�)");
+		builder.append("\n浜笢 (" + countJD + "绗�)");
+		builder.append("\n鎷煎澶� (" + countPDD + "绗�)");
+		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
+			long countVip = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_VIP, 60);
+			long countSL = commonOrderCountService.countOrderBySourceAndNearDay(fansId, Constant.SOURCE_TYPE_SUNING, 60);
+			builder.append("\n鍞搧浼� (" + countVip + "绗�)");
+			builder.append("\n鑻忓畞 (" + countSL + "绗�)");
+		}
+		data.put("orderInfo", builder.toString());
 		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
 	}
 

--
Gitblit v1.8.0