From 7c5b7ed74460dd6996031e4a4bcd0c930aef60dd Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 5 Apr 2021 17:41:11 +0800 Subject: [PATCH 1/3] 1 --- .../bweb/controller/HighDiscountController.java | 4 ++-- .../HighDiscountCouponRelController.java | 6 +++--- .../com/bweb/controller/LoginController.java | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java index 4a269c03..b57f9d17 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountController.java @@ -112,7 +112,6 @@ public class HighDiscountController { if (highDiscount.getId() == null || StringUtils.isBlank(highDiscount.getDiscountName()) || StringUtils.isBlank(highDiscount.getDiscountImg()) - || StringUtils.isBlank(highDiscount.getDiscountCarouselImg()) || highDiscount.getEffectiveDay() == null || highDiscount.getSalesEndTime() == null) { log.error("HighDiscountController -> updateDiscount() error!","参数错误"); @@ -148,7 +147,7 @@ public class HighDiscountController { } - @RequestMapping(value="/updateDiscountStatus",method = RequestMethod.POST) + @RequestMapping(value="/updateDiscountStatus",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "修改优惠券状态") public ResponseData updateDiscountStatus(@RequestParam(name = "discountId", required = true) Long discountId, @@ -187,6 +186,7 @@ public class HighDiscountController { @RequestMapping(value="/getDiscountList",method = RequestMethod.GET) @ResponseBody + @ApiOperation(value = "查询优惠券列表") public ResponseData getDiscountList(@RequestParam(name = "discountKey", required = false) String discountKey, @RequestParam(name = "discountName", required = false) String discountName, diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountCouponRelController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountCouponRelController.java index 4dd37fa9..0a8161b2 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountCouponRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountCouponRelController.java @@ -49,7 +49,7 @@ public class HighDiscountCouponRelController { try { JSONObject jsonObject = JSONObject.parseObject(reqBody); Long discountId = jsonObject.getLong("discountId"); - String couponIdStr = jsonObject.getString("couponId"); + String couponIdStr = jsonObject.getString("couponIdStr"); if (discountId == null || StringUtils.isBlank(couponIdStr)) { log.error("HighDiscountCouponRelController -> insertDiscountCoupon() error!","参数错误"); @@ -110,9 +110,9 @@ public class HighDiscountCouponRelController { } } - @RequestMapping(value="/insertDiscount",method = RequestMethod.GET) + @RequestMapping(value="/getRelByDiscount",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "根据卡卷 查询关联卡券") + @ApiOperation(value = "根据优惠券 查询关联卡券") public ResponseData getRelByDiscount(@RequestParam(name = "discountId", required = true) Long discountId) { try { diff --git a/hai-bweb/src/main/java/com/bweb/controller/LoginController.java b/hai-bweb/src/main/java/com/bweb/controller/LoginController.java index dc782524..53b32db6 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/LoginController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/LoginController.java @@ -60,6 +60,9 @@ public class LoginController { @Resource private SecPermissionService secPermissionService; + @Resource + private HighAgentService highAgentService; + @RequestMapping(value="/userLogin",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "机构用户登录({'loginName':'','password':''})") @@ -156,6 +159,20 @@ public class LoginController { } userInfoModel.setMerchantStore(merchantStore); + } else if (secUser.getObjectType() == 4) { + // 查询门店 + HighAgent highAgent = highAgentService.findByAgentMsgId(secUser.getObjectId()); + if(highAgent == null){ + log.error("login error!","未找到代理商"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, ""); + } + + if(highAgent.getStatus() != 1) { + log.error("login error!","未找到代理商"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_AGENT, ""); + } + userInfoModel.setHighAgent(highAgent); + } else { log.error("login error!","用户信息错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); From da19bc056e5b58ff74e7064109251bd51a056a12 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Mon, 5 Apr 2021 17:41:36 +0800 Subject: [PATCH 2/3] =?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/HighOrderController.java | 18 +++++++++--------- .../com/hai/schedule/HighCouponSchedule.java | 2 +- .../com/hai/schedule/HighDiscountSchedule.java | 2 +- .../com/hai/schedule/HighOrderSchedule.java | 2 +- .../java/com/hai/schedule/SynchronizeCNPC.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index ffea0fa8..e14c3ec3 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -98,8 +98,12 @@ public class HighOrderController { log.error("HighOrderController --> addOrder() error!", "未找到卡卷信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); } - - // 校验优惠券是否可用 + // 是否达到限购数量 + if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) { + log.error("HighOrderController --> addOrder() error!", "已达到限购数量"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",已达到限购数量"); + } + // 校验优惠券是否可用 如果使用优惠券就只能使用卡券的原价 if (highOrder.getMemDiscountId() != null) { List discountCouponRelList = highDiscountCouponRelService.getRelByCoupon(coupon.getId()); if (discountCouponRelList.size() > 0) { @@ -109,14 +113,11 @@ public class HighOrderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法使用优惠券"); } } + childOrder.setGoodsPrice(coupon.getSalesPrice()); + } else { + childOrder.setGoodsPrice(coupon.getDiscountPrice()); } - - // 是否到底限购数量 - if (highCouponService.userBuyLimitNumber(userInfoModel.getHighUser().getId(), coupon.getId()) == true) { - log.error("HighOrderController --> addOrder() error!", "已达到限购数量"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",已达到限购数量"); - } if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) <= 0) { log.error("HighOrderController --> addOrder() error!", "卡卷库存数量不足"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_INSUFFICIENT, ""); @@ -124,7 +125,6 @@ public class HighOrderController { childOrder.setGoodsName(coupon.getCouponName()); childOrder.setGoodsImg(coupon.getCouponImg()); childOrder.setGoodsSpecName("默认"); - childOrder.setGoodsPrice(coupon.getDiscountPrice()); } if (childOrder.getGoodsType() == 2) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index ec8b0a5f..68c564db 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -30,7 +30,7 @@ public class HighCouponSchedule { * @Date 2021/4/4 22:44 **/ // @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 - //@Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行 + @Scheduled(cron = "0 0 0 * * ?") //每天 凌晨0点执行 public void expiredCoupon() { // 查询过期的卡券 List userCoupons = highUserCouponService.getOverdueCoupon(); diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java index 8fd41af8..b370a79c 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java @@ -29,7 +29,7 @@ public class HighDiscountSchedule { * @Description 处理过期的优惠券 * @Date 2021/4/4 22:44 **/ - //@Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 + @Scheduled(cron = "0 0 0 * * ?") //每1分钟执行一次 public void expiredDiscount() { List expiredDiscount = highDiscountUserRelService.getExpiredDiscount(); for (HighDiscountUserRel rel : expiredDiscount) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 9573b7d0..789bef83 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -33,7 +33,7 @@ public class HighOrderSchedule { * @Description 取消订单 15分钟 * @Date 2021/4/4 22:45 **/ - //@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void cancelOrder() { List orderList = highOrderService.getCloseOrder(); if (orderList != null && orderList.size() > 0) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java index 9bbdd083..21d355fe 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java +++ b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java @@ -29,7 +29,7 @@ public class SynchronizeCNPC { private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 + //@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void certification() { Map tokenMap = new HashMap<>(); tokenMap.put("appId", "jsVpwDoHZfR2rrpjhA"); From b82344f3af20f7bf8db0830a5349d5eba56afc73 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Mon, 5 Apr 2021 19:33:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?'=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/HighDiscountAgentRelController.java | 4 ++-- .../com/hai/service/impl/HighDiscountUserRelServiceImpl.java | 3 +++ .../main/java/com/hai/service/impl/HighOrderServiceImpl.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java index ae436423..066d1fde 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java @@ -97,7 +97,7 @@ public class HighDiscountAgentRelController { // 是否已分配 if (highDiscountAgentRelService.getRelByDiscountAgent(highDiscountAgentRel.getDiscountId(), highDiscountAgentRel.getAgentId()) != null) { log.error("HighDiscountAgentRelController -> insertDiscountAgent() error!", discount.getDiscountName() + "重复分配给" + agent.getAgentName()); - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, discount.getDiscountName() + "重复分配给" + agent.getAgentName()); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, discount.getDiscountName() + "重复分配给" + agent.getAgentName()); } highDiscountAgentRel.setCreateTime(new Date()); highDiscountAgentRel.setStatus(1); @@ -110,7 +110,7 @@ public class HighDiscountAgentRelController { //参数 Map map = new HashMap<>(); map.put("type", QrCodeType.AGENT_QR_CODE); - map.put("code", AESEncodeUtil.aesEncrypt(Base64Util.encode(highDiscountAgentRel.getId().toString()))); + map.put("code", Base64Util.encode(AESEncodeUtil.aesEncrypt(highDiscountAgentRel.getId().toString()))); QRCodeGenerator.generateQRCodeImage(JSON.toJSONString(map), 350, 350, qrCodeUrl); highDiscountAgentRel.setQrCode(qrCodeImg); highDiscountAgentRelService.updateDiscountAgentRel(highDiscountAgentRel); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java index a7c4e060..04d06dce 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java @@ -52,6 +52,9 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic if (rel == null || rel.getHighDiscount() == null || rel.getAgentId() == null){ throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_DISCOUNT, ""); } + rel.setStockCount(rel.getStockCount() - 1); + highDiscountAgentRelService.updateDiscountAgentRel(rel); + // 校验卡卷状态 if (rel.getHighDiscount().getStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "卡券已下架"); 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 9b7a735f..ed5c7935 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 @@ -367,7 +367,7 @@ public class HighOrderServiceImpl implements HighOrderService { HighDiscountUserRel rel = highDiscountUserRelService.getRelById(order.getMemDiscountId()); if (rel != null) { rel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 - rel.setUseTime(new Date()); + rel.setUseTime(null); highDiscountUserRelService.updateDiscountUserRel(rel); } }