chenjiahe
2023-04-04 f72f73a11138a79b0e79a345c3c2bb1a08f4d610
退款-订单状态变化优化
1个文件已修改
20 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/tool/refund/PartialRefundUtil.java
@@ -135,6 +135,10 @@
        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);
@@ -152,16 +156,28 @@
            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;
    }