Browse Source

1.个贷我的订单-查询返回结果报告库存状态
2.退产品业务流程优化

GouGengquan 3 months ago
parent
commit
2e904ffa07

+ 3 - 1
dao/src/main/resources/mapper/PersonalMapper.xml

@@ -465,7 +465,8 @@
         o.should_amount,
         p.save_file_date,
         o.id as orderFundId,
-        fi.invoiceAmount
+        fi.invoiceAmount,
+        pro.repertory_state
         from
             personal p
                 LEFT JOIN personal_target pt ON pt.personal_id =  p.id
@@ -477,6 +478,7 @@
                 LEFT JOIN user u3 ON u3.id = p.pricing_staff
                 left join (select id,business_id,real_amount,should_amount from order_fund where business_type='PERSONAL_BUSINESS' and deleted = 0) o on o.business_id = p.id
         left join (select sum(real_amount) as invoiceAmount,order_fund_id from finance_invoice where state ='已开票' and deleted = 0 GROUP BY order_fund_id) fi on fi.order_fund_id = o.id
+        LEFT JOIN personal_production AS pro ON p.deleted = 0 AND pt.id = pro.target_id AND pro.production = 'FINAL'
         where
             p.deleted = 0  and p.client_manager_id = #{personal.clientManagerId}
         <if test="keyword!=null and keyword!='' ">

+ 5 - 0
domain/src/main/java/com/dayou/vo/PersonalVO.java

@@ -214,6 +214,11 @@ public class PersonalVO extends Personal {
     private Set<Long> userIds;
 
     /**
+     * 结果报告库存状态
+     */
+    private Boolean repertoryState;
+
+    /**
      * 项目作废(查询条件)
      */
     private Boolean isCancellation;

+ 23 - 21
service/src/main/java/com/dayou/workflow/config/WorkNodeProcessable.java

@@ -192,29 +192,31 @@ public class WorkNodeProcessable {
                         .eq(BaseEntity::getDeleted, false)
                         .eq(OrderFund::getBusinessType, productionReturn.getBusinessType())
                         .eq(OrderFund::getBusinessId, productionReturn.getBusinessId()));
-                ProductionFund productionFund = productionFundService.getOne(new LambdaQueryWrapper<ProductionFund>()
-                        .eq(BaseEntity::getDeleted, false)
-                        .eq(ProductionFund::getBusinessType, productionReturn.getBusinessType())
-                        .eq(ProductionFund::getBusinessId, productionReturn.getBusinessId())
-                        .eq(ProductionFund::getProductionNo, productionReturn.getProductionNo())
-                        .eq(ProductionFund::getProductionType, productionReturn.getProductionType())
-                        .eq(ProductionFund::getOrderFundId, orderFund.getId()));
                 // 新增罚款后退款记录
-                FinanceFine financeFine = financeFineService.getFineByFundInfo(orderFund.getId(), productionFund.getId() != null ? productionFund.getId() : null);
-                // 判断罚款记录是否为空,为空说明没有已确认的罚款,不新增罚款退款记录
-                if (ObjectUtil.isNotNull(financeFine)) {
-                    FinanceFineRefund financeFineRefund = FinanceFineRefund
-                            .builder()
-                            .fineId(financeFine.getId())
-                            .refundAmount(financeFine.getRealFineAmount())
-                            .status(NOT_RETURNED.getCode())
-                            .build();
-                    if (productionReturn.getReturnInvoice()) {
-                        financeFineRefund.setRefundReason(RETURN_PRODUCTION_INVOICE.getCode());
-                    } else {
-                        financeFineRefund.setRefundReason(RETURN_PRODUCTION.getCode());
+                if(ObjectUtil.isNotNull(orderFund)) { // 判断有没有订单收款信息
+                    ProductionFund productionFund = productionFundService.getOne(new LambdaQueryWrapper<ProductionFund>()
+                            .eq(BaseEntity::getDeleted, false)
+                            .eq(ProductionFund::getBusinessType, productionReturn.getBusinessType())
+                            .eq(ProductionFund::getBusinessId, productionReturn.getBusinessId())
+                            .eq(ProductionFund::getProductionNo, productionReturn.getProductionNo())
+                            .eq(ProductionFund::getProductionType, productionReturn.getProductionType())
+                            .eq(ProductionFund::getOrderFundId, orderFund.getId()));
+                    FinanceFine financeFine = financeFineService.getFineByFundInfo(orderFund.getId(), productionFund != null ? productionFund.getId() : null);
+                    // 判断罚款记录是否为空,为空说明没有已确认的罚款,不新增罚款退款记录
+                    if (ObjectUtil.isNotNull(financeFine)) {
+                        FinanceFineRefund financeFineRefund = FinanceFineRefund
+                                .builder()
+                                .fineId(financeFine.getId())
+                                .refundAmount(financeFine.getRealFineAmount())
+                                .status(NOT_RETURNED.getCode())
+                                .build();
+                        if (productionReturn.getReturnInvoice()) {
+                            financeFineRefund.setRefundReason(RETURN_PRODUCTION_INVOICE.getCode());
+                        } else {
+                            financeFineRefund.setRefundReason(RETURN_PRODUCTION.getCode());
+                        }
+                        financeFineRefundService.saveIfNotExists(financeFineRefund);
                     }
-                    financeFineRefundService.saveIfNotExists(financeFineRefund);
                 }
                 break;
         }