| | |
| | | @Autowired |
| | | private CodeDecorator codeDecorator; |
| | | |
| | | @Autowired |
| | | private OrderItemCheckMapper orderItemCheckMapper; |
| | | |
| | | public String createSales(OrderItemSalesCreateDTO dto){ |
| | | Integer num = dto.getNum(); |
| | | if(num == null || num == 0){ |
| | |
| | | throw new ValidationException("订单商品不存在"); |
| | | } |
| | | |
| | | if(num > oi.getNum()){ |
| | | OrderItemCheck c = orderItemCheckMapper.selectOne(new QueryWrapper<OrderItemCheck>() |
| | | .eq("order_item_id", oi.getId()) |
| | | .eq("type", Constants.CHECK_TYPE.lack.name()) |
| | | .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) |
| | | ); |
| | | int totalNum = oi.getNum(); |
| | | if(c != null){//需要减去缺货的数量 |
| | | totalNum -= c.getNum(); |
| | | } |
| | | if(num > totalNum){ |
| | | throw new ValidationException("申请数量不能超过总数"); |
| | | } |
| | | |
| | |
| | | s.setReason(dto.getReason()); |
| | | s.setStatus(Constants.ORDER_SALES_STATUS.PENDING.name()); |
| | | s.create(userId); |
| | | s.setSalesType(dto.getSalesType()); |
| | | orderItemSalesMapper.insert(s); |
| | | |
| | | return s.getId(); |
| | |
| | | rr.setTotal(oi.getTotal()); |
| | | rr.setSupplierPrice(oi.getSupplierPrice()); |
| | | rr.setMarkupPartner(oi.getMarkupPartner()); |
| | | rr.setRealPrice(oi.getRealPrice()); |
| | | rr.setRealTotal(oi.getRealTotal()); |
| | | |
| | | Long stationId = oi.getStationId(); |
| | | if(stationId != null) { |
| | |
| | | BigDecimal totalFee = feeSupplier.add(feePartner).add(feePlatform).add(feePlatformPack) |
| | | .add(feePlatformCheck).add(feePlatformTransport); |
| | | |
| | | BigDecimal st = oi.getPrice().multiply(new BigDecimal(sl.getNum()));//申请售后的花的金额 |
| | | BigDecimal st = oi.getRealPrice().multiply(new BigDecimal(sl.getNum()));//申请售后的花的金额,使用券后的单价 |
| | | if(totalFee.doubleValue() > st.doubleValue()){ |
| | | throw new ValidationException("退款金额不能大于商品申请数量的售价"); |
| | | } |
| | |
| | | } |
| | | } |
| | | preFee = preFee.add(totalFee); |
| | | if(preFee.doubleValue() > oi.getTotal().doubleValue()){ |
| | | if(preFee.doubleValue() > oi.getRealTotal().doubleValue()){//使用券后的总价 |
| | | throw new ValidationException("退款总金额不能大于商品总价"); |
| | | } |
| | | |