From a4637ae9d71aa4a624b217ed3a1483f0e3a3a7ed Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期三, 06 五月 2020 14:04:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java | 332 +++++++++++++++++++++++++++--------------------------- 1 files changed, 165 insertions(+), 167 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 f93cd6f..68c91cf 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 @@ -13,7 +13,6 @@ 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.vip.UserVIPLevel; @@ -23,9 +22,9 @@ import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum; import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo; +import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; 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.UserInviteValidNum; import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord; import com.yeshi.fanli.entity.bus.user.WeiXinUser; @@ -40,16 +39,17 @@ 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.order.CommonOrderCountService; 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.invite.UserInviteService; import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService; import com.yeshi.fanli.service.inter.user.invite.UserInviteValidRecordService; +import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.RedisKeyEnum; @@ -94,9 +94,6 @@ @Resource private UserVIPInfoService userVIPInfoService; - - @Resource - private UserInviteSeparateService userInviteSeparateService; @Resource private SpreadImgService spreadImgService; @@ -116,6 +113,11 @@ @Resource private UserInviteValidNumService userInviteValidNumService; + @Resource + private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; + + @Resource + private CommonOrderCountService commonOrderCountService; /** * 閭�璇风爜楠岃瘉 @@ -206,7 +208,7 @@ } /** - * 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ 1.5.3鏌ヨ鏈夋晥闃熷憳 + * 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ * * @param acceptData * @param id @@ -219,29 +221,37 @@ return; } - if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { - getMyTeamNew(acceptData, page, uid, type, out); - return; - } - + List<Long> listId = new ArrayList<Long>(); + + + + long count = 0; List<ThreeSale> listTeam = null; if (type == 1) { - listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, 1); - count = threeSaleSerivce.countFirstTeam(uid, 1); + listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId); + count = threeSaleSerivce.countFirstTeam(uid, listId); } else if (type == 2) { - listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, 1); - count = threeSaleSerivce.countSecondTeam(uid, 1); + listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, listId); + count = threeSaleSerivce.countSecondTeam(uid, listId); } - boolean needVIPInfo = false; - if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) - needVIPInfo = true; - - // 缁勭粐鏁版嵁 - JSONObject resultData = organizeTeam(count, listTeam, uid, type,needVIPInfo); - - // 绗竴椤靛垽鏂槸鍚︽縺娲� 鏄惁鏈夐槦鍛� + // 鏁版嵁鍔犲伐 + JSONArray array = null; + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + array = organizeTeamNew(listTeam, uid, type, true); + } else { + boolean needVIPInfo = false; + if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) + needVIPInfo = true; + array = organizeTeam(listTeam, uid, type,needVIPInfo); + } + + + JSONObject result = new JSONObject(); + result.put("count", count); + result.put("list", array); + if (type == 1 && page == 1) { boolean hasCode = false; UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); @@ -249,10 +259,10 @@ if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) hasCode = true; } - resultData.put("hasCode", hasCode); - resultData.put("hasTeam", count > 0 ? true : false); + result.put("hasCode", hasCode); + result.put("hasTeam", count > 0 ? true : false); } - out.print(JsonUtil.loadTrueResult(resultData)); + out.print(JsonUtil.loadTrueResult(result)); } /** @@ -264,10 +274,8 @@ * @param type * @return */ - private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type, boolean needVipInfo) { - JSONObject result = new JSONObject(); + private JSONArray organizeTeam(List<ThreeSale> list, Long uid, int type, boolean needVipInfo) { JSONArray resultArray = new JSONArray(); - Date todayTime = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm"); SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); @@ -299,32 +307,6 @@ // 娣诲姞鏄惁涓篤IP 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(); @@ -376,46 +358,9 @@ object.put("recentMsg", array); resultArray.add(object); } - - result.put("count", count); - result.put("list", resultArray); - return result; + return resultArray; } - - private void getMyTeamNew(AcceptData acceptData, long page, long uid, int type, PrintWriter out) { - if (type != 1 && type != 2) { - out.print(JsonUtil.loadFalseResult("绮変笣绫诲瀷涓嶆纭�")); - return; - } - - long count = 0; - List<ThreeSale> listTeam = null; - if (type == 1) { - listTeam = threeSaleSerivce.listFirstTeamByUndeleted((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid); - count = threeSaleSerivce.countFirstTeamByUndeleted(uid); - } else if (type == 2) { - listTeam = threeSaleSerivce.listSecondTeamByUndeleted((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid); - count = threeSaleSerivce.countSecondTeamByUndeleted(uid); - } - - JSONObject result = new JSONObject(); - result.put("count", count); - result.put("list", organizeTeamNew(count, listTeam, uid, type, true)); - - // 绗竴椤靛垽鏂槸鍚︽縺娲� 鏄惁鏈夐槦鍛� - if (type == 1 && page == 1) { - boolean hasCode = false; - UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); - if (userInfoExtra != null) { - if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) - hasCode = true; - } - result.put("hasCode", hasCode); - result.put("hasTeam", count > 0 ? true : false); - } - out.print(JsonUtil.loadTrueResult(result)); - } /** * 鍔犲伐鏁版嵁 @@ -426,7 +371,7 @@ * @param wxtip 鏄渶瑕佸井淇℃彁绀� * @return */ - private JSONArray organizeTeamNew(long count, List<ThreeSale> list, Long uid, int type, boolean wxtip) { + private JSONArray organizeTeamNew(List<ThreeSale> list, Long uid, int type, boolean wxtip) { JSONArray resultArray = new JSONArray(); if (list == null || list.size() == 0) { return resultArray; @@ -447,22 +392,13 @@ if (type == 1) { validType = UserInviteValidRecord.TYPE_ONE; } + List<Long> listVid = userInviteValidRecordService.getValidWorkerIdsByUid(uid, listWid, validType); for (ThreeSale threeSale : list) { UserInfo worker = threeSale.getWorker(); Long workerId = worker.getId(); - // 閭�璇风姸鎬� - Boolean state = threeSale.getState(); - if (type == 2) { - if (state && threeSale.getStateSuper()) { - state = true; - } else { - state = false; - } - } - // 閭�璇锋垚鍔熸椂闂� Long succeedTime = threeSale.getSucceedTime(); if (succeedTime == null) { @@ -471,7 +407,7 @@ // 鏈夋晥绮変笣 boolean validFans = false; - if (state && listVid != null && listVid.size() > 0 && listVid.contains(workerId)) { + if (listVid != null && listVid.size() > 0 && listVid.contains(workerId)) { validFans = true; } @@ -501,7 +437,7 @@ if(level == null) { level = UserLevelEnum.daRen; } - + level = UserLevelUtil.getShowLevel(level); JSONObject object = new JSONObject(); object.put("workerId", workerId); @@ -509,54 +445,11 @@ object.put("portrait", worker.getPortrait()); object.put("inviteId", threeSale.getId()); object.put("inviteTime", format.format(new Date(succeedTime)) + " 鍔犲叆"); - object.put("state", state? 1 : 2); + object.put("state", 1); object.put("recentMsg", array); object.put("level", level.name()); object.put("validFans", validFans); - - // 鍒ゆ柇鏄惁瀛樺湪鑴辩鍏崇郴闃熷憳 - if (vipLevel != null && state) { - Long bossId = threeSale.getBoss().getId(); - UserInviteSeparate separate = userInviteSeparateService.selectByWorkerIdAndBossId(workerId, bossId); - if (separate != null && separate.getEndTime() != null) { - try { - JSONObject contentJson1 = new JSONObject(); - contentJson1.put("color", "#888888"); - contentJson1.put("content", "灏嗕簬"); - - String dateDiff = DateUtil.dateDiff4(new Date(), separate.getEndTime()); - JSONObject contentJson2 = new JSONObject(); - contentJson2.put("color", "#F14242"); - contentJson2.put("content", dateDiff); - - JSONObject contentJson3 = new JSONObject(); - contentJson3.put("color", "#888888"); - contentJson3.put("content", "鍚庤劚绂婚個璇峰叧绯�"); - - JSONArray vipBreak = new JSONArray(); - vipBreak.add(contentJson1); - vipBreak.add(contentJson2); - vipBreak.add(contentJson3); - object.put("vipBreakTime",vipBreak); - - List<String> tips = new ArrayList<String>(); - tips.add("浜�"+ TimeUtil.formatDateDot(vipLevel.getSuccessTime()) + "鍗囩骇涓�" + level.getName()); - if (type == 1) { - tips.add("浣犻渶瑕佸湪"+ dateDiff +"鍐呭崌绾т负浼氬憳锛屽惁鍒欐寜鐓ч個璇疯鍒橳A灏嗕笌浣犺劚绂婚個璇峰叧绯汇��"); - tips.add("璧跺揩鍔犳补鍗囩骇涓轰細鍛樺惂锛�"); - } else { - tips.add("浣犻渶瑕佽緟鍔㏕A鐨勯個璇蜂汉"+ threeSale.getBoss().getNickName()+ "鍦�"+dateDiff+"鍐呭崌绾т负浼氬憳锛屽惁鍒欒繖浣嶉棿鎺ョ矇涓�" +worker.getNickName()+"灏嗕笌浣犺劚绂婚個璇峰叧绯汇��"); - tips.add("璧跺揩甯姪TA鍗囩骇涓轰細鍛樺惂锛�"); - } - object.put("vipBreakTip",tips); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - if (wxtip && type == 1 && threeSale.getState() != null && threeSale.getState()) { // 涓�绾ч槦鍛� 鏌ヨ鏄电О澶囨敞 String memoName = null; @@ -583,7 +476,6 @@ } } } - resultArray.add(object); } return resultArray; @@ -605,12 +497,12 @@ return; } - List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid, 1); - long count = threeSaleSerivce.countFirstTeam(tid, 1); + List<ThreeSale> listTeam = threeSaleSerivce.listFirstTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, tid); + long count = threeSaleSerivce.countFirstTeam(tid); JSONObject result = new JSONObject(); result.put("count", count); - result.put("list", organizeTeamNew(count, listTeam, tid, 1, false)); + result.put("list", organizeTeamNew(listTeam, tid, 1, false)); out.print(JsonUtil.loadTrueResult(result)); } @@ -627,13 +519,14 @@ JSONObject bossData = getBossInfo(uid, threeSaleSerivce.getMyBoss(uid)); JSONObject resultData = new JSONObject(); - long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1); + long firstTeam = threeSaleSerivce.countFirstTeam(uid); + long countSecond = threeSaleSerivce.countSecondTeam(uid); resultData.put("boss", bossData); - resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey())); resultData.put("firstTeam", firstTeam); - resultData.put("firstTeamTotal", threeSaleSerivce.countFirstTeam(uid, null)); - resultData.put("secondTeam", threeSaleSerivce.countSecondTeam(uid, 1)); - resultData.put("secondTeamTotal", threeSaleSerivce.countSecondTeam(uid, null)); + resultData.put("firstTeamTotal", firstTeam); + resultData.put("secondTeam", countSecond); + resultData.put("secondTeamTotal", countSecond); + resultData.put("helpLink", configService.get(ConfigKeyEnum.teamHelpUrl.getKey())); boolean hasTeam = true; if (firstTeam <= 0) { @@ -908,17 +801,122 @@ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } - - @RequestMapping(value = "remvoeBreak") - public void remvoeBreak(String callback, AcceptData acceptData,Long inviteId, Long uid, Long tid, PrintWriter out) { - if (uid == null || inviteId == null || tid == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("浼犺緭鍙傛暟涓嶅畬鏁�")); + /** + * 鑾峰彇绮変笣淇℃伅 + * @param acceptData + * @param uid + * @param workerId + * @param out + */ + @RequestMapping(value = "getFansInfo") + public void getFansInfo(AcceptData acceptData,Long uid, Long workerId, PrintWriter out) { + if (uid == null || workerId == null) { + out.print(JsonUtil.loadFalseResult("鐢ㄦ埛id缂哄け")); return; } - threeSaleSerivce.remvoeBreak(inviteId, uid, tid); - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛")); + ThreeSale threeSale = threeSaleSerivce.getByWorkerId(workerId); + if (threeSale == null) { + out.print(JsonUtil.loadFalseResult("閭�璇峰叧绯讳笉瀛樺湪")); + return; + } + + UserInfo user = userInfoService.selectByPKey(workerId); + if (user == null) { + out.print(JsonUtil.loadFalseResult("鐢ㄦ埛涓嶅瓨鍦�")); + return; + } + + JSONArray tagArray = new JSONArray(); + String memoName = user.getNickName(); + Long succeedTime = threeSale.getSucceedTime(); + + JSONObject data = new JSONObject(); + data.put("nickName", user.getNickName()); + data.put("phone", user.getPhone()); + data.put("joinTime", TimeUtil.formatDate(succeedTime == null? threeSale.getCreateTime() : succeedTime)); + + ThreeSaleExtraInfo saleExtraInfo = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(uid, workerId); + if (saleExtraInfo != null) { + if(!StringUtil.isNullOrEmpty(saleExtraInfo.getNickname())) { + memoName = saleExtraInfo.getNickname(); + } + String tags = saleExtraInfo.getTags(); + if (!StringUtil.isNullOrEmpty(tags)) { + tagArray = JSONArray.fromObject(tags); + } + } + data.put("memoName", memoName); + data.put("tags", tagArray); + + Date activeTime = null; + String weixin = null; + UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId); + if (userInfoExtra != null) { + weixin = userInfoExtra.getWeiXin(); + activeTime = userInfoExtra.getActiveTime(); + } + data.put("weixin", StringUtil.isNullOrEmpty(weixin)? "": weixin); + data.put("loginTime", TimeUtil.formatDate(activeTime == null? userInfoExtra.getCreateTime():activeTime)); + + UserExtraTaoBaoInfo userExtraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(workerId); + if (userExtraTaoBaoInfo != null && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getRelationId()) + && !StringUtil.isNullOrEmpty(userExtraTaoBaoInfo.getSpecialId())) { + data.put("taobao", true); + } else { + data.put("taobao", false); + } + + long indirectNum = 0; + long directNum = threeSaleSerivce.countFirstTeam(workerId); + if (directNum > 0) { + indirectNum = threeSaleSerivce.countSecondTeam(workerId); + } + data.put("directNum", directNum); + data.put("indirectNum", 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("orderTB", countTB); + data.put("orderJD", countJD); + data.put("orderPDD", countPDD); + out.print(JsonUtil.loadTrueResult(data)); } + + /** + * 鑾峰彇绮変笣淇℃伅 + * @param acceptData + * @param uid + * @param workerId + * @param out + */ + @RequestMapping(value = "saveTags") + public void saveTags(AcceptData acceptData,Long uid, Long workerId, String tags, PrintWriter out) { + if (uid == null || workerId == null) { + out.print(JsonUtil.loadFalseResult("鐢ㄦ埛id缂哄け")); + return; + } + + ThreeSaleExtraInfo saleExtraInfo = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(uid, workerId); + if (saleExtraInfo != null) { + ThreeSaleExtraInfo upObject = new ThreeSaleExtraInfo(); + upObject.setTags(tags); + upObject.setId(saleExtraInfo.getId()); + upObject.setUpdateTime(new Date()); + threeSaleExtraInfoSerivce.updateByPrimaryKeySelective(upObject); + } else { + saleExtraInfo = new ThreeSaleExtraInfo(); + saleExtraInfo.setBoss(new UserInfo(uid)); + saleExtraInfo.setWorker(new UserInfo(workerId)); + saleExtraInfo.setTags(tags); + saleExtraInfo.setCreateTime(new Date()); + threeSaleExtraInfoSerivce.insertSelective(saleExtraInfo); + } + out.print(JsonUtil.loadTrueResult("淇濆瓨鎴愬姛")); + } } -- Gitblit v1.8.0