Forráskód Böngészése

Merge remote-tracking branch 'origin/dev1.0' into dev1.0

zhangc 6 hónapja%!(EXTRA string=óta)
szülő
commit
fcb56faf80

+ 41 - 43
src/main/java/com/sunxung/factoring/service/financing/apply/impl/FinancingApplyServiceImpl.java

@@ -5,12 +5,11 @@ import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.sunxung.factoring.component.enums.FileTypeEnum;
 import com.sunxung.factoring.component.enums.FinancingCurrentStageEnum;
-import com.sunxung.factoring.component.enums.FinancingStatusEnum;
 import com.sunxung.factoring.component.exception.BusinessException;
 import com.sunxung.factoring.component.exception.ValidatorException;
 import com.sunxung.factoring.component.util.*;
 import com.sunxung.factoring.dict.impl.FileModuleDict;
-import com.sunxung.factoring.entity.ResponseJson;
+import com.sunxung.factoring.dict.impl.ProjectInitiationStatusDict;
 import com.sunxung.factoring.entity.creditresolution.CreditResolution;
 import com.sunxung.factoring.entity.entprise.Enterprise;
 import com.sunxung.factoring.entity.financing.apply.*;
@@ -648,6 +647,8 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
                 if (reviewQuotaDisburse.getPlanIrr() != null) {
                     reviewQuotaDisburse.setPlanIrrStr(PercentageUtil.convertPercentage(reviewQuotaDisburse.getPlanIrr().doubleValue()));
                 }
+                //填充业务综合授信余额和供应商授信余额
+                autoBalance(financingBasicInfo, reviewQuotaDisburse);
                 //填充主合同信息
                 autoMasterContractInfo(reviewQuotaDisburse);
                 //填充融资信息
@@ -671,23 +672,9 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
     private void initQuotaDisburse(CFinancingBasicInfo financingBasicInfo, BigDecimal
             netAccountsReceivableAmountTotal, ReviewQuotaDisburse reviewQuotaDisburse) {
         reviewQuotaDisburse.setFinancingBasicInfoId(financingBasicInfo.getId());
-        //计算业务占用的授信金额
-        BigDecimal businessOccupyAmount = getBusinessOccupyAmount(financingBasicInfo);
-        //计算供应商占用的授信金额
-        BigDecimal supplierOccupyAmount = getSupplierOccupyAmount(financingBasicInfo);
-        //计算业务综合授信余额和供应商授信余额
-        ProjectInformation projectInformation = projectInformationService.getOne(new QueryWrapper<ProjectInformation>()
-                .eq("business_number", financingBasicInfo.getBusinessNumber()));
-        if (projectInformation == null) {
-            throw new BusinessException(CodeUtil.FAIL, "根据业务编号获取不到对应项目信息");
-        }
+        autoBalance(financingBasicInfo, reviewQuotaDisburse);
 
-        CreditResolution creditResolution = creditResolutionService.getByProjectInformationId(projectInformation.getId());
         reviewQuotaDisburse.setBusinessNumber(financingBasicInfo.getBusinessNumber());
-        reviewQuotaDisburse.setBusinessCreditBalance(creditResolution.getProposedCreditLine().subtract(businessOccupyAmount));
-
-        SupplierInfo supplierInfo = supplierInfoService.get(projectInformation.getcSupplierInfoId());
-        reviewQuotaDisburse.setSupplierCreditBalance(supplierInfo.getCreditLimit().multiply(new BigDecimal("10000")).subtract(supplierOccupyAmount));
         reviewQuotaDisburse.setAccountsReceivableNetAmountTotal(netAccountsReceivableAmountTotal);
 
         //融资信息
@@ -771,6 +758,32 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
         reviewQuotaDisburse.setReviewBasicContractList(Arrays.asList(reviewBasicContract));
     }
 
