dev-discount
199901012 4 years ago
commit d7be7eebe5
  1. 6
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 2
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  3. 5
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java

@ -174,7 +174,7 @@ public class HighCouponController {
} }
// 查询商户 // 查询商户
HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getCompanyId()); HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId());
if (merchant == null) { if (merchant == null) {
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, "");
@ -208,13 +208,13 @@ public class HighCouponController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, "");
} }
// 如果卡卷状态不处于 编辑中、已下架、审上架批驳回 // 如果卡卷状态不处于 编辑中、已下架、审上架批驳回
if (coupon.getStatus() != 1 || coupon.getStatus() != 3 || coupon.getStatus() != 102) { if (coupon.getStatus() != 1 && coupon.getStatus() != 3 && coupon.getStatus() != 102) {
log.error("HighCouponController -> upShelfApprove() error!","卡卷状态错误"); log.error("HighCouponController -> upShelfApprove() error!","卡卷状态错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_UNABLE_UP_SHELF, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_UNABLE_UP_SHELF, "");
} }
// 根据卡卷查询 销售码库存 // 根据卡卷查询 销售码库存
if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) <= 0) { if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) == 0) {
log.error("HighCouponController -> upShelfApprove() error!","卡卷库存数量错误"); log.error("HighCouponController -> upShelfApprove() error!","卡卷库存数量错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_ERROR, "");
} }

@ -39,7 +39,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
@Override @Override
public Integer getStockCountByCoupon(Long couponId) { public Integer getStockCountByCoupon(Long couponId) {
HighCouponCodeExample example = new HighCouponCodeExample(); HighCouponCodeExample example = new HighCouponCodeExample();
example.createCriteria().andStatusEqualTo(1).andSalesEndTimeLessThan(new Date()); example.createCriteria().andCouponIdEqualTo(couponId).andStatusEqualTo(1).andSalesEndTimeLessThan(new Date());
return highCouponCodeMapper.selectByExample(example).size(); return highCouponCodeMapper.selectByExample(example).size();
} }

@ -1,5 +1,6 @@
package com.hai.service.impl; package com.hai.service.impl;
import com.alibaba.fastjson.JSON;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
@ -288,9 +289,7 @@ public class HighCouponServiceImpl implements HighCouponService {
List<HighCoupon> coupons = highCouponMapper.selectByExample(example); List<HighCoupon> coupons = highCouponMapper.selectByExample(example);
if (coupons != null && coupons.size() > 0) { if (coupons != null && coupons.size() > 0) {
List<HighCouponModel> list = new ArrayList<>(); return JSON.parseArray(JSON.toJSONString(coupons), HighCouponModel.class);
BeanUtils.copyProperties(coupons, list);
return list;
} }
return new ArrayList<>(); return new ArrayList<>();
} }

Loading…
Cancel
Save