From 42411e4a26461229c6bca6e89ca55e98a80f5a4e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 30 九月 2021 18:08:17 +0800
Subject: [PATCH] bug修改
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java | 899 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 457 insertions(+), 442 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java
index f83304d..520b510 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/InviteGetMoneyController.java
@@ -1,442 +1,457 @@
-package com.yeshi.fanli.controller.client.v1;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.yeshi.utils.JsonUtil;
-
-import com.yeshi.fanli.dto.money.InviteGetMoney;
-import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
-import com.yeshi.fanli.entity.bus.user.ThreeSale;
-import com.yeshi.fanli.entity.bus.user.UserInfo;
-import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
-import com.yeshi.fanli.entity.system.BusinessSystem;
-import com.yeshi.fanli.entity.system.SystemClientParams;
-import com.yeshi.fanli.exception.NotExistObjectException;
-import com.yeshi.fanli.exception.user.UserInfoExtraException;
-import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
-import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
-import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
-import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
-import com.yeshi.fanli.service.inter.user.UserInfoService;
-import com.yeshi.fanli.service.inter.user.UserRankingsService;
-import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
-import com.yeshi.fanli.tag.PageEntity;
-import com.yeshi.fanli.util.Constant;
-import com.yeshi.fanli.util.RedisManager;
-import com.yeshi.fanli.util.StringUtil;
-import com.yeshi.fanli.util.account.UserUtil;
-import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
-
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-
-/**
- *
- * 绫昏鏄�: 鍓嶇瀹㈡埛绔墍闇�鎺ュ彛
- *
- * @author mawurui
- * @createTime 2018骞�4鏈�2鏃� 涓婂崍9:39:30
- * @version /test/invite
- */
-@Controller
-@RequestMapping("api/v1/invite")
-public class InviteGetMoneyController {
- @Resource
- private SystemClientParamsService systemClientParamsService;
-
- @Resource
- private SpreadUserImgService spreadUserImgService;
-
- @Resource
- private UserRankingsService userRankingsService;
-
- @Resource
- private ConfigService configService;
-
- @Resource
- private SwiperPictureService swiperPictureService;
-
- @Resource
- private UserInfoExtraService userInfoExtraService;
-
- @Resource
- private UserInfoService userInfoService;
-
- @Resource
- private ThreeSaleSerivce threeSaleSerivce;
-
- @Resource
- private RedisManager redisManager;
-
- @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
- public void everyDayTaskList(AcceptData acceptData, int pageIndex, PrintWriter out, String uid)
- throws NotExistObjectException, UserInfoExtraException {
- // 鏌ヨ鍟嗗搧鎬绘暟
- Integer totalCount = 0;
- int totalPage = totalCount % Constant.PAGE_SIZE == 0 ? totalCount / Constant.PAGE_SIZE
- : totalCount / Constant.PAGE_SIZE + 1;
- PageEntity pageEntity = new PageEntity(pageIndex, Constant.PAGE_SIZE, totalCount, totalPage);
-
- List<InviteGetMoney> inviteGetMoneyList = userRankingsService.getRank(0, 5);
-
- com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
- data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
- data.put("everyDayTaskList", new JSONArray());
- data.put("inviteGetMoneyList",
- JSONArray.fromObject(JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList)));
- if (StringUtil.isNullOrEmpty(uid) || uid.equalsIgnoreCase("0")) {
- data.put("myTeam", "---");
- data.put("moneyToday", "---");
- data.put("moneyMonth", "---");
- data.put("moneyLastMonth", "---");
- } else {
- // 鎴戠殑闃熷憳
- long myFirstTeamCount = threeSaleSerivce.getFirstUsersCount(Long.parseLong(uid));
- long mySecondTeamCount = threeSaleSerivce.getSecondUsersCount(Long.parseLong(uid));
- long myTeamCount = myFirstTeamCount + mySecondTeamCount;
- data.put("myTeam", myTeamCount);
- // 1.5.0鍚庡凡缁忎笉浣跨敤姝ゅ瓧娈�
- data.put("moneyToday", "0");
- data.put("moneyMonth", "0");
- data.put("moneyLastMonth", "0");
- }
-
- // 娲诲姩瑙勫垯
- String key = "activityRules"; // key鍊�
- BusinessSystem system = new BusinessSystem();
- system.setCreatetime(java.lang.System.currentTimeMillis());
- system.setPlatform(1);
- system.setId(4L);
- SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
- // 杞崲鎹㈣绗� 缁欏墠绔�
- String valueN = values.getValue();
- String valueBr = valueN.replace("\n", "<br><br>");
-
- data.put("activityRules", valueBr);
- data.put("inviteList", String.format("http://%s/%s/client/share/friends_new.html",
- Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
- List<SwiperPicture> pictureList = swiperPictureService.getByBannerCard("invite_top_banner");
- if (pictureList != null && pictureList.size() > 0) {
- SwiperPicture picture = pictureList.get(0);
- com.alibaba.fastjson.JSONObject pictureJson = new com.alibaba.fastjson.JSONObject();
- pictureJson.put("src", picture.getSrc());
- pictureJson.put("jumpDetail", picture.getJumpDetail());
- pictureJson.put("params", picture.getParams());
- data.put("topBanner", pictureJson);
- }
-
- data.put("desc", configService.get("invite_desc"));
-
- boolean hasCode = false;
- if (uid != null && uid.trim().length() > 0) {
- String inviteCode = userInfoExtraService.getInviteCodeByUid(Long.parseLong(uid));
- if (inviteCode != null && inviteCode.trim().length() > 0) {
- hasCode = true; // 宸叉湁閭�璇风爜
- }
- }
-
- // 閭�璇锋縺娲婚摼鎺�
- if (!hasCode) {
- data.put("activationlink", configService.get("invite_activation_url"));
- }
-
- data.put("hasCode", hasCode);
-
- com.alibaba.fastjson.JSONObject root = new com.alibaba.fastjson.JSONObject();
- root.put("code", 0);
- root.put("data", data);
- out.print(root.toString());
- }
-
- /**
- *
- * 鏂规硶璇存槑: 鍒嗕韩濂藉弸閭�璇峰浘鐗�
- *
- * @author mawurui createTime 2018骞�4鏈�3鏃� 涓嬪崍3:49:05
- * @param pageIndex
- * @param out
- * @param uid
- * @throws NotExistObjectException
- * @throws IOException
- */
- @RequestMapping(value = "/listInviteFriendImg", method = RequestMethod.POST)
- public void listInviteFriendImg(AcceptData acceptData, Long uid, PrintWriter out)
- throws NotExistObjectException, IOException {
- JSONObject data = new JSONObject();
- if (uid != null && !uid.equals("0")) {
- List<String> imgList = spreadUserImgService.getUserSpreadImg(uid);
- data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
- }
-
- // 閭�璇烽摼鎺�
-// String shortLink = HttpUtil.getShortLink("http://" + Constant.wxGZConfig.getLoginHost() + "/"
-// + Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid);
- data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate");
-
- UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
- if (userInfoExtra != null) {
- data.put("inviteCode", userInfoExtra.getInviteCode());
- }
-
- // 閭�璇疯鍒�
- String key = "inviteRules"; // key鍊�
- BusinessSystem system = new BusinessSystem();
- system.setCreatetime(java.lang.System.currentTimeMillis());
- system.setPlatform(1);
- system.setId(4L);
- SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
- // 杞崲鎹㈣绗� 缁欏墠绔�
- String valueN = values.getValue();
- String valueBr = valueN.replace("\n", "<br><br>");
-
- data.put("helpLink", configService.get("invite_help_link"));
-
- data.put("inviteRules", valueBr);
- out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "鎴愬姛"));
- }
-
- /**
- * 閭�璇锋縺娲�-鐗瑰埆鎻愮ず璇�
- *
- * @param callback
- * @param out
- */
- @RequestMapping(value = "getActivationTip")
- public void getActivationTip(AcceptData acceptData, String callback, PrintWriter out) {
- try {
- String tip = configService.get("invite_activation_tip");
- if (tip == null || tip.trim().length() == 0) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鎻愰啋"));
- return;
- }
-
- JSONObject data = new JSONObject();
- data.put("tip", tip);
-
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
- } catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇澶辫触"));
- e.printStackTrace();
- }
- }
-
- /**
- * 婵�娲婚個璇�
- *
- * @param callback
- * @param uid
- * 鐢ㄦ埛id
- * @param inviteCode
- * 閭�璇峰槢
- * @param out
- */
- @RequestSerializableByKey(key = "'activationInvite-'+#uid")
- @RequestMapping(value = "activationInvite")
- public void activationInvite(AcceptData acceptData, String callback, Long uid, String inviteCode, PrintWriter out) {
- try {
-
- if (uid == null || inviteCode == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
- return;
- }
-
- String newCode = userInfoExtraService.activateInviteCode(uid, inviteCode);
- if (newCode == null || newCode.trim().length() == 0) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("婵�娲诲け璐�"));
- return;
- }
-
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("閭�璇风爜婵�娲绘垚鍔�"));
-
- } catch (UserInfoExtraException e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
- } catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("婵�娲诲け璐�"));
- e.printStackTrace();
- }
- }
-
- /**
- * 婵�娲婚個璇�
- *
- * @param callback
- * @param uid
- * 鐢ㄦ埛id
- * @param inviteCode
- * 閭�璇峰槢
- * @param out
- */
- @RequestSerializableByKey(key = "'activationInviteWX-'+#uid")
- @RequestMapping(value = "activationInviteWX")
- public void activationInviteWX(AcceptData acceptData, Long uid, String code, PrintWriter out) {
- try {
- userInfoExtraService.activationInviteWX(
- Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion()), uid, code);
- out.print(JsonUtil.loadTrueResult("閭�璇风爜婵�娲绘垚鍔�"));
- } catch (UserInfoExtraException e) {
- out.print(JsonUtil.loadFalseResult(e.getMsg()));
- } catch (Exception e) {
- out.print(JsonUtil.loadFalseResult("閭�璇风爜婵�娲诲け璐�"));
- e.printStackTrace();
- }
- }
-
- /**
- * 鑾峰彇閭�璇风爜
- *
- * @param callback
- * @param uid
- * 鐢ㄦ埛id
- * @param out
- */
- @RequestMapping(value = "getInviteCode")
- public void getInviteCode(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
- try {
-
- if (uid == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
- return;
- }
-
- UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
- if (userInfoExtra == null || userInfoExtra.getInviteCode() == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("閭�璇风爜涓嶅瓨鍦�"));
- return;
- }
- String tip = configService.get("invite_activation_success_tip");
-
- JSONObject data = new JSONObject();
- data.put("inviteCode", userInfoExtra.getInviteCode());
- data.put("tip", tip);
-
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
- } catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇鏁版嵁澶辫触"));
- e.printStackTrace();
- }
- }
-
- /**
- * 鑾峰彇閭�璇风煭杩炴帴
- *
- * @param callback
- * @param uid
- * 鐢ㄦ埛id
- * @param out
- */
- @RequestMapping(value = "getShortLink")
- public void getShortLink(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
- try {
-
- if (uid == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
- return;
- }
-
- String inviteShortLink = redisManager.getInviteShortLink(uid);
- if (inviteShortLink != null && inviteShortLink.trim().length() > 0) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇�1鍒嗛挓鍚庡啀璇�"));
- return;
- }
-
- String shortLink = UserUtil.getInviteShortLink(uid);
- // 缂撳瓨1鍒嗛挓
- redisManager.setInviteShortLink(uid, shortLink);
-
- JSONObject data = new JSONObject();
- data.put("shortLink", shortLink);
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
- } catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鐢熸垚鐭繛鎺ュけ璐�"));
- e.printStackTrace();
- }
- }
-
- /**
- * 鑾峰彇閭�璇风數璇濆彿鐮�
- *
- * @param callback
- * @param uid
- * 鐢ㄦ埛id
- * @param out
- */
- @RequestMapping(value = "getUserPhone")
- public void getUserPhone(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
- try {
-
- if (uid == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
- return;
- }
-
- UserInfo userInfo = userInfoService.selectByPKey(uid);
- if (userInfo == null || userInfo.getPhone() == null || userInfo.getPhone().trim().length() == 0) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛湭缁戝畾鐢佃瘽鍙风爜"));
- return;
- }
- JSONObject data = new JSONObject();
- data.put("phone", userInfo.getPhone());
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
- } catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇鏁版嵁澶辫触"));
- e.printStackTrace();
- }
- }
-
- /**
- * 鑾峰彇鐢ㄦ埛閭�璇蜂笂绾�
- *
- * @param callback
- * @param uid
- * @param out
- */
- @RequestMapping(value = "getUserBoss")
- public void getUserBoss(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
- if (uid == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
- return;
- }
-
- try {
- ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
- if (threeSale == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "鏃犱笂绾ч個璇蜂汉"));
- return;
- }
-
- UserInfo boss = threeSale.getBoss();
- if (boss == null) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓婄骇閭�璇蜂汉鑾峰彇澶辫触"));
- return;
- }
-
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
- Long createTime = threeSale.getCreateTime();
- Date inviteTime = new Date(createTime);
-
- JSONObject data = new JSONObject();
- data.put("nickName", boss.getNickName());
- data.put("portrait", boss.getPortrait());
- data.put("inviteTime", sdf.format(inviteTime));
- JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
- } catch (Exception e) {
- JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇鏁版嵁澶辫触"));
- e.printStackTrace();
- }
- }
-}
+package com.yeshi.fanli.controller.client.v1;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.JsonUtil;
+
+import com.yeshi.fanli.dto.money.InviteGetMoney;
+import com.yeshi.fanli.entity.accept.AcceptData;
+import com.yeshi.fanli.entity.bus.user.ThreeSale;
+import com.yeshi.fanli.entity.bus.user.UserInfo;
+import com.yeshi.fanli.entity.system.BusinessSystem;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.fanli.entity.system.SystemClientParams;
+import com.yeshi.fanli.exception.NotExistObjectException;
+import com.yeshi.fanli.exception.user.UserInfoExtraException;
+import com.yeshi.fanli.service.inter.config.ConfigService;
+import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
+import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
+import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
+import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.UserRankingsService;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
+import com.yeshi.common.entity.PageEntity;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.RedisManager;
+import com.yeshi.fanli.util.StringUtil;
+import com.yeshi.fanli.util.VersionUtil;
+import com.yeshi.fanli.util.account.UserUtil;
+import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
+import com.yeshi.fanli.vo.homemodule.BannerVO;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * 绫昏鏄�: 鍓嶇瀹㈡埛绔墍闇�鎺ュ彛
+ *
+ * @author mawurui
+ * @createTime 2018骞�4鏈�2鏃� 涓婂崍9:39:30
+ * @version /test/invite
+ */
+@Controller
+@RequestMapping("api/v1/invite")
+public class InviteGetMoneyController {
+ @Resource
+ private SystemClientParamsService systemClientParamsService;
+
+ @Resource
+ private SpreadUserImgService spreadUserImgService;
+
+ @Resource
+ private UserRankingsService userRankingsService;
+
+ @Resource
+ private ConfigService configService;
+
+ @Resource
+ private SwiperPictureService swiperPictureService;
+
+ @Resource
+ private UserInfoExtraService userInfoExtraService;
+
+ @Resource
+ private UserInfoService userInfoService;
+
+ @Resource
+ private ThreeSaleSerivce threeSaleSerivce;
+
+ @Resource
+ private RedisManager redisManager;
+
+ @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
+ public void everyDayTaskList(AcceptData acceptData, int pageIndex, PrintWriter out, String uid)
+ throws NotExistObjectException, UserInfoExtraException {
+ // 鏌ヨ鍟嗗搧鎬绘暟
+ Integer totalCount = 0;
+ int totalPage = totalCount % Constant.PAGE_SIZE == 0 ? totalCount / Constant.PAGE_SIZE
+ : totalCount / Constant.PAGE_SIZE + 1;
+ PageEntity pageEntity = new PageEntity(pageIndex, Constant.PAGE_SIZE, totalCount, totalPage);
+
+ List<InviteGetMoney> inviteGetMoneyList = userRankingsService.getRank(0, 5);
+
+ com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
+ data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
+ data.put("everyDayTaskList", new JSONArray());
+ data.put("inviteGetMoneyList",
+ JSONArray.fromObject(JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList)));
+ if (StringUtil.isNullOrEmpty(uid) || uid.equalsIgnoreCase("0")) {
+ data.put("myTeam", "---");
+ data.put("moneyToday", "---");
+ data.put("moneyMonth", "---");
+ data.put("moneyLastMonth", "---");
+ } else {
+ // 鎴戠殑闃熷憳
+ long myFirstTeamCount = threeSaleSerivce.countFirstTeam(Long.parseLong(uid));
+ long mySecondTeamCount = threeSaleSerivce.countSecondTeam(Long.parseLong(uid));
+ long myTeamCount = myFirstTeamCount + mySecondTeamCount;
+ data.put("myTeam", myTeamCount);
+ // 1.5.0鍚庡凡缁忎笉浣跨敤姝ゅ瓧娈�
+ data.put("moneyToday", "0");
+ data.put("moneyMonth", "0");
+ data.put("moneyLastMonth", "0");
+ }
+
+ // 娲诲姩瑙勫垯
+ String key = "activityRules"; // key鍊�
+ BusinessSystem system = new BusinessSystem();
+ system.setCreatetime(java.lang.System.currentTimeMillis());
+ system.setPlatform(1);
+ system.setId(4L);
+ SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
+ // 杞崲鎹㈣绗� 缁欏墠绔�
+ String valueN = values.getValue();
+ String valueBr = valueN.replace("\n", "<br><br>");
+
+ data.put("activityRules", valueBr);
+ data.put("inviteList", String.format("http://%s/%s/client/share/friends_new.html",
+ Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
+ List<BannerVO> pictureList = swiperPictureService.getByBannerCardAndVersion("invite_top_banner",
+ acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
+ if (pictureList != null && pictureList.size() > 0) {
+ BannerVO picture = pictureList.get(0);
+ com.alibaba.fastjson.JSONObject pictureJson = new com.alibaba.fastjson.JSONObject();
+ pictureJson.put("src", picture.getSrc());
+ pictureJson.put("jumpDetail", picture.getJumpDetail());
+ pictureJson.put("params", picture.getParams());
+ data.put("topBanner", pictureJson);
+ }
+
+ data.put("desc", configService.getValue(ConfigKeyEnum.inviteDesc.getKey(),acceptData.getSystem()));
+
+ boolean hasCode = false;
+ if (uid != null && uid.trim().length() > 0) {
+ String inviteCode = userInfoExtraService.getInviteCodeByUid(Long.parseLong(uid));
+ if (inviteCode != null && inviteCode.trim().length() > 0) {
+ hasCode = true; // 宸叉湁閭�璇风爜
+ }
+ }
+
+ // 閭�璇锋縺娲婚摼鎺�
+ if (!hasCode) {
+ data.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem()));
+ }
+
+ data.put("hasCode", hasCode);
+
+ com.alibaba.fastjson.JSONObject root = new com.alibaba.fastjson.JSONObject();
+ root.put("code", 0);
+ root.put("data", data);
+ out.print(root.toString());
+ }
+
+ /**
+ *
+ * 鏂规硶璇存槑: 鍒嗕韩濂藉弸閭�璇峰浘鐗�
+ *
+ * @author mawurui createTime 2018骞�4鏈�3鏃� 涓嬪崍3:49:05
+ * @param out
+ * @param uid
+ * @throws NotExistObjectException
+ * @throws IOException
+ */
+ @RequestSerializableByKey(key = "'listInviteFriendImg-'+#uid")
+ @RequestMapping(value = "/listInviteFriendImg", method = RequestMethod.POST)
+ public void listInviteFriendImg(AcceptData acceptData, Long uid, PrintWriter out, HttpServletRequest request)
+ throws NotExistObjectException, IOException {
+ JSONObject data = new JSONObject();
+ if (uid != null && !uid.equals("0")) {
+ List<String> imgList = spreadUserImgService.getUserSpreadImg(uid, request);
+ data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList));
+ }
+
+ // 閭�璇烽摼鎺�
+ // String shortLink = HttpUtil.getShortLink("http://" +
+ // Constant.wxGZConfig.getLoginHost() + "/"
+ // + Constant.systemCommonConfig.getProjectName() +
+ // "/client/threeShareNew?uid=" + uid);
+ data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate");
+
+ String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+ if (!StringUtil.isNullOrEmpty(inviteCode)) {
+ data.put("inviteCode", inviteCode);
+ }
+
+ // 閭�璇疯鍒�
+ String key = "inviteRules"; // key鍊�
+ BusinessSystem system = new BusinessSystem();
+ system.setCreatetime(java.lang.System.currentTimeMillis());
+ system.setPlatform(1);
+ system.setId(4L);
+ SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
+ // 杞崲鎹㈣绗� 缁欏墠绔�
+ String valueN = values.getValue();
+ String valueBr = valueN.replace("\n", "<br><br>");
+
+ data.put("helpLink", configService.getValue(ConfigKeyEnum.inviteHelpLink.getKey(),acceptData.getSystem()));
+
+ data.put("inviteRules", valueBr);
+ out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "鎴愬姛"));
+ }
+
+ /**
+ * 閭�璇锋縺娲�-鐗瑰埆鎻愮ず璇�
+ *
+ * @param callback
+ * @param out
+ */
+ @RequestMapping(value = "getActivationTip")
+ public void getActivationTip(AcceptData acceptData, String callback, PrintWriter out) {
+ try {
+ String tip = configService.getValue(ConfigKeyEnum.inviteActivationTip.getKey(),acceptData.getSystem());
+ if (tip == null || tip.trim().length() == 0) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鎻愰啋"));
+ return;
+ }
+
+ JSONObject data = new JSONObject();
+ data.put("tip", tip);
+
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇澶辫触"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 婵�娲婚個璇�
+ *
+ * @param callback
+ * @param uid
+ * 鐢ㄦ埛id
+ * @param inviteCode
+ * 閭�璇峰槢
+ * @param out
+ */
+ @RequestSerializableByKey(key = "'activationInvite-'+#uid")
+ @RequestMapping(value = "activationInvite")
+ public void activationInvite(AcceptData acceptData, String callback, Long uid, String inviteCode, PrintWriter out) {
+ try {
+ if (uid == null || inviteCode == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
+ return;
+ }
+
+ String newCode = userInfoExtraService.activateInviteCode(uid, inviteCode);
+ if (newCode == null || newCode.trim().length() == 0) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("婵�娲诲け璐�"));
+ return;
+ }
+ if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
+ String myInviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+ JSONObject data = new JSONObject();
+ data.put("inviteCode", myInviteCode);
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+ } else
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("閭�璇风爜婵�娲绘垚鍔�"));
+
+ } catch (UserInfoExtraException e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("婵�娲诲け璐�"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 婵�娲婚個璇�
+ *
+ * @param uid
+ * 鐢ㄦ埛id
+ * 閭�璇峰槢
+ * @param out
+ */
+ @RequestSerializableByKey(key = "'activationInviteWX-'+#uid")
+ @RequestMapping(value = "activationInviteWX")
+ public void activationInviteWX(AcceptData acceptData, Long uid, String code, PrintWriter out) {
+ try {
+ userInfoExtraService.activationInviteWX(
+ Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion()), uid, code);
+
+ if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) {
+ String myInviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+ JSONObject data = new JSONObject();
+ data.put("inviteCode", myInviteCode);
+ JsonUtil.printMode(out, "", JsonUtil.loadTrueResult(data));
+ } else
+ out.print(JsonUtil.loadTrueResult("閭�璇风爜婵�娲绘垚鍔�"));
+ } catch (UserInfoExtraException e) {
+ out.print(JsonUtil.loadFalseResult(e.getMsg()));
+ } catch (Exception e) {
+ out.print(JsonUtil.loadFalseResult("閭�璇风爜婵�娲诲け璐�"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 鑾峰彇閭�璇风爜
+ *
+ * @param callback
+ * @param uid
+ * 鐢ㄦ埛id
+ * @param out
+ */
+ @RequestMapping(value = "getInviteCode")
+ public void getInviteCode(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
+ try {
+
+ if (uid == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
+ return;
+ }
+
+ String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
+ if (StringUtil.isNullOrEmpty(inviteCode)) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("閭�璇风爜涓嶅瓨鍦�"));
+ return;
+ }
+ String tip = configService.getValue(ConfigKeyEnum.inviteActivationSuccessTip.getKey(),acceptData.getSystem());
+
+ JSONObject data = new JSONObject();
+ data.put("inviteCode", inviteCode);
+ data.put("tip", tip);
+
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇鏁版嵁澶辫触"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 鑾峰彇閭�璇风煭杩炴帴
+ *
+ * @param callback
+ * @param uid
+ * 鐢ㄦ埛id
+ * @param out
+ */
+ @RequestMapping(value = "getShortLink")
+ public void getShortLink(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
+ try {
+
+ if (uid == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
+ return;
+ }
+
+ String inviteShortLink = redisManager.getInviteShortLink(uid);
+ if (inviteShortLink != null && inviteShortLink.trim().length() > 0) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("璇�1鍒嗛挓鍚庡啀璇�"));
+ return;
+ }
+
+ String shortLink = UserUtil.getInviteShortLink(uid);
+ // 缂撳瓨1鍒嗛挓
+ redisManager.setInviteShortLink(uid, shortLink);
+
+ JSONObject data = new JSONObject();
+ data.put("shortLink", shortLink);
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鐢熸垚鐭繛鎺ュけ璐�"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 鑾峰彇閭�璇风數璇濆彿鐮�
+ *
+ * @param callback
+ * @param uid
+ * 鐢ㄦ埛id
+ * @param out
+ */
+ @RequestMapping(value = "getUserPhone")
+ public void getUserPhone(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
+ try {
+
+ if (uid == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
+ return;
+ }
+
+ UserInfo userInfo = userInfoService.selectByPKey(uid);
+ if (userInfo == null || userInfo.getPhone() == null || userInfo.getPhone().trim().length() == 0) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛湭缁戝畾鐢佃瘽鍙风爜"));
+ return;
+ }
+ JSONObject data = new JSONObject();
+ data.put("phone", userInfo.getPhone());
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇鏁版嵁澶辫触"));
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 鑾峰彇鐢ㄦ埛閭�璇蜂笂绾�
+ *
+ * @param callback
+ * @param uid
+ * @param out
+ */
+ @RequestMapping(value = "getUserBoss")
+ public void getUserBoss(AcceptData acceptData, String callback, Long uid, PrintWriter out) {
+ if (uid == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犻�掑弬鏁颁笉姝g‘"));
+ return;
+ }
+
+ try {
+ ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
+ if (threeSale == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "鏃犱笂绾ч個璇蜂汉"));
+ return;
+ }
+
+ UserInfo boss = threeSale.getBoss();
+ if (boss == null) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("涓婄骇閭�璇蜂汉鑾峰彇澶辫触"));
+ return;
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
+ Long createTime = threeSale.getCreateTime();
+ Date inviteTime = new Date(createTime);
+
+ JSONObject data = new JSONObject();
+ data.put("nickName", boss.getNickName());
+ data.put("portrait", boss.getPortrait());
+ data.put("inviteTime", sdf.format(inviteTime));
+ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
+
+ } catch (Exception e) {
+ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鑾峰彇鏁版嵁澶辫触"));
+ e.printStackTrace();
+ }
+ }
+}
--
Gitblit v1.8.0