| | |
| | | || StringUtils.isBlank(discount.getName()) |
| | | || Objects.isNull(discount.getType()) |
| | | || Objects.isNull(discount.getLimitType()) |
| | | || (Constants.equalsInteger(discount.getLimitTime(),Constants.ONE) && Objects.isNull(discount.getLimitTime())) |
| | | || (Constants.equalsInteger(discount.getLimitTime(),Constants.ONE) && (Objects.isNull(discount.getLimitTime()) || discount.getLimitTime() > 1440)) |
| | | || Objects.isNull(discount.getPrice()) || discount.getPrice().compareTo(BigDecimal.ZERO) <= Constants.ZERO |
| | | || Objects.isNull(discount.getChannel()) |
| | | || Objects.isNull(discount.getStartDate()) |
| | |
| | | || (Objects.isNull(discount.getUseHoliday()) || Objects.isNull(discount.getUseWorkday()) ) |
| | | || (Objects.isNull(discount.getIsbike()) || Objects.isNull(discount.getIselecbike()) ) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(discount.getStartDate().getTime()>discount.getEndDate().getTime()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"销售时段信息错误"); |
| | | } |
| | | //固定日期生效 |
| | | if(Constants.equalsInteger(discount.getUseType(),Constants.ZERO) && |
| | | ( discount.getUseStartDate().getTime()>discount.getUseEndDate().getTime() || |
| | | discount.getUseStartDate().getTime() < discount.getStartDate().getTime() || |
| | | discount.getUseEndDate().getTime() > discount.getEndDate().getTime() |
| | | ) ){ |
| | | ( discount.getUseStartDate().getTime()>discount.getUseEndDate().getTime()) ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"使用时段信息错误"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Discount findById(String id) { |
| | | Discount discount = discountJoinMapper.selectOne(new MPJLambdaWrapper<Discount>() |
| | | .selectAll(Discount.class) |
| | | .select(" (select count(1) from goodsorder g where g.obj_type = 0 and g.obj_id = t.id and g.pay_status = 1 ) ",Discount::getSaleNum) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,Discount::getCreator) |
| | | .eq(Discount::getId,id) |