From 271ae63c20fcbe28d29c47f1881138ff6551a2a1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 10 六月 2020 19:26:26 +0800 Subject: [PATCH] 唯品会订单bug修复,APP端佣金比例展示错误bug修复 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java | 172 ++++++++++++++++++++++++++++++++------------------------- 1 files changed, 96 insertions(+), 76 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java index 2ff91bc..7c96e19 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java @@ -31,28 +31,23 @@ import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord.ModifyTypeEnum; -import com.yeshi.fanli.entity.bus.user.WeiXinUser; -import com.yeshi.fanli.entity.system.BusinessSystem; -import com.yeshi.fanli.exception.user.ThreeSaleException; import com.yeshi.fanli.exception.user.UserInfoException; 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.extract.BindingAccountService; -import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService; +import com.yeshi.fanli.service.inter.order.CommonOrderCountService; import com.yeshi.fanli.service.inter.user.SpreadUserImgService; -import com.yeshi.fanli.service.inter.user.UserActiveLogService; import com.yeshi.fanli.service.inter.user.UserInfoModifyRecordService; import com.yeshi.fanli.service.inter.user.UserInfoService; -import com.yeshi.fanli.service.inter.user.UserRankService; +import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService; import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.user.tb.TaoBaoUnionAuthRecordService; import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.FilePathEnum; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.account.UserUtil; -import com.yeshi.fanli.util.wx.WXLoginUtil; +import com.yeshi.fanli.util.user.UserLevelUtil; import com.yeshi.fanli.vo.user.UserInfoVO; import net.coobird.thumbnailator.Thumbnails; @@ -62,12 +57,6 @@ @Resource(name = "taskExecutor") private TaskExecutor executor; - - @Resource - private UserInfoService userInfoService; - - @Resource - private ConfigService configService; @Resource private ThreeSaleSerivce threeSaleSerivce; @@ -92,12 +81,10 @@ @Resource private HongBaoV2CountService hongBaoV2CountService; - + + @Lazy @Resource - private UserRankService userRankService; - - @Resource - private UserActiveLogService userActiveLogService; + private CommonOrderCountService commonOrderCountService; @Resource private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; @@ -107,16 +94,16 @@ @Resource private SpreadUserImgService spreadUserImgService; - + + @Lazy @Resource - private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService; - - @Resource - private BindingAccountService bindingAccountService; - + private IntegralDetailService integralDetailService; + @Lazy @Resource private UserInfoModifyRecordService userInfoModifyRecordService; + + public UserInfo getUserByLoginTypeAndOpenId(int loginType, String openid, String appid) { List<UserInfo> list = null; @@ -169,7 +156,7 @@ UserInfo temp = userInfoMapper.selectByPrimaryKey(form.getId()); COSManager cosManager = COSManager.getInstance(); InputStream inputStream = HttpUtil.getAsInputStream(temp.getPortrait()); - String uploadFile = cosManager.uploadFile(inputStream, UUID.randomUUID().toString()).getUrl(); + String uploadFile = cosManager.uploadFile(inputStream, FilePathEnum.userPortrait.getPath() + UUID.randomUUID().toString()).getUrl(); UserInfo updateTemp = new UserInfo(temp.getId()); updateTemp.setPortrait(uploadFile); userInfoMapper.updateByPrimaryKeySelective(updateTemp); @@ -224,43 +211,7 @@ return userInfoMapper.countAvaiableUser(); } - @Transactional - public boolean inviteWXUserInfo(String code, UserInfo inviter) { - WeiXinUser weiXinUser = WXLoginUtil.getWeiXinWYUser(code); - if (weiXinUser == null) { - return false; - } - String wxUnionId = weiXinUser.getUnionid(); - UserInfo find = getUserByLoginTypeAndOpenId(Constant.WEIXIN, wxUnionId, Constant.APPID); - - if (find == null) { - find = new UserInfo(); - find.setAppId(Constant.APPID); - find.setWxUnionId(weiXinUser.getUnionid()); - String wxHeadImg = COSManager.getInstance() - .uploadFile(HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl()), - Constant.WXHEADURL + UUID.randomUUID().toString()) - .getUrl(); - find.setPortrait(wxHeadImg); - find.setWxPic(wxHeadImg); - find.setNickName(weiXinUser.getNickname()); - find.setWxName(weiXinUser.getNickname()); - find.setLoginType(Constant.WEIXIN); - find.setRank(0); - find.setWxOpenId(weiXinUser.getOpenid()); - BusinessSystem system = new BusinessSystem(Constant.FANLI); - system.setPlatform(1); - find.setSystem(system); - } - - try { - threeSaleSerivce.bind(find, inviter); - return true; - } catch (ThreeSaleException e) { - e.printStackTrace(); - return false; - } - } + @Transactional public void unBindUserInfo(UserInfo user, int type) { @@ -316,18 +267,74 @@ return UserUtil.filterForClientUser(user); } + + + @Override + public long countInfo(Integer userState, String key, Integer keyType, String userRank, Integer days, + String startTime, String endTime,Integer userType, String level, Integer activeCode) { + return userInfoMapper.countInfo(userState, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode); + } + + @Override + public List<UserInfoVO> queryInfo(long start, int count, Integer userState, String key, Integer keyType, + String userRank, Integer days, String startTime, String endTime, Integer userType, String level, Integer activeCode) { + + List<UserInfoVO> userList = userInfoMapper.queryInfo(start, count, userState, key, keyType, userRank, days, + startTime, endTime, userType, level, activeCode); + + if (userList == null || userList.size() == 0) { + return null; + } + + for (UserInfoVO userInfoVO : userList) { + Long uid = userInfoVO.getId(); + String rankName = userInfoVO.getRankName(); + if (rankName == null || rankName.trim().length() == 0) { + userInfoVO.setRankName("闈掗摐"); + userInfoVO.setRankPicture("http://img.flqapp.com/resource/rank/rank_picture_new_1.png"); + } + + String userLevel = userInfoVO.getUserLevel(); + if (!StringUtil.isNullOrEmpty(userLevel)) { + userInfoVO.setUserLevel(UserLevelUtil.getByEnumName(userLevel).getName()); + } + // 绱鎻愮幇 + userInfoVO.setTotalExtract(payInfoMapper.sumMoneyByUid(uid)); + + // 绱璁㈠崟鏁伴噺 + userInfoVO.setTotalOrder(commonOrderCountService.countHistoryOrderNum(uid)); + + // 绱鍏戞崲閲戝竵 + userInfoVO.setTotalGoldCoinUsed(integralDetailService.sumUseGoldCoin(uid)); + + // 閭�璇蜂汉 + UserInfo boss = threeSaleSerivce.getBoss(uid); + if (boss == null) { + userInfoVO.setBossName(""); + } else { + userInfoVO.setBossName("涓婄骇锛�" + boss.getNickName()); + } + } + + return userList; + } + + + + @Override public long queryCount(Integer userState, String key, Integer keyType, String userRank, Integer days, - String startTime, String endTime) { - return userInfoMapper.queryCount(userState, key, keyType, userRank, days, startTime, endTime); + String startTime, String endTime,Integer userType, String level, Integer activeCode) { + return userInfoMapper.queryCount(userState, key, keyType, userRank, days, startTime, endTime,userType, level, activeCode); } @Override public List<UserInfoVO> query(long start, int count, Integer userState, String key, Integer keyType, - String userRank, Integer days, String startTime, String endTime, Integer orderField, Integer orderMode) { + String userRank, Integer days, String startTime, String endTime, Integer orderField, Integer orderMode, + Integer userType, String level, Integer activeCode) { List<UserInfoVO> userList = userInfoMapper.query(start, count, userState, key, keyType, userRank, days, - startTime, endTime, orderField, orderMode); + startTime, endTime, orderField, orderMode,userType, level, activeCode); if (userList == null || userList.size() == 0) { return null; @@ -450,12 +457,24 @@ userInfoVO.setCountScanHistory(countScanHistory); // 涓�搴﹂槦鍛樻暟閲� - int firstTeamCount = shareMapper.myFirstTeamCount(uid + ""); - userInfoVO.setCountLevelOne(firstTeamCount); + //int firstTeamCount = shareMapper.myFirstTeamCount(uid + ""); + //userInfoVO.setCountLevelOne(firstTeamCount); // 浜屽害闃熷憳鏁伴噺 - int secondTeamCount = shareMapper.mySecondTeamCount(uid + ""); - userInfoVO.setCountLevelTwo(secondTeamCount); + //int secondTeamCount = shareMapper.mySecondTeamCount(uid + ""); + //userInfoVO.setCountLevelTwo(secondTeamCount); + + String userLevel = userInfoVO.getUserLevel(); + if (!StringUtil.isNullOrEmpty(userLevel)) { + userInfoVO.setUserLevel(UserLevelUtil.getByEnumName(userLevel).getName()); + } + + String inviteCode = userInfoVO.getInviteCode(); + if (!StringUtil.isNullOrEmpty(inviteCode)) { + userInfoVO.setInviteCode("宸叉縺娲�"); + } else { + userInfoVO.setInviteCode("鏈縺娲�"); + } } @Override @@ -515,8 +534,8 @@ * @return */ @Override - public UserInfo getInfoByPhoneOrInviteCode(String phone, String inviteCode) { - return userInfoMapper.getInfoByPhoneOrInviteCode(phone, inviteCode); + public UserInfo getUserInfoByInviteCode(String inviteCode) { + return userInfoMapper.getUserInfoByInviteCode(inviteCode); } @Override @@ -600,7 +619,7 @@ Thumbnails.of(file.getInputStream()).size(200, 200).toFile(targetPath); // 鎵ц涓婁紶 - String filePath = "/img/user/" + UUID.randomUUID().toString().replace("-", "") + ".jpg"; + String filePath =FilePathEnum.userPortrait.getPath() + UUID.randomUUID().toString().replace("-", "") + ".jpg"; String fileLink = COSManager.getInstance().uploadFile(new File(targetPath), filePath).getUrl(); // 鍒犻櫎鏈湴鍥剧墖 @@ -616,7 +635,7 @@ userInfoMapper.updateByPrimaryKeySelective(userInfo); // 鍒犻櫎鍘熷ご鍍� - if (!StringUtil.isNullOrEmpty(portrait) && portrait.contains("/img/user/")) { + if (!StringUtil.isNullOrEmpty(portrait)) { COSManager.getInstance().deleteFile(portrait); } @@ -676,4 +695,5 @@ return userInfoMapper.selectAvailableByPrimaryKey(uid); } + } -- Gitblit v1.8.0