fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -115,61 +115,54 @@ @Resource private UserAccountService userAccountService; @Resource private UserActiveLogService userActiveLogService; @Resource private UserVIPInfoService userVIPInfoService; @Resource private IntegralDetailService integralDetailService; @Resource private UserInviteValidNumService userInviteValidNumService; @Resource private ThreeSaleSerivce threeSaleSerivce; @Resource private ExtractService extractService; @Resource private HongBaoV2Service hongBaoV2Service; @Resource private TearcherService tearcherService; @Resource private ThreeSaleDetailService threeSaleDetailService; @Resource private HongBaoV2CountService hongBaoV2CountService; /** * 查询用户信息列表 正常用户/异常用户 * * @param callback * @param pageIndex * @param key * 查询条件 * @param userType * 用户类型:金冠、银冠、铜冠 * @param days * 查询天数 * @param startTime * 注册时间 * @param endTime * 注册时间 * @param orderMode * 排序方式 订单数量 今日订单 累计队员 * @param key 查询条件 * @param userType 用户类型:金冠、银冠、铜冠 * @param days 查询天数 * @param startTime 注册时间 * @param endTime 注册时间 * @param orderMode 排序方式 订单数量 今日订单 累计队员 * @param out */ @RequestMapping(value = "query") public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank,Integer userType, Integer days, String startTime, String endTime, Integer orderMode, Integer type,String level, Integer activeCode, PrintWriter out) { public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank, Integer userType, Integer days, String startTime, String endTime, Integer orderMode, Integer type, String level, Integer activeCode, PrintWriter out) { try { if (type == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户类型type不能为空")); @@ -217,14 +210,15 @@ } List<UserInfoVO> userList = userInfoService.query((pageIndex - 1) * pageSize, pageSize, type, key, keyType, userRank, days, startTime, endTime, orderField, orderMode,userType, level, activeCode); userRank, days, startTime, endTime, orderField, orderMode, userType, level, activeCode); if (userList == null || userList.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关数据")); return; } long count = userInfoService.queryCount(type, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode); long count = userInfoService.queryCount(type, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode); int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); @@ -245,6 +239,7 @@ /** * 用户基础信息查询 * * @param callback * @param pageIndex * @param pageSize @@ -261,8 +256,8 @@ * @param out */ @RequestMapping(value = "queryInfo") public void queryInfo(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank,Integer userType, Integer days, String startTime, String endTime, Integer state,String level, public void queryInfo(String callback, Integer pageIndex, Integer pageSize, String key, Integer keyType, Integer rank, Integer userType, Integer days, String startTime, String endTime, Integer state, String level, Integer activeCode, PrintWriter out) { try { if (pageIndex == null) @@ -291,15 +286,16 @@ } } List<UserInfoVO> userList = userInfoService.queryInfo((pageIndex - 1) * pageSize, pageSize, state, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode); List<UserInfoVO> userList = userInfoService.queryInfo((pageIndex - 1) * pageSize, pageSize, state, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode); if (userList == null || userList.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关数据")); return; } long count = userInfoService.countInfo(state, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode); long count = userInfoService.countInfo(state, key, keyType, userRank, days, startTime, endTime, userType, level, activeCode); int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); @@ -317,10 +313,10 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); } } /** * 资金统计 * * @param callback * @param uid * @param out @@ -333,7 +329,7 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户ID不存在")); return; } Date minDate = null; Date maxDate = null; long timeStamp = System.currentTimeMillis(); @@ -349,16 +345,16 @@ minDate = new Date(0L); maxDate = new Date(timeStamp); // 累计成功提现 BigDecimal totalExtractMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs(); BigDecimal totalExtractMoney = userMoneyDetailService .statisticUserTypeMoneyWithDate(uid, typeList, minDate, maxDate, 1).abs(); // 提现中金额 BigDecimal extractingMoney = extractService.sumVerifyingMoney(uid); // 全部未到账 minDate = new Date(0); maxDate = new Date(timeStamp); BigDecimal unRecievedMoney = hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate); JSONObject data = new JSONObject(); data.put("totalExtractMoney", totalExtractMoney); data.put("extractingMoney", extractingMoney); @@ -370,10 +366,10 @@ e.printStackTrace(); } } /** * 权益统计 * * @param callback * @param uid * @param out @@ -386,20 +382,19 @@ if (userInfoExtra != null) { goldCoin = userInfoExtra.getGoldCoin(); } JSONObject data = new JSONObject(); data.put("goldCoin", goldCoin); data.put("exchangeGoldCoin",new BigDecimal(integralDetailService.sumUseGoldCoin(uid)).abs()); data.put("exchangeGoldCoin", new BigDecimal(integralDetailService.sumUseGoldCoin(uid)).abs()); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); e.printStackTrace(); } } /** * 用户粉丝统计 * 用户粉丝统计 * * @param callback * @param pageIndex @@ -410,23 +405,23 @@ @RequestMapping(value = "countTeamFans") public void countTeamFans(String callback, Long uid, PrintWriter out) { JSONObject data = new JSONObject(); // 导师 String tearcherName = ""; TearcherInfo tearcherInfo = tearcherService.selectByUid(uid); if (tearcherInfo != null) { tearcherName = tearcherInfo.getNickName(); } data.put("tearcherName", tearcherName); data.put("tearcherName", tearcherName); // 邀请人 String bossName = ""; UserInfo boss = threeSaleSerivce.getBoss(uid); if (boss != null) { bossName = boss.getNickName(); bossName = boss.getNickName(); } data.put("bossName", bossName); data.put("bossName", bossName); // 邀请粉丝 int doneFirst = 0; int doneSecond = 0; @@ -435,76 +430,77 @@ doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst(); doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond(); } data.put("doneFirst", doneFirst); data.put("doneSecond", doneSecond); data.put("doneFirst", doneFirst); data.put("doneSecond", doneSecond); // 九代粉丝数量 data.put("nineFans", threeSaleDetailService.countByBossUidAndMaxLevel(uid, 9)); data.put("nineFans", threeSaleDetailService.countByBossUidAndMaxLevel(uid, 9)); // 有效粉丝 data.put("first", threeSaleSerivce.countFirstTeam(uid)); data.put("second", threeSaleSerivce.countSecondTeam(uid)); data.put("first", threeSaleSerivce.countFirstTeam(uid)); data.put("second", threeSaleSerivce.countSecondTeam(uid)); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } /** * 用户详细信息 * * @param callback * @param uid * @param out */ @RequestMapping(value = "getInfoDetail") public void getInfoDetail(String callback, Long uid, PrintWriter out) { UserInfo user = userInfoService.getUserByIdWithMybatis(uid); UserInfo user = userInfoService.selectByPKey(uid); UserInfoVO userInfoVO = new UserInfoVO(); userInfoVO.setId(uid); userInfoVO.setPhone(user.getPhone()); userInfoVO.setState(user.getState()); userInfoVO.setCreatetime(user.getCreatetime()); UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra != null) { if (!StringUtil.isNullOrEmpty(userInfoExtra.getMark())) { userInfoVO.setMark( userInfoExtra.getMark()); userInfoVO.setMark(userInfoExtra.getMark()); } userInfoVO.setInviteCode(userInfoExtra.getInviteCode()); userInfoVO.setInviteCodeVip(userInfoExtra.getInviteCodeVip()); userInfoVO.setWxId(userInfoExtra.getWeiXin()); } // 最近一次下单时间 Date lastOrderTime = hongBaoV2CountService.getLastHongBaoTime(uid); if (lastOrderTime != null) { userInfoVO.setLastOrderTime(lastOrderTime.getTime()); } // 最近登录时间 UserActiveLog userActiveLog = userActiveLogService.getUserLatestActiveInfo(uid); if (userActiveLog != null) { userInfoVO.setLastLoginTime(userActiveLog.getCreateTime().getTime()); } // 显示用户微信 淘宝 老版本存在 String wxUnionId = user.getWxUnionId(); if (wxUnionId == null || wxUnionId.trim().length() == 0) { user.setWxName(null); String wxId = userInfoVO.getWxId(); if (wxId == null) { userInfoVO.setWxId(""); } user.setWxName(user.getWxUnionId()); // 是否绑定支付宝(购买 + 分享权限) UserExtraTaoBaoInfo extraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid); String taoBaoUid = extraTaoBaoInfo.getTaoBaoUid(); String specialId = extraTaoBaoInfo.getSpecialId(); String relationId = extraTaoBaoInfo.getRelationId(); if (StringUtil.isNullOrEmpty(taoBaoUid) || StringUtil.isNullOrEmpty(specialId) || StringUtil.isNullOrEmpty(relationId)) { userInfoVO.setTbName(null); userInfoVO.setTaoBaoUid(null); } else { userInfoVO.setTbName(extraTaoBaoInfo.getTaoBaoNickName()); userInfoVO.setTaoBaoUid(extraTaoBaoInfo.getTaoBaoUid()); if (extraTaoBaoInfo != null) { String taoBaoUid = extraTaoBaoInfo.getTaoBaoUid(); String specialId = extraTaoBaoInfo.getSpecialId(); String relationId = extraTaoBaoInfo.getRelationId(); if (StringUtil.isNullOrEmpty(taoBaoUid) || StringUtil.isNullOrEmpty(specialId) || StringUtil.isNullOrEmpty(relationId)) { userInfoVO.setTbName(null); userInfoVO.setTaoBaoUid(null); } else { userInfoVO.setTbName(extraTaoBaoInfo.getTaoBaoNickName()); userInfoVO.setTaoBaoUid(extraTaoBaoInfo.getTaoBaoUid()); } } /* 绑定收款账号信息 */ @@ -528,6 +524,82 @@ } /** * 绑定详情 * * @param callback * @param uid * @param out */ @RequestMapping(value = "getBindDetail") public void getBindDetail(String callback, Long uid, PrintWriter out) { UserInfo user = userInfoService.selectByPKey(uid); JSONObject data = new JSONObject(); Integer state = user.getState(); if (state == UserInfo.STATE_FORBIDDEN) { data.put("state", false); } else { data.put("state", true); } data.put("phone", user.getPhone()); // 微信授权 String wxUnionId = user.getWxUnionId(); if(StringUtil.isNullOrEmpty(wxUnionId)) { data.put("wxName", ""); data.put("wxState", false); } else { data.put("wxName", user.getWxName()); data.put("wxnState", true); } String mark = ""; UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra != null) { if (!StringUtil.isNullOrEmpty(userInfoExtra.getMark())) { mark = userInfoExtra.getMark(); } } data.put("mark", mark); // 淘宝授权 String tbName = ""; boolean tbState = false; UserExtraTaoBaoInfo extraTaoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid); if (extraTaoBaoInfo != null) { String taoBaoUid = extraTaoBaoInfo.getTaoBaoUid(); String specialId = extraTaoBaoInfo.getSpecialId(); String relationId = extraTaoBaoInfo.getRelationId(); if (!StringUtil.isNullOrEmpty(taoBaoUid) && StringUtil.isNullOrEmpty(specialId) && StringUtil.isNullOrEmpty(relationId)) { tbState = true; tbName = extraTaoBaoInfo.getTaoBaoNickName(); } } data.put("tbName", tbName); data.put("tbState", tbState); /* 绑定收款账号信息 */ String accountName = ""; boolean accountState = false; List<BindingAccount> account = bindingAccountService.getBindingAccountByUid(uid); if (account != null && account.size() > 0) { BindingAccount bindingAccount = account.get(0); Integer type = bindingAccount.getType(); // 支付宝 if (type != null && type == 1) { accountState = true; accountName = bindingAccount.getName(); } } data.put("accountName", accountName); data.put("accountState", accountState); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } /** * 统计今日用户总情况 * @@ -590,13 +662,11 @@ * // 统计所有总金额 BigDecimal countTotalMoney = * userInfoCountService.countAllMoney(null); * * // 统计所有可提现金额 String minMoney = * configService.get(Constant.EXTRACT_MIN_MONEY); if (minMoney == * null) { minMoney = "20"; } double min = * // 统计所有可提现金额 String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY); * if (minMoney == null) { minMoney = "20"; } double min = * Double.parseDouble(minMoney); BigDecimal countCanAssets = * userInfoCountService.countAllMoney(min); * data.put("countTotalMoney", countTotalMoney); * data.put("countCanAssets", countCanAssets); * userInfoCountService.countAllMoney(min); data.put("countTotalMoney", * countTotalMoney); data.put("countCanAssets", countCanAssets); */ // 今日新增用户数量 @@ -615,10 +685,8 @@ /** * * @param data * @param uid * 用户ID * @param type * 需要解绑的账户类型 * @param uid 用户ID * @param type 需要解绑的账户类型 */ @RequestMapping("unBindUserInfo") public void unBindUserInfo(String callback, Long uid, String typeArray, PrintWriter out) { @@ -694,11 +762,10 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); } } /** * 修改用户备注 * * @param callback * @param uid * @param mark @@ -710,7 +777,7 @@ if (uid == null || uid <= 0 || StringUtil.isNullOrEmpty(mark)) return; UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra == null) if (userInfoExtra == null) return; UserInfoExtra updateExtra = new UserInfoExtra(); updateExtra.setId(userInfoExtra.getId()); @@ -723,35 +790,37 @@ /** * 删除用户-改变其状态 * * @param callback * @param idArray * @param out */ @RequestMapping(value = "deleteUser") public void delete(String callback, String idArray, HttpServletRequest request, PrintWriter out) { public void delete(String callback, String idArray, HttpServletRequest request, PrintWriter out) { try { AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); if (admin == null) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。"))); return; } if (StringUtil.isNullOrEmpty(idArray)) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据")); return; } Gson gson = new Gson(); List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType()); List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() { }.getType()); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据")); return; } for (Long id: list) { for (Long id : list) { UserInfo user = new UserInfo(id); user.setState(UserInfo.STATE_DELETE); user.setStateDesc(admin.getId()+" " + admin.getName()+ "后台手动删除"); user.setStateDesc(admin.getId() + " " + admin.getName() + "后台手动删除"); userInfoService.updateByPrimaryKeySelective(user); } JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除")); @@ -760,9 +829,7 @@ e.printStackTrace(); } } /** * 封禁用户ID * @@ -867,8 +934,7 @@ * * @param callback * @param code * @param type * 1("微信unionId"), 2("淘宝ID"), 3("手机号"), 4("支付宝账号"); * @param type 1("微信unionId"), 2("淘宝ID"), 3("手机号"), 4("支付宝账号"); * @param out */ @RequestMapping(value = "saveForbiddenInfo") @@ -889,8 +955,6 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); } } /** * 队员关系 @@ -952,11 +1016,10 @@ // 用户信息 UserInfo boss = threeSale.getBoss(); threeSale.setBoss(userInfoService.selectByPKey(boss.getId())); UserInfo worker = threeSale.getWorker(); threeSale.setWorker(userInfoService.selectByPKey(worker.getId())); Integer expire = threeSale.getExpire(); if (threeSale.getState()) { threeSale.setExpire(1); // 邀请成功 @@ -968,7 +1031,6 @@ } } } long count = 0; if (type == 0) { @@ -1048,16 +1110,11 @@ /** * 根据渠道 统计当日新增用户数量 * * @param channelArray * 名字数组 * @param dateType * 类型 1日 2月 3年 * @param year * 2018 * @param startTime * 2018-12-01 * @param endTime * 2018-12-01 * @param channelArray 名字数组 * @param dateType 类型 1日 2月 3年 * @param year 2018 * @param startTime 2018-12-01 * @param endTime 2018-12-01 * @param out */ @RequestMapping(value = "getNewUserCharts") @@ -1069,7 +1126,7 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); return; } if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { startTime = null; endTime = null; @@ -1077,40 +1134,40 @@ Date beginDate = null; Date endDate = null; if (dateType == 1) { beginDate = TimeUtil.parse(startTime); endDate = TimeUtil.parse(endTime); } else if (dateType == 2) { Calendar calendar=Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); int currentYear = calendar.get(Calendar.YEAR); if (!StringUtil.isNullOrEmpty(year)) { currentYear = Integer.parseInt(year); } calendar.clear(); calendar.set(Calendar.YEAR, currentYear); beginDate =calendar.getTime(); calendar.set(Calendar.YEAR, currentYear); beginDate = calendar.getTime(); calendar.clear(); calendar.set(Calendar.YEAR, currentYear); calendar.roll(Calendar.DAY_OF_YEAR, -1); endDate=calendar.getTime(); endDate = calendar.getTime(); } else if (dateType == 3) { beginDate = TimeUtil.parse("2018-01-01"); endDate = new Date(); } Gson gson = new Gson(); List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); // 渠道 List<String> channelList = null; if (channelArray != null && channelArray.trim().length() > 0) { channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() { }.getType()); } JSONArray line_list = new JSONArray(); if (channelList != null && channelList.size() > 0) { for (String channel : channelList) { List<Object> list = getNewUserData(dateList, dateType, beginDate, endDate, channel); @@ -1136,35 +1193,35 @@ e.printStackTrace(); } } private List<Object> getNewUserData(List<String> dateList, Integer dateType, Date beginDate, Date endDate, String channel) { private List<Object> getNewUserData(List<String> dateList, Integer dateType, Date beginDate, Date endDate, String channel) { List<Object> list = new ArrayList<>(); List<CountUserInfo> listHistory = userInfoCountService.getNewUserData(beginDate, endDate, channel); for (String date: dateList) { for (String date : dateList) { int value = 0; if (listHistory != null) { for (CountUserInfo history: listHistory) { for (CountUserInfo history : listHistory) { if (dateType == 1) { String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); if (gernalTime.equalsIgnoreCase(date)) { value += history.getNum(); continue; } } else if (dateType == 2){ } else if (dateType == 2) { String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); if(gernalTime.startsWith("0")) { if (gernalTime.startsWith("0")) { gernalTime = gernalTime.substring(1, 2); } if (gernalTime.equalsIgnoreCase(date)) { value += history.getNum(); value += history.getNum(); continue; } } else if (dateType == 3) { String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); if (gernalTime.equalsIgnoreCase(date)) { value += history.getNum(); value += history.getNum(); continue; } } @@ -1172,23 +1229,18 @@ } list.add(value + ""); } return list; } /** * 根据渠道 统计当日新增用户数量 * * @param channelArray * 名字数组 * @param dateType * 类型 1日 2月 3年 * @param year * 2018 * @param startTime * 2018-12-01 * @param endTime * 2018-12-01 * @param channelArray 名字数组 * @param dateType 类型 1日 2月 3年 * @param year 2018 * @param startTime 2018-12-01 * @param endTime 2018-12-01 * @param out */ @RequestMapping(value = "getTodayBuyRate") @@ -1252,8 +1304,7 @@ JSONArray line_list = new JSONArray(); for (String channel : channelList) { List<ChartTDO> list = userInfoCountService.getTodayBuyRate(channel, dateType, year, startTime, endTime); List<ChartTDO> list = userInfoCountService.getTodayBuyRate(channel, dateType, year, startTime, endTime); if ("all".equalsIgnoreCase(channel)) { channel = "总计"; @@ -1299,12 +1350,10 @@ * 当周产生3单的新增用户概率 * * @param callback * @param channelArray * 渠道名称 * @param channelArray 渠道名称 * @param startTime * @param endTime * @param orderNum * 订单数量 * @param orderNum 订单数量 * @param out */ @RequestMapping(value = "getWeekBuyRate") @@ -1365,9 +1414,9 @@ } } /** * 获取金币排行榜 * * @param callback * @param pageIndex * @param pageSize @@ -1381,13 +1430,13 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("type不能为空")); return; } if (pageIndex == null) pageIndex = 1; if (pageSize == null) pageSize = 50; long count = 0; List<UserGoldCoinVO> list = null; if (type == 0) { @@ -1397,10 +1446,9 @@ count = userInfoCountService.countByUserGoldCoin(type, key); list = userInfoCountService.listByUserGoldCoin((pageIndex - 1) * pageSize, pageSize, type, key); } if(list == null) if (list == null) list = new ArrayList<>(); int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); @@ -1410,10 +1458,10 @@ data.put("list", list); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } /** * 获取金币排行榜 * * @param callback * @param pageIndex * @param pageSize @@ -1421,20 +1469,20 @@ * @param out */ @RequestMapping(value = "getGoldCoinRecord") public void getGoldCoinRecord(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) { public void getGoldCoinRecord(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) { if (pageIndex == null) pageIndex = 1; if (pageSize == null) pageSize = 20; List<IntegralDetail> list = integralDetailService.listQuery((pageIndex-1)* pageSize, pageSize, key); List<IntegralDetail> list = integralDetailService.listQuery((pageIndex - 1) * pageSize, pageSize, key); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无相关信息")); return; } for (IntegralDetail integralDetail: list) { for (IntegralDetail integralDetail : list) { Long uid = integralDetail.getUid(); UserInfo userInfo = userInfoService.getUserById(uid); if (userInfo != null) { @@ -1442,42 +1490,40 @@ integralDetail.setPortrait(userInfo.getPortrait()); } } long count = integralDetailService.countQuery(key); int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.serializeNulls(); Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); JSONObject data = new JSONObject(); data.put("pe", pe); data.put("list", gson.toJson(list)); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } /** * * @param callback * @param pageIndex * @param pageSize * @param key 搜索:暂只提供uid * @param state 状态: * @param key 搜索:暂只提供uid * @param state 状态: * @param out */ @RequestMapping(value = "queryVip") public void queryVip(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, PrintWriter out) { public void queryVip(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, PrintWriter out) { try { List<UserVIPInfo> list = userVIPInfoService.listQuery(pageIndex, pageSize, key, state); if (list == null || list.size() == 0) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据")); return; } long count = userVIPInfoService.countQuery(key, state); int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); @@ -1496,10 +1542,9 @@ } } /** * 超级会员升级通过 * * @param callback * @param id * @param out @@ -1507,7 +1552,7 @@ */ @RequestSerializableByKey(key = "'passVIP-' +#id") @RequestMapping(value = "passVIP") public void passVIP(String callback, Long id, PrintWriter out, HttpServletRequest request) { public void passVIP(String callback, Long id, PrintWriter out, HttpServletRequest request) { try { /* 检验是否登陆 */ AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); @@ -1517,39 +1562,8 @@ } userVIPInfoService.passVIPApply(id); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功")); LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的升级超级会员申请!"); } catch (UserVIPInfoException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); return; } catch (Exception e) { e.printStackTrace(); JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败")); return; } } /** * 超级会员升级拒绝 * @param callback * @param id * @param reason * @param out * @param request */ @RequestMapping(value = "rejectVIP") public void rejectVIP(String callback, Long id, String reason, PrintWriter out, HttpServletRequest request) { try { /* 检验是否登陆 */ AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); if (admin == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆")); return; } userVIPInfoService.rejectVIPApply(id, reason); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功")); LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的升级超级会员申请不存在!"); LogHelper.userInfo( "[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的升级超级会员申请!"); } catch (UserVIPInfoException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); return; @@ -1560,8 +1574,39 @@ } } /** * 超级会员升级拒绝 * * @param callback * @param id * @param reason * @param out * @param request */ @RequestMapping(value = "rejectVIP") public void rejectVIP(String callback, Long id, String reason, PrintWriter out, HttpServletRequest request) { try { /* 检验是否登陆 */ AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN); if (admin == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆")); return; } userVIPInfoService.rejectVIPApply(id, reason); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功")); LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的升级超级会员申请不存在!"); } catch (UserVIPInfoException e) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); return; } catch (Exception e) { e.printStackTrace(); JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败")); return; } } /** * 用户账户明细 * @@ -1583,14 +1628,14 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据")); return; } for (UserMoneyDetail detail: list) { for (UserMoneyDetail detail : list) { UserInfo userInfo = detail.getUserInfo(); if (userInfo == null) { detail.setUserInfo(new UserInfo()); continue; } UserInfo user = userInfoService.selectByPKey(userInfo.getId()); if (user != null) { detail.setUserInfo(user); @@ -1600,20 +1645,22 @@ long count = userMoneyDetailService.countQuery(key, keyType); int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); GsonBuilder gsonBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss"); gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new JsonSerializer<UserMoneyDetailTypeEnum>() { @Override public JsonElement serialize(UserMoneyDetailTypeEnum value, Type theType, JsonSerializationContext context) { if (value == null) { return new JsonPrimitive(""); } else { return new JsonPrimitive(value.getDesc()); } } }); gsonBuilder.registerTypeAdapter(UserMoneyDetailTypeEnum.class, new JsonSerializer<UserMoneyDetailTypeEnum>() { @Override public JsonElement serialize(UserMoneyDetailTypeEnum value, Type theType, JsonSerializationContext context) { if (value == null) { return new JsonPrimitive(""); } else { return new JsonPrimitive(value.getDesc()); } } }); Gson gson = gsonBuilder.create(); JSONObject data = new JSONObject(); data.put("pe", pe); data.put("result_list", gson.toJson(list)); @@ -1623,10 +1670,5 @@ JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); } } } fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java
@@ -436,7 +436,7 @@ // 云发单链接 if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { boolean cloudOpen = configService.isRobotCloudOpen(); boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpen.getKey()); if (!cloudOpen && uid != null) { List<String> testUsers = configService.getTestUsers(); if (testUsers != null && testUsers.contains(uid+"")) { fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -643,7 +643,7 @@ } else if (list.size() > 0) { // 活动图片不允许跳转 // 云发单是否开启 boolean cloudOpen = configService.isRobotCloudOpen(); boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenCircle.getKey()); if (!cloudOpen && uid != null) { List<String> testUsers = configService.getTestUsers(); if (testUsers != null && testUsers.contains(uid+"")) { fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -1376,7 +1376,7 @@ */ private void getCloudInfo(AcceptData acceptData,Long uid, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) { // 云发单是否开启 boolean cloudOpen = configService.isRobotCloudOpen(); boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenGoodsDetail.getKey()); if (!cloudOpen && uid != null) { List<String> testUsers = configService.getTestUsers(); if (testUsers != null && testUsers.contains(uid+"")) { @@ -1385,7 +1385,8 @@ } extraVO.setCloudOpen(cloudOpen); if (!goodsDetail.isHasCoupon()) { // 无券或者未开启发圈 if (!goodsDetail.isHasCoupon() || !cloudOpen) { return; } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java
@@ -35,7 +35,6 @@ import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.exception.user.cloud.UserCloudException; import com.yeshi.fanli.exception.user.cloud.UserCloudGroupException; import com.yeshi.fanli.exception.user.cloud.UserCloudOrderException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; @@ -54,6 +53,7 @@ import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.aitaoker.AitaokerApiUtil; import com.yeshi.fanli.util.annotation.RequestSerializableByKey; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; import com.yeshi.fanli.util.suning.SuningUtil; import com.yeshi.fanli.vo.goods.GoodsDetailVO; @@ -261,6 +261,7 @@ * @param uid * @param out */ @RequestSerializableByKey(key = "'getQrcodeMaclogin-'+#uid") @RequestMapping(value = "getQrcodeMaclogin") public void getQrcodeMaclogin(String callback, AcceptData acceptData, Long uid, PrintWriter out) { if (uid == null) { @@ -444,6 +445,12 @@ return; } UserCloud userCloud = userCloudService.getValidByUid(uid); if (userCloud == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "请先开通云发单")); return; } try { // 重新获取群列表 userCloudService.searchGroup(uid); @@ -481,12 +488,20 @@ return; } UserCloud userCloud = userCloudService.getValidByUid(uid); if (userCloud == null) { JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "请先开通云发单")); return; } boolean reslut = false; if (state == 1) { reslut = true; } try { userCloudGroupService.switchGroupState(uid, id, reslut); // 获取最新群 List<UserCloudGroup> list = userCloudGroupService.listGroupByUid(uid); fanli/src/main/java/com/yeshi/fanli/dao/dynamic/GoodsEvaluateDao.java
@@ -398,8 +398,8 @@ List<Criteria> list = new ArrayList<Criteria>(); list.add(Criteria.where("dynamicType").is(1)); list.add(Criteria.where("state").is(1)); list.add(Criteria.where("imgList.goods.goodsId").is(goodsId)); list.add(Criteria.where("imgList.goods.goodsType").is(goodsType)); list.add(Criteria.where("goods.goodsId").is(goodsId)); list.add(Criteria.where("goods.goodsType").is(goodsType)); // 限制时间内 list.add(Criteria.where("startTime").gte(limitTime)); fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/cloud/UserCloudManageMapper.java
@@ -5,4 +5,10 @@ public interface UserCloudManageMapper extends BaseMapper<UserCloudManage> { /** * 查询更新 * @param id * @return */ UserCloudManage selectForUpdate(long id); } fanli/src/main/java/com/yeshi/fanli/dto/mq/user/body/UserCloudMQMsg.java
@@ -12,11 +12,18 @@ public final static int TYPE_STORE = 1; // 商品库 public final static int TYPE_EVALUATE = 2; // 发圈内容 public final static int TYPE_PUSH = 3; // 站内推送消息 private Long uid;// 用户ID private String id;// 发圈id 、 商品库id private Integer type;// 类型 public UserCloudMQMsg(Long uid, Integer type) { super(); this.uid = uid; this.type = type; } public UserCloudMQMsg(Long uid, String id, Integer type) { super(); this.uid = uid; fanli/src/main/java/com/yeshi/fanli/dto/taobao/haodanku/HDKGoodsListResultDTO.java
@@ -11,8 +11,13 @@ */ public class HDKGoodsListResultDTO { private List<HDKGoodsDetail> goodsList; private List<HDKWXCircleContentDTO> list; private Integer minId; public HDKGoodsListResultDTO() { } public HDKGoodsListResultDTO(List<HDKGoodsDetail> goodsList, Integer minId) { super(); this.goodsList = goodsList; @@ -34,4 +39,12 @@ public void setMinId(Integer minId) { this.minId = minId; } public List<HDKWXCircleContentDTO> getList() { return list; } public void setList(List<HDKWXCircleContentDTO> list) { this.list = list; } } fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java
@@ -37,6 +37,7 @@ rejectVIPApply("超级会员","http://img.flqapp.com/resource/msg/icon_msg_vip.png"), teamVIPCallBoss ("温馨提醒","http://img.flqapp.com/resource/msg/icon_msg_notify.png"), teamSplitCallBoss ("邀请脱离","http://img.flqapp.com/resource/msg/icon_msg_invite_break.png"), cloudWX("云发单","http://img.flqapp.com/resource/msg/icon_msg_other_cloud.png"), vipUpgradeReward("系统赠送","http://img.flqapp.com/resource/msg/icon_msg_vip.png"); private final String desc; fanli/src/main/java/com/yeshi/fanli/entity/bus/user/cloud/UserCloudManage.java
@@ -23,6 +23,9 @@ @Column(name = "ucm_custom") private Boolean custom; // 状态 @Column(name = "ucm_offline_notice") private Boolean offlineNotice; // 掉线通知 @Column(name = "ucm_create_time") private Date createTime; @@ -69,4 +72,12 @@ this.updateTime = updateTime; } public Boolean getOfflineNotice() { return offlineNotice; } public void setOfflineNotice(Boolean offlineNotice) { this.offlineNotice = offlineNotice; } } fanli/src/main/java/com/yeshi/fanli/entity/system/ConfigKeyEnum.java
@@ -214,8 +214,13 @@ testUserArray("test_user_array","测试用户数组"), robotCloudOpen("robot_cloud_open","云发单是否开启"), robotCloudLink("robot_cloud_link","云发单链接"), robotCloudOpen("robot_cloud_open","云发单是否开启-我的界面"), robotCloudOpenCircle("robot_cloud_open_circle","云发单是否开启-发圈界面"), robotCloudOpenGoodsDetail("robot_cloud_open_goods_detail","云发单是否开启-商品详情"), robotCloudGroupPictureNum("robot_cloud_group_picture_num","云发单群图片数量"), cloudAlipayJumpLink("cloud_alipay_jump_link","云发单支付跳转地址"), cloudAlipayReturnLink("cloud_alipay_return_link","云发单支付成功后返回哪个前端页面"), cloudAlipayNotifyLink("cloud_alipay_notify_link","云发单支付成功后回调地址"); fanli/src/main/java/com/yeshi/fanli/entity/taobao/dataoke/DaTaoKeDetailV2.java
@@ -108,6 +108,10 @@ // 额外字段维护 @Field private Integer commission;// 佣金金额,单位为分 private String circleText;// 朋友圈文案,需要url解码后使用 public Integer getCommission() { return commission; @@ -468,4 +472,12 @@ public void setTbcid(Integer tbcid) { this.tbcid = tbcid; } public String getCircleText() { return circleText; } public void setCircleText(String circleText) { this.circleText = circleText; } } fanli/src/main/java/com/yeshi/fanli/job/DynamicInfoJob.java
@@ -1,12 +1,14 @@ package com.yeshi.fanli.job; import java.math.BigDecimal; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.apache.commons.lang.StringEscapeUtils; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import org.yeshi.utils.DateUtil; @@ -16,6 +18,7 @@ import com.yeshi.fanli.dto.ConfigParamsDTO; import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult; import com.yeshi.fanli.dto.taobao.haodanku.HDKGoodsListResultDTO; import com.yeshi.fanli.dto.taobao.haodanku.HDKWXCircleContentDTO; import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser; import com.yeshi.fanli.entity.bus.activity.ActivityUser; import com.yeshi.fanli.entity.bus.activity.RecommendActivity; @@ -26,7 +29,6 @@ import com.yeshi.fanli.entity.goods.jd.NYouHuiGoods; import com.yeshi.fanli.entity.jd.JDGoods; import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2; import com.yeshi.fanli.entity.taobao.haodanku.HDKGoodsDetail; import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.activity.ActivityService; @@ -362,71 +364,6 @@ /** * 好单库商品加入发圈 */ @XxlJob("dynamic-insertEvaluate") public ReturnT<String> insertEvaluate(String param) throws Exception { try { boolean addGoods = false; Integer minId = 1; while (minId != null) { HDKGoodsListResultDTO dto = HaoDanKuApiUtil.getInstance().listHotGoods(minId, 100, 1, null); if (dto != null) { minId = dto.getMinId(); addGoods = addGoodsEvaluate(dto.getGoodsList()); } else { minId = null; } if(addGoods) { break; } } // 大淘客备用 if (!addGoods) { DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_TIME, null); if (result != null) { List<DaTaoKeDetailV2> detailList = result.getGoodsList(); if (detailList != null && detailList.size() > 0) { for (DaTaoKeDetailV2 daTaoKeV2: detailList) { if(goodsEvaluateService.addByDaTaoKeGoods(daTaoKeV2)) break; } } } } } catch (Exception e) { LogHelper.errorDetailInfo(e); } return ReturnT.SUCCESS; } private boolean addGoodsEvaluate(List<HDKGoodsDetail> hdkList) { if (hdkList == null || hdkList.size() == 0) { return false; } for (HDKGoodsDetail hdkGoods: hdkList) { try { Long itemid = hdkGoods.getItemid(); String itemdesc = hdkGoods.getItemdesc(); List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 1, 20); ActivityUser user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser(); goodsEvaluateService.addGoodsEvaluate(itemid + "", null, user, itemdesc, null, new Date()); return true; } catch (GoodsEvaluateException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } return false; } /** * 每一个小时随机在分享数的基础上加10~100。增加的时间段是每天8~22点。 * 早上6,7,15,16,21,22,23点更新1次 */ @@ -446,4 +383,126 @@ } } } /** * 商品加入发圈 */ @XxlJob("dynamic-insertEvaluate") public ReturnT<String> insertEvaluate(String param) throws Exception { // 好单库 boolean addResult = addHDKListSelected(); // 大淘客备用 if (!addResult) { addDTKFriendsFircleList(); } return ReturnT.SUCCESS; } /** * 好单库商品加入发圈 * @return */ private boolean addHDKListSelected () { boolean addResult = false; Integer minId = 1; while (minId != null) { HDKGoodsListResultDTO dto = HaoDanKuApiUtil.getInstance().listSelected(minId); if (dto == null) { minId = null; } else { minId = dto.getMinId(); List<HDKWXCircleContentDTO> list = dto.getList(); if (list== null || list.size() == 0) { continue; } for (HDKWXCircleContentDTO hdkGoods: list) { try { String itemid = hdkGoods.getItemid(); List<String> pics = hdkGoods.getItempic(); String copy_content = hdkGoods.getCopy_content(); String showtitle = StringEscapeUtils.unescapeHtml(copy_content); showtitle = showtitle.replace("<br>", "\r\n"); List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 1, 20); ActivityUser user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser(); goodsEvaluateService.addGoodsEvaluate2(itemid, pics, user, showtitle, null); addResult = true; break; } catch (GoodsEvaluateException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } if(addResult) break; } return addResult; } /** * 大淘客商品加入发圈 * @return */ private boolean addDTKFriendsFircleList() { boolean addResult = false; try { DaTaoKeGoodsResult result = DaTaoKeApiUtil.getFriendsFircleList("1", 100); while (result.getGoodsList() != null && result.getGoodsList().size() > 0) { for (DaTaoKeDetailV2 v2 : result.getGoodsList()) { try { Long goodsId = v2.getGoodsId(); String circleText = v2.getCircleText(); if (circleText == null) { continue; } String showtitle = URLDecoder.decode(circleText, "UTF-8"); showtitle = showtitle.replace(" ", " "); ActivityUser user = null; if (v2.getCid() != null) { user = activityUserService.getRandomByDaTaoKeCid(v2.getCid()); } if (user == null) { List<ActivityRuleUser> ruleList = activityUserService .listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 1, 20); user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser(); } goodsEvaluateService.addGoodsEvaluate2(goodsId + "", null, user, showtitle, null); addResult = true; break; } catch (GoodsEvaluateException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } if (addResult) { break; } try { result = DaTaoKeApiUtil.listAll(result.getPageId()); } catch (Exception e) { result = DaTaoKeApiUtil.listAll(result.getPageId()); } try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } catch (Exception e) { LogHelper.errorDetailInfo(e); } return addResult; } } fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -307,7 +307,8 @@ SELECT * FROM yeshi_ec_user u LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id <if test="keyType == 4"> LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id <if test="keyType == 4 || level != null"> LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` </if> WHERE 1=1 @@ -362,7 +363,7 @@ SELECT IFNULL(count(u.id),0) FROM yeshi_ec_user u LEFT JOIN yeshi_ec_user_info_extra ext ON u.`id` = ext.uie_uid LEFT JOIN yeshi_ec_user_rank rak ON rak.ur_id = ext.uie_rank_id LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id LEFT JOIN yeshi_ec_team_user_level_statistic lc ON lc.`tuls_uid` = u.id <if test="keyType == 4"> LEFT JOIN yeshi_ec_binding_account b ON u.`id` = b.`uid` </if> fanli/src/main/java/com/yeshi/fanli/mapping/user/cloud/UserCloudManageMapper.xml
@@ -3,23 +3,25 @@ <mapper namespace="com.yeshi.fanli.dao.mybatis.user.cloud.UserCloudManageMapper"> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage"> <id column="ucm_uid" property="id" jdbcType="BIGINT"/> <id column="ucm_uid" property="id" jdbcType="BIGINT"/> <result column="ucm_official" property="official" jdbcType="BOOLEAN"/> <result column="ucm_custom" property="custom" jdbcType="BOOLEAN"/> <result column="ucm_offline_notice" property="offlineNotice" jdbcType="BOOLEAN"/> <result column="ucm_create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="ucm_update_time" property="updateTime" jdbcType="TIMESTAMP"/> </resultMap> <sql id="Base_Column_List">ucm_uid,ucm_official,ucm_custom,ucm_create_time,ucm_update_time</sql> <sql id="Base_Column_List">ucm_uid,ucm_official,ucm_custom,ucm_offline_notice,ucm_create_time,ucm_update_time</sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select <include refid="Base_Column_List"/>from yeshi_ec_user_cloud_manage where ucm_uid = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_cloud_manage where ucm_uid = #{id,jdbcType=BIGINT}</delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_manage (ucm_uid,ucm_official,ucm_custom,ucm_create_time,ucm_update_time) values (#{id,jdbcType=BIGINT},#{official,jdbcType=BOOLEAN},#{custom,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_manage (ucm_uid,ucm_official,ucm_custom,ucm_offline_notice,ucm_create_time,ucm_update_time) values (#{id,jdbcType=BIGINT},#{official,jdbcType=BOOLEAN},#{custom,jdbcType=BOOLEAN},#{offlineNotice,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_manage <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">ucm_uid,</if> <if test="official != null">ucm_official,</if> <if test="custom != null">ucm_custom,</if> <if test="offlineNotice != null">ucm_offline_notice,</if> <if test="createTime != null">ucm_create_time,</if> <if test="updateTime != null">ucm_update_time,</if> </trim>values @@ -27,17 +29,27 @@ <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="official != null">#{official,jdbcType=BOOLEAN},</if> <if test="custom != null">#{custom,jdbcType=BOOLEAN},</if> <if test="offlineNotice != null">#{offlineNotice,jdbcType=BOOLEAN},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage">update yeshi_ec_user_cloud_manage set ucm_official = #{official,jdbcType=BOOLEAN},ucm_custom = #{custom,jdbcType=BOOLEAN},ucm_create_time = #{createTime,jdbcType=TIMESTAMP},ucm_update_time = #{updateTime,jdbcType=TIMESTAMP} where ucm_uid = #{id,jdbcType=BIGINT}</update> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage">update yeshi_ec_user_cloud_manage set ucm_official = #{official,jdbcType=BOOLEAN},ucm_custom = #{custom,jdbcType=BOOLEAN},ucm_offline_notice = #{offlineNotice,jdbcType=BOOLEAN},ucm_create_time = #{createTime,jdbcType=TIMESTAMP},ucm_update_time = #{updateTime,jdbcType=TIMESTAMP} where ucm_uid = #{id,jdbcType=BIGINT}</update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudManage">update yeshi_ec_user_cloud_manage <set> <if test="official != null">ucm_official=#{official,jdbcType=BOOLEAN},</if> <if test="custom != null">ucm_custom=#{custom,jdbcType=BOOLEAN},</if> <if test="offlineNotice != null">ucm_offline_notice=#{offlineNotice,jdbcType=BOOLEAN},</if> <if test="createTime != null">ucm_create_time=#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">ucm_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> </set> where ucm_uid = #{id,jdbcType=BIGINT} </update> <select id="selectForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long"> SELECT * from yeshi_ec_user_cloud_manage where ucm_uid = #{id,jdbcType=BIGINT} FOR UPDATE </select> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
@@ -193,10 +193,10 @@ } @Cacheable(value = "config", key = "'isRobotCloudOpen'") @Cacheable(value = "config", key = "'isRobotCloudOpen'+'-'+#key") @Override public boolean isRobotCloudOpen() { String value = get(ConfigKeyEnum.robotCloudOpen.getKey()); public boolean isRobotCloudOpen(String key) { String value = get(key); if (StringUtil.isNullOrEmpty(value)) return false; if ("1".equalsIgnoreCase(value.trim())) { @@ -206,6 +206,7 @@ } } @Cacheable(value = "config", key = "'getTestUsers'") @Override fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -1957,6 +1957,7 @@ // 白底图 List<String> imgs = new ArrayList<>(); imgs.addAll(goodsBrief.getImgList()); // 商品VO @@ -2062,6 +2063,141 @@ goodsEvaluateDao.save(goodsEvaluate); } @Override public void addGoodsEvaluate2(String goodsId, List<String> imgs, ActivityUser user, String title, String comment) throws GoodsEvaluateException { if (goodsId == null || user == null || StringUtil.isNullOrEmpty(title)) { throw new GoodsEvaluateException(1, "相关参数不能为空"); } Date limitDate = DateUtil.reduceDay(new Date(), 7); List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExistLimitTime(Constant.SOURCE_TYPE_TAOBAO, goodsId, limitDate); if (evaluateList != null && evaluateList.size() > 0) throw new GoodsEvaluateException(1, "该商品已存在"); TaoBaoGoodsBrief goodsBrief = null; try { goodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId)); } catch (TaobaoGoodsDownException e) { throw new GoodsEvaluateException(1, "商品已下架"); } if (goodsBrief == null) { throw new GoodsEvaluateException(1, "未找到商品信息"); } BigDecimal couponAmount = goodsBrief.getCouponAmount(); if (couponAmount == null || couponAmount.compareTo(new BigDecimal(0)) < 1) { throw new GoodsEvaluateException(1, "该商品无券"); } if (imgs == null) { imgs = new ArrayList<>(); } if (imgs.size() == 0) { imgs.addAll(goodsBrief.getImgList()); } // 商品VO ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55"); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO); // 商品图片信息 int i = 0; List<ImgInfo> imgList = new ArrayList<ImgInfo>(); for (String img : imgs) { ImgInfo imgInfo = new ImgInfo(); imgInfo.setH(1); imgInfo.setW(1); imgInfo.setLarge(false); imgInfo.setUrl(img); imgInfo.setUrlHD(img); if (i != 0) { imgInfo.setType(ImgEnum.img); } else { imgInfo.setType(ImgEnum.goods); SimpleGoods simpleGoods = new SimpleGoods(); simpleGoods.setGoodsId(goodsVO.getGoodsId()); simpleGoods.setGoodsType(goodsVO.getGoodsType()); simpleGoods.setState(goodsVO.getState()); CouponInfoVO couponInfo = goodsVO.getCouponInfo(); if (couponInfo == null) { simpleGoods.setPrice(goodsVO.getZkPrice()); } else { simpleGoods.setPrice(goodsVO.getCouponPrice()); simpleGoods.setAmount(couponInfo.getAmount()); } imgInfo.setGoods(simpleGoods); imgInfo.setGoodsVO(goodsVO); } imgList.add(imgInfo); i++; } // 评论内容 CommentInfo commentInfo = new CommentInfo(); commentInfo.setNeedSpin(true); commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); if (!StringUtil.isNullOrEmpty(comment)) { commentInfo.setContent(comment); commentInfo.setType(""); } else { String token = shareGoodsService.createTaoBaoToken(Constant.LINK_TOKEN_VERIFY_UID, goodsBrief); String template = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()); String commentText = template.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token)); if (!goodsVO.isHasCoupon()) { commentText = commentText.replace("领券抢购", "抢购"); commentText = commentText.replace("【券后价】[券后价]元", ""); commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); } commentInfo.setContent(commentText); commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc()); } List<CommentInfo> commentsNew = new ArrayList<>(); commentsNew.add(commentInfo); // 一行显示多少个图片 int lineNum = 0; if (imgList.size() > 0) { if (imgList.size() == 1) { lineNum = 1; } else if (imgList.size() == 3) { lineNum = 3; } else if (imgList.size() == 2 || imgList.size() == 4) { lineNum = 2; } else { lineNum = 3; } } GoodsEvaluate goodsEvaluate = new GoodsEvaluate(); goodsEvaluate.setId(UUID.randomUUID().toString().replace("-", "")); goodsEvaluate.setUser(user); goodsEvaluate.setTitle(getDescNew(title)); goodsEvaluate.setState(1); goodsEvaluate.setDynamicType(1); goodsEvaluate.setType(EvaluateEnum.single); goodsEvaluate.setShareNum((int) (Math.random() * 5000) + 1000); goodsEvaluate.setShareNumReal(0); goodsEvaluate.setWeight(0.0); goodsEvaluate.setStartTime(new Date()); goodsEvaluate.setEndTime(DateUtil.plusDayDate(3, new Date())); goodsEvaluate.setPublishTime(new Date()); goodsEvaluate.setCreateTime(new Date()); goodsEvaluate.setUpdateTime(new Date()); goodsEvaluate.setGoods(goodsVO); goodsEvaluate.setLineNum(lineNum); goodsEvaluate.setImgList(imgList); goodsEvaluate.setComments(commentsNew); goodsEvaluateDao.save(goodsEvaluate); } @Override public void addGoodsEvaluateByDaTaoKe() { List<Long> listId = null; fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java
@@ -78,4 +78,9 @@ saveMsgDetail(MsgOtherDetailFactory.goldCoinExChangeMsg(uid, num, banlce, name, exNum)); } @Override public void cloudMsg(Long uid, String category, String item, String desc) { saveMsgDetail(MsgOtherDetailFactory.cloudMsg(uid, category, item, desc)); } } fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -305,14 +305,14 @@ userInfoVO.setTotalOrder(commonOrderCountService.countHistoryOrderNum(uid)); // 累计兑换金币 userInfoVO.setTotalGoldCoinUsed(integralDetailService.sumUseGoldCoin(uid)); userInfoVO.setTotalGoldCoinUsed(Math.abs(integralDetailService.sumUseGoldCoin(uid))); // 邀请人 UserInfo boss = threeSaleSerivce.getBoss(uid); if (boss == null) { userInfoVO.setBossName(""); } else { userInfoVO.setBossName("上级:" + boss.getNickName()); userInfoVO.setBossName("邀请人:" + boss.getNickName()); } // 微信号 fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudManageServiceImpl.java
@@ -54,6 +54,7 @@ manage.setCustom(custom); manage.setOfficial(official); manage.setCreateTime(new Date()); manage.setOfflineNotice(false); userCloudManageMapper.insertSelective(manage); send = manage.getCustom(); @@ -70,4 +71,15 @@ return userCloudManageMapper.selectByPrimaryKey(uid); } @Override public void updateByPrimaryKeySelective(UserCloudManage record) { userCloudManageMapper.updateByPrimaryKeySelective(record); } @Override public UserCloudManage selectForUpdate(Long uid) { return userCloudManageMapper.selectForUpdate(uid); } } fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudOrderServiceImpl.java
@@ -14,6 +14,7 @@ import com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder; import com.yeshi.fanli.exception.user.cloud.UserCloudOrderException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService; import com.yeshi.fanli.service.inter.user.cloud.UserCloudOrderService; import com.yeshi.fanli.service.inter.user.cloud.UserCloudService; @@ -28,6 +29,8 @@ @Resource private UserCloudService userCloudService; @Override public UserCloudOrder addCloudOrder(Long uid, String type) throws UserCloudOrderException{ if (uid == null) fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudServiceImpl.java
@@ -8,6 +8,7 @@ import javax.annotation.Resource; import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.yeshi.utils.BigDecimalUtil; @@ -55,8 +56,11 @@ import com.yeshi.fanli.service.inter.goods.CommonGoodsService; import com.yeshi.fanli.service.inter.goods.ShareGoodsService; import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService; import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService; import com.yeshi.fanli.service.inter.msg.UserSystemMsgService; import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.push.PushService; import com.yeshi.fanli.service.inter.user.QrCodeService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; @@ -159,6 +163,19 @@ @Resource(name = "producer") private Producer producer; @Resource private UserOtherMsgNotificationService userOtherMsgNotificationService; @Resource private PushService pushService; @Resource private UserSystemMsgService userSystemMsgService; @Resource(name = "taskExecutor") private TaskExecutor executor; @Override public UserCloud getValidByUid(Long uid) { @@ -197,6 +214,15 @@ if (userCloud == null) throw new UserCloudException(1, "云发单已过期"); // 检测是否需要更新 - 1分钟间隔 String key = "cloudLogin_" + uid; String result = redisManager.getCommonString(key); if (!StringUtil.isNullOrEmpty(result)) { return; } redisManager.cacheCommonString(key , "true" , 60); // 更新信息 UserCloud update = new UserCloud(); update.setId(userCloud.getId()); @@ -204,7 +230,24 @@ update.setWxName(wxName); update.setWxPortrait(wxPortrait); userCloudMapper.updateByPrimaryKeySelective(update); try { userOtherMsgNotificationService.cloudMsg(uid, "云发单微信账号", "微信账号登录成功", "可以开启你的群发单了"); } catch (Exception e) { LogHelper.errorDetailInfo(e); } // 更新提醒状态 UserCloudManage cloudManage = userCloudManageService.selectForUpdate(uid); if (cloudManage == null) { userCloudManageService.save(uid, false, false); } else { UserCloudManage updateManage = new UserCloudManage(); updateManage.setId(uid); updateManage.setOfflineNotice(false); userCloudManageService.updateByPrimaryKeySelective(updateManage); } // 微信号变化-清空群信息 if (!wxId.equals(userCloud.getWxId())) { userCloudGroupService.deleteGroupByUid(uid); @@ -289,6 +332,19 @@ // 开启发圈功能 userCloudManageService.save(uid, null, null); try { String item = null; if (renew) { item = "成功续费" + menuEnum.getDescShow(); } else { item = "成功开通" + menuEnum.getDescShow(); } String desc = "完成充值支付"+ BigDecimal.valueOf(menuEnum.getMoney()).setScale(2, BigDecimal.ROUND_DOWN) +"元"; userOtherMsgNotificationService.cloudMsg(uid, "云发单充值", item, desc); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } @Override @@ -388,10 +444,6 @@ if (StringUtil.isNullOrEmpty(wxId)) throw new UserCloudException(1003, "微信号不存在,请先微信登录"); if (!AitaokerApiUtil.onlineCheck(robotId)) { throw new UserCloudException(1003, "微信已掉线,请先重新登录微信"); } // 验证开启状态 List<UserCloudGroup> listGroup = userCloudGroupService.listByUid(uid); if (listGroup == null || listGroup.size() == 0) @@ -422,7 +474,10 @@ // 检测微信是否登录状态 if (!AitaokerApiUtil.onlineCheck(robotId)) { throw new UserCloudException(1003, "请重新登录微信"); // 通知登录微信 offlineNotification(uid); throw new UserCloudException(1003, "微信已掉线,需要重新扫描二维码登录"); } @@ -466,7 +521,6 @@ String qrCode = null; String cloudPic = null; ImgInfo imgVideo = null; List<String> listImg = new ArrayList<>(); @@ -477,26 +531,7 @@ imgVideo = imgInfo; continue; } if (imgInfo.getType() == ImgEnum.goods) { cloudPic = imgInfo.getUrl(); } listImg.add(imgInfo.getUrl()); // 取消二维码图 // GoodsDetailVO goodsVO = imgInfo.getGoodsVO(); // if (goodsVO == null) { // listImg.add(imgInfo.getUrl()); // } else { // String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl()); // if (!StringUtil.isNullOrEmpty(jumpLink)) { // qrCode = jumpLink; // } // } } if (cloudPic == null) { cloudPic = imgs.get(0).getUrl(); } } @@ -573,16 +608,23 @@ } // 发送图片 if (!StringUtil.isNullOrEmpty(cloudPic)) { try { String imgBase64 = ImageToBase64.NetImageToBase64(cloudPic); boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64); if (macsend) sendContent.setPicUrl(cloudPic); } catch (Exception e) { LogHelper.errorDetailInfo(e); } int num = 1; String picNum = configService.get(ConfigKeyEnum.robotCloudGroupPictureNum.getKey()); if (!StringUtil.isNullOrEmpty(picNum)) { num = Integer.parseInt(picNum); } if (listImg.size() > 0) for (int i = 0; i < num && i < listImg.size(); i++) { try { String imgBase64 = ImageToBase64.NetImageToBase64(listImg.get(i)); boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64); if (macsend) sendContent.setPicUrl(listImg.get(i)); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } // 评论文本 List<String> list = new ArrayList<>(); @@ -697,11 +739,6 @@ if (StringUtil.isNullOrEmpty(wxId)) throw new UserCloudException(1002, "请先登录微信"); if (!AitaokerApiUtil.onlineCheck(robotId)) { throw new UserCloudException(1003, "微信已掉线,请先重新登录微信"); } // 验证开启状态 List<UserCloudGroup> listGroup = userCloudGroupService.listByUid(uid); if (listGroup == null || listGroup.size() == 0) @@ -720,9 +757,11 @@ // 检测微信是否登录状态 if (!AitaokerApiUtil.onlineCheck(robotId)) { throw new UserCloudException(1003, "请重新登录微信"); // 通知登录微信 offlineNotification(uid); throw new UserCloudException(1003, "微信已掉线,需要重新扫描二维码登录"); } // 保存发送记录 UserCloudSendRecord sendRecord = new UserCloudSendRecord(); @@ -1082,18 +1121,25 @@ } // 发送图片 String picurl = listImg.get(0); if (!StringUtil.isNullOrEmpty(picurl)) { try { String imgBase64 = ImageToBase64.NetImageToBase64(picurl); boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64); if (macsend) sendContent.setPicUrl(picurl); } catch (Exception e) { LogHelper.errorDetailInfo(e); int num = 1; String picNum = configService.get(ConfigKeyEnum.robotCloudGroupPictureNum.getKey()); if (!StringUtil.isNullOrEmpty(picNum)) { num = Integer.parseInt(picNum); } if (listImg.size() > 0) for (int i = 0; i < num && i < listImg.size(); i++) { try { String imgBase64 = ImageToBase64.NetImageToBase64(listImg.get(i)); boolean macsend = AitaokerApiUtil.macsendImgBase64(robotId, cloudGroup.getGroupId(), imgBase64); if (macsend) sendContent.setPicUrl(listImg.get(i)); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } } // 评论文本 List<String> list = new ArrayList<>(); boolean macsend = AitaokerApiUtil.macsendText(robotId, cloudGroup.getGroupId(), comment); @@ -1167,6 +1213,65 @@ } } } } private void offlineNotification(Long uid) { UserCloudManage cloudManage = userCloudManageService.selectForUpdate(uid); if (cloudManage == null) { return; } Boolean offlineNotice = cloudManage.getOfflineNotice(); if (offlineNotice != null && offlineNotice) { return; } try { userOtherMsgNotificationService.cloudMsg(uid, "云发单微信账号", "微信账号掉线", "需要你重新扫描二维码登录"); } catch (Exception e) { LogHelper.errorDetailInfo(e); } // 站内信通知 offlineNotificationZNX(uid); // 延迟10分钟再次提醒 if(!Constant.IS_TEST) { UserCloudMQMsg msg = new UserCloudMQMsg(uid, UserCloudMQMsg.TYPE_PUSH); Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.userCloud, msg); message.setStartDeliverTime(java.lang.System.currentTimeMillis() + 1000 * 60 * 10); producer.send(message); } // 更新已提醒 UserCloudManage updateManage = new UserCloudManage(); updateManage.setId(uid); updateManage.setOfflineNotice(true); userCloudManageService.updateByPrimaryKeySelective(updateManage); } // 站内信通知 @Override public void offlineNotificationZNX(Long uid) { // 验证是否开通 UserCloud userCloud = userCloudMapper.getValidByUid(uid); if (userCloud == null) return; Integer robotId = userCloud.getRobotId(); if (robotId == null) return; // 登录状态 if (AitaokerApiUtil.onlineCheck(robotId)) { return; } try { pushService.pushZNX(uid, "【重要通知】你的云发单微信已掉线。", "需要你重新扫描二维码登录", null, null); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } } fanli/src/main/java/com/yeshi/fanli/service/inter/config/ConfigService.java
@@ -125,7 +125,7 @@ * @param uid * @return */ public boolean isRobotCloudOpen(); public boolean isRobotCloudOpen(String key); /** * 测试用户信息 fanli/src/main/java/com/yeshi/fanli/service/inter/dynamic/GoodsEvaluateService.java
@@ -222,4 +222,8 @@ */ public boolean addByDaTaoKeGoods(DaTaoKeDetailV2 daTaoKe); public void addGoodsEvaluate2(String goodsId, List<String> imgs, ActivityUser user, String title, String comment) throws GoodsEvaluateException; } fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java
@@ -93,4 +93,13 @@ */ public void goldCoinExChangeMsg(Long uid, int num, int banlce, String name, String exNum); /** * 云发单消息 * @param uid * @param category * @param item * @param desc */ public void cloudMsg(Long uid, String category, String item, String desc); } fanli/src/main/java/com/yeshi/fanli/service/inter/user/cloud/UserCloudManageService.java
@@ -19,4 +19,13 @@ */ public UserCloudManage selectByPrimaryKey(Long uid); /** * 查询 * @param uid * @return */ public UserCloudManage selectForUpdate(Long uid); public void updateByPrimaryKeySelective(UserCloudManage record); } fanli/src/main/java/com/yeshi/fanli/service/inter/user/cloud/UserCloudService.java
@@ -104,4 +104,10 @@ */ public void cacheMatchGroup(String wxId, String groupId); /** * 站内信通知用户微信下线 * @param uid */ public void offlineNotificationZNX(Long uid); } fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -728,4 +728,42 @@ } return null; } /** * * @param pageId * @return */ public static DaTaoKeGoodsResult getFriendsFircleList(String pageId, int pageSize) { DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult(); TaoKeAppInfo app = getRandomApp(); Map<String, String> params = new TreeMap<>(); params.put("version", "v1.2.2"); params.put("appKey", app.getAppKey()); params.put("pageSize", pageSize + ""); if (!StringUtil.isNullOrEmpty(pageId)) params.put("pageId", pageId); params.put("sign", getSign(params, app.getAppSecret())); String result = null; try { result = HttpUtil.get("https://openapi.dataoke.com/api/goods/friends-circle-list", params, new HashMap<>()); } catch (Exception e) { result = HttpUtil.get("https://openapi.dataoke.com/api/goods/friends-circle-list", params, new HashMap<>()); } JSONObject json = JSONObject.fromObject(result); JSONObject dataJson = json.optJSONObject("data"); if (dataJson != null) { JSONArray array = dataJson.optJSONArray("list"); if (array != null) { List<DaTaoKeDetailV2> list = parseDaTaoKeDetailV2List(array); daTaoKeGoodsResult.setGoodsList(list); } daTaoKeGoodsResult.setPageId(dataJson.optString("pageId")); daTaoKeGoodsResult.setTotalCount(dataJson.optLong("totalNum")); } return daTaoKeGoodsResult; } } fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOtherDetailFactory.java
@@ -267,4 +267,33 @@ return detail; } /** * 云发单相关信息 * @param uid * @param category * @param item * @param desc * @return */ public static MsgOtherDetail cloudMsg(Long uid, String category, String item, String desc) { List<CommonMsgItemVO> listMsg = new ArrayList<>(); listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE), new ClientTextStyleVO(category, ClientTextStyleVO.COLOR_CONTENT))); listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("事项", ClientTextStyleVO.COLOR_TITLE), new ClientTextStyleVO(item, ClientTextStyleVO.COLOR_CONTENT))); listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("说明", ClientTextStyleVO.COLOR_TITLE), new ClientTextStyleVO(desc, ClientTextStyleVO.COLOR_CONTENT))); listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE), new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT))); MsgOtherDetail detail = new MsgOtherDetail(); detail.setCreateTime(new Date()); detail.setRead(false); detail.setUser(new UserInfo(uid)); detail.setType(MsgTypeOtherTypeEnum.cloudWX); detail.setExtraInfo(new Gson().toJson(listMsg)); return detail; } } fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/user/UserCloudMessageListener.java
@@ -9,17 +9,10 @@ import com.aliyun.openservices.ons.api.Message; import com.aliyun.openservices.ons.api.MessageListener; import com.google.gson.Gson; import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum; import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg; import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg; import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum; import com.yeshi.fanli.dto.mq.user.body.UserCloudMQMsg; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.user.cloud.UserCloudService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.rocketmq.MQTopicName; /** @@ -47,9 +40,12 @@ if (msg.getType() == UserCloudMQMsg.TYPE_EVALUATE) { LogHelper.cloudInfo("发圈中信息 -" + msg.getId() ); userCloudService.autoSendByDynamic(msg.getUid(), msg.getId()); } else { } else if (msg.getType() == UserCloudMQMsg.TYPE_STORE) { LogHelper.cloudInfo("选品库信息 -" + msg.getId() ); userCloudService.autoSendCustomGoods(msg.getUid(), Long.parseLong(msg.getId())); } else if (msg.getType() == UserCloudMQMsg.TYPE_PUSH) { LogHelper.cloudInfo("站内信息 -" + msg.getId() ); userCloudService.offlineNotificationZNX(msg.getUid()); } } } fanli/src/main/java/com/yeshi/fanli/util/taobao/HaoDanKuApiUtil.java
@@ -11,6 +11,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.yeshi.fanli.dto.taobao.haodanku.HDKGoodsListResultDTO; import com.yeshi.fanli.dto.taobao.haodanku.HDKWXCircleContentDTO; import com.yeshi.fanli.entity.taobao.haodanku.HDKGoodsDetail; import com.yeshi.fanli.util.StringUtil; @@ -272,4 +273,63 @@ System.out.println(resultJSON.optJSONObject("data").optString("couponurl")); } public HDKGoodsListResultDTO listSelected(Integer minId) { if (minId == null) minId = 1; List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>(); params.add(new ParamsKeyValue("min_id", minId + "")); String result = baseGetRequest("selected_item", params); JSONObject resultData = JSONObject.fromObject(result); if (resultData.optInt("code") == 1) { JSONArray array = resultData.optJSONArray("data"); if (array != null) { List<HDKWXCircleContentDTO> list = new ArrayList<>(); for (int i = 0; i <array.size(); i ++) { JSONObject item = array.optJSONObject(i); HDKWXCircleContentDTO dto = new HDKWXCircleContentDTO(); dto.setTitle(item.optString("title")); dto.setItemid(item.optString("itemid")); dto.setItemtitle(item.optString("itemtitle")); dto.setContent(item.optString("content")); dto.setCopy_content(item.optString("copy_content")); dto.setShow_content(item.optString("show_content")); JSONArray imgArray = item.optJSONArray("itempic"); if (imgArray != null) { List<String> imgList = new ArrayList<>(); for (int n = 0; n < imgArray.size(); n++) { imgList.add(imgArray.optString(n)); } dto.setItempic(imgList); } list.add(dto); } HDKGoodsListResultDTO dto = new HDKGoodsListResultDTO(); dto.setList(list); dto.setMinId(minId); return dto; } } return null; } public HDKGoodsListResultDTO getItemDetail(String itemid) { List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>(); params.add(new ParamsKeyValue("itemid", itemid)); String result = baseGetRequest("item_detail", params); JSONObject resultData = JSONObject.fromObject(result); if (resultData.optInt("code") == 1) { Integer newMinId = resultData.optInt("min_id"); Type type = new TypeToken<ArrayList<HDKGoodsDetail>>() { }.getType(); List<HDKGoodsDetail> list = new Gson().fromJson(resultData.optJSONArray("data").toString(), type); return new HDKGoodsListResultDTO(list, newMinId); } return null; } }