From 972d3bc71115ec977dccf835fbcd148da3bcc86c Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 03 九月 2019 16:41:49 +0800 Subject: [PATCH] 统计可用的免单券数量-countUsableFreeCouponForBuy --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java | 72 +++++++++++++++++++++++++++++++++--- 1 files changed, 66 insertions(+), 6 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 00861ef..d0b4dcc 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 @@ -27,6 +27,7 @@ import com.yeshi.fanli.service.inter.msg.UserSystemMsgService; import com.yeshi.fanli.service.inter.push.PushService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; +import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; @@ -49,6 +50,9 @@ @Resource private ThreeSaleSerivce threeSaleSerivce; + + @Resource + private UserInfoService userInfoService; @Resource private UserInfoExtraService userInfoExtraService; @@ -122,6 +126,18 @@ // 缁勭粐鏁版嵁 JSONObject resultData = organizeTeam(count, listTeam, uid, type); + + // 绗竴椤靛垽鏂槸鍚︽縺娲� 鏄惁鏈夐槦鍛� + if (type == 1 && page == 1) { + boolean hasCode = false; + UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); + if (userInfoExtra != null) { + if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) + hasCode = true; + } + resultData.put("hasCode", hasCode); + resultData.put("hasTeam", count > 0? true:false); + } out.print(JsonUtil.loadTrueResult(resultData)); } @@ -272,6 +288,7 @@ tipWeiXin.add("浣犱篃鍙互鍚戦個璇蜂汉瀛︿範鎴栧悜涓�绾ч槦鍛樻暀鎺堣禋閽辨妧宸с��"); } resultData.put("tipWeiXin", tipWeiXin); + resultData.put("tipWeiXinAdd", "娣诲姞寰俊鍙峰悗锛屼綘鐨勯個璇蜂汉鍜屼竴绾ч槦鍛樺彲浠ラ�氳繃寰俊涓庝綘寤虹珛鑱旂郴銆�"); resultData.put("bdWeiXin", bdWeiXin); out.print(JsonUtil.loadTrueResult(resultData)); @@ -311,7 +328,6 @@ } } bossData.put("inviteTime", "浣犱簬 " + sdf.format(inviteTime) + "鎺ュ彈浜員A鐨勯個璇�"); - } else { bossData.put("hasBoss", false); bossData.put("helpLink", configService.get("invite_code_hlep_link")); @@ -336,6 +352,12 @@ return; } + UserInfo userInfo = userInfoService.selectByPKey(uid); + if (userInfo == null) { + out.print(JsonUtil.loadFalseResult("鐢ㄦ埛淇℃伅涓嶅瓨鍦�")); + return; + } + ThreeSale threeSale = threeSaleSerivce.selectByPrimaryKey(inviteId); if (threeSale == null) { out.print(JsonUtil.loadFalseResult("鍏崇郴id涓嶅瓨鍦�")); @@ -343,9 +365,11 @@ } Long remindId = null; + boolean remindBoss = true; if (uid.longValue() == threeSale.getWorker().getId().longValue()) { remindId = threeSale.getBoss().getId(); // 鎻愰啋涓婄骇 } else if (uid.longValue() == threeSale.getBoss().getId().longValue()) { + remindBoss = false; remindId = threeSale.getWorker().getId(); // 鎻愰啋涓嬬骇 } @@ -354,21 +378,57 @@ return; } + Long bossId = null; + Long workerId = null; + String title = "闃熷憳鎻愰啋娑堟伅"; + String content = ""; + if (remindBoss) { + // 鎻愮ず闃熼暱 + bossId = remindId; + workerId = uid; + content = "浣犵殑涓�绾ч槦鍛�"+ userInfo.getNickName() +"锛屾彁閱掍綘娣诲姞寰俊鍙凤紝浠ヤ究浜庡拰浣犲彇寰楄仈绯诲拰瀛︿範鐪侀挶鎶�宸э紝璧跺揩鍘绘坊鍔犲惂锛涙敞锛氳鍗囩骇鍒版湰杞欢鏈�鏂扮増鏈湪鈥滄垜鐨�-鎴戠殑淇℃伅鈥濅腑娣诲姞銆�"; + } else { + // 鎻愮ず闃熷憳 + bossId = uid; + workerId = remindId; + content = "浣犵殑閭�璇蜂汉"+ userInfo.getNickName() +"锛屾彁閱掍綘娣诲姞寰俊鍙凤紝浠ヤ究浜庡拰浣犲彇寰楄仈绯诲府鍔╀綘鏇村ソ鐨勭渷閽憋紝璧跺揩鍘绘坊鍔犲惂锛涙敞锛氳鍗囩骇鍒版湰杞欢鏈�鏂扮増鏈湪鈥滄垜鐨�-鎴戠殑淇℃伅鈥濅腑娣诲姞銆�"; + } + try { List<String> listIOS = new ArrayList<String>(); List<String> listAndroid = new ArrayList<String>(); - pushService.pushZNX(remindId, "", "", listIOS, listAndroid); - - userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.question, - "", "", UserSystemMsg.TIME_TAG_EMERGENT, null); + pushService.pushZNX(remindId, title, content, listIOS, listAndroid); + + userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.common, + title, content, UserSystemMsg.TIME_TAG_COMMON, null); + + ThreeSaleExtraInfo newInfo = new ThreeSaleExtraInfo(); + if (remindBoss) { + newInfo.setRemindBoss(1); + } else { + newInfo.setRemindWorker(1); + } + + ThreeSaleExtraInfo threeExtra = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(bossId, workerId); + if (threeExtra != null) { + newInfo.setId(threeExtra.getId()); + newInfo.setUpdateTime(new Date()); + threeSaleExtraInfoSerivce.updateByPrimaryKeySelective(newInfo); + } else { + newInfo.setBoss(new UserInfo(bossId)); + newInfo.setWorker(new UserInfo(workerId)); + newInfo.setCreateTime(new Date()); + newInfo.setUpdateTime(new Date()); + threeSaleExtraInfoSerivce.insertSelective(newInfo); + } JSONObject data = new JSONObject(); data.put("weiXinState", 2); data.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�"); out.print(JsonUtil.loadTrueResult(data)); } catch (Exception e) { + e.printStackTrace(); out.print(JsonUtil.loadFalseResult("鎻愰啋澶辫触")); - return; } } } -- Gitblit v1.8.0