|
|
|
@@ -8,6 +8,7 @@ import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.vo.WxCouponStatisVo; |
|
|
|
import com.iformall.enums.EnumCouponType; |
|
|
|
import com.iformall.enums.EnumCouponValidType; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
@@ -70,26 +71,37 @@ public class WxCouponController extends BaseController { |
|
|
|
public ResultData updateStokeAndValidDate(@RequestBody WxCoupon wxCoupon) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponController::updateStokeAndValidDate"); |
|
|
|
if (wxCoupon.getId() == null) { |
|
|
|
logger.error("缺少id"); |
|
|
|
return new ResultData(ResultData.ERROR, "缺少id"); |
|
|
|
} |
|
|
|
if(wxCoupon.getRemainInventory() == null || wxCoupon.getInventory() == null) { |
|
|
|
logger.error("库存错误1"); |
|
|
|
return new ResultData(ErrorCode.COUPON_STOCK_ERR); |
|
|
|
} |
|
|
|
if(wxCoupon.getRemainInventory() > wxCoupon.getInventory()) { |
|
|
|
logger.error("库存错误2"); |
|
|
|
return new ResultData(ErrorCode.COUPON_STOCK_ERR); |
|
|
|
} |
|
|
|
if(wxCoupon.getValidType() == null) { |
|
|
|
logger.error("库存错误3"); |
|
|
|
return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); |
|
|
|
} |
|
|
|
if(wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { |
|
|
|
if(wxCoupon.getValidEndDate() == null) { |
|
|
|
logger.error("有效期错误1"); |
|
|
|
return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); |
|
|
|
} |
|
|
|
} else { |
|
|
|
if(wxCoupon.getValidDays() == null) { |
|
|
|
logger.error("有效期错误2"); |
|
|
|
return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); |
|
|
|
} |
|
|
|
} |
|
|
|
if(wxCoupon.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode()) || |
|
|
|
wxCoupon.getType().equals(EnumCouponType.COUPON_CREDIT_PARK.getCode())) { |
|
|
|
logger.error("券库存有效期不支持停车券"); |
|
|
|
return new ResultData(ErrorCode.COUPON_STOCK_DATE_NO_CAR); |
|
|
|
} |
|
|
|
wxCoupon.setTenantId(getTenantId()); |
|
|
|
return wxCouponService.updateCouponStockAndEndTime(wxCoupon); |
|
|
|
} |
|
|
|
|