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 1044f0b5..79847183 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java @@ -149,7 +149,7 @@ public class HighDiscountAgentRelController { String param = URLEncoder.encode(AESEncodeUtil.aesEncrypt(id.toString()), "UTF-8"); - String url = CommonSysConst.getSysConfig().getHsgDomainName() + "?p=" + param; + String url = CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=000001&key=&code=" + param; return ResponseMsgUtil.success(url); diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 8f932e5a..ff756154 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/couponAgent/convertCodeDetail") .excludePathPatterns("/coupon/getCouponById") .excludePathPatterns("/discount/getDiscountByQrCode") + .excludePathPatterns("/discount/getDiscountByCode") .excludePathPatterns("/discount/getDiscountById") .excludePathPatterns("/discount/getCouponByDiscount") .excludePathPatterns("/discountPackage/getDiscountPackageList") 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 60fb2430..17211dd8 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java @@ -17,6 +17,7 @@ import com.hai.service.HighDiscountCouponRelService; import com.hai.service.HighDiscountService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -89,6 +90,7 @@ public class HighDiscountController { @ApiOperation(value = "根据Code查询优惠券") public ResponseData getDiscountByCode(@RequestParam(name = "code", required = true) String code) { try { + System.out.println(code); String discountAgentId; try { discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(code, "UTF-8")); @@ -96,7 +98,10 @@ public class HighDiscountController { log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误"); } - + if (StringUtils.isBlank(discountAgentId)) { + 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) { 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 c307692b..b05d8989 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -252,7 +252,13 @@ public class HighOrderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知秘钥"); } - String staffId = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(URLDecoder.decode(highOrder.getGasStaffCode(),"UTF-8")), qrCodeSignKey); + String staffId; + try { + staffId = AESEncodeUtil.aesDecryptByBytes(AESEncodeUtil.base64Decode(URLDecoder.decode(highOrder.getGasStaffCode(),"UTF-8")), qrCodeSignKey); + } catch (Exception e) { + log.error("HighOrderController --> addOrder() error!", "收银员code解析失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "收银员code解析失败"); + } // 查询员工 HighGasStaff gasStaff = gasStaffService.getStaffDetailById(Long.parseLong(staffId)); diff --git a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java index 4e81ee5d..ae6b984c 100644 --- a/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java @@ -41,6 +41,6 @@ public interface HighDiscountUserRelMapperExt { List getUserCouponsList(@Param("map") Map map); - @Select({" 100 ]]> "}) + @Select({""}) Integer receiveDiscountCount(@Param("userId") Long userId, @Param("discountId") Long discountId); } 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 2acc324d..84dfc3e0 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 @@ -133,8 +133,8 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic if (!discount.getStatus().equals(2)) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期"); } - if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()) < discount.getReceiveNumber()) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已达到上线"); + if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()) >= discount.getReceiveNumber()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取数量已达到上线"); } // 查询可分配的优惠券code List discountAgentCodeList = highDiscountAgentCodeService.getDiscountCodeByStatus(discountAgentRel.getId(), 1);