171250443 1 年間 前
コミット
128fe89493

+ 30 - 32
src/main/java/com/cool/bang/api/DataMatch.java

@@ -1,13 +1,8 @@
 package com.cool.bang.api;
 
-import com.cool.bang.modules.mysql.service.AccountService;
-import com.cool.bang.modules.mysql.service.MySQLSecondService;
-import com.cool.bang.modules.mysql.service.MySQLService;
-import com.cool.bang.modules.mysql.service.UserService;
+import com.cool.bang.modules.mysql.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 
@@ -26,6 +21,9 @@ public class DataMatch {
     @Resource
     private AccountService accountService;
 
+    @Resource
+    private RefundService refundService;
+
     /**
      * 用户表导入
      */
@@ -34,14 +32,6 @@ public class DataMatch {
         userService.execute();
     }
 
-    /**
-     * 账户表导入
-     */
-    @GetMapping("account")
-    public void account(){
-        accountService.execute();
-    }
-
     /**
      * 项目表导入
      */
@@ -50,6 +40,14 @@ public class DataMatch {
         mySQLService.project();
     }
 
+    /**
+     * 账户表导入
+     */
+    @GetMapping("account")
+    public void account(){
+        accountService.execute();
+    }
+
     /**
      * 项目虚拟户、楼幢虚拟户表导入
      */
@@ -146,25 +144,25 @@ public class DataMatch {
     /**
      * 退款(合同)
      */
-    @GetMapping("refundTo")
-    public void refundTo(){
-        mySQLSecondService.refundTo();
+    @GetMapping("refund")
+    public void refund(){
+        refundService.execute();
     }
 
-
     /**
-     * 交易 待对账
+     * 楼栋解除
      */
-//    @GetMapping("tradeDDZTo")
-//    public void tradeDDZTo(){
-//        mySQLSecondService.tradeDDZTo();
-//    }
+    @GetMapping("buildingRelieve")
+    public void buildingRelieve(){
+        mySQLSecondService.buildingRelieve();
+    }
+
 
     /**
-     * 交易 托管
+     * 交易表记录(托管记录)
      */
-    @GetMapping("tradeTgTo")
-    public void tradeTgTo(){
+    @GetMapping("trade")
+    public void trade(){
         mySQLSecondService.tradeTgTo();
     }
 
@@ -189,13 +187,13 @@ public class DataMatch {
     @GetMapping("contractFundCheckTrade")
     public void contractFundCheckTrade(){mySQLSecondService.contractFundCheckTrade();}
 
-
     /**
-     * 楼栋解除
+     * 查询银行账单,按日期
      */
-    @GetMapping("buildingRelieve")
-    public void buildingRelieve(){
-        mySQLSecondService.buildingRelieve();
+    @GetMapping("bank/{bankCode}/{startDate}/{endDate}")
+    public void bank(@PathVariable String bankCode, @PathVariable String startDate, @PathVariable String endDate) {
+        mySQLService.bankBill(bankCode, startDate, endDate);
     }
 
+
 }

+ 63 - 0
src/main/java/com/cool/bang/modules/mysql/domain/BankBill.java

@@ -0,0 +1,63 @@
+package com.cool.bang.modules.mysql.domain;
+
+import java.math.BigDecimal;
+
+/**
+ * 描述:
+ *
+ * @author PeiZhi Guo
+ * 2023-4-8 17:28
+ */
+public class BankBill {
+
+    private String businessNumber;
+
+    private String account;
+
+    private BigDecimal amount;
+
+    // 1收入 2支出
+    private Integer type;
+
+    private String transactionTime;
+
+    public String getBusinessNumber() {
+        return businessNumber;
+    }
+
+    public void setBusinessNumber(String businessNumber) {
+        this.businessNumber = businessNumber;
+    }
+
+    public String getAccount() {
+        return account;
+    }
+
+    public void setAccount(String account) {
+        this.account = account;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getTransactionTime() {
+        return transactionTime;
+    }
+
+    public void setTransactionTime(String transactionTime) {
+        this.transactionTime = transactionTime;
+    }
+}

+ 14 - 6
src/main/java/com/cool/bang/modules/mysql/domain/Refund.java

@@ -73,7 +73,6 @@ public class Refund {
 
     private String appropriationAccount;
 
-
     /**
      * 收款银行
      */
@@ -125,7 +124,7 @@ public class Refund {
     /**
      * 退款状态 0待退款 1已退款
      */
-    private String appropriationStatus;
+    private Integer appropriationStatus;
 
     /**
      * 删除标识 1正常 0删除
@@ -136,7 +135,12 @@ public class Refund {
 
     private Date createTime;
 
+    private String remark;
+
 
+    public Refund() {
+
+    }
 
     public Refund(TkInfo item, Org org, ProjectAccount projectAccount, Account account,ContractInfo contract,BuildingAccount buildingAccount) {
         this.businessNumber = item.getBusinessNumber();
@@ -176,9 +180,13 @@ public class Refund {
         this.createTime = item.getSqsj();
     }
 
+    public String getRemark() {
+        return remark;
+    }
 
-
-
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
 
     public String getSigner() {
         return signer;
@@ -421,11 +429,11 @@ public class Refund {
         this.refundAmount = refundAmount;
     }
 
-    public String getAppropriationStatus() {
+    public Integer getAppropriationStatus() {
         return appropriationStatus;
     }
 
-    public void setAppropriationStatus(String appropriationStatus) {
+    public void setAppropriationStatus(Integer appropriationStatus) {
         this.appropriationStatus = appropriationStatus;
     }
 

+ 14 - 0
src/main/java/com/cool/bang/modules/mysql/mapper/ContractMapper.java

@@ -0,0 +1,14 @@
+package com.cool.bang.modules.mysql.mapper;
+
+import com.cool.bang.modules.mysql.domain.Contract;
+
+/**
+ * 描述:
+ *
+ * @author PeiZhi Guo
+ * 2023-4-8 11:54
+ */
+public interface ContractMapper {
+
+    Contract selectByContractNumber(String contractNumber);
+}

+ 7 - 0
src/main/java/com/cool/bang/modules/mysql/mapper/MySqlMapper.java

@@ -132,4 +132,11 @@ public interface MySqlMapper {
      * @return
      */
     Long getProjectAccountIdByAregId(@Param("aregId") Long aregId);
+
+    /**
+     * 查询银行账单
+     */
+    List<BankBill> selectByBankBill(@Param("bankCode") String bankCode,
+                                    @Param("startDate") String startDate,
+                                    @Param("endDate") String endDate);
 }

+ 1 - 10
src/main/java/com/cool/bang/modules/mysql/service/AccountService.java

@@ -24,15 +24,6 @@ import java.util.Map;
 @Service
 public class AccountService extends BaseService {
 
-    @Resource
-    private OrgMapper orgMapper;
-
-    @Resource
-    private ProjectMapper projectMapper;
-
-    @Resource
-    private AccountMapper accountMapper;
-
     public void execute() {
         long startTime = System.currentTimeMillis();
         System.out.println(">>>>>>>>>>>>>>>>>>" + "导入账户开始执行," + startTime);
@@ -69,7 +60,7 @@ public class AccountService extends BaseService {
         }
         int i = accountMapper.insertAccount(accountList);
 
-        //查询账号的数据
+        // 查询账号的数据
         List<Long> ids = accountMapper.selectReuseAcoount();
         for (Long id : ids) {
             accountMapper.deleteById(id);

+ 31 - 0
src/main/java/com/cool/bang/modules/mysql/service/BaseService.java

@@ -1,6 +1,9 @@
 package com.cool.bang.modules.mysql.service;
 
+import com.cool.bang.modules.mysql.mapper.*;
+import com.cool.bang.modules.oracle.mapper.ApplyMapper;
 import com.cool.bang.modules.oracle.mapper.OracleMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import javax.annotation.Resource;
 
@@ -14,4 +17,32 @@ public abstract class BaseService {
 
     @Resource
     protected OracleMapper oracleMapper;
+
+    @Resource
+    protected MySqlMapper mySqlMapper;
+
+    @Resource
+    protected FlowMapper flowMapper;
+
+    @Resource
+    protected OrgMapper orgMapper;
+
+    @Resource
+    protected ProjectMapper projectMapper;
+
+    @Resource
+    protected ProjectAccountMapper projectAccountMapper;
+
+    @Resource
+    protected BuildingAccountMapper buildingAccountMapper;
+
+    @Resource
+    protected AccountMapper accountMapper;
+
+    @Resource
+    protected ContractMapper contractMapper;
+
+    @Resource
+    protected ApplyMapper applyMapper;
+
 }

+ 90 - 90
src/main/java/com/cool/bang/modules/mysql/service/MySQLSecondService.java

@@ -53,94 +53,90 @@ public class MySQLSecondService {
      */
     @Transactional
     public void refundTo() {
-        System.out.println("===============fc_refund 导入数据开始=================");
-        // 获取结束节点
-        ApprovalFlow approvalFlow = flowMapper.selectFlowByType(6); //合同退款
-        ApprovalNode endNode = new ApprovalNode();
-        List<ApprovalNode> approvalNodeList = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
-        for (ApprovalNode node : approvalNodeList) {
-            if (node.getNumber() == 4) {
-                endNode = node;
-            }
-        }
+//        System.out.println("===============fc_refund 导入数据开始=================");
+//        // 获取结束节点
+//        ApprovalFlow approvalFlow = flowMapper.selectFlowByType(6); //合同退款
+//        ApprovalNode endNode = new ApprovalNode();
+//        List<ApprovalNode> approvalNodeList = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
+//        for (ApprovalNode node : approvalNodeList) {
+//            if (node.getNumber() == 4) {
+//                endNode = node;
+//            }
+//        }
         List<TkInfo> htTkList = oracleMapper.selectHtTk();
-        for (TkInfo item : htTkList) {
-            Integer qybh = StringUtils.isEmpty(item.getQybh()) ? null : Integer.valueOf(item.getQybh());
-            Org org = qyxxMapper.selectOrgByMisid(qybh);
-            if (org == null) { //测试用
-                org = new Org();
-                org.setId(3);
-                org.setOrgName("山东酷邦软件有限公司");
-            }
-            BuildingAccount buildingAccount = null;
-            if (!StringUtils.isEmpty(item.getLzbh())) {
-                buildingAccount = buildingAccountMapper.getInfoByLZBH(item.getLzbh());
-            }
-            Long projectAccountId = (null != buildingAccount && null != buildingAccount.getProjectAccountId()) ? buildingAccount.getProjectAccountId() : null;
-            ProjectAccount projectAccount = null;
-            if (null != projectAccountId) {
-                projectAccount = projectAccountMapper.getInfoById(projectAccountId);
-            }
-            Account account = null;
-            if (!StringUtils.isEmpty(item.getAccountNo())) {
-                account = accountMapper.selectByAccountNO(item.getAccountNo());
-            }
-            ContractInfo contract = null;
-            if (!StringUtils.isEmpty(item.getHtBh())) {
-                contract = mySqlMapper.getInfoByNumber(item.getHtBh());
-            }
-            Refund refund = new Refund(item, org, projectAccount, account, contract, buildingAccount);
-            //定金退款的
-            if (null == item.getMoney()) {
-                refund.setAppropriationStatus("0");
-            } else {
-                refund.setAppropriationStatus("1");
-            }
-            // 如果是流程结束
-            if (item.getFLOWSTATE().equals("0")) {
-                refund.setBusinessState(3);
-            }
-            if (item.getFLOWSTATE().equals("1")) {
-                refund.setBusinessState(2);
-            }
-            refund.setFlowNumber(approvalFlow.getFlowNumber());
-            refund.setFlowNodeId(endNode.getId());
-            refund.setFlowNodeName(endNode.getNodeName());
-            if (!StringUtils.isEmpty(item.getFWBH())) {
-                P_lpb_fw fw = fwMapper.getFwByMissid(item.getFWBH(), null);
-                if (null != fw) {
-                    refund.setHouseAddress(fw.getXxdz());
-                }
-            }
-            mySqlMapper.insertRefund(refund);
-
-            // 插入审批记录
-            List<ApprovalRecord> records = new ArrayList<>();
-            List<OracleApprovalRecord> oracleApprovalRecords =
-                    applyMapper.selectApprovalRecords_8(item.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(item.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(refund.getId());
-                    if (oracleApprovalRecord.getApprovalStatus() != null) {
-                        record.setApprovalStatus(1);
-                    }
-                    record.setApprovalRemark(oracleApprovalRecord.getRemark());
-                    records.add(record);
-                }
-                flowMapper.insertRecordBatch(records);
-            }
-        }
+//        for (TkInfo item : htTkList) {
+//            Integer qybh = StringUtils.isEmpty(item.getQybh()) ? null : Integer.valueOf(item.getQybh());
+//            Org org = qyxxMapper.selectOrgByMisid(qybh);
+//
+//            BuildingAccount buildingAccount = null;
+//            if (!StringUtils.isEmpty(item.getLzbh())) {
+//                buildingAccount = buildingAccountMapper.getInfoByLZBH(item.getLzbh());
+//            }
+//            Long projectAccountId = (null != buildingAccount && null != buildingAccount.getProjectAccountId()) ? buildingAccount.getProjectAccountId() : null;
+//            ProjectAccount projectAccount = null;
+//            if (null != projectAccountId) {
+//                projectAccount = projectAccountMapper.getInfoById(projectAccountId);
+//            }
+//            Account account = null;
+//            if (!StringUtils.isEmpty(item.getAccountNo())) {
+//                account = accountMapper.selectByAccountNO(item.getAccountNo());
+//            }
+//            ContractInfo contract = null;
+//            if (!StringUtils.isEmpty(item.getHtBh())) {
+//                contract = mySqlMapper.getInfoByNumber(item.getHtBh());
+//            }
+//            Refund refund = new Refund(item, org, projectAccount, account, contract, buildingAccount);
+//            //定金退款的
+//            if (null == item.getMoney()) {
+//                refund.setAppropriationStatus("0");
+//            } else {
+//                refund.setAppropriationStatus("1");
+//            }
+//            // 如果是流程结束
+//            if (item.getFLOWSTATE().equals("0")) {
+//                refund.setBusinessState(3);
+//            }
+//            if (item.getFLOWSTATE().equals("1")) {
+//                refund.setBusinessState(2);
+//            }
+//            refund.setFlowNumber(approvalFlow.getFlowNumber());
+//            refund.setFlowNodeId(endNode.getId());
+//            refund.setFlowNodeName(endNode.getNodeName());
+//            if (!StringUtils.isEmpty(item.getFWBH())) {
+//                P_lpb_fw fw = fwMapper.getFwByMissid(item.getFWBH(), null);
+//                if (null != fw) {
+//                    refund.setHouseAddress(fw.getXxdz());
+//                }
+//            }
+//            mySqlMapper.insertRefund(refund);
+//
+//            // 插入审批记录
+//            List<ApprovalRecord> records = new ArrayList<>();
+//            List<OracleApprovalRecord> oracleApprovalRecords =
+//                    applyMapper.selectApprovalRecords_8(item.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(item.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(refund.getId());
+//                    if (oracleApprovalRecord.getApprovalStatus() != null) {
+//                        record.setApprovalStatus(1);
+//                    }
+//                    record.setApprovalRemark(oracleApprovalRecord.getRemark());
+//                    records.add(record);
+//                }
+//                flowMapper.insertRecordBatch(records);
+//            }
+//        }
         System.out.println("===============fc_refund数据匹配结束=================");
     }
 
@@ -214,6 +210,7 @@ public class MySQLSecondService {
     public void accountChecking() {
         List<Map<String, Object>> tgXm = mySqlMapper.selectTgXm();
         List<String> list = new ArrayList<>();
+        list.add("项目名称;项目编号;楼幢名称;楼幢编号;监管资金转托管;交存资金;拨付资金;计算余额;账户余额;是否一致;余额差值");
         for (Map<String, Object> map : tgXm) {
             List<Map<String, Object>> xmAccount = mySqlMapper.selectXmAccountByProjectId((Long) map.get("id"));
             for (Map<String, Object> account : xmAccount) {
@@ -248,8 +245,8 @@ public class MySQLSecondService {
                             .append(";" + hj)
                             .append(";" + accountBalance)
                             .append(";" + (hj.compareTo(accountBalance) == 0 ? "是" : "否"))
-                            .append(";" + (hj.compareTo(accountBalance) == 0 ? "" : cz));
-                    System.out.println(str.toString());
+                            .append(";" + (hj.compareTo(accountBalance) == 0 ? "0" : cz));
+                    // System.out.println(str.toString());
                     list.add(str.toString());
                 }
             }
@@ -267,6 +264,7 @@ public class MySQLSecondService {
         List<Account> wdzJc = oracleMapper.getWdzJc();
         List<Account> wdzBf = oracleMapper.getWdzBf();
         List<String> strs = new ArrayList<>();
+        strs.add("银行名称;银行编号;已计算余额;系统未对账的交存;系统未对账的拨付;其他金额;账户余额;差值");
         //处理特殊的对账
         //1、寿光农商银行  缺失的 定金626475.6 (银行流水号 = 041002202216625184199811) 手续费0.44(银行流水号= 041002202216655621675571) (总的楼栋户的合计 比 账户余额少 这两笔 需要加上这两笔 )
         //2、中国建设银行股份有限公司寿光支行 bankCode:02   手续费 -200(银行流水号= 021002202216625378315471) (总的楼栋户的合计 比对完账的账户余额 多200 总的楼栋户合计需要加上这个-200)
@@ -302,10 +300,10 @@ public class MySQLSecondService {
             StringBuilder str = new StringBuilder();
             str.append(account.getBankName())
                     .append(";" + account.getBankCode())
+                    .append(";" + account.getBalance())
                     .append(";" + jc)
                     .append(";" + bf)
                     .append(";" + otherTypeAmount)
-                    .append(";" + account.getBalance())
                     .append(";" + account.getAccountBalance())
                     .append(";" + ((account.getBalance().subtract(jc)).add(bf).add(otherTypeAmount)).subtract(account.getAccountBalance()));
             strs.add(str.toString());
@@ -368,6 +366,8 @@ public class MySQLSecondService {
                 relieve.setBusinessState(1);
             } else if (oracleRelieve.getFlowState().equals(1) && oracleRelieve.getFlowNodeName().equals("保存")) {
                 relieve.setBusinessState(0);
+            } else if (oracleRelieve.getFlowState().equals(1) && oracleRelieve.getFlowNodeName().equals("解除楼幢初审通过")) {
+                relieve.setBusinessState(2);
             } else if (oracleRelieve.getFlowState().equals(1)) {
                 throw new RuntimeException("解除项目异常:" + oracleRelieve.getFlowNodeName());
             }

+ 28 - 4
src/main/java/com/cool/bang/modules/mysql/service/MySQLService.java

@@ -1,5 +1,6 @@
 package com.cool.bang.modules.mysql.service;
 
+import com.alibaba.druid.support.json.JSONUtils;
 import com.cool.bang.common.util.DateUtil;
 import com.cool.bang.modules.mysql.domain.*;
 import com.cool.bang.modules.mysql.domain.flowPo.ApprovalFlow;
@@ -108,7 +109,7 @@ public class MySQLService {
 //            }else {
             project.setOrgId(org.getId());
 //            }
-            //查询该项目下房屋总套数
+            // 查询该项目下房屋总套数
             Integer houseTotal = projectMapper.selectProjectHouseTotal(project.getProjectNumber());
             project.setHouseTotal(houseTotal == null ? 0 : houseTotal);
             projectList.add(project);
@@ -924,9 +925,17 @@ public class MySQLService {
             if (oracleAppropriation.getFlowState().equals(0)) {
                 appropriation.setBusinessState(3);
             }
-            if (oracleAppropriation.getFlowState().equals(1) && oracleAppropriation.getFlowNodeName().equals("保存")) {
+            else if (oracleAppropriation.getFlowState().equals(1) && oracleAppropriation.getFlowNodeName().equals("保存")) {
                 appropriation.setBusinessState(0);
             }
+            else if (oracleAppropriation.getFlowState().equals(1) && oracleAppropriation.getFlowNodeName().equals("托管额度内资金申请上报")) {
+                appropriation.setBusinessState(1);
+            }
+            else if (oracleAppropriation.getFlowState().equals(1) && oracleAppropriation.getFlowNodeName().equals("托管额度内资金申请初审不通过")) {
+                appropriation.setBusinessState(4);
+            }
+
+
             appropriation.setDelFlag(1);
             appropriation.setCreateTime(oracleAppropriation.getCreateTime());
             appropriation.setUpdateTime(oracleAppropriation.getUpdateTime());
@@ -1180,6 +1189,7 @@ public class MySQLService {
 
         for (HtInfo item : htInfoList) {
             Contract contract = new Contract();
+
             // 查询企业
             Org org = qyxxMapper.selectOrgByMisid(Integer.parseInt(item.getQYBH()));
             contract.setOrgId(org.getId());
@@ -1216,7 +1226,6 @@ public class MySQLService {
 
             contract.initValueConfig(item, fw, bhtTrades);
 
-
             // 银行
             if (!StringUtils.isEmpty(bankAccount)) {
                 Account account = accountMapper.selectByAccountNO(bankAccount);
@@ -1231,7 +1240,6 @@ public class MySQLService {
                 System.out.println(" >>>>>>>> 快来看看,你的数据:"+ item.getHTID());
             }
 
-
             contracts.add(contract);
 
             index++;
@@ -1339,4 +1347,20 @@ public class MySQLService {
         }
         System.out.println("===============fc_earnest数据匹配结束=================");
     }
+
+    public void bankBill(String bankCode, String startDate, String endDate) {
+        List<BankBill> bills = mySqlMapper.selectByBankBill(bankCode, startDate, endDate);
+        List<String> strs = new ArrayList<>();
+        strs.add("编号;账号;金额;时间;类型");
+        for (BankBill item : bills) {
+            StringBuilder str = new StringBuilder();
+            str.append(item.getBusinessNumber())
+                    .append(";" + item.getAccount())
+                    .append(";" + item.getAmount())
+                    .append(";" + item.getTransactionTime())
+                    .append(";" + (item.getType().equals(1)?"收入":"支出"));
+            strs.add(str.toString());
+        }
+        strs.forEach(System.out::println);
+    }
 }

+ 144 - 0
src/main/java/com/cool/bang/modules/mysql/service/RefundService.java

@@ -0,0 +1,144 @@
+package com.cool.bang.modules.mysql.service;
+
+import com.alibaba.druid.util.StringUtils;
+import com.cool.bang.modules.mysql.domain.*;
+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.oracle.domain.OracleApprovalRecord;
+import com.cool.bang.modules.oracle.domain.Refund;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ *
+ * @author PeiZhi Guo
+ * 2023-4-8 10:02
+ */
+@Service
+public class RefundService extends BaseService {
+
+    @Transactional
+    public void execute() {
+        long startTime = System.currentTimeMillis();
+        System.out.println(">>>>>>>>>>>>>>>>>>" + "导入退款记录开始执行," + startTime);
+
+        // 获取结束节点
+        ApprovalFlow approvalFlow = flowMapper.selectFlowByType(6); //合同退款
+        ApprovalNode endNode = new ApprovalNode();
+        List<ApprovalNode> approvalNodeList = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
+        for (ApprovalNode node : approvalNodeList) {
+            if (node.getNumber() == 4) {
+                endNode = node;
+            }
+        }
+
+        List<Refund> refunds = oracleMapper.selectRefundInfo();
+
+        for (Refund item : refunds) {
+            com.cool.bang.modules.mysql.domain.Refund refund = new com.cool.bang.modules.mysql.domain.Refund();
+            refund.setBusinessNumber(item.getBusinessNumber());
+            refund.setContractNumber(item.getContractNumber());
+            refund.setBuyer(item.getBuyer());
+            refund.setRefundAmount(item.getRefundAmount());
+            refund.setCreateTime(item.getCreateTime());
+
+            // 企业信息
+            Org org = orgMapper.selectOrgByMisid(item.getMisId());
+            if (org == null || org.getId() == null) {
+                throw new RuntimeException("开发单位异常");
+            }
+            refund.setOrgId(org.getId());
+            refund.setOrgName(org.getOrgName());
+
+            // 楼幢信息
+            BuildingAccount building = buildingAccountMapper.selectByBuildingNumber(item.getBuildingNumber());
+            if (building != null && building.getId() != null) {
+                refund.setBuildingAccountId(building.getId());
+                refund.setBuildingName(building.getBuildingName());
+            }
+
+            // 项目信息
+            ProjectAccount project = projectAccountMapper.selectByAregid(item.getAregId());
+            refund.setProjectAccountId(project.getId());
+            refund.setProjectName(project.getProjectName());
+            refund.setProjectNumber(project.getProjectNumber());
+
+            // 收款账户信息
+            refund.setCollectionBank(item.getCollectionBank());
+            refund.setCollectionName(item.getCollectionName());
+            refund.setCollectionAccount(item.getCollectionAccount());
+
+            // 付款账户信息
+            if (StringUtils.isEmpty(item.getAppropriationAccount())) {
+                continue;
+            }
+            Account account = accountMapper.selectByAccountNO(item.getAppropriationAccount());
+            refund.setAccountId(account.getId());
+            refund.setAccountType(account.getType());
+            refund.setAppropriationAccount(account.getAccount());
+            refund.setAppropriationBank(account.getBankName());
+            refund.setBankCode(account.getBankCode());
+
+            // 退款状态
+            refund.setAppropriationStatus(item.getIsRefund());
+
+            // 合同
+            refund.setContractNumber(item.getContractNumber());
+            Contract contract = contractMapper.selectByContractNumber(item.getContractNumber());
+            if (contract != null && contract.getId() != null) {
+                refund.setContractId(contract.getId());
+                refund.setHouseAddress(contract.getHouseAddress());
+            }
+
+            // 如果是流程结束
+            if (item.getFlowState().equals(0)) {
+                refund.setBusinessState(3);
+            }
+            if (item.getFlowState().equals(1) && item.getFlowNodeName().equals("合同退款申请初审不通过")) {
+                refund.setBusinessState(4);
+            }
+            refund.setFlowNumber(approvalFlow.getFlowNumber());
+            refund.setFlowNodeId(endNode.getId());
+            refund.setFlowNodeName(endNode.getNodeName());
+            refund.setRemark(item.getRemark());
+            refund.setDelFlag(1);
+            mySqlMapper.insertRefund(refund);
+
+            // 历史记录
+            List<ApprovalRecord> records = new ArrayList<>();
+            List<OracleApprovalRecord> oracleApprovalRecords =
+                    applyMapper.selectApprovalRecords_8(item.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(item.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(refund.getId());
+                    if (oracleApprovalRecord.getApprovalStatus() != null) {
+                        record.setApprovalStatus(1);
+                    }
+                    record.setApprovalRemark(oracleApprovalRecord.getRemark());
+                    records.add(record);
+                }
+                flowMapper.insertRecordBatch(records);
+            }
+
+        }
+        System.out.println(">>>>>>>>>>>>>>>>>>" + "导入退款记录执行结束,用时:"
+                + (System.currentTimeMillis() - startTime) + "ms");
+    }
+}

+ 1 - 1
src/main/java/com/cool/bang/modules/mysql/service/UserService.java

@@ -17,7 +17,7 @@ import java.util.Map;
  * 2023-3-6 17:00
  */
 @Service
-public class UserService extends BaseService{
+public class UserService extends BaseService {
 
     @Resource
     private UserMapper userMapper;

+ 223 - 0
src/main/java/com/cool/bang/modules/oracle/domain/Refund.java

@@ -0,0 +1,223 @@
+package com.cool.bang.modules.oracle.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 描述:
+ *
+ * @author PeiZhi Guo
+ * 2023-4-8 10:07
+ */
+public class Refund {
+
+    private Integer appId;
+
+    private String businessNumber;
+
+    /** 退款金额 */
+    private BigDecimal refundAmount;
+
+    private Integer aregId;
+
+    private Integer misId;
+
+    private Integer flowId;
+
+    private String flowNodeName;
+
+    private Integer flowState;
+
+    /** 买受人 */
+    private String buyer;
+
+    /** 合同编号 */
+    private String contractNumber;
+
+    private Date createTime;
+
+    /** 楼幢编号 */
+    private String buildingNumber;
+
+    /** 收款户名 */
+    private String collectionName;
+
+    /** 收款银行 */
+    private String collectionBank;
+
+    /** 收款账号 */
+    private String collectionAccount;
+
+    /** 银行编号 */
+    private String bankCode;
+
+    /** 付款银行 */
+    private String appropriationBank;
+
+    /** 付款账号 */
+    private String appropriationAccount;
+
+    private Integer isRefund;
+
+    private String remark;
+
+    public Integer getAppId() {
+        return appId;
+    }
+
+    public void setAppId(Integer appId) {
+        this.appId = appId;
+    }
+
+    public BigDecimal getRefundAmount() {
+        return refundAmount;
+    }
+
+    public void setRefundAmount(BigDecimal refundAmount) {
+        this.refundAmount = refundAmount;
+    }
+
+    public Integer getAregId() {
+        return aregId;
+    }
+
+    public void setAregId(Integer aregId) {
+        this.aregId = aregId;
+    }
+
+    public Integer getMisId() {
+        return misId;
+    }
+
+    public void setMisId(Integer misId) {
+        this.misId = misId;
+    }
+
+    public Integer getFlowId() {
+        return flowId;
+    }
+
+    public void setFlowId(Integer flowId) {
+        this.flowId = flowId;
+    }
+
+    public String getFlowNodeName() {
+        return flowNodeName;
+    }
+
+    public void setFlowNodeName(String flowNodeName) {
+        this.flowNodeName = flowNodeName;
+    }
+
+    public Integer getFlowState() {
+        return flowState;
+    }
+
+    public void setFlowState(Integer flowState) {
+        this.flowState = flowState;
+    }
+
+    public String getBuyer() {
+        return buyer;
+    }
+
+    public void setBuyer(String buyer) {
+        this.buyer = buyer;
+    }
+
+    public String getContractNumber() {
+        return contractNumber;
+    }
+
+    public void setContractNumber(String contractNumber) {
+        this.contractNumber = contractNumber;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getBuildingNumber() {
+        return buildingNumber;
+    }
+
+    public void setBuildingNumber(String buildingNumber) {
+        this.buildingNumber = buildingNumber;
+    }
+
+    public String getCollectionName() {
+        return collectionName;
+    }
+
+    public void setCollectionName(String collectionName) {
+        this.collectionName = collectionName;
+    }
+
+    public String getCollectionBank() {
+        return collectionBank;
+    }
+
+    public void setCollectionBank(String collectionBank) {
+        this.collectionBank = collectionBank;
+    }
+
+    public String getCollectionAccount() {
+        return collectionAccount;
+    }
+
+    public void setCollectionAccount(String collectionAccount) {
+        this.collectionAccount = collectionAccount;
+    }
+
+    public String getBankCode() {
+        return bankCode;
+    }
+
+    public void setBankCode(String bankCode) {
+        this.bankCode = bankCode;
+    }
+
+    public String getAppropriationBank() {
+        return appropriationBank;
+    }
+
+    public void setAppropriationBank(String appropriationBank) {
+        this.appropriationBank = appropriationBank;
+    }
+
+    public String getAppropriationAccount() {
+        return appropriationAccount;
+    }
+
+    public void setAppropriationAccount(String appropriationAccount) {
+        this.appropriationAccount = appropriationAccount;
+    }
+
+    public Integer getIsRefund() {
+        return isRefund;
+    }
+
+    public void setIsRefund(Integer isRefund) {
+        this.isRefund = isRefund;
+    }
+
+    public String getBusinessNumber() {
+        return businessNumber;
+    }
+
+    public void setBusinessNumber(String businessNumber) {
+        this.businessNumber = businessNumber;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+}

+ 9 - 0
src/main/java/com/cool/bang/modules/oracle/mapper/OracleMapper.java

@@ -4,6 +4,7 @@ import com.cool.bang.modules.mysql.domain.Account;
 import com.cool.bang.modules.mysql.domain.Relieve;
 import com.cool.bang.modules.mysql.domain.TradeInfo;
 import com.cool.bang.modules.oracle.domain.OracleUser;
+import com.cool.bang.modules.oracle.domain.Refund;
 import com.cool.bang.modules.oracle.domain.Trade;
 import com.cool.bang.modules.oracle.domain.po.*;
 import org.apache.ibatis.annotations.Param;
@@ -97,4 +98,12 @@ public interface OracleMapper {
      * @return
      */
     List<TradeInfo> selectTGTsDz(@Param("ids") List<Integer> ids);
+
+    /**
+     * 查询退款记录信息
+     *
+     * Param
+     * Return
+     */
+    List<Refund> selectRefundInfo();
 }

+ 2 - 2
src/main/resources/application.yml

@@ -35,9 +35,9 @@ spring:
         stat-view-servlet.enabled: true
       yszj-oracle:
         driver-class-name: oracle.jdbc.driver.OracleDriver
-        url: jdbc:oracle:thin:@192.168.0.105:1521:orcl
+        url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
         username: yszjjg
-        password: zjjg
+        password: yszjjg
         initial-size: 1
         min-idle: 5
         max-active: 20

+ 55 - 0
src/main/resources/mapper/mysql/ContractMapper.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.cool.bang.modules.mysql.mapper.ContractMapper">
+
+    <!-- 结果集 -->
+    <resultMap id="resultMap" type="com.cool.bang.modules.mysql.domain.Contract">
+        <id property="id"                        column="id"                      jdbcType="BIGINT"/>
+        <result property="contractNumber"        column="contract_number"         jdbcType="VARCHAR"/>
+        <result property="bankCode"              column="bank_code"               jdbcType="BIGINT"/>
+        <result property="orgId"                 column="org_id"                  jdbcType="INTEGER"/>
+        <result property="orgName"               column="org_name"                jdbcType="VARCHAR"/>
+        <result property="projectId"             column="project_id"              jdbcType="INTEGER"/>
+        <result property="projectAccountId"      column="project_account_id"      jdbcType="BIGINT"/>
+        <result property="projectNumber"         column="project_number"          jdbcType="VARCHAR"/>
+        <result property="projectName"           column="project_name"            jdbcType="VARCHAR"/>
+        <result property="buildingId"            column="building_id"             jdbcType="INTEGER"/>
+        <result property="buildingAccountId"     column="building_account_id"     jdbcType="BIGINT"/>
+        <result property="buildingNumber"        column="building_number"         jdbcType="VARCHAR"/>
+        <result property="buildingName"          column="building_name"           jdbcType="VARCHAR"/>
+        <result property="houseId"               column="house_id"                jdbcType="BIGINT"/>
+        <result property="houseAddress"          column="house_address"           jdbcType="VARCHAR"/>
+        <result property="houseArea"             column="house_area"              jdbcType="DECIMAL"/>
+        <result property="houseUse"              column="house_use"               jdbcType="VARCHAR"/>
+        <result property="buyer"                 column="buyer"                   jdbcType="VARCHAR"/>
+        <result property="idCard"                column="id_card"                 jdbcType="VARCHAR"/>
+        <result property="payWay"                column="pay_way"                 jdbcType="TINYINT"/>
+        <result property="contractPrice"         column="contract_price"          jdbcType="DECIMAL"/>
+        <result property="paymentAmount1"        column="payment_amount_1"        jdbcType="DECIMAL"/>
+        <result property="paymentAmount2"        column="payment_amount_2"        jdbcType="DECIMAL"/>
+        <result property="paymentAmount3"        column="payment_amount_3"        jdbcType="DECIMAL"/>
+        <result property="paymentAmount4"        column="payment_amount_4"        jdbcType="DECIMAL"/>
+        <result property="signTime"              column="sign_time"               jdbcType="VARCHAR"/>
+        <result property="paidAmount"            column="paid_amount"             jdbcType="DECIMAL"/>
+        <result property="unpaidAmount"          column="unpaid_amount"           jdbcType="DECIMAL"/>
+        <result property="collectionBank"        column="collection_bank"         jdbcType="VARCHAR"/>
+        <result property="collectionName"        column="collection_name"         jdbcType="VARCHAR"/>
+        <result property="collectionAccount"     column="collection_account"      jdbcType="VARCHAR"/>
+        <result property="collectionOpenAddress" column="collection_open_address" jdbcType="VARCHAR"/>
+        <result property="accountId"             column="account_id"              jdbcType="BIGINT"/>
+        <result property="accountType"           column="account_type"            jdbcType="INTEGER"/>
+        <result property="isMortgage"            column="is_mortgage"             jdbcType="TINYINT"/>
+        <result property="isRefund"              column="is_refund"               jdbcType="TINYINT"/>
+        <result property="isEarnest"             column="is_earnest"              jdbcType="INTEGER"/>
+        <result property="isRescind"             column="is_rescind"              jdbcType="TINYINT"/>
+        <result property="paymentStatus"         column="payment_status"          jdbcType="TINYINT"/>
+        <result property="createTime"            column="create_time"             jdbcType="TIMESTAMP"/>
+        <result property="delFlag"               column="del_flag"                jdbcType="TINYINT"/>
+    </resultMap>
+
+    <select id="selectByContractNumber" resultMap="resultMap">
+        select * from fc_contract where contract_number = #{contractNumber} and is_refund = 1
+    </select>
+
+
+</mapper>

+ 6 - 2
src/main/resources/mapper/mysql/MySQLMapper.xml

@@ -304,7 +304,7 @@
         (business_number,bank_code,contract_number,contract_id,contract_price,org_id,org_name,project_account_id,project_name,project_number,
         buyer,id_card,account_id,account_type,appropriation_bank,appropriation_account,collection_bank,collection_name,collection_account,
         refund_amount,signer,signer_phone,flow_number,flow_node_id,flow_node_name,business_state,appropriation_status,del_flag,
-        building_account_id,building_name,house_address,create_time)
+        building_account_id,building_name,house_address,create_time,remark)
         values
             (#{businessNumber},#{bankCode},#{contractNumber},#{contractId},#{contractPrice},#{orgId},
             #{orgName},#{projectAccountId},#{projectName},#{projectNumber},#{buyer},#{idCard},
@@ -312,7 +312,7 @@
             #{collectionName},#{collectionAccount},#{refundAmount},
             #{signer},#{signerPhone},#{flowNumber},#{flowNodeId},#{flowNodeName},#{businessState},
             #{appropriationStatus},#{delFlag},#{buildingAccountId},#{buildingName},#{houseAddress},
-            #{createTime})
+            #{createTime},#{remark})
     </insert>
 
     <select id="getInfoByNumber" resultType="com.cool.bang.modules.mysql.domain.ContractInfo">
@@ -425,4 +425,8 @@
     <select id="getProjectAccountIdByAregId" resultType="long">
         select id from  fc_project_account where aregid = #{aregId} LIMIT 1
     </select>
+
+    <select id="selectByBankBill" resultType="com.cool.bang.modules.mysql.domain.BankBill">
+        select business_number as businessNumber, account, amount, transaction_time as transactionTime, type  from fc_trade where channel_code = #{bankCode} and transaction_time &gt;= #{startDate} and transaction_time &lt;= #{endDate} order by transaction_time desc
+    </select>
 </mapper>

+ 35 - 1
src/main/resources/mapper/oracle/OracleMapper.xml

@@ -62,7 +62,7 @@
 
     <!-- 查询BHT-->
     <select id="selectHtInfo" resultType="com.cool.bang.modules.oracle.domain.po.HtInfo">
-        select t1.*,t2.FWID,t3.FWBH
+        select t1.*, t2.FWID, t3.FWBH
         from BHT t1
         left join BHTFW t2 ON  t1.HTID = t2.HTID and t2.STATE = 1
         left join BFW t3 ON t3.FWID = t2.FWID and t3.STATE = 1
@@ -255,4 +255,38 @@
         WHERE  a.ACCOUNTTYPE =1  and   t.CHECKFLAG = 1 AND t.TRADESTATE = 1  AND t.PAYTYPE in (18,19,20)
         GROUP BY a.BANKCODE
     </select>
+
+    <select id="selectRefundInfo" resultType="com.cool.bang.modules.oracle.domain.Refund">
+        SELECT
+            t.HTID as htid,
+            t.APPID AS appId,
+            t.APPBH AS businessNumber,
+            t.ALLMONEY AS refundAmount,
+            t.AREGID AS aregId,
+            t.FLOWID AS flowId,
+            t.FLOWNODENAME AS flowNodeName,
+            to_number(t.FLOWSTATE) AS flowState,
+            t.GFR AS buyer,
+            t.HTBH AS contractNumber,
+            t.SQSJ AS createTime,
+            t3.QYBH AS misId,
+            t2.LZBH AS buildingNumber,
+            t4.PAYACCOUNTNAME AS collectionName,
+            t4.PAYEEBANKNAME AS collectionBank,
+            t4.PAYACCOUNTNO AS collectionAccount,
+            t5.BANKCODE AS bankCode,
+            t5.ACCOUNTNAME AS appropriationBank,
+            t5.ACCOUNTNO AS appropriationAccount,
+            NVL2(t6.TRADEAMOUNT, 1, 0)  AS isRefund,
+            t4.PAYUSE AS remark
+        FROM
+            APPLY t
+            LEFT JOIN BHT t2 ON t2.HTID = t.HTID
+            LEFT JOIN AREG t3 ON t3.AREGID = t.AREGID
+            LEFT JOIN PAYITEM t4 ON t4.APPID = t.APPID
+            LEFT JOIN ACCOUNT t5 ON t5.ACCOUNTID = t4.ACCOUNTID
+            LEFT JOIN TRADE t6 ON t6.TRADENUM = t4.PAYCODE AND t6.TRADESTATE = 1
+        WHERE
+            t.state = 1 AND t.APPTYPE = 8
+    </select>
 </mapper>