10 Commits 0efff3cb6c ... 75019c8b49

Auteur SHA1 Message Date
  liutao 75019c8b49 fix(苏商银行):更改开户行 il y a 2 semaines
  liutao b2010ec418 Merge branch 'refs/heads/smb' il y a 2 semaines
  liuj 33230694b6 苏商还款定时任务优化 il y a 2 semaines
  liutao 53dc0a59ae fix(苏商银行):更改开户行 il y a 2 semaines
  liuj 449f963a99 对账文件批处理任务优化 il y a 2 semaines
  liuj 803fd82c11 对账文件批处理任务优化 il y a 2 semaines
  liutao 8ab3ee9984 Merge branch 'smb' il y a 2 semaines
  liuj 569fb6d27e 单价保留小数点4位SQL更新 il y a 2 semaines
  liuj 160c3d21b4 发票金额进度调整 il y a 2 semaines
  liuj f748fccee5 问题修复 il y a 2 semaines

+ 1 - 1
build.gradle

@@ -9,7 +9,7 @@ targetCompatibility = 1.8
 
 jar {
     baseName = 'factoring-trade-prod'
-    version = '1.0.76'
+    version = '1.0.78'
 }
 
 springBoot {

+ 13 - 0
src/main/java/com/sunxung/factoring/entity/smb/vo/FinancingPaymentInfoSearch.java

@@ -26,6 +26,11 @@ public class FinancingPaymentInfoSearch extends BaseSearch {
      */
     private String paymentStatus;
 
+    /**
+     * 还款编号
+     */
+    private String repayNo;
+
     private List<Long> userIds;
 
     public List<Long> getUserIds() {
@@ -59,4 +64,12 @@ public class FinancingPaymentInfoSearch extends BaseSearch {
     public void setPaymentStatus(String paymentStatus) {
         this.paymentStatus = paymentStatus;
     }
+
+    public String getRepayNo() {
+        return repayNo;
+    }
+
+    public void setRepayNo(String repayNo) {
+        this.repayNo = repayNo;
+    }
 }

+ 13 - 3
src/main/java/com/sunxung/factoring/job/impl/SmbTaskJob.java

@@ -60,12 +60,22 @@ public class SmbTaskJob {
     }
 
     /**
-     * 苏商还款文件批处理任务(每天凌晨1点执行
+     * 苏商还款申请重新发起任务(每20分钟执行一次
      */
-    @Scheduled(cron = "0 0 1 * * ?")
+    @Scheduled(cron = "0 0/20 * * * ?")
+    public void repayApplyAgainProcess() {
+        log.info("苏商还款申请重新发起定时任务执行开始...");
+        financingPaymentInfoService.repayApplyAgainProcess();
+        log.info("苏商还款申请重新发起定时任务执行结束...");
+    }
+
+    /**
+     * 苏商还款文件批处理任务(每天凌晨4点执行)
+     */
+    @Scheduled(cron = "0 0 4 * * ?")
     public void repaymentFileProcess() {
         log.info("苏商还款文件批处理任务执行开始...");
-        LocalDate localDate = LocalDate.now().minusDays(1L);
+        LocalDate localDate = LocalDate.now();
         financingReconciliationInfoService.repaymentFileProcess(localDate);
         log.info("苏商还款文件批处理任务执行结束...");
     }

+ 21 - 12
src/main/java/com/sunxung/factoring/service/cashflowmanage/impl/CashFlowManageBasicInfoServiceImpl.java

@@ -726,20 +726,26 @@ public class CashFlowManageBasicInfoServiceImpl extends ServiceImpl<CashFlowMana
             }
             cashFlowManageOutInfoService.save(cashFlowManageOutInfo);
 
-            //更新现金流信息表状态
-            this.lambdaUpdate().eq(CashFlowManageBasicInfo::getId, cashFlowManageOutInfo.getCashFlowManageBasicInfoId())
-                    .set(CashFlowManageBasicInfo::getCashStatus, 4).update();
 
             CashFlowManageBasicInfo cashFlowManageBasicInfo = getById(cashFlowManageOutInfo.getCashFlowManageBasicInfoId());
-            if (cashFlowManageBasicInfo != null && CashFlowOutTypeDict.ChildEnum.MANAGEMENT_AMOUNT.getCode().equals(cashFlowManageBasicInfo.getCashType())) {
-                //如果类型为资方融资款时,需要向苏商银行发起提款申请
-                //异步调用
-                CompletableFuture.runAsync(() -> {
-                    LedgerFundGoodsAssign ledgerFundGoodsAssign = ledgerFundGoodsAssignService.getById(cashFlowManageBasicInfo.getLedgerFundGoodsAssignId());
-                    if (ledgerFundGoodsAssign != null) {
-                        ledgerManagementService.repayApplyBySMB(ledgerFundGoodsAssign);
-                    }
-                });
+            if (cashFlowManageBasicInfo != null) {
+                //更新现金流信息表状态(非资方融资款项类型的)
+                if (!CashFlowOutTypeDict.ChildEnum.MANAGEMENT_AMOUNT.getCode().equals(cashFlowManageBasicInfo.getCashType())) {
+                    this.lambdaUpdate().eq(CashFlowManageBasicInfo::getId, cashFlowManageOutInfo.getCashFlowManageBasicInfoId())
+                            .set(CashFlowManageBasicInfo::getCashStatus, 4).update();
+                } else {
+                    //如果类型为资方融资款时,需要向苏商银行发起提款申请
+                    //异步调用
+                    CompletableFuture.runAsync(() -> {
+                        LedgerFundGoodsAssign ledgerFundGoodsAssign = ledgerFundGoodsAssignService.getById(cashFlowManageBasicInfo.getLedgerFundGoodsAssignId());
+                        if (ledgerFundGoodsAssign != null) {
+                            ledgerManagementService.repayApplyBySMB(ledgerFundGoodsAssign);
+                        }
+                        //更新状态
+                        this.lambdaUpdate().eq(CashFlowManageBasicInfo::getId, cashFlowManageOutInfo.getCashFlowManageBasicInfoId())
+                                .set(CashFlowManageBasicInfo::getCashStatus, 4).update();
+                    });
+                }
             }
         }
     }
@@ -766,12 +772,15 @@ public class CashFlowManageBasicInfoServiceImpl extends ServiceImpl<CashFlowMana
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void repayApplyAgain(Long id) {
         CashFlowManageBasicInfo cashFlowManageBasicInfo = this.getById(id);
         if (cashFlowManageBasicInfo != null) {
             LedgerFundGoodsAssign ledgerFundGoodsAssign = ledgerFundGoodsAssignService.getById(cashFlowManageBasicInfo.getLedgerFundGoodsAssignId());
             if (ledgerFundGoodsAssign != null) {
                 ledgerManagementService.repayApplyBySMB(ledgerFundGoodsAssign);
+                //更新状态
+                this.lambdaUpdate().eq(CashFlowManageBasicInfo::getId, id).set(CashFlowManageBasicInfo::getCashStatus, 4).update();
             }
         }
     }

+ 4 - 4
src/main/java/com/sunxung/factoring/service/invoicemanage/impl/InvoiceApprovalServiceImpl.java

@@ -325,16 +325,16 @@ public class InvoiceApprovalServiceImpl extends ServiceImpl<InvoiceApprovalMappe
             List<FileStorage> fileStorages = fileStorageService.findByBelongIdAndBelongType(salesInvoiceInfo.getId() + "", FileModuleDict.ChildEnum.INVOICE_SALES_FILE.getCode());
             salesInvoiceInfo.setSalesInvoicFile(CollectionUtil.isNotEmpty(fileStorages)?fileStorages:new ArrayList<>());
             salesInvoiceInfo.setNvoiceNum(nvoiceNum);
-            salesInvoiceInfo.setAmount(amount.divide(bigDecimal,2, RoundingMode.HALF_UP));
-            salesInvoiceInfo.setTaxAmount(amount.multiply(bigDecimal1).divide(bigDecimal,2, RoundingMode.HALF_UP));
+            salesInvoiceInfo.setAmount(amount.divide(bigDecimal,4, RoundingMode.HALF_UP));
+            salesInvoiceInfo.setTaxAmount(amount.multiply(bigDecimal1).divide(bigDecimal,4, RoundingMode.HALF_UP));
             salesInvoiceInfo.setPriceTaxTotal(amount);
             invoiceApproval.setSalesInvoiceInfo(salesInvoiceInfo);
         }else {
             salesInvoiceInfo = new SalesInvoiceInfo();
             salesInvoiceInfo.setInvoiceBasicInfoId(businessKey);
             salesInvoiceInfo.setNvoiceNum(nvoiceNum);
-            salesInvoiceInfo.setAmount(amount.divide(bigDecimal,2, RoundingMode.HALF_UP));
-            salesInvoiceInfo.setTaxAmount(amount.multiply(bigDecimal1).divide(bigDecimal,2, RoundingMode.HALF_UP));
+            salesInvoiceInfo.setAmount(amount.divide(bigDecimal,4, RoundingMode.HALF_UP));
+            salesInvoiceInfo.setTaxAmount(amount.multiply(bigDecimal1).divide(bigDecimal,4, RoundingMode.HALF_UP));
             salesInvoiceInfo.setPriceTaxTotal(amount);
             invoiceApproval.setSalesInvoiceInfo(salesInvoiceInfo);
         }

