From 60ce38a3e7aae1d0853d673ce02c04254d73532f Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 7 Sep 2021 15:45:57 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighUserController.java | 10 +------ .../com/cweb/controller/WechatController.java | 21 +++++++------ .../main/java/com/hai/model/UserModel.java | 21 +++++++++++++ .../com/hai/service/HighUserCardService.java | 9 ++++++ .../java/com/hai/service/HighUserService.java | 9 ++++++ .../service/impl/HighUserCardServiceImpl.java | 11 +++++++ .../hai/service/impl/HighUserServiceImpl.java | 30 +++++++++++++++++-- 7 files changed, 91 insertions(+), 20 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java index f2401946..01596edd 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -66,15 +66,7 @@ public class HighUserController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - HighUser highUser = highUserService.findByUserId(userInfoModel.getHighUser().getId()); - if (highUser != null) { - highUser.setUnusedCouponNum( highUserCouponService.getCouponList(highUser.getId(), 1).size()); //未使用卡卷数量 - highUser.setUnpaid(highOrderService.countOrderByUserId(highUser.getId() , 1)); - highUser.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(highUser.getId() , 1)); - highUser.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userInfoModel.getHighUser().getId())); - highUser.setIsSetHltCard(highUserCardService.isBindHtlCard(highUser.getId())); - } - return ResponseMsgUtil.success(highUser); + return ResponseMsgUtil.success(highUserService.getDetailDataByUser(userInfoModel.getHighUser().getId())); } catch (Exception e) { log.error("HighUserController --> findByUserId() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 13338fc3..b720295a 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -99,10 +99,12 @@ public class WechatController { } // 定义个人所有数据 - HighUserModel loginDataModel = new HighUserModel(); - highUser.setPassword(null); - loginDataModel.setHighUser(highUser); - SessionObject so = new SessionObject(highUser.getUnionId(), 1 , loginDataModel); + HighUserModel highUserModel = new HighUserModel(); + HighUser detailData = highUserService.getDetailDataByUser(highUser.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); + + SessionObject so = new SessionObject(highUser.getUnionId(), 1 , highUserModel); userCenter.save(request, response, so); return ResponseMsgUtil.success(so); @@ -143,8 +145,9 @@ public class WechatController { // 定义个人所有数据 HighUserModel highUserModel = new HighUserModel(); - user.setPassword(null); - highUserModel.setHighUser(user); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); userCenter.save(request, response, so); @@ -207,9 +210,9 @@ public class WechatController { // 定义个人所有数据 HighUserModel highUserModel = new HighUserModel(); - user.setPassword(null); - user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId())); - highUserModel.setHighUser(user); + HighUser detailData = highUserService.getDetailDataByUser(user.getId()); + detailData.setPassword(null); + highUserModel.setHighUser(detailData); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); userCenter.save(request, response, so); diff --git a/hai-service/src/main/java/com/hai/model/UserModel.java b/hai-service/src/main/java/com/hai/model/UserModel.java index 555f900b..c28c68dd 100644 --- a/hai-service/src/main/java/com/hai/model/UserModel.java +++ b/hai-service/src/main/java/com/hai/model/UserModel.java @@ -1,5 +1,7 @@ package com.hai.model; +import com.hai.entity.HighUserCard; + /** * @Auther: 胡锐 * @Description: @@ -22,6 +24,25 @@ public class UserModel { // 是否绑定汇联通工会卡 private Boolean isSetHltCard; + // 汇联通卡号 + private HighUserCard hltCardNo; + + public Boolean getSetHltCard() { + return isSetHltCard; + } + + public void setSetHltCard(Boolean setHltCard) { + isSetHltCard = setHltCard; + } + + public HighUserCard getHltCardNo() { + return hltCardNo; + } + + public void setHltCardNo(HighUserCard hltCardNo) { + this.hltCardNo = hltCardNo; + } + public Integer getUnusedCouponNum() { return unusedCouponNum; } diff --git a/hai-service/src/main/java/com/hai/service/HighUserCardService.java b/hai-service/src/main/java/com/hai/service/HighUserCardService.java index cc1ca75a..ed49c39b 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserCardService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserCardService.java @@ -43,4 +43,13 @@ public interface HighUserCardService { */ Boolean isBindHtlCard(Long userId); + /** + * @Author hurui + * @Description 获取一张汇联通工会卡 + * @Date 15:42 2021/9/7 + * @Param [userId] + * @return com.hai.entity.HighUserCard + **/ + HighUserCard getUserHtlCardNo(Long userId); + } diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 3a1331f6..8a4510cd 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -40,6 +40,15 @@ public interface HighUserService { */ HighUser findByUserId(Long userId); + /** + * @Author hurui + * @Description 查询用户详情数据 + * @Date 15:34 2021/9/7 + * @Param [userId] + * @return com.hai.entity.HighUser + **/ + HighUser getDetailDataByUser(Long userId); + /** * @Author 胡锐 * @Description 根据微信openId 查询用户 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java index 7b5f1ee5..e6531893 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserCardServiceImpl.java @@ -66,4 +66,15 @@ public class HighUserCardServiceImpl implements HighUserCardService { } return false; } + + @Override + public HighUserCard getUserHtlCardNo(Long userId) { + HighUserCardExample example = new HighUserCardExample(); + example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(0); + List list = highUserCardMapper.selectByExample(example); + if(list.size() > 0) { + return list.get(0); + } + return null; + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 8d72c073..34301c88 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -11,8 +11,7 @@ import com.hai.entity.HighGoldRec; import com.hai.entity.HighUser; import com.hai.entity.HighUserExample; import com.hai.model.HighUserModel; -import com.hai.service.HighGoldRecService; -import com.hai.service.HighUserService; +import com.hai.service.*; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -36,6 +35,18 @@ public class HighUserServiceImpl implements HighUserService { @Resource private HighGoldRecService highGoldRecService; + @Resource + private HighUserCouponService highUserCouponService; + + @Resource + private HighUserCardService highUserCardService; + + @Resource + private HighOrderService highOrderService; + + @Resource + private HighUserPayPasswordService highUserPayPasswordService; + @Resource private UserCenter userCenter; @@ -69,6 +80,21 @@ public class HighUserServiceImpl implements HighUserService { return highUserMapper.selectByPrimaryKey(userId); } + @Override + public HighUser getDetailDataByUser(Long userId) { + HighUser user = highUserMapper.selectByPrimaryKey(userId); + if (user == null) { + return null; + } + user.setUnusedCouponNum(highUserCouponService.getCouponList(userId, 1).size()); //未使用卡卷数量 + user.setUnpaid(highOrderService.countOrderByUserId(userId , 1)); + user.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(userId , 1)); + user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userId)); + user.setIsSetHltCard(highUserCardService.isBindHtlCard(userId)); + user.setHltCardNo(highUserCardService.getUserHtlCardNo(userId)); + return user; + } + @Override public HighUser findByOpenId(String openId) { HighUserExample example = new HighUserExample();