fanli/src/main/java/com/yeshi/fanli/aspect/RequestSerializableAspect.java
@@ -148,7 +148,10 @@ return joinPoint.proceed(); } catch (Throwable e) { e.printStackTrace(); LogHelper.errorDetailInfo(e); if (!Constant.IS_TEST) LogHelper.errorDetailInfo(e); else throw e; } finally { } return null; fanli/src/main/java/com/yeshi/fanli/aspect/SignValidateAspect.java
@@ -42,7 +42,7 @@ } @Around(EDP) public Object testAround(ProceedingJoinPoint joinPoint) throws IOException { public Object testAround(ProceedingJoinPoint joinPoint) throws Throwable { Object[] args = joinPoint.getArgs(); PrintWriter out = null; ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder @@ -125,7 +125,10 @@ } catch (Throwable e) { LogHelper.errorDetailInfo(e, getHttpServletParams(request), request.getRequestURI().toString()); out.print(JsonUtil.loadFalseResult(90009, "服务器内部错误")); if (!Constant.IS_TEST) out.print(JsonUtil.loadFalseResult(90009, "服务器内部错误")); else throw e; } return obj; } else { fanli/src/main/java/com/yeshi/fanli/controller/TestController.java
@@ -5,7 +5,6 @@ import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Iterator; @@ -450,8 +449,17 @@ if (goods == null) out.println("商品已下架"); else out.println("<html><head><meta charset=utf-8></head><body>" + String.format("cat_name:%s <br> cat_leaf_name:%s", goods.getRootCategoryName(), goods.getLeafName()) + "</body></html>"); out.println( "<html><head><meta charset=utf-8></head><body>" + String.format("cat_name:%s <br> cat_leaf_name:%s", goods.getRootCategoryName(), goods.getLeafName()) + "</body></html>"); } @RequestMapping("getJedisInfo") public void getJedisInfo(PrintWriter out) { JSONObject data = new JSONObject(); data.put("active", jedisPool.getNumActive()); data.put("idle", jedisPool.getNumIdle()); data.put("waiters", jedisPool.getNumWaiters()); out.print(data.toString()); } } fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/OrderController.java
@@ -50,10 +50,10 @@ @Resource private UserCustomSettingsService userCustomSettingsService; @Resource private HongBaoV2CountService hongBaoV2CountService; @Resource private CommonOrderService commonOrderService; @@ -68,7 +68,7 @@ @Resource private RedisManager redisManager; @Resource private ESOrderService esOrderService; @@ -98,7 +98,7 @@ List<Integer> listSource = new ArrayList<>(); listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); // 验证是否显示模块 if (settings != null && settings.getNoBonusCount() != null) { if (settings.getNoBonusCount() == 1) { @@ -121,10 +121,7 @@ data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString()); out.print(JsonUtil.loadTrueResult(data)); } /** * 订单列表 * @@ -147,28 +144,28 @@ * 时间段:1-最近三天 2-最近七天 3最近半月 4本月 5近三月 6近半年 * @param dateType * 1-今日 2-昨天 3-本月 4-上个月 | * @param source * 页面来源:welfareCore-福利中心、bonus -奖金统计(我的界面) * @param source * 页面来源:welfareCore-福利中心、bonus -奖金统计(我的界面) * @param out */ @RequestMapping(value = "getOrderList", method = RequestMethod.POST) public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type, Integer orderState, String orderNo, String startTime, String endTime, Integer slotTime, Integer dateType, Integer goodsType, String source, PrintWriter out) { public void getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, String type, Integer orderState, String orderNo, String startTime, String endTime, Integer slotTime, Integer dateType, Integer goodsType, String source, PrintWriter out) { if (uid == null) { out.print(JsonUtil.loadFalseResult(1, "用户未登录")); return; } if (page == null || page < 1) page = 1; // 搜索内容、订单号 if (!StringUtil.isNullOrEmpty(orderNo)) { searchOrder(orderNo, page, uid, out); return; } // 转换状态 if (state != null) { if (state == 0) { @@ -189,13 +186,13 @@ Integer orderType = null; if (StringUtil.isNullOrEmpty(type)) { orderType = null; } else if (!"0".equalsIgnoreCase(type)){ orderType = Integer.parseInt(type); } } else if (!"0".equalsIgnoreCase(type)) { orderType = Integer.parseInt(type); } if (goodsType != null && goodsType == 0) goodsType = null; // 筛选时间 if (slotTime != null) { try { @@ -229,7 +226,7 @@ e.printStackTrace(); } } if (endTime != null && endTime.trim().length() > 0) { endTime += " 23:59:59"; } @@ -241,9 +238,7 @@ listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); } try { // 筛选结果顶部统计 String validMoney = "0.00"; @@ -251,14 +246,14 @@ if (page == 1) { BigDecimal predictMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 1, orderNo, state, startTime, endTime, listSource); if (predictMoney != null) if (predictMoney != null) validMoney = predictMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); BigDecimal postSaleMoney = hongBaoV2CountService.getRewardMoneyByToSearch(uid, dateType, orderType, 2, orderNo, state, startTime, endTime, listSource); if (postSaleMoney != null) if (postSaleMoney != null) invalidMoney = postSaleMoney.setScale(2, BigDecimal.ROUND_DOWN).toString(); if (orderType != null && dateType != null && dateType == 4) { if (orderType == 1) { dateType = 6; // 返利订单有效 @@ -267,22 +262,22 @@ } } } // 查询列表 List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState, orderNo, startTime, endTime, dateType, listSource); // 统计总数 long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime, endTime, dateType, listSource); // 判断是否需要显示订单找回提示 8秒内请求3次触发 // 查询列表 List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, orderType, orderState, orderNo, startTime, endTime, dateType, listSource); // 统计总数 long count = commonOrderService.countGroupOrderNoByUid(uid, state, orderType, orderState, orderNo, startTime, endTime, dateType, listSource); // 判断是否需要显示订单找回提示 8秒内请求3次触发 String orderFindUrl = null; if (state ==null && page == 1) { if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4)||count==0L) { if (state == null && page == 1) { if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 8, 4) || count == 0L) { orderFindUrl = configService.get(ConfigKeyEnum.orderFindNotifyUrl.getKey()); } } JSONObject data = new JSONObject(); data.put("count", count); data.put("list", JsonUtil.getApiCommonGson().toJson(list)); @@ -294,13 +289,17 @@ } catch (CommonOrderException e) { out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg())); } catch (Exception e) { out.print(JsonUtil.loadFalseResult(1, "查询失败")); if (Constant.IS_TEST) { e.printStackTrace(out); } else out.print(JsonUtil.loadFalseResult(1, "查询失败")); LogHelper.errorDetailInfo(e); } } /** * 搜索订单 * * @param key * @param out */ @@ -312,16 +311,16 @@ listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); List<ESOrder> listES = esOrderService.query(key, uid.toString(), listSource); if (listES.size() != 0) { list = commonOrderService.searchOrderByUid(page, Constant.PAGE_SIZE, uid, listES); count = commonOrderService.countSearchOrderByUid(uid, listES); } if (list == null) { list = new ArrayList<>(); } JSONObject data = new JSONObject(); data.put("count", count); data.put("list", JsonUtil.getApiCommonGson().toJson(list)); @@ -333,14 +332,12 @@ } } /** * 用户订单统计 * * @param acceptData * @param uid * 用户id * type 类型:0全部、1淘宝 2京东、拼多多 * 用户id type 类型:0全部、1淘宝 2京东、拼多多 * @param out */ @RequestMapping(value = "getOrderCount", method = RequestMethod.POST) @@ -349,7 +346,7 @@ out.print(JsonUtil.loadFalseResult(1, "请求参数不正确")); return; } try { UserInfo user = userInfoService.selectByPKey(uid); if (user == null) { @@ -365,12 +362,12 @@ } JSONObject data = new JSONObject(); data.put("userInfo", userInfo); List<Integer> listSource = new ArrayList<>(); if (type == null || type == 0) { listSource.add(Constant.SOURCE_TYPE_JD); listSource.add(Constant.SOURCE_TYPE_PDD); OrderCountVO total = commonOrderService.getOrderCount(uid, null, listSource); data.put("total", total.getSelf() + total.getShared() + total.getInvite()); data.put("self", total.getSelf()); @@ -383,7 +380,7 @@ data.put("invite", 0); listSource.add(type); } // 今天 OrderCountVO today = commonOrderService.getOrderCount(uid, 1, listSource); today.setTotal(today.getSelf() + today.getShared() + today.getInvite()); @@ -407,7 +404,5 @@ e.printStackTrace(); } } } fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/UserAccountController.java
@@ -94,20 +94,19 @@ @Resource private ConfigService configService; @Resource private UserVIPInfoService userVIPInfoService; @Resource private UserVipConfigService userVipConfigService; @Resource private BanLiShopOrderService banLiShopOrderService; @Resource private HongBaoV2CountService hongBaoV2CountService; /** * 通过邀请码获取用户信息 * @@ -155,10 +154,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(); @@ -186,7 +187,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 +206,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 +217,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 +252,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 +309,7 @@ userAccountService.updateUserSelective(update); } }); break; return; case WXMPLoginResult.CODE_BIND_PHONE: // 需要绑定电话号码 redisManager.saveObj(result.getUser(), key, 60 * 5);// 只缓存5分钟 @@ -334,8 +333,8 @@ out.print(JsonUtil.loadFalseResult("openId为空")); return; } if(uid==null){ if (uid == null) { out.print(JsonUtil.loadFalseResult("uid为空")); return; } @@ -344,7 +343,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 +398,7 @@ out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg())); } } /** * 绑定电话号码 V1.5.3 * @@ -460,8 +458,6 @@ } } /** * 获取vip信息 * @@ -542,15 +538,14 @@ } 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)); vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list)); // 区分老用户和新用户 String limtDate = userVipConfigService.getValueByKey("vip_execute_time"); Date executeDate = null; @@ -588,7 +583,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 +618,8 @@ 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 finishHongBao = banLiShopOrderService.countByUidAndState(uid, list); BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid); @@ -638,7 +634,7 @@ } catch (ParseException e) { e.printStackTrace(); } UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid); if (extra != null && (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) { @@ -677,4 +673,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("")); } } fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java
@@ -171,11 +171,12 @@ ps.flush(); ps.close(); } catch (Exception e1) { } finally { try { out.close(); } catch (IOException e1) { } catch (Exception e1) { e1.printStackTrace(); } } fanli/src/main/resource/env-sandbox/redis.properties
@@ -1,8 +1,9 @@ redis.addr=172.16.16.3 redis.port=6379 redis.auth=weikou2014 redis.max_total=1024 #控制一个pool可分配多少个jedis实例, redis.max_total=-1 redis.max_idle=200 redis.max_wait=10000 redis.timeout=5000 redis.test_on_borrow=true redis.test_on_borrow=true