171250443 před 1 rokem
rodič
revize
7863d350e5

+ 5 - 4
src/main/java/com/cool/bang/api/DataMatch.java

@@ -102,7 +102,7 @@ public class DataMatch {
      * 工程形象进度业务表、明细表导入
      */
     @GetMapping("progressBusiness")
-    public void progressBusiness(){
+    public void progressBusiness() {
         mySQLService.progressBusiness();
     }
 
@@ -110,10 +110,11 @@ public class DataMatch {
      * 拨付业务信息导入
      */
     @GetMapping("appropriation")
-    public void appropriation(){
-        mySQLService.appropriation();
-    }
+    public void appropriation() {
+        mySQLService.trusteeshipAppropriation();
+        mySQLService.superviseAppropriation();
 
+    }
 
     /**
      * 合同

+ 23 - 26
src/main/java/com/cool/bang/modules/mysql/domain/Appropriation.java

@@ -1,12 +1,9 @@
 package com.cool.bang.modules.mysql.domain;
 
-import com.cool.bang.modules.mysql.domain.flowPo.ApprovalRecord;
 import com.cool.bang.modules.oracle.domain.po.Bfxx;
-import com.sun.org.apache.bcel.internal.generic.ACONST_NULL;
 
 import java.math.BigDecimal;
 import java.util.Date;
-import java.util.List;
 
 /**
  * 拨付申请
@@ -122,52 +119,52 @@ public class Appropriation {
 
     public Appropriation(){}
 
-    public Appropriation(Bfxx bfxx, Account bfzh, Account skzh,Org org,ProjectAccount projectAccount){
+    public Appropriation(Bfxx bfxx, Account bfzh, Account skzh, Org org, ProjectAccount projectAccount) {
         this.businessNumber = bfxx.getYwbh();
-        this.bankCode = bfzh.getBankCode();
-        this.orgId = org.getId();
-        this.orgName = org.getOrgName();
-        this.projectId = projectAccount.getProjectId();
-        this.projectAccountId = projectAccount.getId();
-        this.projectNumber = projectAccount.getProjectNumber();
-        this.projectName = projectAccount.getProjectName();
         this.director = bfxx.getLxr();
         this.phone = bfxx.getLxdh();
+        this.applyAmount = bfxx.getXmsqzj();
+        this.purpose = bfxx.getZjyt();
+        this.remark = bfxx.getZjyt();
+        this.createTime = bfxx.getSqrq();
+        this.updateTime = bfxx.getShrq();
+        if (bfxx.getBfzt1() != null && bfxx.getBfzt1() == 1) {
+            this.applicationState = 1;
+        } else {
+            this.applicationState = 0;
+        }
 
+        this.bankCode = bfzh.getBankCode();
         this.appropriationAccountId = bfzh.getId();
         this.appropriationBank = bfzh.getBankName();
         this.appropriationName = bfzh.getName();
         this.appropriationAccount = bfzh.getAccount();
         this.appropriationOpenAddress = bfzh.getOpenAddress();
 
-        if (skzh == null){
-            this.collectionBank = bfxx.getSkyh();
+        this.orgId = org.getId();
+        this.orgName = org.getOrgName();
 
-            if (bfxx.getSkhm() != null){
+        this.projectId = projectAccount.getProjectId();
+        this.projectAccountId = projectAccount.getId();
+        this.projectNumber = projectAccount.getProjectNumber();
+        this.projectName = projectAccount.getProjectName();
+
+        if (skzh == null) {
+            this.collectionBank = bfxx.getSkyh();
+            if (bfxx.getSkhm() != null) {
                 this.collectionName = bfxx.getSkhm().length() < 50 ? bfxx.getSkhm() : bfxx.getSkhm().substring(0, 13);
             }
             this.collectionAccount = bfxx.getSkzh();
             this.collectionOpenAddress = "";
-        }else {
+        } else {
             this.collectionAccountId = skzh.getId();
             this.collectionBank = skzh.getBankName();
             this.collectionName = skzh.getName();
             this.collectionAccount = skzh.getAccount();
             this.collectionOpenAddress = skzh.getOpenAddress();
         }
-
-        this.applyAmount = bfxx.getXmsqzj();
-        this.purpose = bfxx.getZjyt();
-        this.remark = bfxx.getZjyt();
         this.delFlag = 1;
-        this.createTime = bfxx.getSqrq();
-        this.updateTime = bfxx.getShrq();
         this.businessState = 3;
-        if (bfxx.getBfzt1() != null && bfxx.getBfzt1() == 1){
-            this.applicationState = 1;
-        }else {
-            this.applicationState = 0;
-        }
     }
 
     public String getRemark() {

+ 11 - 0
src/main/java/com/cool/bang/modules/mysql/domain/AppropriationDetail.java

@@ -1,5 +1,6 @@
 package com.cool.bang.modules.mysql.domain;
 
+import com.cool.bang.modules.oracle.domain.OracleAppropriationDetail;
 import com.cool.bang.modules.oracle.domain.po.Bfmx;
 
 import java.math.BigDecimal;
@@ -46,6 +47,16 @@ public class AppropriationDetail {
 
     public AppropriationDetail(){}
 
+    public AppropriationDetail(OracleAppropriationDetail oracleAppropriationDetail) {
+        this.buildingNumber = oracleAppropriationDetail.getBuildingNumber();
+        this.buildingName = oracleAppropriationDetail.getBuildingName();
+        this.accountBalance = oracleAppropriationDetail.getAccountBalance();
+        this.keepPercentage = oracleAppropriationDetail.getKeepPercentage();
+        this.keepAmount = oracleAppropriationDetail.getKeepAmount();
+        this.applyAmount = oracleAppropriationDetail.getApplyAmount();
+        this.delFlag = 1;
+    }
+
     public AppropriationDetail(Bfmx bfmx,Appropriation appropriation,BuildingAccount buildingAccount){
         this.appropriationId = appropriation.getId();
         this.buildingAccountId = buildingAccount.getId();

+ 21 - 0
src/main/java/com/cool/bang/modules/mysql/domain/flowPo/ApprovalRecord.java

@@ -54,6 +54,7 @@ public class ApprovalRecord {
 
     private Date updateTime;
 
+
     public Date getCreateTime() {
         return createTime;
     }
@@ -165,4 +166,24 @@ public class ApprovalRecord {
     public void setDelFlag(Integer delFlag) {
         this.delFlag = delFlag;
     }
+
+    @Override
+    public String toString() {
+        return "ApprovalRecord{" +
+                "id=" + id +
+                ", businessNumber='" + businessNumber + '\'' +
+                ", flowNumber='" + flowNumber + '\'' +
+                ", tableId=" + tableId +
+                ", nodeId=" + nodeId +
+                ", nodeName='" + nodeName + '\'' +
+                ", approverId=" + approverId +
+                ", approver='" + approver + '\'' +
+                ", approvalTime=" + approvalTime +
+                ", approvalStatus=" + approvalStatus +
+                ", approvalRemark='" + approvalRemark + '\'' +
+                ", delFlag=" + delFlag +
+                ", createTime=" + createTime +
+                ", updateTime=" + updateTime +
+                '}';
+    }
 }

+ 11 - 2
src/main/java/com/cool/bang/modules/mysql/mapper/MySqlMapper.java

@@ -36,9 +36,9 @@ public interface MySqlMapper {
 
     int insertAppropriationDetail(@Param("list")List<AppropriationDetail> appropriationDetails);
 
-    int insertAppropriationOutgoing(@Param("list") List<AppropriationOutgoing> outgoingList);
+    int insertAppropriationOutgoing(AppropriationOutgoing outgoing);
 
-    int insertAppropriationPosting(@Param("list") List<AppropriationPosting> postingList);
+    int insertAppropriationPosting(AppropriationPosting posting);
 
     int insertRelieve(Relieve relieve);
 
@@ -90,4 +90,13 @@ public interface MySqlMapper {
      * @return
      */
     List<Account> selectTgAccountInfo();
+
+    /**
+     * 更新楼幢账户表额度内余额
+     */
+    int updateInLimitFund();
+    /**
+     * 更新楼幢账户表主键
+     */
+    int updateBuildingAccountId();
 }

+ 310 - 349
src/main/java/com/cool/bang/modules/mysql/service/MySQLService.java

@@ -6,10 +6,7 @@ import com.cool.bang.modules.mysql.domain.flowPo.ApprovalFlow;
 import com.cool.bang.modules.mysql.domain.flowPo.ApprovalNode;
 import com.cool.bang.modules.mysql.domain.flowPo.ApprovalRecord;
 import com.cool.bang.modules.mysql.mapper.*;
-import com.cool.bang.modules.oracle.domain.Areg;
-import com.cool.bang.modules.oracle.domain.AregItem;
-import com.cool.bang.modules.oracle.domain.Bxmxy;
-import com.cool.bang.modules.oracle.domain.Trade;
+import com.cool.bang.modules.oracle.domain.*;
 import com.cool.bang.modules.oracle.domain.po.*;
 import com.cool.bang.modules.oracle.mapper.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -464,6 +461,7 @@ public class MySQLService {
             }
         }
         mySqlMapper.insertSuperviseRelieve(superviseRelieveList);
+        recordList.forEach(item -> System.out.println(">>>>>> item ===" + item));
         flowMapper.insertRecordBatch(recordList);
     }
 
