From dc444e2ba2017fb8a476faf9448de9df335ea1c3 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 31 Aug 2021 23:05:58 +0800 Subject: [PATCH 1/5] =?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 --- .../controller/HighUserCardController.java | 25 +++++++++++++++++-- .../cweb/controller/HighUserController.java | 10 +++++--- .../cweb/controller/pay/OrderController.java | 2 +- .../main/java/com/hai/model/UserModel.java | 19 ++++++++++++++ .../com/hai/service/HighUserCardService.java | 7 ++++++ .../service/impl/HighOrderServiceImpl.java | 10 ++++---- .../service/impl/HighUserCardServiceImpl.java | 11 ++++++++ 7 files changed, 72 insertions(+), 12 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java index 84ee6b67..50c05130 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java @@ -10,11 +10,14 @@ import com.hai.common.security.UserCenter; import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongUnionCardConfig; +import com.hai.entity.HighUser; import com.hai.entity.HighUserCard; import com.hai.enum_type.UserCardType; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.service.HighUserCardService; +import com.hai.service.HighUserPayPasswordService; +import com.hai.service.HighUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -45,6 +48,11 @@ public class HighUserCardController { @Resource private RedisUtil redisUtil; + @Resource + private HighUserService highUserService; + + @Resource + private HighUserPayPasswordService highUserPayPasswordService; @RequestMapping(value = "/getUserCardList", method = RequestMethod.GET) @ResponseBody @@ -125,7 +133,11 @@ public class HighUserCardController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - if (highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo")) == null) { + if (highUserCardService.isBindHtlCard(userInfoModel.getHighUser().getId()) == true) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "绑定失败!只能绑定一张工会卡"); + } + + if (highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo")) != null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定此卡,请勿重复绑定"); } @@ -142,7 +154,16 @@ public class HighUserCardController { highUserCardService.editCard(userCard); redisUtil.del(body.getString("phone")); - return ResponseMsgUtil.success("操作成功"); + + // 定义个人所有数据 + HighUser user = highUserService.findByUserId(userInfoModel.getHighUser().getId()); + HighUserModel highUserModel = new HighUserModel(); + user.setPassword(null); + user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId())); + user.setIsSetHltCard(highUserCardService.isBindHtlCard(user.getId())); + highUserModel.setHighUser(user); + SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); + return ResponseMsgUtil.success(so); } throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误"); 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 01a4c244..f2401946 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserController.java @@ -12,10 +12,7 @@ import com.hai.entity.HighUserCoupon; import com.hai.entity.HighUserPayPassword; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; -import com.hai.service.HighOrderService; -import com.hai.service.HighUserCouponService; -import com.hai.service.HighUserPayPasswordService; -import com.hai.service.HighUserService; +import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -51,6 +48,9 @@ public class HighUserController { @Resource private HighUserCouponService highUserCouponService; + @Resource + private HighUserCardService highUserCardService; + @Resource private HighOrderService highOrderService; @@ -72,6 +72,7 @@ public class HighUserController { 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); @@ -162,6 +163,7 @@ public class HighUserController { HighUserModel highUserModel = new HighUserModel(); user.setPassword(null); user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(user.getId())); + user.setIsSetHltCard(highUserCardService.isBindHtlCard(user.getId())); highUserModel.setHighUser(user); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel); return ResponseMsgUtil.success(so); diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 5bd580bf..0c0d85e8 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -313,7 +313,7 @@ public class OrderController { } // 查询用户与卡号的关系 - HighUserCard userCard = highUserCardService.getDetailByUserCardNo(1L, cardNo); + HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo); if (userCard == null) { log.error("OrderController --> orderToPay() ERROR", "未绑定卡号"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号"); 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 490b42ba..555f900b 100644 --- a/hai-service/src/main/java/com/hai/model/UserModel.java +++ b/hai-service/src/main/java/com/hai/model/UserModel.java @@ -19,6 +19,9 @@ public class UserModel { // 是否设置支付密码 private Boolean isSetPayPwd; + // 是否绑定汇联通工会卡 + private Boolean isSetHltCard; + public Integer getUnusedCouponNum() { return unusedCouponNum; } @@ -50,4 +53,20 @@ public class UserModel { public void setIsSetPayPwd(Boolean setPayPwd) { isSetPayPwd = setPayPwd; } + + public Boolean getSetPayPwd() { + return isSetPayPwd; + } + + public void setSetPayPwd(Boolean setPayPwd) { + isSetPayPwd = setPayPwd; + } + + public Boolean getIsSetHltCard() { + return isSetHltCard; + } + + public void setIsSetHltCard(Boolean setHltCard) { + isSetHltCard = setHltCard; + } } 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 7ba4953d..cc1ca75a 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserCardService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserCardService.java @@ -36,4 +36,11 @@ public interface HighUserCardService { */ HighUserCard getDetailByUserCardNo(Long userId,String codeNo); + /** + * 是否绑定汇联通工会卡 + * @param userId + * @return + */ + Boolean isBindHtlCard(Long userId); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 9108ca36..38baf321 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -337,10 +337,6 @@ public class HighOrderServiceImpl implements HighOrderService { // 商品类型 商品类型 1:卡卷 2:金币充值 if (highChildOrder.getGoodsType() == 1) { highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 - HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); - code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 - code.setReceiveTime(new Date()); - highCouponCodeService.updateCouponCode(code); HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); // 贵州中石化 @@ -350,7 +346,6 @@ public class HighOrderServiceImpl implements HighOrderService { if (!tokenObject.getString("result").equals("success")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败"); } - Map push = new HashMap<>(); push.put("token", "data"); push.put("couTypeCode", coupon.getCouponKey()); @@ -399,6 +394,11 @@ public class HighOrderServiceImpl implements HighOrderService { highGasOrderPushMapper.insert(highGasOrderPush); } else { + HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); + code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 + code.setReceiveTime(new Date()); + highCouponCodeService.updateCouponCode(code); + // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); highUserCoupon.setMerchantId(code.getMerchantId()); 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 dee42d00..7b5f1ee5 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 @@ -55,4 +55,15 @@ public class HighUserCardServiceImpl implements HighUserCardService { } return null; } + + @Override + public Boolean isBindHtlCard(Long userId) { + HighUserCardExample example = new HighUserCardExample(); + example.createCriteria().andUserIdEqualTo(userId).andStatusNotEqualTo(0); + List list = highUserCardMapper.selectByExample(example); + if (list.size() > 0) { + return true; + } + return false; + } } From fa6ce0bd57b2c8719d551957b12dcffc300c6b72 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 31 Aug 2021 23:07:16 +0800 Subject: [PATCH 2/5] =?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 --- hai-cweb/src/main/resources/pre/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hai-cweb/src/main/resources/pre/application.yml b/hai-cweb/src/main/resources/pre/application.yml index 2145d8a7..329ecc10 100644 --- a/hai-cweb/src/main/resources/pre/application.yml +++ b/hai-cweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource From 96ec8e09cedaf8059b295b6f9221bfb6e035f8ad Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 2 Sep 2021 16:25:52 +0800 Subject: [PATCH 3/5] =?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 --- .../com/hai/common/exception/ErrorCode.java | 1 + .../config/HuiLianTongUnionCardConfig.java | 27 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java index 1a5115ea..72b5f220 100644 --- a/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java +++ b/hai-service/src/main/java/com/hai/common/exception/ErrorCode.java @@ -121,6 +121,7 @@ public enum ErrorCode { DELETE_DATA_ERROR("3003","删除数据失败"), COMPETENCE_INSUFFICIENT("3004","权限不足"), REQUEST_ERROR("3005","请求错误"), + REQUEST_TIMED_OUT("3006","请求超时,请稍后重试"), MSG_EVENT_NULL("2999","消息类型为空"), USE_VISIT_ILLEGAL("4001","用户身份错误"), diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java index 1a49dfc4..47ba427e 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java @@ -72,18 +72,23 @@ public class HuiLianTongUnionCardConfig { * @throws Exception */ public static JSONObject queryConsumptionRecordByBusiness(String businessType,String cardNo,Long sdate,Long edate,Integer page,Integer pageSize) throws Exception { - Map dataMap = new HashMap<>(); - dataMap.put("businessType", businessType); - dataMap.put("cardNo", cardNo); - dataMap.put("page", page); - dataMap.put("pageSize", pageSize); - if (sdate != null) { - dataMap.put("sdate", DateUtil.date2String(new Date(sdate), "yyyy-MM-dd")); + try { + Map dataMap = new HashMap<>(); + dataMap.put("businessType", businessType); + dataMap.put("cardNo", cardNo); + dataMap.put("page", page); + dataMap.put("pageSize", pageSize); + if (sdate != null) { + dataMap.put("sdate", DateUtil.date2String(new Date(sdate), "yyyy-MM-dd")); + } + if (edate != null) { + dataMap.put("edate", DateUtil.date2String(new Date(edate), "yyyy-MM-dd")); + } + return request("qtk/queryConsumptionRecordByBusiness", dataMap); + } catch (Exception e) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_TIMED_OUT, ""); } - if (edate != null) { - dataMap.put("edate", DateUtil.date2String(new Date(edate), "yyyy-MM-dd")); - } - return request("qtk/queryConsumptionRecordByBusiness", dataMap); + } /** From 3b214e211be42a58bceef08f5b4fdb8a38d70def Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 6 Sep 2021 16:14:19 +0800 Subject: [PATCH 4/5] =?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 --- .../java/com/cweb/controller/HighTestController.java | 12 +++++++++++- .../com/hai/service/impl/HighOrderServiceImpl.java | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index d5f343ff..a9807b4f 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -2,6 +2,7 @@ package com.cweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.cweb.config.SysConst; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -223,7 +224,16 @@ public class HighTestController { public ResponseData test3() { try { // return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse("T3xbPEKEXV9+CbBw8D1B+N2jk8xwa55s0Bde48c49YDMmj1rv5nOrkawWt8fskSihNw0wugKUT1x\\nWjHhIN8af7NylRVfhJvbeja2Zjjxnwk3FEKgyvIvJnk3QgiY4aghqQcGKxDOlAxT/kjrkDd2ESu1\\nIWkpi+0HGnG3rKSL6+a1Nu7aW+rPHwXUOmHSgWFZFb9HhlfKI/jml3GhMZBWsZFirayyMMi8UKrd\\nYN7ANPEB/6uV9iVtpLF5Kz8M2+GpI0EqRhPFAH2u3Q/RSgW8ei2ZbOY9NnbkdwuOjU93wgJxdY1Y\\n93hvLYNe1i9QkSM1")); - return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.queryCardInfo("HF2021061600273071609").getString("data")); + // 获取token + JSONObject tokenObject = HuiLianTongConfig.getToken(); + if (!tokenObject.getString("result").equals("success")) { + log.error("HighCouponController -> insertCoupon() error!","获取token失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取token失败"); + } + // 推送给高速 + JSONObject returnParam = HuiLianTongConfig.couJointDist(tokenObject.getString("data"), "20JY000251", 4, "15932678659", "HF"+new Date().getTime()); + + return ResponseMsgUtil.success(returnParam); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 38baf321..a17a2daa 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -305,6 +305,10 @@ public class HighOrderServiceImpl implements HighOrderService { goodsDesc = "积分充值"+order.getPayPrice()+"元"; tranDesc = "嗨森逛积分充值"+order.getPayPrice()+"元"; + } else if (order.getHighChildOrderList().get(0).getGoodsType() == 3) { + goodsDesc = "加油站加"+order.getPayPrice()+"元油"; + tranDesc = "【"+order.getHighChildOrderList().get(0).getGoodsName()+"】加油"+order.getPayPrice()+"元"; + } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,请使用其他支付方式"); } @@ -333,6 +337,7 @@ public class HighOrderServiceImpl implements HighOrderService { order.setPayType(4); // 支付方式: 1:支付宝 2:微信 3:金币 4:汇联通支工会卡 order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { // 商品类型 商品类型 1:卡卷 2:金币充值 if (highChildOrder.getGoodsType() == 1) { 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 5/5] =?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();