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