+ 2 - 0
src/main/java/com/sunxung/factoring/service/ledger/impl/LedgerManagementServiceImpl.java

@@ -635,6 +635,8 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
         if (repayStatusResp.getHxCint() != null) {
             financingPaymentInfo.setHxCint(new BigDecimal(repayStatusResp.getHxCint()));
         }
+        //还款日期
+        financingPaymentInfo.setRepayDate(new Date());
         if ("02".equals(repayStatusResp.getRepayStatus())) {
             //如果还款状态为还款失败
             financingPaymentInfo.setRemark(repayStatusResp.getRemark());

+ 5 - 0
src/main/java/com/sunxung/factoring/service/smb/IFinancingPaymentInfoService.java

@@ -42,4 +42,9 @@ public interface IFinancingPaymentInfoService extends IService<FinancingPaymentI
      * 还款状态查询
      */
     void repayStatusQuery();
+
+    /**
+     * 苏商还款重新发起
+     */
+    void repayApplyAgainProcess();
 }

+ 30 - 1
src/main/java/com/sunxung/factoring/service/smb/impl/FinancingPaymentInfoServiceImpl.java

@@ -12,8 +12,11 @@ import com.sunxung.factoring.component.util.CodeUtil;
 import com.sunxung.factoring.component.util.CollectionUtil;
 import com.sunxung.factoring.component.util.ConstantConversionUtil;
 import com.sunxung.factoring.component.util.ThreadLocalUtil;