+    /**
+     * 填充业务综合授信余额和供应商综合授信余额
+     *
+     * @param financingBasicInfo
+     * @param reviewQuotaDisburse
+     */
+    private void autoBalance(CFinancingBasicInfo financingBasicInfo, ReviewQuotaDisburse reviewQuotaDisburse) {
+        //计算业务占用的授信金额
+        BigDecimal businessOccupyAmount = getBusinessOccupyAmount(financingBasicInfo);
+        //计算供应商占用的授信金额
+        BigDecimal supplierOccupyAmount = getSupplierOccupyAmount(financingBasicInfo);
+        //计算业务综合授信余额和供应商授信余额
+        ProjectInformation projectInformation = projectInformationService.getOne(new QueryWrapper<ProjectInformation>()
+                .eq("business_number", financingBasicInfo.getBusinessNumber()));
+        if (projectInformation == null) {
+            throw new BusinessException(CodeUtil.FAIL, "根据业务编号获取不到对应项目信息");
+        }
+
+        CreditResolution creditResolution = creditResolutionService.getByProjectInformationId(projectInformation.getId());
+
+        reviewQuotaDisburse.setBusinessCreditBalance(creditResolution.getProposedCreditLine().subtract(businessOccupyAmount));
+
+        SupplierInfo supplierInfo = supplierInfoService.get(projectInformation.getcSupplierInfoId());
+        reviewQuotaDisburse.setSupplierCreditBalance(supplierInfo.getCreditLimit().multiply(new BigDecimal("10000")).subtract(supplierOccupyAmount));
+    }
+
     /**
      * 填充主合同信息
      *
@@ -820,22 +833,15 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
             throw new BusinessException(CodeUtil.FAIL, "查询sop对应的业务编号失败:" + jsonObject.getStr("msg"));
         }
         BigDecimal returnedPrincipal = jsonObject.getBigDecimal("data");
+
         List<CFinancingBasicInfo> list1 = financingBasicInfoService.list(new QueryWrapper<CFinancingBasicInfo>()
                 .eq("supplier_id", financingBasicInfo.getMainEnterpriseId())
-                .ne("current_stage", FinancingCurrentStageEnum.REVIEW_QUOTA_DISBURSE.getCode())
-                .ne("financing_status", FinancingStatusEnum.FINANCING_PROCESSING.getCode()));
+                .ne("id", financingBasicInfo.getId())
+                .ne("current_stage", FinancingCurrentStageEnum.REVIEW_QUOTA_DISBURSE.getCode()));
         if (CollectionUtil.isNotEmpty(list1)) {
-            BigDecimal occupyAmount = list1.stream().filter(basicInfo -> basicInfo.getFinancingAmount() != null).map(CFinancingBasicInfo::getFinancingAmount)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
-            supplierOccupyAmount = supplierOccupyAmount.add(occupyAmount).subtract(returnedPrincipal);
-        }
-        List<CFinancingBasicInfo> list2 = financingBasicInfoService.list(new QueryWrapper<CFinancingBasicInfo>()
-                .eq("supplier_id", financingBasicInfo.getMainEnterpriseId())
-                .ne("current_stage", "")
-                .ne("financing_status", FinancingStatusEnum.FINANCING_TERMINATED.getCode()));
-        if (CollectionUtil.isNotEmpty(list2)) {
-            BigDecimal occupyAmount = list2.stream().filter(basicInfo -> basicInfo.getFinancingAmount() != null).map(CFinancingBasicInfo::getFinancingAmount)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal occupyAmount = list1.stream().filter(basicInfo -> basicInfo.getFinancingAmount() != null
+                            && !ProjectInitiationStatusDict.ChildEnum.TERMINATED.getCode().equals(basicInfo.getFinancingStatus()))
+                    .map(CFinancingBasicInfo::getFinancingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
             supplierOccupyAmount = supplierOccupyAmount.add(occupyAmount).subtract(returnedPrincipal);
         }
         return supplierOccupyAmount;
@@ -858,20 +864,12 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
         BigDecimal returnedPrincipal = jsonObject.getBigDecimal("data");
         List<CFinancingBasicInfo> list1 = financingBasicInfoService.list(new QueryWrapper<CFinancingBasicInfo>()
                 .eq("business_number", financingBasicInfo.getBusinessNumber())
-                .ne("current_stage", FinancingCurrentStageEnum.REVIEW_QUOTA_DISBURSE.getCode())
-                .ne("financing_status", FinancingStatusEnum.FINANCING_PROCESSING.getCode()));
+                .ne("id", financingBasicInfo.getId())
+                .ne("current_stage", FinancingCurrentStageEnum.REVIEW_QUOTA_DISBURSE.getCode()));
         if (CollectionUtil.isNotEmpty(list1)) {
-            BigDecimal occupyAmount = list1.stream().filter(basicInfo -> basicInfo.getFinancingAmount() != null).map(CFinancingBasicInfo::getFinancingAmount)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
-            businessOccupyAmount = businessOccupyAmount.add(occupyAmount).subtract(returnedPrincipal);
-        }
-        List<CFinancingBasicInfo> list2 = financingBasicInfoService.list(new QueryWrapper<CFinancingBasicInfo>()
-                .eq("business_number", financingBasicInfo.getBusinessNumber())
-                .ne("current_stage", "")
-                .ne("financing_status", FinancingStatusEnum.FINANCING_TERMINATED.getCode()));
-        if (CollectionUtil.isNotEmpty(list2)) {
-            BigDecimal occupyAmount = list2.stream().filter(basicInfo -> basicInfo.getFinancingAmount() != null).map(CFinancingBasicInfo::getFinancingAmount)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal occupyAmount = list1.stream().filter(basicInfo -> basicInfo.getFinancingAmount() != null
+                            && !ProjectInitiationStatusDict.ChildEnum.TERMINATED.getCode().equals(basicInfo.getFinancingStatus()))
+                    .map(CFinancingBasicInfo::getFinancingAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
             businessOccupyAmount = businessOccupyAmount.add(occupyAmount).subtract(returnedPrincipal);
         }
         return businessOccupyAmount;

+ 2 - 0
src/main/java/com/sunxung/factoring/service/financing/review/impl/ReviewQuotaDisburseServiceImpl.java

@@ -1334,6 +1334,8 @@ public class ReviewQuotaDisburseServiceImpl extends ServiceImpl<ReviewQuotaDisbu
                     if (StringUtils.isBlank(masterContract.getContractNo())) {
                         //生成新的保理合同编号
                         contractNo = serialNumberGenerator.nextValue(ConstantUtil.REVIEW_MASTER_CONTRACT_DOMESTIC_CODE);
+                    } else {
+                        contractNo = masterContract.getContractNo();
                     }
                 }
                 masterContract.setContractNo(contractNo);

+ 9 - 9
src/main/java/com/sunxung/factoring/service/fundmanagement/impl/FinancialInstitutionServiceImpl.java

@@ -40,7 +40,6 @@ import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmati
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmationElectronicInfo;
 import com.sunxung.factoring.entity.settlement.SettlementGoodsInfo;
 import com.sunxung.factoring.entity.supplier.SupplierInfo;
-import com.sunxung.factoring.entity.sys.Dictionary;
 import com.sunxung.factoring.entity.sys.*;
 import com.sunxung.factoring.entity.sys.vo.SeachUser;
 import com.sunxung.factoring.mapper.fundmanagement.FinancialInstitutionMapper;
@@ -76,7 +75,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
 
-import java.io.File;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -804,12 +802,14 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
 
                             SalesInvoiceInfo salesInvoiceInfo = salesInvoiceInfoService.lambdaQuery().eq(SalesInvoiceInfo::getInvoiceBasicInfoId, invoiceBasicInfoId).one();
                             //销售发票附件(销售发票未在B端中间表存储 所以取数逻辑不同)
-                            List<FileStorage> salesFileList = fileStorageService.findByBelongIdAndBelongType(salesInvoiceInfo.getId().toString(), FileModuleDict.ChildEnum.INVOICE_SALES_FILE.getCode());
-                            if (CollectionUtil.isNotEmpty(salesFileList)) {
-                                salesFileList.stream().forEach(p -> {
-                                    sysAttachmentRefService.copyFile(p, FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_DOWNSTREAM_INVOICE_FILE,
-                                            AttachmentDto.builder().setEntityId(customerExpenditureContractInfo.getId()).build());
-                                });
+                            if (salesInvoiceInfo != null) {
+                                List<FileStorage> salesFileList = fileStorageService.findByBelongIdAndBelongType(salesInvoiceInfo.getId().toString(), FileModuleDict.ChildEnum.INVOICE_SALES_FILE.getCode());
+                                if (CollectionUtil.isNotEmpty(salesFileList)) {
+                                    salesFileList.stream().forEach(p -> {
+                                        sysAttachmentRefService.copyFile(p, FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_DOWNSTREAM_INVOICE_FILE,
+                                                AttachmentDto.builder().setEntityId(customerExpenditureContractInfo.getId()).build());
+                                    });
+                                }
                             }
                         }
 
@@ -906,7 +906,7 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
                 //如果客户对应的支用信息都为空 删除客户信息
                 if (dictService.get(financialCustomer.getCustomerStatus()).getCode().equals(FinancialCustomerStatusDict.ChildEnum.FINANCIAL_CUSTOMER_TO_BE_EDIT.getCode())) {
                     BusinessProcessingLog customerLog = businessProcessingLogService
-                            .findLatestByTaskDefKey(null,ConstantUtil.FINANCIAL_CUSTOMER_PROCESS, financialCustomer.getId());
+                            .findLatestByTaskDefKey(null, ConstantUtil.FINANCIAL_CUSTOMER_PROCESS, financialCustomer.getId());
                     //终止客户信息流程
                     businessProcessingTaskService.terminate(customerLog.getHistoricTaskId(), financialCustomer.getId(), customerLog.getBusinessType(),
                             customerLog.getTaskName(), customerLog.getTaskDefKey());

+ 27 - 5
src/main/java/com/sunxung/factoring/service/ledger/impl/LedgerManagementServiceImpl.java

@@ -75,13 +75,14 @@ import com.sunxung.factoring.service.sys.DictionaryService;
 import com.sunxung.factoring.service.sys.UserService;
 import com.sunxung.factoring.service.sys.flowable.FlowableService;
 import com.sunxung.factoring.service.tradingPlatform.PlatformService;
+import io.seata.core.context.RootContext;
+import io.seata.spring.annotation.GlobalTransactional;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.PropertySource;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
@@ -335,6 +336,7 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
     }
 
     @Override
+    @GlobalTransactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public void addApproval(LedgerApprovalInfo ledgerApprovalInfo) {
         if (ledgerApprovalInfo == null || ledgerApprovalInfo.getLedgerAccountBasicInfoId() == null) {
@@ -382,7 +384,13 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
                 //调用sop变更收放款计划接口
                 List<LedgerPlanFactoringAssign> planFactoringAssignList = planFactoringAssignService.findByBasicInfoId(ledgerAccountBasicInfo.getId());
                 if (CollectionUtil.isNotEmpty(planFactoringAssignList)) {
-                    ResponseEntity<String> responseEntity = restTemplate.postForEntity(planInfoAddUrl, planFactoringAssignList, String.class);
+                    HttpHeaders headers = new HttpHeaders();
+                    headers.setContentType(MediaType.APPLICATION_JSON);
+                    headers.set("Accept", "application/json");
+                    headers.set(RootContext.KEY_XID, RootContext.getXID());
+
+                    HttpEntity<String> entity = new HttpEntity<>(JSONUtil.toJsonStr(planFactoringAssignList), headers);
+                    ResponseEntity<String> responseEntity = restTemplate.postForEntity(planInfoAddUrl, entity, String.class);
                     ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
                     if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || !responseJson.isSuccess()) {
                         throw new BusinessException(CodeUtil.FAIL, "分账失败--变更sop收放款计划失败:" + responseJson.getMsg());
@@ -667,7 +675,14 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
             throw new BusinessException(CodeUtil.FAIL, "获取不到项目对应的贸易平台");
         }
         oaOtherPaymentTradeVo.setOaCompanyEntityStr(platform.getPlatformName());
-        ResponseEntity<String> responseEntity = restTemplate.postForEntity(startOaPaymentProcessUrl, oaOtherPaymentTradeVo, String.class);
+
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        headers.set("Accept", "application/json");
+        headers.set(RootContext.KEY_XID, RootContext.getXID());
+
+        HttpEntity<String> entity = new HttpEntity<>(JSONUtil.toJsonStr(oaOtherPaymentTradeVo), headers);
+        ResponseEntity<String> responseEntity = restTemplate.postForEntity(startOaPaymentProcessUrl, entity, String.class);
         ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
         if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || !responseJson.isSuccess()) {
             throw new BusinessException(CodeUtil.FAIL, "开启OA申请-归还保理融资款失败:" + responseJson.getMsg().toString());
@@ -771,7 +786,14 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
             planFactoringList.add(planFactoring);
         }
         billingRecordBasic.setPlanFactoringList(planFactoringList);
-        ResponseEntity<String> responseEntity = restTemplate.postForEntity(billingRecordBasicAddUrl, billingRecordBasic, String.class);
+
+        HttpHeaders headers = new HttpHeaders();
+        headers.setContentType(MediaType.APPLICATION_JSON);
+        headers.set("Accept", "application/json");
+        headers.set(RootContext.KEY_XID, RootContext.getXID());
+
+        HttpEntity<String> entity = new HttpEntity<>(JSONUtil.toJsonStr(billingRecordBasic), headers);
+        ResponseEntity<String> responseEntity = restTemplate.postForEntity(billingRecordBasicAddUrl, entity, String.class);
         ResponseJson responseJson = JSONUtil.toBean(responseEntity.getBody(), ResponseJson.class);
         if (responseEntity.getStatusCode().value() != HttpStatus.OK.value() || !responseJson.isSuccess()) {
             throw new BusinessException(CodeUtil.FAIL, "数据同步到sop失败:" + responseJson.getMsg().toString());

+ 3 - 2
src/main/java/com/sunxung/factoring/service/refundsManagement/impl/RefundManagementApprovalServiceImpl.java

@@ -144,7 +144,7 @@ public class RefundManagementApprovalServiceImpl extends ServiceImpl<RefundManag
                                 .list();
                         if (CollectionUtil.isNotEmpty(fundGoodsAssignList)) {
                             List<LedgerAccountBasicInfo> ledgerAccountBasicInfos = fundGoodsAssignList.stream().map(fundGoodsAssign -> {
-                                return ledgerAccountBasicInfoService.getById(fundGoodsAssign.getLedgerAccountBasicInfoId());
+                                return ledgerAccountBasicInfoService.getDetail(fundGoodsAssign.getLedgerAccountBasicInfoId());
                             }).sorted(Comparator.comparing(LedgerAccountBasicInfo::getGmtCreate).reversed()).collect(Collectors.toList());
                             List<RefundsApplyAccountInfo> accountInfoList = new ArrayList<>();
                             if (CollectionUtil.isNotEmpty(ledgerAccountBasicInfos)) {
@@ -232,6 +232,7 @@ public class RefundManagementApprovalServiceImpl extends ServiceImpl<RefundManag
                         cashFlowManageBasicInfoService.add(cashFlowRequest);
                         //闭合分账推送给现金流的数据
                         cashFlowComplete(apply, null);
+                        handleApprovalProcess(apply.getRefundManagementId());
                     }
 
                     RefundManagementApprovalApplyDetailsRef approvalApplyDetailsRef = new RefundManagementApprovalApplyDetailsRef();
@@ -395,7 +396,7 @@ public class RefundManagementApprovalServiceImpl extends ServiceImpl<RefundManag
 
         //收放款计划和退款管理关联关系 状态置为通过
         refundManagementPayCollPlanFactoringRefService.lambdaUpdate()
-                .eq(RefundManagementPayCollPlanFactoringRef::getRefundManagementId,nobusinessManage.getTradeRefundManagementId())
+                .eq(RefundManagementPayCollPlanFactoringRef::getRefundManagementId,applyDetail.getRefundManagementId())
                 .set(RefundManagementPayCollPlanFactoringRef::getStatus,1)
                 .update();
     }

+ 1 - 1
src/main/resources/mapper/financing/apply/CFinancingBasicInfoMapper.xml

@@ -86,7 +86,7 @@
                 </foreach>
             </if>
             <if test="searchNumber != null and searchNumber != ''">
-                AND ( t1.business_number LIKE CONCAT('%', #{businessNo},'%') OR t3.contract_no LIKE CONCAT('%',#{businessNo},'%'))
+                AND ( t1.business_number LIKE CONCAT('%', #{searchNumber},'%') OR t3.contract_no LIKE CONCAT('%',#{searchNumber},'%'))
             </if>
             <if test="fastSearch != null and fastSearch != ''">
                 AND (t1.project_name LIKE CONCAT('%',#{fastSearch},'%') OR t4.corporate_name LIKE CONCAT('%',#{fastSearch},'%') OR

+ 7 - 6
src/main/resources/mapper/refundManagement/RefundManagementMapper.xml

@@ -12,7 +12,7 @@
         <result property="customerName" column="customer_name"/>
         <result property="supplierName" column="supplier_name"/>
         <result property="platformName" column="platform_name"/>
-        <result property="taskName" column="stage" />
+        <result property="taskName" column="stage"/>
         <result property="quotaDisburseBatch" column="quota_disburse_batch"/>
         <result property="gmtModified" column="gmt_modified"/>
         <association property="status" column="status" resultMap="dictionaryResult"/>
@@ -96,10 +96,10 @@
         SELECT t.id,
                t.business_number,
                t.refund_number,
-               t.contract_no contract_number,
+               t.contract_no     contract_number,
                t.quota_disburse_batch,
                t.refund_status,
-               t5.platform_name trading_platform_name,
+               t5.platform_name  trading_platform_name,
                t1.project_name,
                t3.corporate_name supplier_name,
                t7.corporate_name customer_name,
@@ -141,7 +141,7 @@
                       ledger_account_basic_info t3
                  WHERE t.id = t2.ledger_fund_goods_assign_id
                    AND t.ledger_account_basic_info_id = t3.id
-                   AND t2.cash_type IN ("outType_discount","performanceBond","retentionMoney")
+                   AND t2.cash_type IN ("outType_discount", "performanceBond", "retentionMoney")
                    AND t.is_submit = 1
              ) tt
                  LEFT JOIN refund_management a
@@ -174,13 +174,14 @@
                           ledger_account_basic_info t3
                      WHERE t.id = t2.ledger_fund_goods_assign_id
                        AND t.ledger_account_basic_info_id = t3.id
-                       AND t2.cash_type IN ("outType_discount","performanceBond","retentionMoney")
+                       AND t2.cash_type IN ("outType_discount", "performanceBond", "retentionMoney")
                        AND t.is_submit = 1
                  ) tt
                      LEFT JOIN refund_management a ON a.contract_no = tt.contract_no
                 AND a.quota_disburse_batch = tt.quota_disburse_batch
             WHERE a.id = #{value}
-              AND tt.amount_type NOT IN (SELECT mm.amount_type FROM refund_details mm)
+              AND tt.amount_type NOT IN
+                  (SELECT mm.amount_type FROM refund_details mm WHERE mm.refund_management_id = #{value})
         )
     </select>