@@ -504,7 +502,7 @@ public class MySQLService {
      */
     @Transactional
     public void superviseTo() {
-        System.out.println("===============fc_supervise_to、fc_supervise_to_detail数据匹配开始=================");
+        System.out.println("=============== 监管资金转托管 =================");
         List<Jgztg> jgztgList = applyMapper.selectJgztg();
 
         //查询流程信息
@@ -567,7 +565,6 @@ public class MySQLService {
                     tradeCz = t;
                 }
             }
-
             //出账通知书
             SuperviseToNotice superviseToNotice = new SuperviseToNotice();
             superviseToNotice.initNotice(superviseTo);
@@ -617,6 +614,7 @@ public class MySQLService {
             }
         }
         mySqlMapper.insertSuperviseToDetail(superviseToDetailList);
+        recordList.forEach(item -> System.out.println(">>>>>> item ===" + item));
         flowMapper.insertRecordBatch(recordList);
         mySqlMapper.insertSuperviseToPosting(superviseToPostingList);
         mySqlMapper.insertSuperviseToOutgoing(superviseToOutgoingList);
@@ -734,6 +732,7 @@ public class MySQLService {
             if (index == 200 || gcjdsq.getId().equals(lastGcjdsq.getId())) { //200条数据为1组
                 mySqlMapper.insertProgressDetail(progressDetailList);
                 progressDetailList.clear();
+                recordList.forEach(item -> System.out.println(">>>>>> item ===" + item));
                 flowMapper.insertRecordBatch(recordList);
                 recordList.clear();
                 index = 0;
@@ -744,352 +743,349 @@ public class MySQLService {
 
     /**
      * 拨付业务信息导入
+     *
+     * 监管拨付
+     * 额度内拨付(apptype=6 flowid=4)
+     * 业务表只存一条数据 监管出账通知书插入一条数据
+     * -----------------------------------------------------------------------------
+     * 额度外拨付(apptype=7 flowid=5)
+     * 业务表只存一条数据 监管出账通知书插入一条数据
+     * =============================================================================
+     * 托管拨付 (托管拨付中需要监管户过渡的时候,payitem表中gdaccountid不为空)
+     * 额度内拨付(apptype=18 flowid=18) 其中特批通道拨付【政府拨付】(apply表中zgflag=1)
+     * 政府拨付:托管户 -> 一般户 政府发起拨付业务时只可以从托管额度内资金申请
+     * 业务表只存一条数据 托管出账通知书插入一条数据
+     * -----------------------------------------------------------------------------
+     * 正常拨付:
+     *  gdaccountid不为空时,即 托管户 -> 监管户 -> 一般户
+     *  业务表插入两条数据 1.托管户->监管户 2.监管户->一般户
+     *  托管出账通知书 监管入账通知书 监管出账通知书
+     *
+     *  gdaccountid为空时, 即 托管户 -> 账户(这里填入的可能为监管户也可能为一般户,但是统一视为一般户处理)
+     *  业务表插入一条数据
+     *  托管出账通知书插入一条数据
+     * -----------------------------------------------------------------------------
+     * 额度外拨付(apptype=19 flowid=19)
+     *  gdaccountid不为空时,即 托管户 -> 监管户 -> 一般户
+     *  业务表插入两条数据 1托管户->监管户 2监管户->一般户
+     *  托管出账通知书 监管入账通知书 监管出账通知书
+     *
+     *  gdaccountid为空时, 即 托管户 -> 账户(这里填入的可能为监管户也可能为一般户,但是统一视为一般户处理)
+     *  业务表插入一条数据
+     *  托管出账通知书插入一条数据
      */
     @Transactional
-    public void appropriation() {
-        System.out.println("===============fc_appropriation、fc_appropriation_detail数据匹配开始=================");
-
-        /**
-         * 监管拨付
-         * 额度内拨付(apptype=6 flowid=4)
-         * 业务表只存一条数据 监管出账通知书插入一条数据
-         * -----------------------------------------------------------------------------
-         * 额度外拨付(apptype=7 flowid=5)
-         * 业务表只存一条数据 监管出账通知书插入一条数据
-         * =============================================================================
-         * 托管拨付 (托管拨付中需要监管户过渡的时候,payitem表中gdaccountid不为空)
-         * 额度内拨付(apptype=18 flowid=18) 其中特批通道拨付【政府拨付】(apply表中zgflag=1)
-         * 政府拨付:托管户 -> 一般户 政府发起拨付业务时只可以从托管额度内资金申请
-         * 业务表只存一条数据 托管出账通知书插入一条数据
-         * -----------------------------------------------------------------------------
-         * 正常拨付:
-         *  gdaccountid不为空时,即 托管户 -> 监管户 -> 一般户
-         *  业务表插入两条数据 1.托管户->监管户 2.监管户->一般户
-         *  托管出账通知书 监管入账通知书 监管出账通知书
-         *
-         *  gdaccountid为空时, 即 托管户 -> 账户(这里填入的可能为监管户也可能为一般户,但是统一视为一般户处理)
-         *  业务表插入一条数据
-         *  托管出账通知书插入一条数据
-         * -----------------------------------------------------------------------------
-         * 额度外拨付(apptype=19 flowid=19)
-         *  gdaccountid不为空时,即 托管户 -> 监管户 -> 一般户
-         *  业务表插入两条数据 1托管户->监管户 2监管户->一般户
-         *  托管出账通知书 监管入账通知书 监管出账通知书
-         *
-         *  gdaccountid为空时, 即 托管户 -> 账户(这里填入的可能为监管户也可能为一般户,但是统一视为一般户处理)
-         *  业务表插入一条数据
-         *  托管出账通知书插入一条数据
-         */
-
-        //查询流程信息
-        ApprovalFlow approvalFlow = flowMapper.selectFlowByType(4); //工程形象进度申请flowType = 4
-        //查询结束节点 节点信息
-        List<ApprovalNode> approvalNodeList = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
-
+    public void trusteeshipAppropriation() {
+        System.out.println("=============== 托管拨付 =================");
+        // 获取结束节点
+        ApprovalFlow approvalFlow = flowMapper.selectFlowByType(4); //托管拨付申请flowType = 4
         ApprovalNode endNode = new ApprovalNode();
-
+        List<ApprovalNode> approvalNodeList = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
         for (ApprovalNode node : approvalNodeList) {
             if (node.getNumber() == 4) {
                 endNode = node;
             }
         }
 
-        List<ApprovalRecord> recordList = new ArrayList<>();
-        List<AppropriationOutgoing> outgoingList = new ArrayList<>();
-        List<AppropriationPosting> postingList = new ArrayList<>();
-        List<AppropriationDetail> detailList = new ArrayList<>();
+        List<OracleAppropriation> oracleAppropriations = applyMapper.selectApply_18_19();
+
+        for (OracleAppropriation oracleAppropriation : oracleAppropriations) {
+
+            Appropriation appropriation = new Appropriation();
+
+            // 拨付明细
+            List<OracleAppropriationDetail> oracleAppropriationDetails =
+                    applyMapper.selectApplyDetails_18_19(oracleAppropriation.getAppId());
+
+            // 开发单位
+            Org org = qyxxMapper.selectOrgByMisid(oracleAppropriation.getOrgMisId());
+            appropriation.setOrgId(org.getId());
+            appropriation.setOrgName(org.getOrgName());
+
+            // 付款银行
+            Account account = accountMapper.selectByAccountNO(
+                    oracleAppropriation.getAppropriationAccount());
+            appropriation.setBusinessNumber(oracleAppropriation.getBusinessNumber());
+            appropriation.setBankCode(account.getBankCode());
+            appropriation.setAppropriationAccountId(account.getId());
+            appropriation.setAppropriationBank(account.getBankName());
+            appropriation.setAppropriationName(account.getName());
+            appropriation.setAppropriationAccount(account.getAccount());
+            appropriation.setAppropriationOpenAddress(account.getOpenAddress());
+
+            // 项目信息
+            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(oracleAppropriation.getAregId());
+            appropriation.setProjectId(projectAccount.getProjectId());
+            appropriation.setProjectAccountId(projectAccount.getId());
+            appropriation.setProjectNumber(projectAccount.getProjectNumber());
+            appropriation.setProjectName(projectAccount.getProjectName());
+
+            // 联系人
+            appropriation.setDirector(oracleAppropriation.getDirectory());
+            appropriation.setPhone(oracleAppropriation.getPhone());
+
+            // 额度内拨付
+            if (oracleAppropriation.getAppType().equals(18)) {
+                appropriation.setApplicationType(1);
+            }
 
-        int index = 0;
+            // 额度外拨付
+            if (oracleAppropriation.getAppType().equals(19)) {
+                appropriation.setApplicationType(2);
+            }
 
-        //监管额度内拨付
-        /*List<Bfxx> jgednList = applyMapper.selectBfxx(6,4);
-        Bfxx lastJgedn = jgednList.get(jgednList.size() - 1);
-        for (Bfxx bfxx : jgednList) {
-            Account bfzh = accountMapper.selectByAccountNO(bfxx.getBfzh());
-//            Account skzh = accountMapper.selectByAccountNO(bfxx.getSkzh());
+            if (oracleAppropriation.getZgFlag() != null &&
+                    oracleAppropriation.getZgFlag().equals(1)) {
+                appropriation.setAppropriationType(3); // 政府拨付
+            } else {
+                appropriation.setAppropriationType(1); // 托管拨付
+            }
 
-            Org org = qyxxMapper.selectOrgByMisid(bfxx.getQybh());
-            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(bfxx.getAregid());
+            // 托管转监管再转一般户
+            if (oracleAppropriation.getSuperviseAccount() != null) {
+                appropriation.setCollectionType(1);
+                // 收款账户系统内查找
+                Account collectionAccount = accountMapper.selectByAccountNO(
+                        oracleAppropriation.getSuperviseAccount());
+                if (collectionAccount != null && collectionAccount.getId() != null) {
+                    appropriation.setCollectionAccountId(collectionAccount.getId());
+                    appropriation.setCollectionBank(collectionAccount.getBankName());
+                    appropriation.setCollectionName(collectionAccount.getName());
+                    appropriation.setCollectionAccount(collectionAccount.getAccount());
+                    appropriation.setCollectionOpenAddress(collectionAccount.getOpenAddress());
+                }
+                // 拨付状态
+                if (oracleAppropriationDetails.get(0).getPayFlag2().equals(0)) {
+                    appropriation.setApplicationState(0);
+                }
+                if (oracleAppropriationDetails.get(0).getPayFlag2().equals(1) ||
+                        oracleAppropriationDetails.get(0).getPayFlag2().equals(2)) {
+                    appropriation.setApplicationState(1);
+                }
+            } else {
+                appropriation.setCollectionType(2);
+                appropriation.setCollectionBank(oracleAppropriationDetails.get(0).getCollectionBank());
+                appropriation.setCollectionName(oracleAppropriationDetails.get(0).getCollectionName());
+                appropriation.setCollectionAccount(oracleAppropriationDetails.get(0).getCollectionAccount());
+                appropriation.setApplicationState(oracleAppropriationDetails.get(0).getPayFlag());
+            }
 
-            Appropriation appropriation = new Appropriation(bfxx,bfzh,null,org,projectAccount);
-            appropriation.setCollectionType(2);
-            appropriation.setAppropriationType(2);
-            appropriation.setApplicationType(1);
+            appropriation.setPurpose(oracleAppropriationDetails.get(0).getPurpose());
+            appropriation.setApplyAmount(oracleAppropriationDetails.get(0).getApplyAmountTotal());
+            // 如果是流程结束
+            if (oracleAppropriation.getFlowState().equals(0)) {
+                appropriation.setBusinessState(3);
+            }
+            if (oracleAppropriation.getFlowState().equals(1) && oracleAppropriation.getFlowNodeName().equals("保存")) {
+                appropriation.setBusinessState(0);
+            }
+            appropriation.setDelFlag(1);
+            appropriation.setCreateTime(oracleAppropriation.getCreateTime());
+            appropriation.setUpdateTime(oracleAppropriation.getUpdateTime());
             appropriation.setFlowNumber(approvalFlow.getFlowNumber());
             appropriation.setFlowNodeId(endNode.getId());
             appropriation.setFlowNodeName(endNode.getNodeName());
-            mySqlMapper.insertAppropriation(appropriation);
 
-            recordList.addAll(getBfFlow(bfxx.getsFlowList(),appropriation));
-            outgoingList.add(getAppropriationOutgoing(appropriation,4));
+            mySqlMapper.insertAppropriation(appropriation);
 
-            index ++;
-            //数据量达到200条时存一次 或 已到最后一条数据直接存
-            if (index == 200 || lastJgedn.getYwbh().equals(bfxx.getYwbh())){ //200条数据为1组
-                flowMapper.insertRecordBatch(recordList);
-                recordList.clear();
-                if (outgoingList.size()>0){
-                    mySqlMapper.insertAppropriationOutgoing(outgoingList);
-                    outgoingList.clear();
+            // 插入拨付明细
+            List<AppropriationDetail> details = new ArrayList<>();
+            for (OracleAppropriationDetail oracleAppropriationDetail : oracleAppropriationDetails) {
+                AppropriationDetail appropriationDetail = new AppropriationDetail(oracleAppropriationDetail);
+                appropriationDetail.setAppropriationId(appropriation.getId());
+                appropriation.setCreateTime(appropriation.getCreateTime());
+                appropriation.setUpdateTime(appropriation.getUpdateTime());
+                details.add(appropriationDetail);
+            }
+            mySqlMapper.insertAppropriationDetail(details);
+
+            // 插入审批记录
+            List<ApprovalRecord> records = new ArrayList<>();
+            List<OracleApprovalRecord> oracleApprovalRecords =
+                    applyMapper.selectApprovalRecords_18_19(oracleAppropriation.getAppId());
+            if (oracleApprovalRecords != null && oracleApprovalRecords.size() > 0
+                    && oracleApprovalRecords.get(0) != null
+                    && !StringUtils.isEmpty(oracleApprovalRecords.get(0).getNodeName())) {
+                for (OracleApprovalRecord oracleApprovalRecord : oracleApprovalRecords) {
+                    ApprovalRecord record = new ApprovalRecord();
+                    record.setBusinessNumber(oracleAppropriation.getBusinessNumber());
+                    record.setFlowNumber(approvalFlow.getFlowNumber());
+                    record.setNodeId(endNode.getId());
+                    if (!StringUtils.isEmpty(oracleApprovalRecord.getNodeName())) {
+                        record.setNodeName(oracleApprovalRecord.getNodeName());
+                    }
+                    record.setApprover(oracleApprovalRecord.getApprover());
+                    record.setApprovalTime(oracleApprovalRecord.getApprovalTime());
+                    record.setTableId(appropriation.getId());
+                    if (oracleApprovalRecord.getApprovalStatus() != null) {
+                        record.setApprovalStatus(1);
+                    }
+                    record.setApprovalRemark(oracleApprovalRecord.getRemark());
+                    records.add(record);
                 }
-                index = 0;
+                flowMapper.insertRecordBatch(records);
             }
-        }*/
+            // 插入通知书
+            // 通知书类型(type) 1托管转监管户 2托管转一般户 3托管转其他户 4监管转一般户 5监管转其他户
+            mySqlMapper.insertAppropriationOutgoing(getAppropriationOutgoing(appropriation, 4));
+        }
+        // 更新楼幢账户表额度内已拨付金额
+        mySqlMapper.updateInLimitFund();
+        // 更新明细表楼幢账户主键
+        mySqlMapper.updateBuildingAccountId();
 
-        //监管额度外拨付
-        /*List<Bfxx> jgedwList = applyMapper.selectBfxx(7,5);
-        Bfxx lastJgedw = jgedwList.get(jgedwList.size() - 1);
-        for (Bfxx bfxx : jgedwList) {
-            Account bfzh = accountMapper.selectByAccountNO(bfxx.getBfzh());
-            Org org = qyxxMapper.selectOrgByMisid(bfxx.getQybh());
-            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(bfxx.getAregid());
+        System.out.println("=============== 托管拨付数据匹配结束 =================");
+    }
 
-            Appropriation appropriation = new Appropriation(bfxx,bfzh,null,org,projectAccount);
-            appropriation.setCollectionType(2);
+    @Transactional
+    public void superviseAppropriation() {
+        System.out.println("=============== 监管拨付 =================");
+        // 获取结束节点
+        ApprovalFlow approvalFlow = flowMapper.selectFlowByType(4); //托管拨付申请flowType = 4
+        ApprovalNode endNode = new ApprovalNode();
+        List<ApprovalNode> approvalNodeList = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
+        for (ApprovalNode node : approvalNodeList) {
+            if (node.getNumber() == 4) {
+                endNode = node;
+            }
+        }
+        List<OracleAppropriation> oracleAppropriations = applyMapper.selectApply_6_7();
+
+        for (OracleAppropriation oracleAppropriation : oracleAppropriations) {
+
+            Appropriation appropriation = new Appropriation();
+
+            // 拨付明细
+            List<OracleAppropriationDetail> oracleAppropriationDetails =
+                    applyMapper.selectApplyDetails_6_7(oracleAppropriation.getAppId());
+
+            // 开发单位
+            Org org = qyxxMapper.selectOrgByMisid(oracleAppropriation.getOrgMisId());
+            appropriation.setOrgId(org.getId());
+            appropriation.setOrgName(org.getOrgName());
+
+            // 付款银行
+            appropriation.setBusinessNumber(oracleAppropriation.getBusinessNumber());
+            if (!StringUtils.isEmpty(oracleAppropriation.getAppropriationAccount())) {
+                Account account = accountMapper.selectByAccountNO(
+                        oracleAppropriation.getAppropriationAccount());
+                appropriation.setBankCode(account.getBankCode());
+                appropriation.setAppropriationAccountId(account.getId());
+                appropriation.setAppropriationBank(account.getBankName());
+                appropriation.setAppropriationName(account.getName());
+                appropriation.setAppropriationAccount(account.getAccount());
+                appropriation.setAppropriationOpenAddress(account.getOpenAddress());
+            }
+            // 项目信息
+            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(oracleAppropriation.getAregId());
+            appropriation.setProjectId(projectAccount.getProjectId());
+            appropriation.setProjectAccountId(projectAccount.getId());
+            appropriation.setProjectNumber(projectAccount.getProjectNumber());
+            appropriation.setProjectName(projectAccount.getProjectName());
+
+            // 联系人
+            appropriation.setDirector(oracleAppropriation.getDirectory());
+            appropriation.setPhone(oracleAppropriation.getPhone());
+
+            // 额度内拨付
+            if (oracleAppropriation.getAppType().equals(6)) {
+                appropriation.setApplicationType(1);
+            }
+            // 额度外拨付
+            if (oracleAppropriation.getAppType().equals(7)) {
+                appropriation.setApplicationType(2);
+            }
             appropriation.setAppropriationType(2);
-            appropriation.setApplicationType(2);
+            appropriation.setCollectionType(2);
+            if (oracleAppropriationDetails != null && oracleAppropriationDetails.size() != 0) {
+                appropriation.setCollectionBank(oracleAppropriationDetails.get(0) == null ? "":oracleAppropriationDetails.get(0).getCollectionBank());
+                appropriation.setCollectionName(oracleAppropriationDetails.get(0).getCollectionName());
+                appropriation.setCollectionAccount(oracleAppropriationDetails.get(0).getCollectionAccount());
+                appropriation.setApplicationState(oracleAppropriationDetails.get(0).getPayFlag());
+                appropriation.setPurpose(oracleAppropriationDetails.get(0).getPurpose());
+                appropriation.setApplyAmount(oracleAppropriationDetails.get(0).getApplyAmountTotal());
+            } else {
+                appropriation.setApplicationState(0);
+            }
+
+            // 如果是流程结束
+            if (oracleAppropriation.getFlowState().equals(0)) {
+                appropriation.setBusinessState(3);
+            }
+            if (oracleAppropriation.getFlowState().equals(1) && oracleAppropriation.getFlowNodeName().equals("保存")) {
+                //  appropriation.setBusinessState(0);
+                continue;
+            }
+            if (oracleAppropriation.getFlowState().equals(1) &&
+                    oracleAppropriation.getFlowNodeName().equals("重点资金申请初审不通过")) {
+                //  appropriation.setBusinessState(4);
+                continue;
+            }
+            if (oracleAppropriation.getFlowState().equals(1) &&
+                    oracleAppropriation.getFlowNodeName().equals("一般资金申请初审不通过")) {
+                // appropriation.setBusinessState(4);
+                continue;
+            }
+
+            appropriation.setDelFlag(1);
+            appropriation.setCreateTime(oracleAppropriation.getCreateTime());
+            appropriation.setUpdateTime(oracleAppropriation.getUpdateTime());
             appropriation.setFlowNumber(approvalFlow.getFlowNumber());
             appropriation.setFlowNodeId(endNode.getId());
             appropriation.setFlowNodeName(endNode.getNodeName());
-            mySqlMapper.insertAppropriation(appropriation);
 
-            recordList.addAll(getBfFlow(bfxx.getsFlowList(),appropriation));
-            outgoingList.add(getAppropriationOutgoing(appropriation,4));
+            mySqlMapper.insertAppropriation(appropriation);
 
-            index ++;
-            //数据量达到200条时存一次 或 已到最后一条数据直接存
-            if (index == 200 || lastJgedw.getYwbh().equals(bfxx.getYwbh())){ //200条数据为1组
-                flowMapper.insertRecordBatch(recordList);
-                recordList.clear();
-                if (outgoingList.size()>0){
-                    mySqlMapper.insertAppropriationOutgoing(outgoingList);
-                    outgoingList.clear();
+            // 插入拨付明细
+            if (oracleAppropriationDetails != null && oracleAppropriationDetails.size() != 0) {
+                List<AppropriationDetail> details = new ArrayList<>();
+                for (OracleAppropriationDetail oracleAppropriationDetail : oracleAppropriationDetails) {
+                    AppropriationDetail appropriationDetail = new AppropriationDetail(oracleAppropriationDetail);
+                    appropriationDetail.setAppropriationId(appropriation.getId());
+                    appropriation.setCreateTime(appropriation.getCreateTime());
+                    appropriation.setUpdateTime(appropriation.getUpdateTime());
+                    details.add(appropriationDetail);
                 }
-                index = 0;
+                mySqlMapper.insertAppropriationDetail(details);
             }
-        }*/
-
-        //通知书类型(type) 1托管转监管户 2托管转一般户 3托管转其他户 4监管转一般户 5监管转其他户
 
-        //托管额度内拨付
-        /*List<Bfxx> tgednList = applyMapper.selectBfxx(18, 18);
-        Bfxx lastTgedn = tgednList.get(tgednList.size() - 1);
-        for (Bfxx bfxx : tgednList) {
-            Account bfzh = accountMapper.selectByAccountNO(bfxx.getBfzh());
-            Org org = qyxxMapper.selectOrgByMisid(bfxx.getQybh());
-            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(bfxx.getAregid());
-
-            if (bfxx.getZgflag() != null && bfxx.getZgflag() == 1) { //政府拨付 托管户 -> 一般户
-                Appropriation appropriation = new Appropriation(bfxx, bfzh, null, org, projectAccount);
-                appropriation.setCollectionType(2);
-                appropriation.setAppropriationType(3);
-                appropriation.setApplicationType(1);
-                appropriation.setFlowNumber(approvalFlow.getFlowNumber());
-                appropriation.setFlowNodeId(endNode.getId());
-                appropriation.setFlowNodeName(endNode.getNodeName());
-                mySqlMapper.insertAppropriation(appropriation);
-
-                if (bfxx.getBfmxList() != null && bfxx.getBfmxList().size() > 0) {
-                    List<AppropriationDetail> details = getAppropriationDetail(bfxx.getBfmxList(), appropriation);
-                    detailList.addAll(details);
-                    //如果有楼幢拨付 变更楼幢虚拟户额度内拨付金额
-                    if (appropriation.getApplicationState() == 1) {
-                        buildingAccountMapper.updateInLimitFundById(details);
-                    }
-                }
-                recordList.addAll(getBfFlow(bfxx.getsFlowList(), appropriation));
-                outgoingList.add(getAppropriationOutgoing(appropriation, 2));
-            } else {
-                if (bfxx.getGdzh() != null) { //过渡账号不为空说明 托管户 -> 监管户 -> 一般户
-                    //托管户 -> 监管户(过渡户)
-                    Account gdzh = accountMapper.selectByAccountNO(bfxx.getGdzh());
-                    Appropriation appropriation1 = new Appropriation(bfxx, bfzh, gdzh, org, projectAccount);
-                    appropriation1.setBusinessNumber(appropriation1.getBusinessNumber() + "CZ");
-                    appropriation1.setCollectionType(1);
-                    appropriation1.setAppropriationType(1);
-                    appropriation1.setApplicationType(1);
-                    appropriation1.setFlowNumber(approvalFlow.getFlowNumber());
-                    appropriation1.setFlowNodeId(endNode.getId());
-                    appropriation1.setFlowNodeName(endNode.getNodeName());
-                    if (bfxx.getBfzt2() == 0) {
-                        appropriation1.setApplicationState(0);
-                    } else {
-                        appropriation1.setApplicationState(1);
-                    }
-                    mySqlMapper.insertAppropriation(appropriation1);
-
-                    if (bfxx.getBfmxList() != null && bfxx.getBfmxList().size() > 0) {
-                        List<AppropriationDetail> details = getAppropriationDetail(bfxx.getBfmxList(), appropriation1);
-                        detailList.addAll(details);
-                        //如果有楼幢拨付 变更楼幢虚拟户额度内拨付金额
-                        if (appropriation1.getApplicationState() == 1) {
-                            buildingAccountMapper.updateInLimitFundById(details);
-                        }
-                    }
-                    recordList.addAll(getBfFlow(bfxx.getsFlowList(), appropriation1));
-                    outgoingList.add(getAppropriationOutgoing(appropriation1, 1));
-                    postingList.add(getAppropriationPosting(appropriation1));
-
-                    //监管户(过渡户) -> 一般户
-                    Appropriation appropriation2 = new Appropriation(bfxx, gdzh, null, org, projectAccount);
-                    appropriation2.setBusinessNumber(appropriation2.getBusinessNumber() + "RZ");
-                    appropriation2.setCollectionType(2);
-                    appropriation2.setAppropriationType(2);
-                    appropriation2.setApplicationType(1);
-                    appropriation2.setFlowNumber(approvalFlow.getFlowNumber());
-                    appropriation2.setFlowNodeId(endNode.getId());
-                    appropriation2.setFlowNodeName(endNode.getNodeName());
-                    if (bfxx.getBfzt2() == 2) {
-                        appropriation2.setApplicationState(1);
-                    } else {
-                        appropriation2.setApplicationState(0);
+            // 插入审批记录
+            List<ApprovalRecord> records = new ArrayList<>();
+            List<OracleApprovalRecord> oracleApprovalRecords =
+                    applyMapper.selectApprovalRecords_6_7(oracleAppropriation.getAppId());
+            if (oracleApprovalRecords != null && oracleApprovalRecords.size() > 0
+                    && oracleApprovalRecords.get(0) != null
+                    && !StringUtils.isEmpty(oracleApprovalRecords.get(0).getNodeName())) {
+                for (OracleApprovalRecord oracleApprovalRecord : oracleApprovalRecords) {
+                    ApprovalRecord record = new ApprovalRecord();
+                    record.setBusinessNumber(oracleAppropriation.getBusinessNumber());
+                    record.setFlowNumber(approvalFlow.getFlowNumber());
+                    record.setNodeId(endNode.getId());
+                    if (!StringUtils.isEmpty(oracleApprovalRecord.getNodeName())) {
+                        record.setNodeName(oracleApprovalRecord.getNodeName());
                     }
-                    mySqlMapper.insertAppropriation(appropriation2);
-                    recordList.addAll(getBfFlow(bfxx.getsFlowList(), appropriation2));
-                    outgoingList.add(getAppropriationOutgoing(appropriation2, 4));
-                } else { //过渡账号为空说明 托管户 -> 一般户
-                    Appropriation appropriation = new Appropriation(bfxx, bfzh, null, org, projectAccount);
-                    appropriation.setCollectionType(2);
-                    appropriation.setAppropriationType(1);
-                    appropriation.setApplicationType(1);
-                    appropriation.setFlowNumber(approvalFlow.getFlowNumber());
-                    appropriation.setFlowNodeId(endNode.getId());
-                    appropriation.setFlowNodeName(endNode.getNodeName());
-                    mySqlMapper.insertAppropriation(appropriation);
-
-                    if (bfxx.getBfmxList() != null && bfxx.getBfmxList().size() > 0) {
-                        List<AppropriationDetail> details = getAppropriationDetail(bfxx.getBfmxList(), appropriation);
-                        detailList.addAll(details);
-                        //如果有楼幢拨付 变更楼幢虚拟户额度内拨付金额
-                        if (appropriation.getApplicationState() == 1) {
-                            buildingAccountMapper.updateInLimitFundById(details);
-                        }
+                    record.setApprover(oracleApprovalRecord.getApprover());
+                    record.setApprovalTime(oracleApprovalRecord.getApprovalTime());
+                    record.setTableId(appropriation.getId());
+                    if (oracleApprovalRecord.getApprovalStatus() != null) {
+                        record.setApprovalStatus(Integer.parseInt(oracleApprovalRecord.getApprovalStatus()));
                     }
-                    recordList.addAll(getBfFlow(bfxx.getsFlowList(), appropriation));
-                    outgoingList.add(getAppropriationOutgoing(appropriation, 2));
-                }
-            }
-            index++;
-            //数据量达到200条时存一次 或 已到最后一条数据直接存
-            if (index == 200 || lastTgedn.getYwbh().equals(bfxx.getYwbh())) { //200条数据为1组
-                flowMapper.insertRecordBatch(recordList);
-                recordList.clear();
-                if (detailList.size() > 0) {
-                    mySqlMapper.insertAppropriationDetail(detailList);
-                    detailList.clear();
-                }
-                if (outgoingList.size() > 0) {
-                    mySqlMapper.insertAppropriationOutgoing(outgoingList);
-                    outgoingList.clear();
-                }
-                if (postingList.size() > 0) {
-                    mySqlMapper.insertAppropriationPosting(postingList);
-                    postingList.clear();
-                }
-                index = 0;
-            }
-        }*/
-
-        //托管额度外拨付
-        List<Bfxx> tgedwList = applyMapper.selectBfxx(19,18);
-        Bfxx lastTgedw = tgedwList.get(tgedwList.size() - 1);
-        for (Bfxx bfxx : tgedwList) {
-            Account bfzh = accountMapper.selectByAccountNO(bfxx.getBfzh());
-            Account skzh = accountMapper.selectByAccountNO(bfxx.getSkzh());
-            Org org = qyxxMapper.selectOrgByMisid(bfxx.getQybh());
-            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(bfxx.getAregid());
-
-            if (bfxx.getGdzh() != null){ //过渡账号不为空说明 托管户 -> 监管户 -> 一般户
-                //托管户 -> 监管户(过渡户)
-                Account gdzh = accountMapper.selectByAccountNO(bfxx.getGdzh());
-                Appropriation appropriation1 = new Appropriation(bfxx,bfzh,gdzh,org,projectAccount);
-                appropriation1.setBusinessNumber(appropriation1.getBusinessNumber()+"CZ");
-                appropriation1.setCollectionType(1);
-                appropriation1.setAppropriationType(1);
-                appropriation1.setApplicationType(2);
-                appropriation1.setFlowNumber(approvalFlow.getFlowNumber());
-                appropriation1.setFlowNodeId(endNode.getId());
-                appropriation1.setFlowNodeName(endNode.getNodeName());
-                if (bfxx.getBfzt2() == 0){
-                    appropriation1.setApplicationState(0);
-                }else {
-                    appropriation1.setApplicationState(1);
-                }
-                mySqlMapper.insertAppropriation(appropriation1);
-
-                if (bfxx.getBfmxList() != null && bfxx.getBfmxList().size() > 0){
-                    detailList.addAll(getAppropriationDetail(bfxx.getBfmxList(),appropriation1));
-                }
-                recordList.addAll(getBfFlow(bfxx.getsFlowList(),appropriation1));
-                outgoingList.add(getAppropriationOutgoing(appropriation1,1));
-                postingList.add(getAppropriationPosting(appropriation1));
-
-                //监管户(过渡户) -> 一般户
-                Appropriation appropriation2 = new Appropriation(bfxx,gdzh,null,org,projectAccount);
-                appropriation2.setBusinessNumber(appropriation2.getBusinessNumber()+"RZ");
-                appropriation2.setCollectionType(2);
-                appropriation2.setAppropriationType(2);
-                appropriation2.setApplicationType(2);
-                appropriation2.setFlowNumber(approvalFlow.getFlowNumber());
-                appropriation2.setFlowNodeId(endNode.getId());
-                appropriation2.setFlowNodeName(endNode.getNodeName());
-                if (bfxx.getBfzt2() == 2){
-                    appropriation2.setApplicationState(1);
-                }else {
-                    appropriation2.setApplicationState(0);
-                }
-                mySqlMapper.insertAppropriation(appropriation2);
-                recordList.addAll(getBfFlow(bfxx.getsFlowList(),appropriation2));
-                outgoingList.add(getAppropriationOutgoing(appropriation2,4));
-            }else { //过渡账号为空说明 托管户 -> 一般户
-                Appropriation appropriation = new Appropriation(bfxx,bfzh,null,org,projectAccount);
-                appropriation.setCollectionType(2);
-                appropriation.setAppropriationType(1);
-                appropriation.setApplicationType(2);
-                appropriation.setFlowNumber(approvalFlow.getFlowNumber());
-                appropriation.setFlowNodeId(endNode.getId());
-                appropriation.setFlowNodeName(endNode.getNodeName());
-                mySqlMapper.insertAppropriation(appropriation);
-
-                if (bfxx.getBfmxList() != null && bfxx.getBfmxList().size() > 0){
-                    detailList.addAll(getAppropriationDetail(bfxx.getBfmxList(),appropriation));
+                    record.setApprovalRemark(oracleApprovalRecord.getRemark());
+                    records.add(record);
                 }
-                recordList.addAll(getBfFlow(bfxx.getsFlowList(),appropriation));
-                outgoingList.add(getAppropriationOutgoing(appropriation,2));
+                flowMapper.insertRecordBatch(records);
             }
-
-            index ++;
-            //数据量达到200条时存一次 或 已到最后一条数据直接存
-            if (index == 200 || lastTgedw.getYwbh().equals(bfxx.getYwbh())){ //200条数据为1组
-                flowMapper.insertRecordBatch(recordList);
-                recordList.clear();
-                if (detailList.size()>0){
-                    mySqlMapper.insertAppropriationDetail(detailList);
-                    detailList.clear();
-                }
-                if (outgoingList.size()>0){
-                    mySqlMapper.insertAppropriationOutgoing(outgoingList);
-                    outgoingList.clear();
-                }
-                if (postingList.size()>0){
-                    mySqlMapper.insertAppropriationPosting(postingList);
-                    postingList.clear();
-                }
-                index = 0;
+            // 插入通知书
+            // 通知书类型(type) 1托管转监管户 2托管转一般户 3托管转其他户 4监管转一般户 5监管转其他户
+            if (oracleAppropriation.getSuperviseAccount() != null) {
+                mySqlMapper.insertAppropriationOutgoing(getAppropriationOutgoing(appropriation, 1));
+                mySqlMapper.insertAppropriationPosting(getAppropriationPosting(appropriation));
+            } else {
+                mySqlMapper.insertAppropriationOutgoing(getAppropriationOutgoing(appropriation, 2));
             }
         }
-        System.out.println("===============fc_appropriation、fc_appropriation_detail数据匹配结束=================");
-    }
 
-    //拨付明细
-    public List<AppropriationDetail> getAppropriationDetail(List<Bfmx> bfmxList, Appropriation appropriation) {
-        List<AppropriationDetail> detailList = new ArrayList<>();
-        for (Bfmx bfmx : bfmxList) {
-            BuildingAccount buildingAccount = buildingAccountMapper.selectByBuildingNumber(bfmx.getLzbh());
-            AppropriationDetail appropriationDetail = new AppropriationDetail(bfmx, appropriation, buildingAccount);
-            detailList.add(appropriationDetail);
-        }
-        return detailList;
+        System.out.println("=============== 监管拨付数据匹配结束 =================");
     }
 
     //拨付出账通知书
@@ -1112,41 +1108,6 @@ public class MySQLService {
         return posting;
     }
 
-    //拨付审批流程
-    public List<ApprovalRecord> getBfFlow(List<SFlow> sFlowList, Appropriation appropriation) {
-        List<ApprovalRecord> recordList = new ArrayList<>();
-        for (SFlow sFlow : sFlowList) {
-            ApprovalRecord record = new ApprovalRecord();
-            record.setBusinessNumber(appropriation.getBusinessNumber());
-            record.setFlowNumber(appropriation.getFlowNumber());
-            record.setTableId(appropriation.getId());
-            record.setApprovalTime(sFlow.getShsj());
-            record.setApprovalRemark(sFlow.getBz());
-            record.setCreateTime(record.getApprovalTime());
-            record.setUpdateTime(record.getApprovalTime());
-            record.setDelFlag(1);
-            if (sFlow.getShzt() == null) {
-                record.setNodeName("申请节点");
-                record.setApprover(appropriation.getOrgName() + "(" + sFlow.getShr() + ")");
-            } else {
-                //这种情况是范哥的托管额度外拨付流程与托管额度内拨付流程用的是同一个flowid,所以流程节点名称都是”额度内...“,需要此处判断替换一下
-                if (appropriation.getAppropriationType() == 1 && appropriation.getApplicationType() == 2) {
-                    record.setNodeName(sFlow.getLcmc().replace("内", "外"));
-                } else {
-                    record.setNodeName(sFlow.getLcmc());
-                }
-                record.setApprover("监管部门(" + sFlow.getShr() + ")");
-                if (sFlow.getShzt() == 1) {
-                    record.setApprovalStatus(1);
-                } else {
-                    record.setApprovalStatus(2);
-                }
-            }
-            recordList.add(record);
-        }
-        return recordList;
-    }
-
 
     /**
      * 合同导入

+ 217 - 0
src/main/java/com/cool/bang/modules/oracle/domain/OracleAppropriation.java

@@ -0,0 +1,217 @@
+package com.cool.bang.modules.oracle.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * oracle appropriation
+ *
+ * @author PeiZhi Guo
+ * 2023-3-13 11:51
+ */
+public class OracleAppropriation {
+
+    private String businessNumber;
+
+    private String appropriationAccount;
+
+    private String superviseAccount;
+
+    private Integer orgMisId;
+
+    private Integer appId;
+
+    private Integer aregId;
+
+    private Integer appType;
+
+    private BigDecimal applyAmount;
+
+    private Integer flowId;
+
+    private Integer flowNodeId;
+
+    private String flowNodeName;
+
+    private Integer flowState;
+
+    private String directory;
+
+    private String phone;
+
+    private Integer zjFlag;
+
+    private Integer zgFlag;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public String getFlowNodeName() {
+        return flowNodeName;
+    }
+
+    public void setFlowNodeName(String flowNodeName) {
+        this.flowNodeName = flowNodeName;
+    }
+
+    public String getBusinessNumber() {
+        return businessNumber;
+    }
+
+    public void setBusinessNumber(String businessNumber) {
+        this.businessNumber = businessNumber;
+    }
+
+    public String getAppropriationAccount() {
+        return appropriationAccount;
+    }
+
+    public void setAppropriationAccount(String appropriationAccount) {
+        this.appropriationAccount = appropriationAccount;
+    }
+
+    public String getSuperviseAccount() {
+        return superviseAccount;
+    }
+
+    public void setSuperviseAccount(String superviseAccount) {
+        this.superviseAccount = superviseAccount;
+    }
+
+    public Integer getOrgMisId() {
+        return orgMisId;
+    }
+
+    public void setOrgMisId(Integer orgMisId) {
+        this.orgMisId = orgMisId;
+    }
+
+    public Integer getAppId() {
+        return appId;
+    }
+
+    public void setAppId(Integer appId) {
+        this.appId = appId;
+    }
+
+    public Integer getAregId() {
+        return aregId;
+    }
+
+    public void setAregId(Integer aregId) {
+        this.aregId = aregId;
+    }
+
+    public Integer getAppType() {
+        return appType;
+    }
+
+    public void setAppType(Integer appType) {
+        this.appType = appType;
+    }
+
+    public BigDecimal getApplyAmount() {
+        return applyAmount;
+    }
+
+    public void setApplyAmount(BigDecimal applyAmount) {
+        this.applyAmount = applyAmount;
+    }
+
+    public Integer getFlowId() {
+        return flowId;
+    }
+
+    public void setFlowId(Integer flowId) {
+        this.flowId = flowId;
+    }
+
+    public Integer getFlowNodeId() {
+        return flowNodeId;
+    }
+
+    public void setFlowNodeId(Integer flowNodeId) {
+        this.flowNodeId = flowNodeId;
+    }
+
+    public Integer getFlowState() {
+        return flowState;
+    }
+
+    public void setFlowState(Integer flowState) {
+        this.flowState = flowState;
+    }
+
+    public String getDirectory() {
+        return directory;
+    }
+
+    public void setDirectory(String directory) {
+        this.directory = directory;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public Integer getZjFlag() {
+        return zjFlag;
+    }
+
+    public void setZjFlag(Integer zjFlag) {
+        this.zjFlag = zjFlag;
+    }
+
+    public Integer getZgFlag() {
+        return zgFlag;
+    }
+
+    public void setZgFlag(Integer zgFlag) {
+        this.zgFlag = zgFlag;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        return "OracleAppropriation{" +
+                "businessNumber='" + businessNumber + '\'' +
+                ", appropriationAccount='" + appropriationAccount + '\'' +
+                ", superviseAccount='" + superviseAccount + '\'' +
+                ", orgMisId='" + orgMisId + '\'' +
+                ", appId=" + appId +
+                ", aregId=" + aregId +
+                ", appType=" + appType +
+                ", applyAmount=" + applyAmount +
+                ", flowId=" + flowId +
+                ", flowNodeId=" + flowNodeId +
+                ", flowNodeName='" + flowNodeName + '\'' +
+                ", flowState=" + flowState +
+                ", directory='" + directory + '\'' +
+                ", phone='" + phone + '\'' +
+                ", zjFlag=" + zjFlag +
+                ", zgFlag=" + zgFlag +
+                ", createTime=" + createTime +
+                ", updateTime=" + updateTime +
+                '}';
+    }
+}

+ 183 - 0
src/main/java/com/cool/bang/modules/oracle/domain/OracleAppropriationDetail.java

@@ -0,0 +1,183 @@
+package com.cool.bang.modules.oracle.domain;
+
+import java.math.BigDecimal;
+
+/**
+ * 拨付详情
+ *
+ * @author PeiZhi Guo
+ * 2023-3-13 14:20
+ */
+public class OracleAppropriationDetail {
+
+    // 1 托管拨付 2监管拨付
+    private Integer appropriationType;
+    private Integer orgMisId;
+    private String appropriationAccount;
+    private String collectionName;
+    private String collectionAccount;
+    private String collectionBank;
+    private String purpose;
+    private BigDecimal applyAmountTotal;
+    // 0 1
+    private Integer payFlag;
+    // 0 1 2
+    private Integer payFlag2;
+
+    private String buildingNumber;
+    private String buildingName;
+    private BigDecimal accountBalance;
+    private BigDecimal applyAmount;
+    private BigDecimal keepPercentage; // 留存比例
+    private BigDecimal keepAmount;  // 留存金额
+
+    public Integer getAppropriationType() {
+        return appropriationType;
+    }
+
+    public void setAppropriationType(Integer appropriationType) {
+        this.appropriationType = appropriationType;
+    }
+
+    public Integer getOrgMisId() {
+        return orgMisId;
+    }
+
+    public void setOrgMisId(Integer orgMisId) {
+        this.orgMisId = orgMisId;
+    }
+
+    public String getAppropriationAccount() {
+        return appropriationAccount;
+    }
+
+    public void setAppropriationAccount(String appropriationAccount) {
+        this.appropriationAccount = appropriationAccount;
+    }
+
+    public String getCollectionName() {
+        return collectionName;
+    }
+
+    public void setCollectionName(String collectionName) {
+        this.collectionName = collectionName;
+    }
+
+    public String getCollectionAccount() {
+        return collectionAccount;
+    }
+
+    public void setCollectionAccount(String collectionAccount) {
+        this.collectionAccount = collectionAccount;
+    }
+
+    public String getCollectionBank() {
+        return collectionBank;
+    }
+
+    public void setCollectionBank(String collectionBank) {
+        this.collectionBank = collectionBank;
+    }
+
+    public String getPurpose() {
+        return purpose;
+    }
+
+    public void setPurpose(String purpose) {
+        this.purpose = purpose;
+    }
+
+    public BigDecimal getApplyAmountTotal() {
+        return applyAmountTotal;
+    }
+
+    public void setApplyAmountTotal(BigDecimal applyAmountTotal) {
+        this.applyAmountTotal = applyAmountTotal;
+    }
+
+    public Integer getPayFlag() {
+        return payFlag;
+    }
+
+    public void setPayFlag(Integer payFlag) {
+        this.payFlag = payFlag;
+    }
+
+    public Integer getPayFlag2() {
+        return payFlag2;
+    }
+
+    public void setPayFlag2(Integer payFlag2) {
+        this.payFlag2 = payFlag2;
+    }
+
+    public String getBuildingNumber() {
+        return buildingNumber;
+    }
+
+    public void setBuildingNumber(String buildingNumber) {
+        this.buildingNumber = buildingNumber;
+    }
+
+    public String getBuildingName() {
+        return buildingName;
+    }
+
+    public void setBuildingName(String buildingName) {
+        this.buildingName = buildingName;
+    }
+
+    public BigDecimal getAccountBalance() {
+        return accountBalance;
+    }
+
+    public void setAccountBalance(BigDecimal accountBalance) {
+        this.accountBalance = accountBalance;
+    }
+
+    public BigDecimal getApplyAmount() {
+        return applyAmount;
+    }
+
+    public void setApplyAmount(BigDecimal applyAmount) {
+        this.applyAmount = applyAmount;
+    }
+
+    public BigDecimal getKeepPercentage() {
+        return keepPercentage;
+    }
+
+    public void setKeepPercentage(BigDecimal keepPercentage) {
+        this.keepPercentage = keepPercentage;
+    }
+
+    public BigDecimal getKeepAmount() {
+        return keepAmount;
+    }
+
+    public void setKeepAmount(BigDecimal keepAmount) {
+        this.keepAmount = keepAmount;
+    }
+
+    @Override
+    public String toString() {
+        return "OracleAppropriationDetail{" +
+                "appropriationType=" + appropriationType +
+                ", orgMisId=" + orgMisId +
+                ", appropriationAccount='" + appropriationAccount + '\'' +
+                ", collectionName='" + collectionName + '\'' +
+                ", collectionAccount='" + collectionAccount + '\'' +
+                ", collectionBank='" + collectionBank + '\'' +
+                ", purpose='" + purpose + '\'' +
+                ", applyAmountTotal=" + applyAmountTotal +
+                ", payFlag=" + payFlag +
+                ", payFlag2=" + payFlag2 +
+                ", buildingNumber='" + buildingNumber + '\'' +
+                ", buildingName='" + buildingName + '\'' +
+                ", accountBalance='" + accountBalance + '\'' +
+                ", applyAmount=" + applyAmount +
+                ", keepPercentage=" + keepPercentage +
+                ", keepAmount=" + keepAmount +
+                '}';
+    }
+}

+ 73 - 0
src/main/java/com/cool/bang/modules/oracle/domain/OracleApprovalRecord.java

@@ -0,0 +1,73 @@
+package com.cool.bang.modules.oracle.domain;
+
+import java.util.Date;
+
+/**
+ *
+ *
+ * @author PeiZhi Guo
+ * 2023-3-13 21:12
+ */
+public class OracleApprovalRecord {
+
+    private String nodeName;
+
+    private String approver;
+
+    private Date approvalTime;
+
+    private String approvalStatus;
+
+    private String remark;
+
+    public String getNodeName() {
+        return nodeName;
+    }
+
+    public void setNodeName(String nodeName) {
+        this.nodeName = nodeName;
+    }
+
+    public String getApprover() {
+        return approver;
+    }
+
+    public void setApprover(String approver) {
+        this.approver = approver;
+    }
+
+    public Date getApprovalTime() {
+        return approvalTime;
+    }
+
+    public void setApprovalTime(Date approvalTime) {
+        this.approvalTime = approvalTime;
+    }
+
+    public String getApprovalStatus() {
+        return approvalStatus;
+    }
+
+    public void setApprovalStatus(String approvalStatus) {
+        this.approvalStatus = approvalStatus;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "OracleApprovalRecord{" +
+                "nodeName='" + nodeName + '\'' +
+                ", approver='" + approver + '\'' +
+                ", approvalTime=" + approvalTime +
+                ", approvalStatus='" + approvalStatus + '\'' +
+                ", remark='" + remark + '\'' +
+                '}';
+    }
+}

+ 23 - 0
src/main/java/com/cool/bang/modules/oracle/mapper/ApplyMapper.java

@@ -1,6 +1,9 @@
 package com.cool.bang.modules.oracle.mapper;
 
 import com.cool.bang.modules.oracle.domain.Areg;
+import com.cool.bang.modules.oracle.domain.OracleAppropriation;
+import com.cool.bang.modules.oracle.domain.OracleAppropriationDetail;
+import com.cool.bang.modules.oracle.domain.OracleApprovalRecord;
 import com.cool.bang.modules.oracle.domain.po.Bfxx;
 import com.cool.bang.modules.oracle.domain.po.Jgxmjc;
 import com.cool.bang.modules.oracle.domain.po.Jgyw;
@@ -44,4 +47,24 @@ public interface ApplyMapper {
     List<Jgxmjc> selectJgxmjc();
 
     List<Areg> selectByXmbhFromAreg(String xmbh);
+
+    //-----------------
+
+    /**
+     * 查询托管拨付
+     */
+    List<OracleAppropriation> selectApply_18_19();
+
+    /**
+     * 查询监管拨付
+     */
+    List<OracleAppropriation> selectApply_6_7();
+
+    List<OracleAppropriationDetail> selectApplyDetails_18_19(Integer appId);
+
+    List<OracleAppropriationDetail> selectApplyDetails_6_7(Integer appId);
+
+    List<OracleApprovalRecord> selectApprovalRecords_18_19(Integer appId);
+
+    List<OracleApprovalRecord> selectApprovalRecords_6_7(Integer appId);
 }

+ 16 - 1
src/main/resources/mapper/mysql/FlowMapper.xml

@@ -65,7 +65,22 @@
             fc_approval_record (id, business_number, flow_number,table_id, node_id, node_name, approver_id, approver, approval_time, approval_status, approval_remark, create_time, update_time, del_flag)
         values
         <foreach collection="list" item="item" separator=",">
-            (#{item.id}, #{item.businessNumber}, #{item.flowNumber}, #{item.tableId}, #{item.nodeId}, #{item.nodeName}, #{item.approverId}, #{item.approver}, #{item.approvalTime}, #{item.approvalStatus}, #{item.approvalRemark}, #{item.createTime}, #{item.updateTime}, #{item.delFlag})
+            (
+             #{item.id},
+             #{item.businessNumber},
+             #{item.flowNumber},
+             #{item.tableId},
+             #{item.nodeId},
+             #{item.nodeName},
+             #{item.approverId},
+             #{item.approver},
+             #{item.approvalTime},
+             #{item.approvalStatus},
+             #{item.approvalRemark},
+             #{item.createTime},
+             #{item.updateTime},
+             #{item.delFlag}
+             )
         </foreach>
     </insert>
 </mapper>

+ 27 - 21
src/main/resources/mapper/mysql/MySQLMapper.xml

@@ -163,27 +163,24 @@
     </insert>
 
     <!--  插入拨付出账通知书  -->
-    <insert id="insertAppropriationOutgoing">
+    <insert id="insertAppropriationOutgoing" parameterType="com.cool.bang.modules.mysql.domain.AppropriationOutgoing">
         insert into
         fc_appropriation_outgoing (id, business_number, bank_code, org_id, org_name, appropriation_id,application_type,
         project_account_id, project_name, appropriation_account_id, appropriation_bank, appropriation_name,
         appropriation_account, appropriation_open_address, collection_account_id, collection_bank, collection_name,
         collection_account, collection_open_address, apply_amount, purpose, type, appropriation_status, pdf_url,
         is_rescind, create_time, update_time, del_flag, remark)
-        values
-        <foreach collection="list" item="item" separator=",">
-            (#{item.id}, #{item.businessNumber}, #{item.bankCode}, #{item.orgId}, #{item.orgName},
-            #{item.appropriationId}, #{item.applicationType}, #{item.projectAccountId}, #{item.projectName},
-            #{item.appropriationAccountId}, #{item.appropriationBank}, #{item.appropriationName},
-            #{item.appropriationAccount}, #{item.appropriationOpenAddress}, #{item.collectionAccountId},
-            #{item.collectionBank}, #{item.collectionName}, #{item.collectionAccount}, #{item.collectionOpenAddress},
-            #{item.applyAmount}, #{item.purpose}, #{item.type}, #{item.appropriationStatus}, #{item.pdfUrl},
-            #{item.isRescind}, #{item.createTime}, #{item.updateTime}, #{item.delFlag}, #{item.remark})
-        </foreach>
+        values(#{id}, #{businessNumber}, #{bankCode}, #{orgId}, #{orgName},
+            #{appropriationId}, #{applicationType}, #{projectAccountId}, #{projectName},
+            #{appropriationAccountId}, #{appropriationBank}, #{appropriationName},
+            #{appropriationAccount}, #{appropriationOpenAddress}, #{collectionAccountId},
+            #{collectionBank}, #{collectionName}, #{collectionAccount}, #{collectionOpenAddress},
+            #{applyAmount}, #{purpose}, #{type}, #{appropriationStatus}, #{pdfUrl},
+            #{isRescind}, #{createTime}, #{updateTime}, #{delFlag}, #{remark})
     </insert>
 
     <!--  插入拨付入账通知书  -->
-    <insert id="insertAppropriationPosting">
+    <insert id="insertAppropriationPosting" parameterType="com.cool.bang.modules.mysql.domain.AppropriationPosting">
         insert into
         fc_appropriation_posting (id, business_number, bank_code, org_id, org_name, appropriation_id,
         project_account_id, project_name, appropriation_account_id, appropriation_bank, appropriation_name,
@@ -191,15 +188,13 @@
         collection_account, collection_open_address, posting_amount, posting_status, purpose, is_rescind, create_time,
         update_time, del_flag, remark)
         values
-        <foreach collection="list" item="item" separator=",">
-            (#{item.id}, #{item.businessNumber}, #{item.bankCode}, #{item.orgId}, #{item.orgName},
-            #{item.appropriationId}, #{item.projectAccountId}, #{item.projectName}, #{item.appropriationAccountId},
-            #{item.appropriationBank}, #{item.appropriationName}, #{item.appropriationAccount},
-            #{item.appropriationOpenAddress}, #{item.collectionAccountId}, #{item.collectionBank},
-            #{item.collectionName}, #{item.collectionAccount}, #{item.collectionOpenAddress}, #{item.postingAmount},
-            #{item.postingStatus}, #{item.purpose}, #{item.isRescind}, #{item.createTime}, #{item.updateTime},
-            #{item.delFlag}, #{item.remark})
-        </foreach>
+        (#{id}, #{businessNumber}, #{bankCode}, #{orgId}, #{orgName},
+        #{appropriationId}, #{projectAccountId}, #{projectName}, #{appropriationAccountId},
+        #{appropriationBank}, #{appropriationName}, #{appropriationAccount},
+        #{appropriationOpenAddress}, #{collectionAccountId}, #{collectionBank},
+        #{collectionName}, #{collectionAccount}, #{collectionOpenAddress}, #{postingAmount},
+        #{postingStatus}, #{purpose}, #{isRescind}, #{createTime}, #{updateTime},
+        #{delFlag}, #{remark})
     </insert>
 
     <!--  插入项目解除监管业务数据  -->
@@ -388,4 +383,15 @@
         WHERE
             t.type = 1
     </select>
+
+    <!-- 更新额度内余额 -->
+    <update id="updateInLimitFund">
+        update fc_building_account t, (select t2.building_number, sum(t2.apply_amount) as apply_amount from fc_appropriation t left join fc_appropriation_detail t2 on t2.appropriation_id = t.id where t.business_state = 3 and application_type = 1 group by t2.building_number) t2 set t.in_limit_fund = t2.apply_amount where t2.building_number = t.building_number
+    </update>
+
+    <update id="updateBuildingAccountId">
+        update fc_appropriation_detail t, fc_building_account t2 set t.building_account_id = t2.id where t2.building_number = t.building_number
+    </update>
+
+
 </mapper>

+ 1 - 1
src/main/resources/mapper/mysql/OrgMapper.xml

@@ -4,6 +4,6 @@
 
     <!--  通过mis库企业id 查询 zhfg库企业id  -->
     <select id="selectOrgByMisid" resultType="com.cool.bang.modules.mysql.domain.Org">
-        select id,misid,qymc as orgName from p_qyxx where misid = #{misid} and state = 1
+        select id, misid, qymc as orgName from p_qyxx where misid = #{misid} and state = 1
     </select>
 </mapper>

+ 137 - 0
src/main/resources/mapper/oracle/ApplyMapper.xml

@@ -200,4 +200,141 @@
         where t1.state = 1 and t1.flowstate = 0 <!-- 只查询审核通过的信息 -->
         <if test="apptype != null"> and t1.apptype = #{apptype}</if>
     </select>
+
+    <!-- //////////////////////////////// 托管拨付 //////////////////////////////// -->
+
+    <!-- 托管拨付 18额度内拨付 19额度外拨付 zgflag 政府拨付 -->
+    <select id="selectApply_18_19" resultType="com.cool.bang.modules.oracle.domain.OracleAppropriation">
+        select
+            t.appid as appId,
+            t.appbh as businessNumber,
+            t.aregid as aregId,
+            t.apptype as appType,
+            t.allmoney applyAmount,
+            t.flowid as flowId,
+            t.flownodeid as flowNodeId,
+            t.flownodename as flowNodeName,
+            t.flowstate as flowState,
+            t.jbr as directory,
+            t.lxdh as phone,
+            to_date(to_char(t.spjssj,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as updateTime,
+            to_date(to_char(t.sqsj,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as createTime,
+            t.zjflag as zjFlag,
+            t.zgflag as zgFlag,
+            t3.accountno as appropriationAccount,
+            t4.qybh as orgMisId,
+            t5.accountno as superviseAccount
+        from
+            apply t
+                left join payitem t2 on t2.appid = t.appid and t2.state = 1
+                left join account t3 on t3.accountid = t2.accountid
+                left join areg t4 on t4.aregid = t2.regid
+                left join account t5 on t5.accountid = t2.gdaccountid
+        where
+            t.APPTYPE IN (18, 19) and t.state = 1
+    </select>
+
+    <!-- 托管拨付 6额度内拨付 7额度外拨付 zgflag 政府拨付 -->
+    <select id="selectApply_6_7" resultType="com.cool.bang.modules.oracle.domain.OracleAppropriation">
+        select
+            t.appid as appId,
+            t.appbh as businessNumber,
+            t.aregid as aregId,
+            t.apptype as appType,
+            t.allmoney applyAmount,
+            t.flowid as flowId,
+            t.flownodeid as flowNodeId,
+            t.flownodename as flowNodeName,
+            t.flowstate as flowState,
+            t.jbr as directory,
+            t.lxdh as phone,
+            to_date(to_char(t.spjssj,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as updateTime,
+            to_date(to_char(t.sqsj,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as createTime,
+            t.zjflag as zjFlag,
+            t.zgflag as zgFlag,
+            t3.accountno as appropriationAccount,
+            t4.qybh as orgMisId,
+            t5.accountno as superviseAccount
+        from
+            apply t
+                left join payitem t2 on t2.appid = t.appid and t2.state = 1
+                left join account t3 on t3.accountid = t2.accountid
+                left join areg t4 on t4.aregid = t.aregid
+                left join account t5 on t5.accountid = t2.gdaccountid
+        where
+            t.APPTYPE IN (6, 7) and t.state = 1
+    </select>
+
+    <select id="selectApplyDetails_18_19" resultType="com.cool.bang.modules.oracle.domain.OracleAppropriationDetail">
+        select
+            t2.payaccountname as collectionName,
+            t2.payaccountno as collectionAccount,
+            t2.payeebankname as collectionBank,
+            t2.payuse as purpose,
+            t2.money as applyAmountTotal,
+            t2.payflag as payFlag,     <!-- 0未拨付 1已拨付 -->
+            t2.zt as payFlag2,  <!-- 0未拨付 1已到监管户 2已到一般户 -->
+            t4.lzbh as buildingNumber,
+            t4.lzmc as buildingName,
+            t3.money as applyAmount,
+            t3.lzye as accountBalance,
+            t3.lcbl as keepPercentage,
+            t3.lcje as keepAmount
+        from apply t
+            left join payitem t2 on t.appid = t2.appid
+            left join payitemlz t3 on t3.payitemid = t2.payitemid
+            left join aregitem t4 on t4.aregitemid = t3.aregitemid
+        where
+            t.apptype in (18, 19) and t.state = 1 and t2.state = 1 and t.appid = #{appId}
+    </select>
+
+    <select id="selectApplyDetails_6_7" resultType="com.cool.bang.modules.oracle.domain.OracleAppropriationDetail">
+        select
+        t2.payaccountname as collectionName,
+        t2.payaccountno as collectionAccount,
+        t2.payeebankname as collectionBank,
+        t2.payuse as purpose,
+        t2.money as applyAmountTotal,
+        t2.payflag as payFlag,     <!-- 0未拨付 1已拨付 -->
+        t2.zt as payFlag2,  <!-- 0未拨付 1已到监管户 2已到一般户 -->
+        t4.lzbh as buildingNumber,
+        t4.lzmc as buildingName,
+        t3.money as applyAmount,
+        t3.lzye as accountBalance,
+        t3.lcbl as keepPercentage,
+        t3.lcje as keepAmount
+        from apply t
+        left join payitem t2 on t.appid = t2.appid
+        left join payitemlz t3 on t3.payitemid = t2.payitemid
+        left join aregitem t4 on t4.aregitemid = t3.aregitemid
+        where
+        t.apptype in (6, 7) and t.state = 1 and t2.state = 1 and t.appid = #{appId}
+    </select>
+
+    <select id="selectApprovalRecords_18_19" resultType="com.cool.bang.modules.oracle.domain.OracleApprovalRecord">
+        select
+            t5.flownodename as nodeName,
+            t5.operatedate as approvalTime,
+            t5.operator as approver,
+            t5.remark as remark,
+            t5.state as approvalStatus
+        from apply t
+            left join sflowlog t5 on t5.infoid = t.appid and t5.flowid = 18
+        where
+            t.apptype in (18, 19) and t.state = 1  and t.appid = #{appId}
+    </select>
+
+    <select id="selectApprovalRecords_6_7" resultType="com.cool.bang.modules.oracle.domain.OracleApprovalRecord">
+        select
+            t5.flownodename as nodeName,
+            t5.operatedate as approvalTime,
+            t5.operator as approver,
+            t5.remark as remark,
+            t5.state as approvalStatus
+        from apply t
+                 left join sflowlog t5 on t5.infoid = t.appid and t5.flowid in (4,5)
+        where
+            t.apptype in (6, 7) and t.state = 1  and t.appid = #{appId}
+    </select>
+
 </mapper>