From 99f131731d056d3d2f7d4b20e0d2578f57602362 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 14 四月 2020 11:06:51 +0800
Subject: [PATCH] 消息调整
---
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java | 108 ++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 81 insertions(+), 27 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java
index b186d98..98da7e0 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java
@@ -33,6 +33,7 @@
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
+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.bus.user.WeiXinUser;
@@ -43,6 +44,7 @@
import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
+import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
@@ -51,6 +53,7 @@
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
import com.yeshi.fanli.service.inter.user.wx.WXMPUserLoginService;
@@ -94,20 +97,24 @@
@Resource
private ConfigService configService;
-
+
@Resource
private UserVIPInfoService userVIPInfoService;
-
+
@Resource
private UserVipConfigService userVipConfigService;
-
+
@Resource
private BanLiShopOrderService banLiShopOrderService;
-
+
@Resource
private HongBaoV2CountService hongBaoV2CountService;
+
+ @Resource
+ private ThreeSaleSerivce threeSaleSerivce;
+
/**
* 閫氳繃閭�璇风爜鑾峰彇鐢ㄦ埛淇℃伅
*
@@ -155,10 +162,12 @@
}
String sessionKey = null;
- WXMPSessionInfo sessionInfo = (WXMPSessionInfo) session.getAttribute(UserController.WXMP_SESSION_INFO_KEY);
+ WXMPSessionInfo sessionInfo = WXXCXUtil.getSessionInfo(Constant.WXMP_APP_INFO, code);
if (sessionInfo == null) {
out.print(JsonUtil.loadFalseResult(90000, "璇烽噸鏂扮櫥褰�"));
return;
+ } else {
+ session.setAttribute(UserController.WXMP_SESSION_INFO_KEY, sessionInfo);
}
sessionKey = sessionInfo.getSessionKey();
@@ -168,6 +177,8 @@
return;
}
String phoneNumber = WXXCXUtil.getPhoneNumber(sessionKey, phoneEncryptedData, phoneIv);
+ LogHelper.test("灏忕▼搴忚幏鍙栧埌鐨勭數璇濆彿鐮佷负:"+phoneNumber);
+
if (StringUtil.isNullOrEmpty(phoneNumber)) {
out.print(JsonUtil.loadFalseResult("鑾峰彇鐢佃瘽鍙风爜澶辫触"));
return;
@@ -186,7 +197,8 @@
UserInfo lastUserInfo = null;
if (!StringUtil.isNullOrEmpty(userData)) {
- String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
+ String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin,
+ StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
String data = redisManager.getCommonString(redisKey);
if (!StringUtil.isNullOrEmpty(data)) {
lastUserInfo = new Gson().fromJson(data, UserInfo.class);
@@ -204,7 +216,7 @@
}
@RequestMapping("wxLogin")
- public void wxLogin(WXMPAcceptData acceptData, String wxEncryptedData, String wxIv, String inviteCode,
+ public void wxLogin(WXMPAcceptData acceptData, String wxEncryptedData, String wxIv, String inviteCode, String code,
HttpServletRequest request, HttpSession session, PrintWriter out) {
if (StringUtil.isNullOrEmpty(acceptData.getOpenId())) {
out.print(JsonUtil.loadFalseResult("openId涓虹┖"));
@@ -215,11 +227,7 @@
out.print(JsonUtil.loadFalseResult("寰俊鐢ㄦ埛鍔犲瘑鏁版嵁涓虹┖"));
return;
}
- WXMPSessionInfo sessionInfo = (WXMPSessionInfo) session.getAttribute(UserController.WXMP_SESSION_INFO_KEY);
- if (sessionInfo == null) {
- out.print(JsonUtil.loadFalseResult(90000, "璇烽噸鏂扮櫥褰�"));
- return;
- }
+ WXMPSessionInfo sessionInfo = WXXCXUtil.getSessionInfo(Constant.WXMP_APP_INFO, code);
String sessionKey = sessionInfo.getSessionKey();
if (StringUtil.isNullOrEmpty(sessionKey)) {
@@ -254,7 +262,8 @@
return;
}
- String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
+ String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin,
+ StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
UserInfo user = new Gson().fromJson(redisManager.getCommonString(key), UserInfo.class);
if (user == null) {
@@ -310,7 +319,7 @@
userAccountService.updateUserSelective(update);
}
});
- break;
+ return;
case WXMPLoginResult.CODE_BIND_PHONE:
// 闇�瑕佺粦瀹氱數璇濆彿鐮�
redisManager.saveObj(result.getUser(), key, 60 * 5);// 鍙紦瀛�5鍒嗛挓
@@ -334,8 +343,8 @@
out.print(JsonUtil.loadFalseResult("openId涓虹┖"));
return;
}
-
- if(uid==null){
+
+ if (uid == null) {
out.print(JsonUtil.loadFalseResult("uid涓虹┖"));
return;
}
@@ -344,7 +353,7 @@
out.print(JsonUtil.loadFalseResult("寰俊淇℃伅涓虹┖"));
return;
}
-
+
WXMPSessionInfo sessionInfo = (WXMPSessionInfo) session.getAttribute(UserController.WXMP_SESSION_INFO_KEY);
if (sessionInfo == null) {
out.print(JsonUtil.loadFalseResult(90000, "璇烽噸鏂扮櫥褰�"));
@@ -399,8 +408,7 @@
out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
}
}
-
-
+
/**
* 缁戝畾鐢佃瘽鍙风爜 V1.5.3
*
@@ -460,8 +468,6 @@
}
}
-
-
/**
* 鑾峰彇vip淇℃伅
*
@@ -542,15 +548,33 @@
}
vo.setFinishMoney(hongBaoV2CountService.getRewardMoneyBySelf(uid));
-
List<Integer> list = new ArrayList<Integer>();
list.add(BanLiShopOrder.STATE_SUCCESS);
BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
- vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
+// vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
+// TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
+
+ int finishTeam = 0;
+ long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
+ List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
+ if (listThreeSale != null && listThreeSale.size() > 0) {
+ for (ThreeSale three: listThreeSale) {
+ UserInfo worker = three.getWorker();
+ if (worker == null || worker.getId() == null) {
+ continue;
+ }
+ // 1銆侀個璇峰叧绯绘垚鍔熷悗锛�2銆佸崟锛堝垎浜� + 鑷喘锛夊疄浠樻澶т簬1鍏�
+ long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
+ if (countValid > 0) {
+ finishTeam ++;
+ }
+ }
+ }
+ vo.setFinishTeam(finishTeam);
+
vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
-
// 鍖哄垎鑰佺敤鎴峰拰鏂扮敤鎴�
String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
Date executeDate = null;
@@ -588,7 +612,7 @@
JSONObject data = new JSONObject();
data.put("info", gson.toJson(vo));
- data.put("welfare",JSONArray.fromObject( userVipConfigService.getValueByKey("vip_welfare")));
+ data.put("welfare", JSONArray.fromObject(userVipConfigService.getValueByKey("vip_welfare")));
if (!StringUtil.isNullOrEmpty(callback)) {
out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
} else {
@@ -623,7 +647,28 @@
list.add(BanLiShopOrder.STATE_SUCCESS);
BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
- long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
+// long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
+// TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
+ long finishTeam = 0L;
+ long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
+ List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
+ if (listThreeSale != null && listThreeSale.size() > 0) {
+ for (ThreeSale three: listThreeSale) {
+ UserInfo worker = three.getWorker();
+ if (worker == null || worker.getId() == null) {
+ continue;
+ }
+ // 1銆侀個璇峰叧绯绘垚鍔熷悗锛�2銆佸崟锛堝垎浜� + 鑷喘锛夊疄浠樻澶т簬1鍏�
+ long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
+ if (countValid > 0) {
+ finishTeam ++;
+ }
+ }
+ }
+
+
+
+
long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
@@ -638,7 +683,7 @@
} catch (ParseException e) {
e.printStackTrace();
}
-
+
UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
if (extra != null
&& (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
@@ -677,4 +722,13 @@
out.print(JsonUtil.loadTrueResult("宸茬敵璇�"));
}
}
+
+ @RequestMapping("logout")
+ public void logout(WXMPAcceptData acceptData, Long uid, PrintWriter out) {
+ if (uid == null) {
+ out.print(JsonUtil.loadFalseResult("uid涓虹┖"));
+ return;
+ }
+ out.print(JsonUtil.loadTrueResult(""));
+ }
}
--
Gitblit v1.8.0