From a3ead770c30b310b9b1b7e3786d5d847da540e55 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期三, 25 十二月 2019 12:21:20 +0800 Subject: [PATCH] 2.0.6 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java | 125 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 122 insertions(+), 3 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 7d1d7d6..30b5568 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 @@ -8,10 +8,12 @@ import java.util.Map; 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.DateUtil; import org.yeshi.utils.JsonUtil; import com.yeshi.fanli.dto.wx.WXAccountInfoDTO; @@ -22,14 +24,22 @@ import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.bus.user.UserInfoExtra; +import com.yeshi.fanli.entity.bus.user.UserInviteSeparate; import com.yeshi.fanli.entity.bus.user.WeiXinUser; +import com.yeshi.fanli.entity.system.BusinessSystem; +import com.yeshi.fanli.entity.system.SystemClientParams; import com.yeshi.fanli.exception.user.UserAccountException; import com.yeshi.fanli.exception.user.UserInfoExtraException; +import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.config.ConfigService; +import com.yeshi.fanli.service.inter.config.SpreadImgService; +import com.yeshi.fanli.service.inter.config.SystemClientParamsService; import com.yeshi.fanli.service.inter.msg.UserSystemMsgService; import com.yeshi.fanli.service.inter.push.PushService; +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.UserInviteSeparateService; 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.vip.UserVIPInfoService; @@ -73,7 +83,21 @@ @Resource private UserVIPInfoService userVIPInfoService; + + @Resource + private UserInviteSeparateService userInviteSeparateService; + @Resource + private SpreadImgService spreadImgService; + + @Resource + private SpreadUserImgService spreadUserImgService; + + @Resource + private SystemClientParamsService systemClientParamsService; + + + /** * 閭�璇风爜楠岃瘉 * @@ -249,9 +273,38 @@ Date inviteTime = new Date(threeSale.getCreateTime()); object.put("inviteTime", format.format(inviteTime) + " 鍔犲叆"); // 娣诲姞鏄惁涓篤IP - if (vipMap != null && vipMap.get(worker.getId()) != null) + if (vipMap != null && vipMap.get(worker.getId()) != null) { object.put("vip", vipMap.get(worker.getId())); + if (vipMap.get(worker.getId())) { + UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(worker.getId(), uid); + if (separate != null && separate.getEndTime() != null) { + try { + + + JSONObject contentJson1 = new JSONObject(); + contentJson1.put("color", "#888888"); + contentJson1.put("content", "灏嗕簬"); + JSONObject contentJson2 = new JSONObject(); + contentJson2.put("color", "#F14242"); + contentJson2.put("content", DateUtil.dateDiff4(new Date(), separate.getEndTime())); + + JSONObject contentJson3 = new JSONObject(); + contentJson3.put("color", "#888888"); + contentJson3.put("content", "鍚庤劚绂婚個璇峰叧绯�"); + + JSONArray array = new JSONArray(); + array.add(contentJson1); + array.add(contentJson2); + array.add(contentJson3); + object.put("vipBreakTime",array); + + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } String fontColor1 = "#888888"; JSONArray array = new JSONArray(); if (threeSale.getState()) { @@ -317,7 +370,7 @@ */ @RequestMapping(value = "countMyTeam", method = RequestMethod.POST) public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) { - JSONObject bossData = getBossInfo(acceptData, uid, threeSaleSerivce.getMyBoss(uid)); + JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid)); JSONObject resultData = new JSONObject(); long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1); @@ -370,6 +423,23 @@ } /** + * 鑾峰彇鐢ㄦ埛淇℃伅 + * @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 @@ -377,7 +447,7 @@ * @param threeSale * @return */ - private JSONObject getBossInfo(AcceptData acceptData, long uid, ThreeSale threeSale) { + private JSONObject getBossInfo(long uid, ThreeSale threeSale) { JSONObject bossData = new JSONObject(); if (threeSale != null && threeSale.getBoss() != null) { UserInfo boss = threeSale.getBoss(); @@ -508,4 +578,53 @@ out.print(JsonUtil.loadFalseResult("鎻愰啋澶辫触")); } } + + + @RequestSerializableByKey(key = "'getInviteImgs-'+#uid") + @RequestMapping(value = "/getInviteImgs", method = RequestMethod.POST) + public void getInviteImgs(AcceptData acceptData, Long uid, Integer page, PrintWriter out, HttpServletRequest request) { + if (uid == null || uid <= 0) { + out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�")); + return; + } + + if (page == null || page < 1) + page = 1; + + try { + String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); + if (StringUtil.isNullOrEmpty(inviteCode)) { + out.print(JsonUtil.loadFalseResult("閭�璇风爜鏈縺娲�")); + return; + } + + int count = 3; + if (page > 1) + count = Integer.MAX_VALUE; + + // 閭�璇峰浘 + List<String> imgList = spreadUserImgService.getUserSpreadImgToPage(uid, page, count, request); + + // 閭�璇疯鍒� + BusinessSystem system = new BusinessSystem(); + system.setId(4L); + system.setPlatform(1); + system.setCreatetime(java.lang.System.currentTimeMillis()); + SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, "inviteRules"); + + JSONObject data = new JSONObject(); + data.put("count", spreadImgService.countAll()); + data.put("inviteCode", inviteCode); + data.put("helpLink", configService.get("invite_help_link")); + data.put("inviteRules", values.getValue().replace("\n", "<br><br>")); + data.put("imgUrlList", JsonUtil.getSimpleGsonWithDate().toJson(imgList)); + data.put("inviteLink", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yeshi.ec.rebate"); + out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "鎴愬姛")); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + out.print(JsonUtil.loadFalseResult("閭�璇蜂俊鎭幏鍙栧け璐�")); + } + } + + } -- Gitblit v1.8.0