From 3f2b34aa24482a45eace7d9882cb115251954c61 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期四, 02 一月 2020 18:01:52 +0800
Subject: [PATCH] 小程序

---
 fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/InviteController.java |   66 +++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/InviteController.java b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/InviteController.java
index f6d1b28..32fecdd 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/InviteController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/InviteController.java
@@ -15,6 +15,7 @@
 import org.yeshi.utils.DateUtil;
 import org.yeshi.utils.JsonUtil;
 
+import com.yeshi.fanli.dto.WXMPAcceptData;
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.bus.user.ThreeSale;
 import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
@@ -65,7 +66,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "tailorCode")
-	public void tailorCode(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
+	public void tailorCode(WXMPAcceptData acceptData, String callback, Long uid, PrintWriter out) {
 		if (uid == null) {
 			out.print(JsonUtil.loadFalseResult("鐢ㄦ埛id缂哄け"));
 			return;
@@ -85,7 +86,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
-	public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
+	public void countMyTeam(WXMPAcceptData acceptData, long uid, PrintWriter out) {
 		try {
 			long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
 			long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
@@ -145,7 +146,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "listMyTeam", method = RequestMethod.POST)
-	public void listMyTeam(AcceptData acceptData, int page, long uid, int type, PrintWriter out) {
+	public void listMyTeam(WXMPAcceptData acceptData, int page, long uid, int type, PrintWriter out) {
 		if (type != 1 && type != 2) {
 			out.print(JsonUtil.loadFalseResult("绮変笣绫诲瀷涓嶆纭�"));
 			return;
@@ -311,4 +312,63 @@
 		result.put("list", resultArray);
 		return result;
 	}
+	
+	/**
+	 * 鑾峰彇鐢ㄦ埛淇℃伅
+	 * @param acceptData
+	 * @param uid
+	 * @param out
+	 */
+	@RequestMapping(value = "getBossInfo", method = RequestMethod.POST)
+	public void getBossInfo(AcceptData acceptData, Long uid, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
+			return;
+		}
+		JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid));
+		out.print(JsonUtil.loadTrueResult(bossData));
+	}
+	
+	/**
+	 * 涓婄骇淇℃伅缁勭粐
+	 * 
+	 * @param acceptData
+	 * @param uid
+	 * @param threeSale
+	 * @return
+	 */
+	private JSONObject getBossInfo(long uid, ThreeSale threeSale) {
+		JSONObject bossData = new JSONObject();
+		if (threeSale != null && threeSale.getBoss() != null) {
+			UserInfo boss = threeSale.getBoss();
+			bossData.put("hasBoss", true);
+			bossData.put("inviteId", threeSale.getId());
+			bossData.put("nickName", boss.getNickName());
+			bossData.put("portrait", boss.getPortrait());
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
+			Long createTime = threeSale.getCreateTime();
+			Date inviteTime = new Date(createTime);
+
+			UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(boss.getId());
+			if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
+				bossData.put("weiXin", userInfoExtra.getWeiXin());
+				bossData.put("weiXinState", 3);
+				bossData.put("weiXinTip", "娣诲姞TA鐨勫井淇★紝浣犲彲鍚慣A瀛︿範濡備綍閫氳繃鏉挎牀蹇渷璧氶挶銆�");
+			} else {
+				if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
+					bossData.put("weiXinState", 1);
+					bossData.put("weiXinTip", "鐐瑰嚮鎻愰啋TA锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
+				} else {
+					bossData.put("weiXinState", 2);
+					bossData.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
+				}
+			}
+			bossData.put("inviteTime", "浣犱簬 " + sdf.format(inviteTime) + "鎺ュ彈浜員A鐨勯個璇�");
+		} else {
+			bossData.put("hasBoss", false);
+			bossData.put("helpLink", configService.get("invite_code_hlep_link"));
+			bossData.put("weiXinTip", "鎭枩浣狅紝鎴戜滑鐨勪紭璐ㄧ敤鎴凤紱\r\n浣犲苟娌℃湁閭�璇蜂汉锛屼絾浣犵殑閭�璇锋縺娲诲姛鑳芥槸琚粯璁ゅ紑鍚殑锛沑r\n浣犳嫢鏈夌嫭鐗圭殑鏃犻個璇蜂汉婵�娲荤爜銆�");
+		}
+		return bossData;
+	}
 }

--
Gitblit v1.8.0