| | |
| | | sqlSentence.sqlSentence("select * from order_item WHERE orderId=#{m.orderId} and isDel=0",values); |
| | | List<OrderItem> orderItemList=commonService.selectList(OrderItemMapper.class,sqlSentence); |
| | | |
| | | values.clear(); |
| | | values.put("oldStatus",ordersTotal.getStatus()); |
| | | values.put("oldRefundStatus",ordersTotal.getRefundStatus()); |
| | | |
| | | List<Integer> collect = orderItemList.stream().map(OrderItem::getRefundStatus).collect(Collectors.toList()); |
| | | if(collect.contains(OrderTotalConstants.STATUS_REFUND_PART)){ |
| | | ordersTotal.setRefundStatus(OrderTotalConstants.STATUS_REFUND_PART); |
| | |
| | | if(OrderTotalConstants.TYPE_RECHARGE.equals(ordersTotal.getType())){ |
| | | if(ordersTotal.getActualTotal().compareTo(refundRecord.getRefundTotal()) <= 0){ |
| | | ordersTotal.setRefundStatus(OrderTotalConstants.STATUS_REFUND_FINSH); |
| | | ordersTotal.setStatus(OrderTotalConstants.STATUS_CANCEL); |
| | | ordersTotal.setReTotal(ordersTotal.getReTotal().add(refundRecord.getRefundTotal())); |
| | | }else{ |
| | | ordersTotal.setRefundStatus(OrderTotalConstants.STATUS_REFUND_PART); |
| | | ordersTotal.setReTotal(ordersTotal.getReTotal().add(refundRecord.getRefundTotal())); |
| | | } |
| | | }else{ |
| | | ordersTotal.setRefundStatus(OrderTotalConstants.STATUS_REFUND_NONE); |
| | | } |
| | | } |
| | | ordersTotal.setIsSyncOrder(BaseEntity.NO); |
| | | ordersTotal.setEditTime(new Date()); |
| | | commonService.updateAll(OrdersTotalMapper.class,ordersTotal); |
| | | |
| | | values.put("isSyncOrder",BaseEntity.NO); |
| | | values.put("status",ordersTotal.getStatus()); |
| | | values.put("refundStatus",ordersTotal.getRefundStatus()); |
| | | values.put("reTotal",ordersTotal.getReTotal()); |
| | | values.put("id",ordersTotal.getId()); |
| | | sqlSentence.sqlUpdate("isSyncOrder = #{m.isSyncOrder},status = #{m.status},refundStatus = #{m.refundStatus},reTotal = #{m.reTotal}" + |
| | | " WHERE id = #{m.id} AND status = #{m.oldStatus} AND refundStatus = #{m.oldRefundStatus}",values); |
| | | if(commonService.updateWhere(OrdersTotalMapper.class,sqlSentence) != 1){ |
| | | throw new TipsException("操作失败,订单状态已发生改变!"); |
| | | } |
| | | return ordersTotal; |
| | | } |
| | | |