+import com.sunxung.factoring.dict.impl.CashFlowOutTypeDict;
 import com.sunxung.factoring.entity.GridPage;
 import com.sunxung.factoring.entity.ResponseJson;
+import com.sunxung.factoring.entity.cashflowmanage.CashFlowManageBasicInfo;
+import com.sunxung.factoring.entity.cashflowmanage.CashFlowManageOutInfo;
 import com.sunxung.factoring.entity.entprise.Enterprise;
 import com.sunxung.factoring.entity.smb.FinancingPaymentInfo;
 import com.sunxung.factoring.entity.smb.SmbRefinancingInfo;
@@ -22,6 +25,8 @@ import com.sunxung.factoring.entity.sys.Permission;
 import com.sunxung.factoring.entity.sys.UserOrgRel;
 import com.sunxung.factoring.entity.sys.UserRoleRel;
 import com.sunxung.factoring.mapper.smb.FinancingPaymentInfoMapper;
+import com.sunxung.factoring.service.cashflowmanage.CashFlowManageBasicInfoService;
+import com.sunxung.factoring.service.cashflowmanage.CashFlowManageOutInfoService;
 import com.sunxung.factoring.service.entprise.IEnterpriseService;
 import com.sunxung.factoring.service.smb.IFinancingPaymentInfoService;
 import com.sunxung.factoring.service.smbApi.api.SMBApiService;
