提交代码

dev-discount
胡锐 2 years ago
parent 5f00efc54b
commit 762101b6e0
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountAgentRelController.java
  2. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  3. 7
      hai-cweb/src/main/java/com/cweb/controller/HighDiscountController.java
  4. 8
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  5. 2
      hai-service/src/main/java/com/hai/dao/HighDiscountUserRelMapperExt.java
  6. 4
      hai-service/src/main/java/com/hai/service/impl/HighDiscountUserRelServiceImpl.java

@ -149,7 +149,7 @@ public class HighDiscountAgentRelController {
String param = URLEncoder.encode(AESEncodeUtil.aesEncrypt(id.toString()), "UTF-8"); 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); return ResponseMsgUtil.success(url);

@ -97,6 +97,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/couponAgent/convertCodeDetail") .excludePathPatterns("/couponAgent/convertCodeDetail")
.excludePathPatterns("/coupon/getCouponById") .excludePathPatterns("/coupon/getCouponById")
.excludePathPatterns("/discount/getDiscountByQrCode") .excludePathPatterns("/discount/getDiscountByQrCode")
.excludePathPatterns("/discount/getDiscountByCode")
.excludePathPatterns("/discount/getDiscountById") .excludePathPatterns("/discount/getDiscountById")
.excludePathPatterns("/discount/getCouponByDiscount") .excludePathPatterns("/discount/getCouponByDiscount")
.excludePathPatterns("/discountPackage/getDiscountPackageList") .excludePathPatterns("/discountPackage/getDiscountPackageList")

@ -17,6 +17,7 @@ import com.hai.service.HighDiscountCouponRelService;
import com.hai.service.HighDiscountService; import com.hai.service.HighDiscountService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -89,6 +90,7 @@ public class HighDiscountController {
@ApiOperation(value = "根据Code查询优惠券") @ApiOperation(value = "根据Code查询优惠券")
public ResponseData getDiscountByCode(@RequestParam(name = "code", required = true) String code) { public ResponseData getDiscountByCode(@RequestParam(name = "code", required = true) String code) {
try { try {
System.out.println(code);
String discountAgentId; String discountAgentId;
try { try {
discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(code, "UTF-8")); discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(code, "UTF-8"));
@ -96,7 +98,10 @@ public class HighDiscountController {
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误"); log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_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 // 查询优惠券与代理商关系id
HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelById(Long.parseLong(discountAgentId)); HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelById(Long.parseLong(discountAgentId));
if (discountAgentRel == null) { if (discountAgentRel == null) {

@ -252,7 +252,13 @@ public class HighOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知秘钥"); 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)); HighGasStaff gasStaff = gasStaffService.getStaffDetailById(Long.parseLong(staffId));

@ -41,6 +41,6 @@ public interface HighDiscountUserRelMapperExt {
List<HighUserDiscountUnicomModel> getUserCouponsList(@Param("map") Map<String,Object> map); List<HighUserDiscountUnicomModel> getUserCouponsList(@Param("map") Map<String,Object> map);
@Select({" <![CDATA[ select count(1) count from high_discount_user_rel where user_id = #{userId} and discount_id = #{discountId} and `status` <> 100 ]]> "}) @Select({"<script> select count(1) count from high_discount_user_rel where user_id = #{userId} and discount_id = #{discountId} and `status` <![CDATA[ <> 100 ]]> </script>"})
Integer receiveDiscountCount(@Param("userId") Long userId, @Param("discountId") Long discountId); Integer receiveDiscountCount(@Param("userId") Long userId, @Param("discountId") Long discountId);
} }

@ -133,8 +133,8 @@ public class HighDiscountUserRelServiceImpl implements HighDiscountUserRelServic
if (!discount.getStatus().equals(2)) { if (!discount.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法领取,优惠券活动已过期");
} }
if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()) < discount.getReceiveNumber()) { if (discount.getReceiveNumber() > 0 && this.receiveDiscountCount(userId, discount.getId()) >= discount.getReceiveNumber()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券已达到上线"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "领取数量已达到上线");
} }
// 查询可分配的优惠券code // 查询可分配的优惠券code
List<HighDiscountAgentCode> discountAgentCodeList = highDiscountAgentCodeService.getDiscountCodeByStatus(discountAgentRel.getId(), 1); List<HighDiscountAgentCode> discountAgentCodeList = highDiscountAgentCodeService.getDiscountCodeByStatus(discountAgentRel.getId(), 1);

Loading…
Cancel
Save