From 5f00efc54bd6843fcd3979f770b5e93f1c6f2fd0 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 12 Jul 2022 14:07:53 +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 --- .../controller/HighDiscountController.java | 27 +++++++++++++++++++ .../cweb/controller/HighOrderController.java | 9 ++++--- .../HighUserDiscountController.java | 1 + .../hai/common/security/AESEncodeUtil.java | 3 +-- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java index 3882861b..60fb2430 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java @@ -23,6 +23,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; @@ -83,6 +84,32 @@ public class HighDiscountController { } } + @RequestMapping(value="/getDiscountByCode",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据Code查询优惠券") + public ResponseData getDiscountByCode(@RequestParam(name = "code", required = true) String code) { + try { + String discountAgentId; + try { + discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(code, "UTF-8")); + } catch (Exception e) { + log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误"); + } + + // 查询优惠券与代理商关系id + HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelById(Long.parseLong(discountAgentId)); + if (discountAgentRel == null) { + log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误"); + } + return ResponseMsgUtil.success(discountAgentRel); + + } catch (Exception e) { + log.error("HighDiscountController -> getDiscountByQrCode() error!",e); + return ResponseMsgUtil.exception(e); + } + } @RequestMapping(value="/getDiscountByDiscountAgentId",method = RequestMethod.GET) @ResponseBody 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 228d03d6..c307692b 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -247,10 +247,11 @@ public class HighOrderController { } if (StringUtils.isNotBlank(highOrder.getGasStaffCode())) { - String qrCodeSignKey = commonService.getDictionaryCodeName("QR_CODE_SIGN_KEY", "柴油"); + String qrCodeSignKey = commonService.getDictionaryCodeName("QR_CODE_SIGN_KEY", "1"); if (StringUtils.isBlank(qrCodeSignKey)) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知秘钥"); } + String staffId = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(URLDecoder.decode(highOrder.getGasStaffCode(),"UTF-8")), qrCodeSignKey); // 查询员工 @@ -258,8 +259,10 @@ public class HighOrderController { if (gasStaff == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知收银员"); } - childOrder.setGasStaffId(gasStaff.getId()); - childOrder.setGasStaffName(gasStaff.getName()); + if (gasStaff.getMerchantStoreId().equals(childOrder.getGoodsId())) { + childOrder.setGasStaffId(gasStaff.getId()); + childOrder.setGasStaffName(gasStaff.getName()); + } } // 查询门店 diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java index 26dc7bf0..20a01b23 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java @@ -139,6 +139,7 @@ public class HighUserDiscountController { } } + @RequestMapping(value="/getUserDiscountList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取用户的优惠券列表") diff --git a/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java b/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java index 5f33aa77..b967be6c 100644 --- a/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java +++ b/hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.java @@ -64,8 +64,7 @@ public class AESEncodeUtil { public static void main(String[] args) throws Exception{ long currentTimeMillis = System.currentTimeMillis(); - System.out.println(URLDecoder.decode("Ble3spwlvhIa%2FArAa2cq0Q%3D%3D", "UTF-8")); - System.out.println(AESEncodeUtil.aesDecrypt(Base64Util.decode("ZStZUjRIcFl5SVo4MEhzSU96MldDUEFZa3lmbUhpNTdKMGhCVytIY3NJaz0"))); + System.out.println(AESEncodeUtil.aesDecrypt(URLDecoder.decode("mL4laIILGps4E58w8sbseQ%3D%3D", "UTF-8"))); /* String content = "{\"create_time\":1573544092110,\"order_serial_no\":\"40280e816db49c0b016db4a2c31f0004\",\"product_code\":\"8a9e80045cf85e54015cf8809fcd\",\"product_name\":\"平安发票贷\",\"uscc\":\"91370781687233838E\"}"; System.out.println("加密前" + content);