提交代码

dev-discount
胡锐 2 years ago
parent 160dccf1e0
commit 5f00efc54b
  1. 27
      hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java
  2. 9
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  3. 1
      hai-cweb/src/main/java/com/cweb/controller/HighUserDiscountController.java
  4. 3
      hai-service/src/main/java/com/hai/common/security/AESEncodeUtil.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

@ -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());
}
}
// 查询门店

@ -139,6 +139,7 @@ public class HighUserDiscountController {
}
}
@RequestMapping(value="/getUserDiscountList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取用户的优惠券列表")

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

Loading…
Cancel
Save