Browse Source

1:代码优化

171250443 1 year ago
parent
commit
26d696b069

+ 20 - 1
src/main/java/com/cool/bang/api/DataMatch.java

@@ -167,13 +167,19 @@ public class DataMatch {
     }
 
     /**
-     * 对账
+     * 楼幢对账
      */
     @GetMapping("accountChecking")
     public void accountChecking(){
         mySQLSecondService.accountChecking();
     }
 
+    /**
+     * 楼幢对账
+     */
+    @GetMapping("projectCheck")
+    public void projectCheck() {mySQLSecondService.projectCheck();}
+
     /**
      * 托管账户对账
      */
@@ -195,5 +201,18 @@ public class DataMatch {
         mySQLService.bankBill(bankCode, startDate, endDate);
     }
 
+    /**
+     * 查询银行账单,按日期
+     */
+    @GetMapping("orgAccount")
+    public void org() {
+        mySQLService.selectOrgAccount();
+    }
+
+    @GetMapping("projectAccount2")
+    public void projectAccount2() {
+        mySQLService.projectAccount2();
+    }
+
 
 }

+ 69 - 0
src/main/java/com/cool/bang/modules/mysql/domain/OrgAccount.java

@@ -0,0 +1,69 @@
+package com.cool.bang.modules.mysql.domain;
+
+/**
+ * 描述:
+ *
+ * @author PeiZhi Guo
+ * 2023-4-11 14:19
+ */
+public class OrgAccount {
+
+    private String orgName;
+
+    private String bankName;
+
+    private String projectName;
+
+    private String name;
+
+    private String account;
+
+    public String getOrgName() {
+        return orgName;
+    }
+
+    public void setOrgName(String orgName) {
+        this.orgName = orgName;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public void setBankName(String bankName) {
+        this.bankName = bankName;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAccount() {
+        return account;
+    }
+
+    public void setAccount(String account) {
+        this.account = account;
+    }
+
+    @Override
+    public String toString() {
+        return orgName + ";" +
+                bankName + ";" +
+                projectName + ";" +
+                name + ";" +
+                account;
+    }
+}

+ 30 - 1
src/main/java/com/cool/bang/modules/mysql/domain/Project.java

@@ -1,6 +1,7 @@
 package com.cool.bang.modules.mysql.domain;
 
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Map;
 
@@ -61,8 +62,13 @@ public class Project {
     /** 项目状态  0解除监管 1正常  2申请解除监管 */
     private Integer state;
 
+    /** 初始对账日期,第一次交存时,添加日期 */
+    private Date checkDate;
+
     private Date createTime;
 
+    private Date updateTime;
+
     /** 删除标识 1正常 0删除 */
     private Integer delFlag;
 
@@ -90,8 +96,15 @@ public class Project {
         this.isFrozen = 0;
         this.type = typeSwitch(Integer.parseInt(map.get("JGLX").toString()));
         this.state = stateSwitch(Integer.parseInt(map.get("JGZT").toString()));
-        this.createTime =  (Date) map.get("SPJSSJ");
+        this.createTime = (Date) map.get("SQSJ");
+        this.updateTime = (Date) map.get("SPJSSJ");
         this.delFlag = 1;
+        try {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            this.checkDate = sdf.parse("2023-04-25");
+        } catch (Exception e) {
+            throw new RuntimeException("日期转换异常");
+        }
     }
 
     private Integer typeSwitch(Integer data) {
@@ -122,6 +135,14 @@ public class Project {
         }
     }
 
+    public Date getCheckDate() {
+        return checkDate;
+    }
+
+    public void setCheckDate(Date checkDate) {
+        this.checkDate = checkDate;
+    }
+
     public Long getId() {
         return id;
     }
@@ -265,4 +286,12 @@ public class Project {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
 }

+ 40 - 0
src/main/java/com/cool/bang/modules/mysql/domain/ProjectAccountTrade.java

@@ -0,0 +1,40 @@
+package com.cool.bang.modules.mysql.domain;
+
+import java.math.BigDecimal;
+
+/**
+ * 描述:
+ *
+ * @author PeiZhi Guo
+ * 2023-4-11 15:56
+ */
+public class ProjectAccountTrade {
+
+    private Integer id;
+
+    private BigDecimal amount;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    @Override
+    public String toString() {
+        return "ProjectAccountTrade{" +
+                "id=" + id +
+                ", amount=" + amount +
+                '}';
+    }
+}

+ 12 - 3
src/main/java/com/cool/bang/modules/mysql/domain/TradeInfo.java

@@ -29,6 +29,8 @@ public class TradeInfo {
 
     private Date transactionTime;
 
+    private String projectNumber;
+
     private String lzbh;
 
     private String payType;
@@ -39,10 +41,17 @@ public class TradeInfo {
 
     private Date createTime;
 
-    private Long aregId;
+    private Integer aregId;
 
     private String tellErno;
 
+    public String getProjectNumber() {
+        return projectNumber;
+    }
+
+    public void setProjectNumber(String projectNumber) {
+        this.projectNumber = projectNumber;
+    }
 
     public Long getId() {
         return id;
@@ -180,11 +189,11 @@ public class TradeInfo {
         this.createTime = createTime;
     }
 
-    public Long getAregId() {
+    public Integer getAregId() {
         return aregId;
     }
 
-    public void setAregId(Long aregId) {
+    public void setAregId(Integer aregId) {
         this.aregId = aregId;
     }
 

+ 16 - 1
src/main/java/com/cool/bang/modules/mysql/domain/mysql/MysqlUser.java

@@ -55,7 +55,7 @@ public class MysqlUser {
     private String remark;
 
     public MysqlUser(OracleUser oracle) {
-        this.userType = 2;
+        userType(oracle.getUsertype());
         this.username = oracle.getLoginname();
         this.password = "$2a$10$fgr4fEsZenOOeh8PGWGGxexo1Szju/tqt6XNMQt/9n/8nux0OuSdq";
         this.realName = oracle.getUsername();
@@ -69,6 +69,21 @@ public class MysqlUser {
         this.updateTime = new Date();
     }
 
+    private void userType(Integer userType) {
+        // 房管
+        if (userType.equals(0)) {
+            this.userType = 1;
+        }
+        // 开发单位
+        if (userType.equals(1)) {
+            this.userType = 2;
+        }
+        // 银行
+        if (userType.equals(2)) {
+            this.userType = 3;
+        }
+    }
+
     public String getUsername() {
         return username;
     }

+ 22 - 1
src/main/java/com/cool/bang/modules/mysql/mapper/MySqlMapper.java

@@ -1,5 +1,6 @@
 package com.cool.bang.modules.mysql.mapper;
 
+import com.cool.bang.modules.mysql.domain.OrgAccount;
 import com.cool.bang.modules.mysql.domain.*;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -96,6 +97,12 @@ public interface MySqlMapper {
      */
     List<Account> selectTgAccountInfo();
 
+    /**
+     * 查询每个托管账户下的项目
+     * @return
+     */
+    List<ProjectAccount> selectTgProjectAccountInfo(String bankCode);
+
     /**
      * 更新楼幢账户表额度内余额
      */
@@ -131,7 +138,7 @@ public interface MySqlMapper {
      * @param aregId
      * @return
      */
-    Long getProjectAccountIdByAregId(@Param("aregId") Long aregId);
+    Long getProjectAccountIdByAregId(@Param("aregId") Integer aregId);
 
     /**
      * 查询银行账单
@@ -144,4 +151,18 @@ public interface MySqlMapper {
      * 根据账户查询交易总余额
      */
     List<BankBill> selectAccountBill(String account);
+
+
+    List<OrgAccount> selectOrgList();
+
+    //-------------- 查询 ------------------
+
+    List<ProjectAccountTrade> selectPaymentTrade();
+
+    List<ProjectAccountTrade> selectAppropriationTrade();
+
+    List<ProjectAccountTrade> selectProjectAccount();
+
+    // 更新p_lpb_xmxx 状态
+    int updateProjectStatus();
 }

+ 3 - 0
src/main/java/com/cool/bang/modules/mysql/mapper/ProjectAccountMapper.java

@@ -1,5 +1,6 @@
 package com.cool.bang.modules.mysql.mapper;
 
+import com.cool.bang.modules.mysql.domain.Project;
 import com.cool.bang.modules.mysql.domain.ProjectAccount;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -11,6 +12,8 @@ import java.util.List;
 @Repository
 public interface ProjectAccountMapper {
 
+    ProjectAccount selectByProjectNumber(String projectNumber);
+
     /**
      * 插入项目虚拟户表数据
      * @param projectAccount

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

@@ -5,6 +5,7 @@ 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.mysql.domain.mysql.MysqlUser;
 import com.cool.bang.modules.mysql.mapper.*;
 import com.cool.bang.modules.oracle.domain.*;
 import com.cool.bang.modules.oracle.domain.po.*;
@@ -182,11 +183,13 @@ public class MySQLSecondService {
             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);
-            }
+
+            // Long projectAccountId = (null != buildingAccount && null != buildingAccount.getProjectAccountId()) ? buildingAccount.getProjectAccountId() : null;
+            // ProjectAccount projectAccount = null;
+            // if (null != projectAccountId) {
+            //     projectAccount = projectAccountMapper.getInfoById(projectAccountId);
+            // }
+            ProjectAccount projectAccount = projectAccountMapper.selectByAregid(item.getAregId());
             Account account = null;
 
             if (!StringUtils.isEmpty(item.getAccountNo())) {
@@ -256,6 +259,41 @@ public class MySQLSecondService {
         }
     }
 
+    /**
+     * 项目对账
+     */
+    public void projectCheck() {
+        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"));
+            BigDecimal projectBalance = new BigDecimal("0");
+            BigDecimal buildingBalance = new BigDecimal("0");
+            for (Map<String, Object> account : xmAccount) {
+                // 楼幢虚拟户
+                List<Map<String, Object>> buildingInfo = mySqlMapper.selectBuildingBy((Long) map.get("id"), (Long) account.get("id"));
+                for (Map<String, Object> building : buildingInfo) {
+                    buildingBalance = buildingBalance.add((BigDecimal) building.get("account_balance"));
+                }
+                projectBalance = projectBalance.add((BigDecimal) account.get("trusteeship_balance"));
+            }
+            StringBuilder str = new StringBuilder();
+            str.append(map.get("org_name").toString())
+                    .append(";" + map.get("project_name").toString())
+                    .append(";" + projectBalance)
+                    .append(";" + buildingBalance)
+                    .append(";" + (projectBalance.compareTo(buildingBalance) == 0 ? "是" : "否"))
+                    .append(";" + (projectBalance.subtract(buildingBalance)));
+            // System.out.println(str.toString());
+            list.add(str.toString());
+        }
+        for (String str : list) {
+            System.out.println(str);
+        }
+    }
+
     /**
      * 银行账户对账
      */
@@ -265,7 +303,7 @@ public class MySQLSecondService {
         List<Account> appropriations = oracleMapper.getWdzBf();
 
         List<String> systemOut = new ArrayList<>();
-        systemOut.add("银行名称;银行编号;交存;支出;未对账交存;未对账支出;计算;账户余额;差值");
+        systemOut.add("银行名称;银行编号;交存;支出;未对账交存;未对账支出;计算;项目;账户余额;差值;项目差值;最终差值");
         for (Account account : list) {
 
             BigDecimal payment = BigDecimal.ZERO;
@@ -298,6 +336,14 @@ public class MySQLSecondService {
                 }
             }
 
+            BigDecimal projectBalance = BigDecimal.ZERO;
+            List<ProjectAccount> projects = mySqlMapper.selectTgProjectAccountInfo(account.getBankCode());
+            for (ProjectAccount project : projects) {
+                if (project.getTrusteeshipBalance() != null) {
+                    projectBalance = projectBalance.add(project.getTrusteeshipBalance());
+                }
+            }
+
             StringBuilder str = new StringBuilder();
             str.append(account.getBankName())
                     .append(";" + account.getBankCode())
@@ -306,8 +352,11 @@ public class MySQLSecondService {
                     .append(";" + notPayment)
                     .append(";" + notAppropriation)
                     .append(";" + payment.subtract(appropriation))
+                    .append(";" + projectBalance)
                     .append(";" + account.getAccountBalance())
-                    .append(";" + (payment.subtract(appropriation)).subtract(account.getAccountBalance()));
+                    .append(";" + (payment.subtract(appropriation)).subtract(account.getAccountBalance()))
+                    .append(";" + account.getAccountBalance().subtract(projectBalance))
+                    .append(";" + (account.getAccountBalance().subtract(projectBalance)).add(notPayment).subtract(notAppropriation));
             systemOut.add(str.toString());
         }
 

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

@@ -70,6 +70,7 @@ public class MySQLService {
     /**
      * 项目表 数据匹配
      */
+    @Transactional
     public void project() {
         //对应YSZJJG--BXM表
 
@@ -115,6 +116,7 @@ public class MySQLService {
             projectList.add(project);
         }
         int i = projectMapper.insertProject(projectList);
+        mySqlMapper.updateProjectStatus();
         System.out.println("===============fc_project 数据匹配结束==插入" + i + "条数据==============");
     }
 
@@ -718,7 +720,7 @@ public class MySQLService {
             progress.setFlowNumber(approvalFlow.getFlowNumber());
 
             if (progress.getBusinessState() == 1) { //待审核
-                progress.setFlowNodeId(node1.getId());
+                progress.setFlowNodeId(node2.getId());
                 progress.setFlowNodeName(node1.getNodeName());
                 mySqlMapper.insertProgress(progress);
 
@@ -1365,4 +1367,78 @@ public class MySQLService {
         strs.forEach(System.out::println);
         System.out.println("总计:"+ strs.size());
     }
+
+    public void selectOrgAccount() {
+        List<String> strs = new ArrayList<>();
+        strs.add("开发单位;项目;银行;账户;账号");
+        List<OrgAccount> orgList = mySqlMapper.selectOrgList();
+        orgList.forEach(item -> {
+            StringBuilder str = new StringBuilder();
+            str.append(item.getOrgName())
+                    .append(";" + item.getBankName())
+                    .append(";" + item.getProjectName())
+                    .append(";" + item.getName())
+                    .append(";" + item.getAccount())
+                    ;
+            strs.add(str.toString());
+        });
+        strs.forEach(System.out::println);
+    }
+
+    public void projectAccount2 () {
+        List<ProjectAccountTrade> payments = mySqlMapper.selectPaymentTrade();
+
+        BigDecimal ba = new BigDecimal("0");
+
+        for (ProjectAccountTrade item : payments) {
+            ba = ba.add(item.getAmount());
+        }
+        System.out.println(ba);
+
+
+        List<ProjectAccountTrade> appropriations = mySqlMapper.selectAppropriationTrade();
+
+        BigDecimal pa = new BigDecimal("0");
+
+        for (ProjectAccountTrade item : appropriations) {
+            pa = pa.add(item.getAmount());
+        }
+        System.out.println(pa);
+
+
+        List<ProjectAccountTrade> projectBalances = mySqlMapper.selectProjectAccount();
+
+        List<ProjectAccountTrade> amounts = new ArrayList<>();
+        for (ProjectAccountTrade payment : payments) {
+            ProjectAccountTrade t = new ProjectAccountTrade();
+            t.setId(payment.getId());
+            t.setAmount(payment.getAmount());
+            for (ProjectAccountTrade appropriation : appropriations) {
+                if (appropriation.getId().equals(payment.getId())) {
+                    t.setId(appropriation.getId());
+                    t.setAmount(payment.getAmount().subtract(appropriation.getAmount()));
+                }
+            }
+            amounts.add(t);
+        }
+
+        List<String> strs = new ArrayList<>();
+
+        for (ProjectAccountTrade item : amounts) {
+            StringBuffer str = new StringBuffer();
+            str.append(item.getId());
+            str.append(";").append(item.getAmount());
+                for (ProjectAccountTrade balance : projectBalances) {
+                    if (balance.getId().equals(item.getId())) {
+                        str.append(";").append(balance.getAmount())
+                                .append(";").append(item.getAmount().compareTo(balance.getAmount()))
+                                .append(";").append(item.getAmount().subtract(balance.getAmount()));
+
+                    }
+                }
+            strs.add(str.toString());
+        }
+
+        strs.forEach(System.out::println);
+    }
 }

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

@@ -5,6 +5,7 @@ import com.cool.bang.modules.mysql.mapper.UserMapper;
 import com.cool.bang.modules.oracle.domain.OracleUser;
 import com.cool.bang.modules.oracle.mapper.OracleMapper;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -22,6 +23,7 @@ public class UserService extends BaseService {
     @Resource
     private UserMapper userMapper;
 
+    @Transactional
     public void execute() {
         long startTime = System.currentTimeMillis();
         System.out.println(">>>>>>>>>>>>>>>>>>" + "导入用户开始执行," + startTime);
@@ -30,9 +32,13 @@ public class UserService extends BaseService {
 
         for (OracleUser user : oracleUsers) {
             MysqlUser mysqlUser = new MysqlUser(user);
-            Map<String, Object> map = userMapper.selectByOrgCode(user.getQybh());
-            mysqlUser.setOrgId((Integer) map.get("id"));
-
+            if (user.getUsertype().equals(1)) {
+                if (user.getQybh() ==null || user.getQybh().equals("1")) {
+                    continue;
+                }
+                Map<String, Object> map = userMapper.selectByOrgCode(user.getQybh());
+                mysqlUser.setOrgId((Integer) map.get("id"));
+            }
             userMapper.insert(mysqlUser);
             userMapper.insertRole(mysqlUser.getId(), 3L);
         }

+ 3 - 0
src/main/java/com/cool/bang/modules/oracle/domain/OracleUser.java

@@ -54,6 +54,9 @@ public class OracleUser {
     private String qymc;
 
     public int convertSex() {
+        if (this.sex == null) {
+            return 2;
+        }
         if (this.sex.equals("男")) {
             return 0;
         }

+ 30 - 3
src/main/resources/mapper/mysql/MySQLMapper.xml

@@ -378,15 +378,22 @@
 
     <select id="selectTgAccountInfo" resultType="com.cool.bang.modules.mysql.domain.Account">
         SELECT
-            t.account, t.book_balance, t.income_balance, t2.bank_code AS bankCode , t.bank_name AS bankName,
-            t.account_balance AS accountBalance, t2.balance AS balance
+            t.account, t.book_balance, t.income_balance, t.bank_code AS bankCode , t.bank_name AS bankName,
+            t.account_balance AS accountBalance
         FROM
             fc_account t
-            LEFT JOIN ( SELECT bank_code, sum( trusteeship_balance) as balance FROM fc_project_account WHERE account_type = 1 GROUP BY bank_code ) t2 ON t2.bank_code = t.bank_code
         WHERE
             t.type = 1
     </select>
 
+    <select id="selectTgProjectAccountInfo" resultType="com.cool.bang.modules.mysql.domain.ProjectAccount">
+        SELECT
+            t.trusteeship_balance as trusteeshipBalance
+        FROM
+            fc_project_account t
+        WHERE
+            t.bank_code = #{bankCode}
+    </select>
 
     <!-- 更新额度内余额 -->
     <update id="updateInLimitFund">
@@ -434,4 +441,24 @@
         select business_number as businessNumber, account, amount, transaction_time as transactionTime, type from fc_trade where account = #{account}
     </select>
 
+    <select id="selectOrgList" resultType="com.cool.bang.modules.mysql.domain.OrgAccount">
+        select org_name as orgName, bank_name as bankName, project_name as projectName, name , account from fc_account where type = 2 and state = 1 order by org_name, project_name
+    </select>
+
+    <!-- /////////////////////////   //////////////////////// -->
+    <select id="selectPaymentTrade" resultType="com.cool.bang.modules.mysql.domain.ProjectAccountTrade">
+        select sum(amount) as amount, project_account_id as id from fc_trade where channel_code = '04' and project_account_id is not null and type = 1 group by project_account_id
+    </select>
+
+    <select id="selectAppropriationTrade" resultType="com.cool.bang.modules.mysql.domain.ProjectAccountTrade">
+        select sum(amount) as amount, project_account_id as id from fc_trade where channel_code = '04' and project_account_id is not null and type = 2 group by project_account_id
+    </select>
+
+    <select id="selectProjectAccount" resultType="com.cool.bang.modules.mysql.domain.ProjectAccountTrade">
+        select trusteeship_balance as amount, id from fc_project_account  where bank_code is not null and bank_code = '04'
+    </select>
+
+    <update id="updateProjectStatus">
+        update fc_project t, p_lpb_xmxx t2 set t2.tgzt = 1 where t2.xmbh = t.project_number;
+    </update>
 </mapper>

+ 9 - 0
src/main/resources/mapper/mysql/ProjectAccountMapper.xml

@@ -91,4 +91,13 @@
             id = #{id}
     </select>
 
+    <select id="selectByProjectNumber" resultMap="projectAccountMap">
+        select *  from
+            fc_project_account
+        where
+            project_number = #{projectNumber}
+    </select>
+
+
+
 </mapper>

+ 4 - 2
src/main/resources/mapper/mysql/ProjectMapper.xml

@@ -19,17 +19,19 @@
         <result property="isFrozen"                column="is_frozen"                    jdbcType="INTEGER"/>
         <result property="type"                    column="type"                         jdbcType="INTEGER"/>
         <result property="state"                   column="state"                        jdbcType="INTEGER"/>
+        <result property="checkDate"               column="check_date"                   jdbcType="TIMESTAMP"/>
         <result property="createTime"              column="create_time"                  jdbcType="TIMESTAMP"/>
+        <result property="updateTime"              column="update_time"                  jdbcType="TIMESTAMP"/>
         <result property="delFlag"                 column="del_flag"                     jdbcType="TINYINT"/>
     </resultMap>
 
     <!--  插入项目表数据  -->
     <insert id="insertProject">
         insert into
-            fc_project (id, org_id, org_name, project_number, project_name, project_address, build_area, building_total, house_total, build_cost_id, build_cost_name, adjustment_percentage, bank_percentage, is_frozen, type, state, create_time, del_flag)
+            fc_project (id, org_id, org_name, project_number, project_name, project_address, build_area, building_total, house_total, build_cost_id, build_cost_name, adjustment_percentage, bank_percentage, is_frozen, type, state, check_date, create_time, update_time, del_flag)
         values
         <foreach collection="list" item="item" separator=",">
-            (#{item.id},#{item.orgId},#{item.orgName},#{item.projectNumber},#{item.projectName},#{item.projectAddress},#{item.buildArea},#{item.buildingTotal},#{item.houseTotal},#{item.buildCostId},#{item.buildCostName},#{item.adjustmentPercentage},#{item.bankPercentage},#{item.isFrozen},#{item.type}, #{item.state}, #{item.createTime}, #{item.delFlag})
+            (#{item.id},#{item.orgId},#{item.orgName},#{item.projectNumber},#{item.projectName},#{item.projectAddress},#{item.buildArea},#{item.buildingTotal},#{item.houseTotal},#{item.buildCostId},#{item.buildCostName},#{item.adjustmentPercentage},#{item.bankPercentage},#{item.isFrozen},#{item.type}, #{item.state}, #{item.checkDate}, #{item.createTime}, #{item.updateTime}, #{item.delFlag})
         </foreach>
     </insert>
 

+ 32 - 10
src/main/resources/mapper/oracle/OracleMapper.xml

@@ -3,9 +3,11 @@
 <mapper namespace="com.cool.bang.modules.oracle.mapper.OracleMapper">
 
     <select id="selectFromBxm" resultType="java.util.Map">
-        select t1.*, t2.qymc, t3.SPJSSJ from BXM t1
+        select t1.*, t2.qymc, t3.SQSJ, t3.SPJSSJ from BXM t1
             left join BQY t2 on t1.qybh = t2.qybh
-            left join (select t.* from (select t.XMBH, to_date(to_char(t2.SPJSSJ,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as SPJSSJ, ROW_NUMBER() OVER (PARTITION BY t.XMBH ORDER BY t.XMBH DESC) rn from AREG t left join APPLY t2 on t2.AREGID = t.AREGID and t2.APPTYPE = 0 and T2.STATE = 1) t  where t.rn = 1) t3 on t3.XMBH = t1.XMBH
+            left join (select t.* from (
+                select t.XMBH, to_date(to_char(t2.SQSJ,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as SQSJ,
+                       to_date(to_char(t2.SPJSSJ,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') as SPJSSJ, ROW_NUMBER() OVER (PARTITION BY t.XMBH ORDER BY t.XMBH DESC) rn from AREG t left join APPLY t2 on t2.AREGID = t.AREGID and t2.APPTYPE = 0 and T2.STATE = 1) t  where t.rn = 1) t3 on t3.XMBH = t1.XMBH
         where t1.xmbh in (select XMBH from areg group by XMBH)
     </select>
 
@@ -17,7 +19,7 @@
         select t1.*,t3.name as BANKNAME,t3.code as BANKCODE
         from
             AREG t1
-        LEFT JOIN
+        left join
             ACCOUNT t2 on t1.aregid = t2.aregid
         left join
             BANK t3 on t2.bankcode = t3.code
@@ -129,7 +131,7 @@
     <!-- 查询企业用户 -->
     <select id="selectByUser" resultType="com.cool.bang.modules.oracle.domain.OracleUser">
         select t.loginname, t.sex, t.state, t.tel, t.typecode, t.username, t.usertype, t2.qybh, t2.qymc
-        from SUSER t left join BQY t2 on t2.qybh = t.TYPECODE where t.usertype = 1 and t.state = 1 and t2.qyid is not null
+        from SUSER t left join BQY t2 on t2.qybh = t.TYPECODE where  t.state = 1
     </select>
 
     <select id="selectHtTk" resultType="com.cool.bang.modules.oracle.domain.po.TkInfo">
@@ -185,14 +187,34 @@
 
     <select id="selectTG" resultType="com.cool.bang.modules.mysql.domain.TradeInfo">
         SELECT
-            ID AS id,ACCOUNTNO AS accountNo,BANKSER AS serialNumber,OLDBANKSER AS flushSerialNumber,
-            TRADENUM AS businessNumber,BANKFLAG AS channelType,TRADEAMOUNT AS amount,TRADECODE  AS code, PAYTYPE AS payType,
-            1 AS checkStatus,CHECKDATE AS checkDate, 1 AS transactionMode,TRADEDATE AS  transactionTime,LZBH AS lzbh,
-            UNDOEDATE AS undoeDate,REMARK AS remark,TRADEDATE AS createTime,AREGID AS aregId,TELLERNO AS tellErno
+            t.ID AS id,
+            t.ACCOUNTNO AS accountNo,
+            t.BANKSER AS serialNumber,
+            t.OLDBANKSER AS flushSerialNumber,
+            t.TRADENUM AS businessNumber,
+            t.BANKFLAG AS channelType,
+            t.TRADEAMOUNT AS amount,
+            t.TRADECODE AS code,
+            t.PAYTYPE AS payType,
+            1 AS checkStatus,
+            t.CHECKDATE AS checkDate,
+            1 AS transactionMode,
+            t.TRADEDATE AS transactionTime,
+            t.LZBH AS lzbh,
+            t.UNDOEDATE AS undoeDate,
+            t.REMARK AS remark,
+            t.TRADEDATE AS createTime,
+            t.AREGID AS aregId,
+            t2.xmbh as projectNumber,
+            t.TELLERNO AS tellErno
         FROM
-            trade
+            trade t
+            left join areg t2 on t2.AREGID = t.aregid
         WHERE
-            accountno IN ( SELECT accountno FROM account  WHERE accountid &lt;= 8 ) AND CHECKFLAG = 2 AND TRADESTATE = 1 AND ZJJGFLAG = 1
+            t.accountno IN ( SELECT accountno FROM account WHERE accountid &lt;= 8 )
+            AND t.CHECKFLAG = 2
+            AND t.TRADESTATE = 1
+            AND t.ZJJGFLAG = 1
     </select>
 
     <select id="selectTGTsDz" resultType="com.cool.bang.modules.mysql.domain.TradeInfo">