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); } }