@@ -41,7 +46,6 @@ import org.springframework.web.client.RestTemplate;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.UUID;
 
 /**
  * <p>
@@ -75,6 +79,12 @@ public class FinancingPaymentInfoServiceImpl extends ServiceImpl<FinancingPaymen
     @Autowired
     private RestTemplate restTemplate;
 
+    @Autowired
+    private CashFlowManageBasicInfoService cashFlowManageBasicInfoService;
+
+    @Autowired
+    private CashFlowManageOutInfoService cashFlowManageOutInfoService;
+
     @Override
     public GridPage<FinancingPaymentInfo> findBySearch(FinancingPaymentInfoSearch search) {
         Long currentUserId = ThreadLocalUtil.getUserId();
@@ -190,6 +200,25 @@ public class FinancingPaymentInfoServiceImpl extends ServiceImpl<FinancingPaymen
         }
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void repayApplyAgainProcess() {
+        //获取所有类型为资方融资款 状态为处理中的现金流信息
+        List<CashFlowManageBasicInfo> cashFlowManageBasicInfoList = cashFlowManageBasicInfoService.lambdaQuery()
+                .eq(CashFlowManageBasicInfo::getCashType, CashFlowOutTypeDict.ChildEnum.MANAGEMENT_AMOUNT.getCode())
+                .eq(CashFlowManageBasicInfo::getCashStatus, 3).list();
+        if (CollectionUtil.isNotEmpty(cashFlowManageBasicInfoList)) {
+            for (CashFlowManageBasicInfo cashFlowManageBasicInfo : cashFlowManageBasicInfoList) {
+                //判断是否有出账记录
+                CashFlowManageOutInfo outInfo = cashFlowManageOutInfoService.lambdaQuery().eq(CashFlowManageOutInfo::getCashFlowManageBasicInfoId, cashFlowManageBasicInfo.getId()).one();
+                if (outInfo != null) {
+                    //有出账记录说明OA已审批结束,重新发起还款申请
+                    cashFlowManageBasicInfoService.repayApplyAgain(cashFlowManageBasicInfo.getId());
+                }
+            }
+        }
+    }
+
     /**
      * 修改资方还款信息
      *

+ 5 - 5
src/main/java/com/sunxung/factoring/service/smb/impl/FinancingReconciliationInfoServiceImpl.java

@@ -58,8 +58,8 @@ public class FinancingReconciliationInfoServiceImpl extends ServiceImpl<Financin
     @Autowired
     private RestTemplate restTemplate;
 
-    @Value("${config.smbRefinancingPlanUpdate.url}")
-    private String smbRefinancingPlanUpdateUrl;
+    @Value("${config.smbBeforeRepayPlanUpdate.url}")
+    private String smbBeforeRepayPlanUpdateUrl;
 
     @Override
     public GridPage<FinancingReconciliationInfo> findBySearch(FinancingReconciliationInfoSearch search) {
@@ -134,7 +134,7 @@ public class FinancingReconciliationInfoServiceImpl extends ServiceImpl<Financin
                 //交易日期
                 if (map.get(12) != null) {
                     String str = (String) map.get(12);
-                    info.setTransactionDate(DateUtil.parse(str, "yyyyMMdd"));
+                    info.setTransactionDate(DateUtil.parse(str, "yyyy-MM-dd"));
                 }
                 //交易流水
                 if (map.get(13) != null) {
@@ -163,9 +163,9 @@ public class FinancingReconciliationInfoServiceImpl extends ServiceImpl<Financin
                             smbRefinancingInfo.setContractNo(financingLoanInfo.getContractNo());
                             smbRefinancingInfo.setQuotaDisburseBatch(financingLoanInfo.getQuotaDisburseBatch());
                             smbRefinancingInfo.setRepayPlanResp(repayPlanResp);
-                            smbRefinancingInfo.setRepaymentMethod(SmbRepaymentMethodEnum.BATCH_DEDUCTION.getCode());
+                       //     smbRefinancingInfo.setRepaymentMethod(SmbRepaymentMethodEnum.BATCH_DEDUCTION.getCode());
 
-                            ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbRefinancingPlanUpdateUrl, smbRefinancingInfo, String.class);
+                            ResponseEntity<String> responseEntity = restTemplate.postForEntity(smbBeforeRepayPlanUpdateUrl, smbRefinancingInfo, 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());

+ 13 - 0
src/main/resources/data/update/smb0826.sql

@@ -101,3 +101,16 @@ VALUES ('资方融资款项',(select id from t_dictionary p where p.code = 'cash
 
 ALTER TABLE `ledger_fund_goods_assign` ADD `repay_kind` varchar(2) DEFAULT NULL COMMENT '苏商还款种类';
 ALTER TABLE `financing_payment_info` ADD `biz_no` varchar(32) DEFAULT NULL COMMENT 'biz_no';
+
+ALTER TABLE `c_settlement_goods_info` MODIFY `reference_price` decimal(17,4) DEFAULT NULL COMMENT '参考价格';
+ALTER TABLE `c_settlement_goods_info` MODIFY `floating_price` decimal(17,4) DEFAULT NULL COMMENT '浮动价格';
+ALTER TABLE `settlement_his_goods_info` MODIFY `reference_price` decimal(17,4) DEFAULT NULL COMMENT '参考价格';
+ALTER TABLE `settlement_his_goods_info` MODIFY `floating_price` decimal(17,4) DEFAULT NULL COMMENT '浮动价格';
+ALTER TABLE `c_invoice_goods_info` MODIFY `sales_price` decimal(17,4) DEFAULT NULL COMMENT '销售单价';
+ALTER TABLE `c_invoice_goods_info` MODIFY `open_amount` decimal(17,4) DEFAULT NULL COMMENT '开票金额';
+ALTER TABLE `invoice_his_goods_info` MODIFY `sales_price` decimal(17,4) DEFAULT NULL COMMENT '销售单价';
+ALTER TABLE `invoice_his_goods_info` MODIFY `open_amount` decimal(17,4) DEFAULT NULL COMMENT '开票金额';
+
+ALTER TABLE `c_sales_invoice_info` MODIFY `amount` decimal(17,4) DEFAULT NULL COMMENT '金额';
+ALTER TABLE `c_sales_invoice_info` MODIFY `tax_amount` decimal(17,4) DEFAULT NULL COMMENT '税额';
+ALTER TABLE `c_sales_invoice_info` MODIFY `price_tax_total` decimal(17,4) DEFAULT NULL COMMENT '价税合计';

+ 4 - 1
src/main/resources/mapper/smb/FinancingPaymentInfoMapper.xml

@@ -20,7 +20,10 @@
             </if>
             <if test="keyword != null and keyword != ''">
                 and (t4.corporate_name like CONCAT('%',#{keyword},'%') or t1.open_id like CONCAT('%',#{keyword},'%') or t1.contract_no like CONCAT('%',#{keyword},'%')
-                        or t1.due_bill_no like CONCAT('%',#{keyword},'%') or t1.repay_no like CONCAT('%',#{keyword},'%') )
+                        or t1.due_bill_no like CONCAT('%',#{keyword},'%'))
+            </if>
+            <if test="repayNo != null and repayNo !=''">
+                and t1.repay_no like CONCAT('%',#{repayNo},'%')
             </if>
             <if test="paymentDate != null">
                 and t1.repay_date = #{paymentDate}