yangdamao 1 year ago
parent
commit
3f48af1ea0

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderHandle.java

@@ -77,6 +77,8 @@ private static final long serialVersionUID=1L;
     private Integer refundStatus;
     /** 退款金额 */
     private BigDecimal refundPrice;
+    /** 已退 */
+    private BigDecimal refundedPrice;
     /** 审核时间 */
     private Long checkTime;
 

+ 5 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderHandleServiceImpl.java

@@ -125,6 +125,8 @@ public class OrderHandleServiceImpl extends ServiceImpl<OrderHandleMapper, Order
             return new ArrayList<>();
         }
         orderHandleVos.forEach(item -> {
+            //实际价格
+            item.setRealPrice(item.getPayPrice().subtract(item.getGoodsRefund()));
             //发票
             List<OrderInvoiceOrder> list = iOrderInvoiceOrderService
                     .list(new LambdaQueryWrapper<OrderInvoiceOrder>()
@@ -612,10 +614,10 @@ public class OrderHandleServiceImpl extends ServiceImpl<OrderHandleMapper, Order
                 }
                 //退款金额
                 BigDecimal reduce = goodsRefundList.stream().map(OrderGoodsRefund::getRealRefundFee).reduce(BigDecimal.ZERO, BigDecimal::add);
-                if (ObjectUtils.isNotNull(orderHandle.getRefundPrice())){
-                    orderHandle.setRefundPrice(orderHandle.getRefundPrice().add(reduce));
+                if (ObjectUtils.isNotNull(orderHandle.getRefundedPrice())){
+                    orderHandle.setRefundedPrice(orderHandle.getRefundedPrice().add(reduce));
                 }else {
-                    orderHandle.setRefundPrice(reduce);
+                    orderHandle.setRefundedPrice(reduce);
                 }
                 orderHandle.setRefundStatus(1);//已退款
                 updateById(orderHandle);

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/CompanyOrderInvoiceVo.java

@@ -71,4 +71,13 @@ public class CompanyOrderInvoiceVo implements Serializable {
 
     @ApiModelProperty("备注")
     private String remark;
+
+    @ApiModelProperty("教育名称")
+    private String educationName;
+    @ApiModelProperty("项目名称")
+    private String projectName;
+    @ApiModelProperty("业务名称")
+    private String businessName;
+    @ApiModelProperty("商品类型")
+    private Integer goodsType;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderHandleVo.java

@@ -138,6 +138,9 @@ public class OrderHandleVo {
 	@ApiModelProperty("退款金额")
 	private BigDecimal refundPrice;
 
+	@ApiModelProperty("实际价格")
+	private BigDecimal realPrice;
+
 	@ApiModelProperty("退款状态: 0待审核 1已退款 2不通过")
 	private Integer refundStatus;
 

+ 40 - 16
zhongzheng-system/src/main/resources/mapper/modules/order/OrderHandleMapper.xml

@@ -85,30 +85,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN course_project_type cpt ON u.project_id = cpt.id
         LEFT JOIN course_business cb ON u.business_id = cb.id
         where 1=1
-        <if test="invoiceStatus != null and invoiceStatus != ''">
-        AND
-          (SELECT
-            COUNT(oi.invoice_id)
-            FROM
-            order_invoice_order oio
-            LEFT JOIN order_invoice oi ON oio.invoice_id = oi.invoice_id
-            WHERE
-            oio.order_sn = u.handle_order_sn
             <if test="invoiceStatus != null and invoiceStatus == 1">
-                AND oi.period_status = 1
+            AND (SELECT
+                oi.period_status
+                FROM
+                order_invoice_order oio
+                LEFT JOIN order_invoice oi ON oio.invoice_id = oi.invoice_id
+                WHERE
+                oio.order_sn = u.handle_order_sn
+                AND (oi.wash_status is null or oi.wash_status = 1)
+                order by oi.create_time DESC limit 1
+                ) = 1
             </if>
             <if test="invoiceStatus != null and invoiceStatus == 2">
-                AND oi.invoice_status = 2
+            AND (SELECT
+                oi.invoice_status
+                FROM
+                order_invoice_order oio
+                LEFT JOIN order_invoice oi ON oio.invoice_id = oi.invoice_id
+                WHERE
+                oio.order_sn = u.handle_order_sn
+                AND (oi.wash_status is null or oi.wash_status = 1)
+                order by oi.create_time DESC limit 1
+                ) = 2
             </if>
             <if test="invoiceStatus != null and invoiceStatus == 3">
-                AND oi.period_status = 2
+            AND (SELECT
+                oi.period_status
+                FROM
+                order_invoice_order oio
+                LEFT JOIN order_invoice oi ON oio.invoice_id = oi.invoice_id
+                WHERE
+                oio.order_sn = u.handle_order_sn
+                AND (oi.wash_status is null or oi.wash_status = 1)
+                order by oi.create_time DESC limit 1
+                ) = 2
             </if>
             <if test="invoiceStatus != null and invoiceStatus == 4">
-                AND oi.invoice_status = 4
+            AND (SELECT
+                oi.invoice_status
+                FROM
+                order_invoice_order oio
+                LEFT JOIN order_invoice oi ON oio.invoice_id = oi.invoice_id
+                WHERE
+                oio.order_sn = u.handle_order_sn
+                AND (oi.wash_status is null or oi.wash_status = 1)
+                order by oi.create_time DESC limit 1
+                ) = 4
             </if>
-            AND (oi.wash_status is null or oi.wash_status = 1)
-           ) > 0
-        </if>
         ORDER BY u.create_time DESC
     </select>
 

+ 8 - 1
zhongzheng-system/src/main/resources/mapper/modules/order/OrderInvoiceMapper.xml

@@ -169,11 +169,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             oi.invoice_mode,
             oi.open_remark,
             oi.wash_status,
-            oi.handle_remark
+            oi.handle_remark,
+            cet.education_name education_name,
+            cpt.project_name project_name,
+            cb.business_name business_name,
+            oh.goods_type
         FROM
             order_invoice oi
                 LEFT JOIN order_invoice_order oio ON oi.invoice_id = oio.invoice_id
                 LEFT JOIN order_handle oh ON oio.order_sn = oh.handle_order_sn
+                LEFT JOIN course_education_type cet ON oh.education_type_id = cet.id
+                LEFT JOIN course_project_type cpt ON oh.project_id = cpt.id
+                LEFT JOIN course_business cb ON oh.business_id = cb.id
                 LEFT JOIN `user` u ON oh.create_user_id = u.user_id
         WHERE
             oi.invoice_type = 2