'修复已知问题'

dev-discount
199901012 4 years ago
parent e831642b42
commit 6095762522
  1. 54
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 3
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  3. 2
      hai-service/src/main/java/com/hai/service/HighCouponService.java
  4. 11
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java

@ -75,6 +75,11 @@ public class HighCouponController {
try { try {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighCouponController -> insertCoupon() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
if (highCoupon.getMerchantId() == null if (highCoupon.getMerchantId() == null
|| StringUtils.isBlank(highCoupon.getCouponName()) || StringUtils.isBlank(highCoupon.getCouponName())
|| StringUtils.isBlank(highCoupon.getCouponImg()) || StringUtils.isBlank(highCoupon.getCouponImg())
@ -93,11 +98,8 @@ public class HighCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
Map<String, Object> map = new HashMap<>(); // 校验名称是否重复
if (highCouponService.getCouponByCouponName(userInfoModel.getBsCompany().getId(),highCoupon.getCouponName()) > 0) {
map.put("couponName", highCoupon.getCouponName());
if (highCouponService.getCouponByCouponName(map) > 0) {
log.error("HighCouponController -> insertCoupon() error!","参数错误"); log.error("HighCouponController -> insertCoupon() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_CODE_NAME, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_CODE_NAME, "");
} }
@ -191,11 +193,6 @@ public class HighCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.DISCOUNT_PRICE_BIG_SALES_PRICE_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.DISCOUNT_PRICE_BIG_SALES_PRICE_ERROR, "");
} }
Map<String, Object> map = new HashMap<>();
map.put("couponName", highCoupon.getCouponName());
// 查询卡券 // 查询卡券
HighCoupon coupon = highCouponService.getCouponById(highCoupon.getId()); HighCoupon coupon = highCouponService.getCouponById(highCoupon.getId());
if (coupon == null) { if (coupon == null) {
@ -203,13 +200,12 @@ public class HighCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
} }
// 校验名称是否重复
if (highCouponService.getCouponByCouponName(map) > 0 && !coupon.getCouponName().equals(highCoupon.getCouponName())) { if (!highCoupon.getCouponName().equals(coupon.getCouponName()) && highCouponService.getCouponByCouponName(userInfoModel.getBsCompany().getId(),highCoupon.getCouponName()) > 0) {
log.error("HighCouponController -> updateCoupon() error!","参数错误"); log.error("HighCouponController -> insertCoupon() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_CODE_NAME, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_CODE_NAME, "");
} }
// 是否赠送卡卷 // 是否赠送卡卷
if (highCoupon.getIsPresent()) { if (highCoupon.getIsPresent()) {
if (highCoupon.getHandselCouponId() == null || highCoupon.getHandselCouponId().size() == 0) { if (highCoupon.getHandselCouponId() == null || highCoupon.getHandselCouponId().size() == 0) {
@ -254,16 +250,26 @@ public class HighCouponController {
log.error("HighCouponController -> updateCoupon() error!","未找到商户"); log.error("HighCouponController -> updateCoupon() error!","未找到商户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
} }
coupon.setCouponSource(highCoupon.getCouponSource());
highCoupon.setCompanyId(merchant.getCompanyId()); coupon.setMerchantId(highCoupon.getMerchantId());
highCoupon.setOperatorId(userInfoModel.getSecUser().getId()); coupon.setCouponName(highCoupon.getCouponName());
highCoupon.setOperatorName(userInfoModel.getSecUser().getUserName()); coupon.setCouponImg(highCoupon.getCouponImg());
highCoupon.setUpdateTime(new Date()); coupon.setCouponCarouselImg(highCoupon.getCouponCarouselImg());
highCoupon.setHandselCouponList(coupon.getHandselCouponList()); coupon.setCouponDesc(highCoupon.getCouponDesc());
highCoupon.setStatus(3); // 状态:0.删除 1.编辑中 2.已上架 3.已下架 101.上架审批中 102.上架审批驳回 coupon.setPayType(highCoupon.getPayType());
highCouponService.updateCoupon(highCoupon); coupon.setSalesEndTime(highCoupon.getSalesEndTime());
coupon.setRecycleDay(highCoupon.getRecycleDay());
return ResponseMsgUtil.success(highCoupon); coupon.setLimitNumber(highCoupon.getLimitNumber());
coupon.setSalesPrice(highCoupon.getSalesPrice());
coupon.setDiscountPrice(highCoupon.getDiscountPrice());
coupon.setIsPresent(highCoupon.getIsPresent());
coupon.setOperatorId(userInfoModel.getSecUser().getId());
coupon.setOperatorName(userInfoModel.getSecUser().getUserName());
coupon.setUpdateTime(new Date());
coupon.setStatus(3); // 状态:0.删除 1.编辑中 2.已上架 3.已下架 101.上架审批中 102.上架审批驳回
highCouponService.updateCoupon(coupon);
return ResponseMsgUtil.success(coupon);
} catch (Exception e) { } catch (Exception e) {
log.error("HighCouponController -> updateCoupon() error!",e); log.error("HighCouponController -> updateCoupon() error!",e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -93,6 +93,9 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/coupon/getCouponList") .excludePathPatterns("/coupon/getCouponList")
.excludePathPatterns("/wechatpay/*") .excludePathPatterns("/wechatpay/*")
.excludePathPatterns("/coupon/getCouponById") .excludePathPatterns("/coupon/getCouponById")
.excludePathPatterns("/discount/getDiscountByQrCode")
.excludePathPatterns("/discount/getDiscountById")
.excludePathPatterns("/discount/getCouponByDiscount")
.excludePathPatterns("/highMerchantStore/getMerchantStoreById") .excludePathPatterns("/highMerchantStore/getMerchantStoreById")
.excludePathPatterns("/highMerchantStore/getStoreListByCoupon") .excludePathPatterns("/highMerchantStore/getStoreListByCoupon")
.excludePathPatterns("/highMerchantStore/getMerchantList") .excludePathPatterns("/highMerchantStore/getMerchantList")

@ -103,7 +103,7 @@ public interface HighCouponService {
* @Description 获取数量 * @Description 获取数量
* @Date 2021/3/15 23:12 * @Date 2021/3/15 23:12
**/ **/
Long getCouponByCouponName(Map<String, Object> map); Long getCouponByCouponName(Long companyId,String couponName);
/** /**
* @Author 胡锐 * @Author 胡锐

@ -373,16 +373,9 @@ public class HighCouponServiceImpl implements HighCouponService {
} }
@Override @Override
public Long getCouponByCouponName(Map<String, Object> map) { public Long getCouponByCouponName(Long companyId,String couponName) {
HighCouponExample example = new HighCouponExample(); HighCouponExample example = new HighCouponExample();
HighCouponExample.Criteria criteria = example.createCriteria(); example.createCriteria().andCompanyIdEqualTo(companyId).andCouponNameEqualTo(couponName);
if (StringUtils.isNotBlank(MapUtils.getString(map, "couponName"))) {
criteria.andCouponNameEqualTo(MapUtils.getString(map, "couponName"));
}
return highCouponMapper.countByExample(example); return highCouponMapper.countByExample(example);
} }

Loading…
Cancel
Save