|
@@ -376,13 +376,14 @@ public class MySQLService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 监管项目解除
|
|
|
|
|
|
+ * 项目解除,账户解除
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
public void relieve() {
|
|
public void relieve() {
|
|
- List<Jgxmjc> jgxmjcList = applyMapper.selectJgxmjc();
|
|
|
|
- List<SuperviseRelieve> superviseRelieveList = new ArrayList<>();
|
|
|
|
- ApprovalFlow approvalFlow = flowMapper.selectFlowByType(7);//解除申请flowid = 7
|
|
|
|
|
|
+ List<OracleRelieve> oracleRelieves = applyMapper.selectRelieves();
|
|
|
|
+
|
|
|
|
+ // 查询审批流程
|
|
|
|
+ ApprovalFlow approvalFlow = flowMapper.selectFlowByType(7); // 解除申请flowId = 7
|
|
List<ApprovalNode> nodes = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
|
|
List<ApprovalNode> nodes = flowMapper.selectNodeByFlowNumber(approvalFlow.getFlowNumber());
|
|
ApprovalNode endNode = new ApprovalNode();
|
|
ApprovalNode endNode = new ApprovalNode();
|
|
for (ApprovalNode node : nodes) {
|
|
for (ApprovalNode node : nodes) {
|
|
@@ -390,81 +391,126 @@ public class MySQLService {
|
|
endNode = node;
|
|
endNode = node;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<ApprovalRecord> recordList = new ArrayList<>();
|
|
|
|
|
|
|
|
- for (Jgxmjc jgxmjc : jgxmjcList) {
|
|
|
|
- Org org = qyxxMapper.selectOrgByMisid(jgxmjc.getQybh());
|
|
|
|
- Project project = projectMapper.selectByProjectNumber(jgxmjc.getXmbh());
|
|
|
|
- ProjectAccount projectAccount = projectAccountMapper.selectByAregid(jgxmjc.getAregid());
|
|
|
|
- List<Areg> aregList = applyMapper.selectByXmbhFromAreg(jgxmjc.getXmbh());
|
|
|
|
- //项目解除业务信息
|
|
|
|
- Relieve relieve = new Relieve(jgxmjc, org, project);
|
|
|
|
|
|
+ for (OracleRelieve oracleRelieve : oracleRelieves) {
|
|
|
|
+
|
|
|
|
+ // 审核不通过的,不导入
|
|
|
|
+ if (oracleRelieve.getFlowState().equals(1) &&
|
|
|
|
+ oracleRelieve.getFlowNodeName().equals("解除监管初审不通过")) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Relieve relieve = new Relieve(oracleRelieve);
|
|
|
|
+
|
|
|
|
+ // 申请未审核的导入
|
|
|
|
+ if (oracleRelieve.getFlowState().equals(1) &&
|
|
|
|
+ oracleRelieve.getFlowNodeName().equals("解除监管申请上报")) {
|
|
|
|
+ relieve.setBusinessState(1);
|
|
|
|
+ } else if (oracleRelieve.getFlowState().equals(1)) {
|
|
|
|
+ throw new RuntimeException("解除项目异常:" + oracleRelieve.getFlowNodeName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 审核已完成
|
|
|
|
+ if (oracleRelieve.getFlowState().equals(0)) {
|
|
|
|
+ relieve.setBusinessState(3);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Org org = qyxxMapper.selectOrgByMisid(oracleRelieve.getOrgMisId());
|
|
|
|
+ relieve.setOrgId(org.getId());
|
|
|
|
+ relieve.setOrgName(org.getOrgName());
|
|
|
|
+
|
|
|
|
+ Project project = projectMapper.selectByProjectNumber(oracleRelieve.getProjectNumber());
|
|
|
|
+ relieve.setProjectId(project.getId());
|
|
|
|
+ relieve.setProjectNumber(project.getProjectNumber());
|
|
|
|
+ relieve.setProjectName(project.getProjectName());
|
|
|
|
+
|
|
relieve.setFlowNumber(approvalFlow.getFlowNumber());
|
|
relieve.setFlowNumber(approvalFlow.getFlowNumber());
|
|
relieve.setFlowNodeId(endNode.getId());
|
|
relieve.setFlowNodeId(endNode.getId());
|
|
relieve.setFlowNodeName(endNode.getNodeName());
|
|
relieve.setFlowNodeName(endNode.getNodeName());
|
|
- if (aregList.size() == 1) {//说明该项目下所有的项目虚拟户都已经解除,可以解除项目、项目虚拟户、账户、楼幢
|
|
|
|
- relieve.setRelieveType(1);
|
|
|
|
- mySqlMapper.insertRelieve(relieve);
|
|
|
|
- projectMapper.updateRelieve(relieve.getProjectId());
|
|
|
|
- } else { //说明该项目下存在还没有解除的项目虚拟户,所以只解除该项目虚拟户、以及该项目虚拟户绑定的账户、楼幢
|
|
|
|
- relieve.setRelieveType(2);
|
|
|
|
- mySqlMapper.insertRelieve(relieve);
|
|
|
|
- }
|
|
|
|
- //项目虚拟户变更解除状态
|
|
|
|
- projectAccountMapper.updateRelieveByAregid(jgxmjc.getAregid(), jgxmjc.getSqrq());
|
|
|
|
- //监管账户解除业务信息
|
|
|
|
- if (jgxmjc.getAccountList() != null && jgxmjc.getAccountList().size() > 0) {
|
|
|
|
- for (Account account : jgxmjc.getAccountList()) {
|
|
|
|
- account = accountMapper.selectByAccountNO(account.getAccount());
|
|
|
|
- SuperviseRelieve superviseRelieve = new SuperviseRelieve(account, org, projectAccount, jgxmjc);
|
|
|
|
- superviseRelieveList.add(superviseRelieve);
|
|
|
|
- //更新账户解除日期
|
|
|
|
- accountMapper.updateCancelDate(account.getId(), superviseRelieve.getUpdateTime());
|
|
|
|
|
|
+
|
|
|
|
+ // 判断项目虚拟户是否已全部解除
|
|
|
|
+ List<Areg> list = applyMapper.selectIsRelieve(relieve.getProjectNumber());
|
|
|
|
+ if (list.size() == 1) {
|
|
|
|
+ relieve.setRelieveType(1); // 项目解除
|
|
|
|
+ // 如果是未审核通过的,改为解除中
|
|
|
|
+ if (oracleRelieve.getFlowState().equals(1)) {
|
|
|
|
+ projectMapper.updateRelieve(relieve.getProjectId(), 2);
|
|
|
|
+ } else {
|
|
|
|
+ projectMapper.updateRelieve(relieve.getProjectId(), 0);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ relieve.setRelieveType(2);
|
|
}
|
|
}
|
|
- //解除明细
|
|
|
|
- List<RelieveDetail> relieveDetailList = new ArrayList<>();
|
|
|
|
- if (jgxmjc.getAregItemList() != null && jgxmjc.getAregItemList().size() > 0) {
|
|
|
|
- for (AregItem aregItem : jgxmjc.getAregItemList()) {
|
|
|
|
- BuildingAccount buildingAccount = buildingAccountMapper.selectByBuildingNumber(aregItem.getLzbh());
|
|
|
|
- RelieveDetail relieveDetail = new RelieveDetail(buildingAccount);
|
|
|
|
|
|
+ mySqlMapper.insertRelieve(relieve);
|
|
|
|
+
|
|
|
|
+ // ------------------------------ 项目解除详情 ----------------------------------
|
|
|
|
+
|
|
|
|
+ List<RelieveDetail> relieveDetails = new ArrayList<>();
|
|
|
|
+ List<OracleRelieveDetail> oracleRelieveDetails = applyMapper.selectRelieveDetails(oracleRelieve.getAppId());
|
|
|
|
+ if (oracleRelieveDetails != null && oracleRelieveDetails.size() > 0
|
|
|
|
+ && oracleRelieveDetails.get(0) != null && !StringUtils.isEmpty(oracleRelieveDetails.get(0).getBuildingNumber())) {
|
|
|
|
+ StringBuilder relieveBuilding = new StringBuilder();
|
|
|
|
+ for (OracleRelieveDetail detail : oracleRelieveDetails) {
|
|
|
|
+ BuildingAccount building = buildingAccountMapper.selectByBuildingNumber(detail.getBuildingNumber());
|
|
|
|
+ RelieveDetail relieveDetail = new RelieveDetail(building);
|
|
relieveDetail.setRelieveId(relieve.getId());
|
|
relieveDetail.setRelieveId(relieve.getId());
|
|
- relieveDetailList.add(relieveDetail);
|
|
|
|
|
|
+ relieveDetails.add(relieveDetail);
|
|
|
|
+ relieveBuilding.append(building.getBuildingName()).append(",");
|
|
}
|
|
}
|
|
- mySqlMapper.insertRelieveDetail(relieveDetailList);
|
|
|
|
- buildingAccountMapper.updateRelieve(relieveDetailList, jgxmjc.getShrq());
|
|
|
|
|
|
+ String buildingNames = relieveBuilding.toString().substring(0, relieveBuilding.length() -1);
|
|
|
|
+ mySqlMapper.updateRelieveBuilding(relieve.getId(), buildingNames);
|
|
|
|
+ mySqlMapper.insertRelieveDetail(relieveDetails);
|
|
|
|
+ buildingAccountMapper.updateRelieve(relieveDetails, relieve.getUpdateTime());
|
|
}
|
|
}
|
|
- //审批流程
|
|
|
|
- if (jgxmjc.getsFlowList() != null && jgxmjc.getsFlowList().size() > 0) {
|
|
|
|
- for (SFlow sFlow : jgxmjc.getsFlowList()) {
|
|
|
|
- ApprovalRecord record = new ApprovalRecord();
|
|
|
|
- record.setBusinessNumber(relieve.getBusinessNumber());
|
|
|
|
- record.setFlowNumber(relieve.getFlowNumber());
|
|
|
|
- record.setTableId(relieve.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(relieve.getOrgName() + "(" + sFlow.getShr() + ")");
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // ------------------------------ 项目解除审批记录 ----------------------------------
|
|
|
|
+
|
|
|
|
+ List<ApprovalRecord> approvalRecords = new ArrayList<>();
|
|
|
|
+ List<OracleApprovalRecord> oracleApprovalRecords = applyMapper.selectRelieveRecord(oracleRelieve.getAppId());
|
|
|
|
+ for (OracleApprovalRecord approval : oracleApprovalRecords) {
|
|
|
|
+ ApprovalRecord record = new ApprovalRecord();
|
|
|
|
+ record.setBusinessNumber(relieve.getBusinessNumber());
|
|
|
|
+ record.setFlowNumber(relieve.getFlowNumber());
|
|
|
|
+ record.setTableId(relieve.getId());
|
|
|
|
+ record.setApprovalTime(approval.getApprovalTime());
|
|
|
|
+ record.setApprovalRemark(approval.getRemark());
|
|
|
|
+ record.setCreateTime(record.getApprovalTime());
|
|
|
|
+ record.setUpdateTime(record.getApprovalTime());
|
|
|
|
+ record.setDelFlag(1);
|
|
|
|
+ if (StringUtils.isEmpty(approval.getApprovalStatus())) {
|
|
|
|
+ record.setNodeName("申请节点");
|
|
|
|
+ record.setApprover(relieve.getOrgName() + "(" + approval.getApprover() + ")");
|
|
|
|
+ } else {
|
|
|
|
+ record.setNodeName(approval.getNodeName());
|
|
|
|
+ record.setApprover("监管部门(" + approval.getApprover() + ")");
|
|
|
|
+ if (approval.getApprovalStatus().equals("1")) {
|
|
|
|
+ record.setApprovalStatus(1);
|
|
} else {
|
|
} else {
|
|
- record.setNodeName(sFlow.getLcmc());
|
|
|
|
- record.setApprover("监管部门(" + sFlow.getShr() + ")");
|
|
|
|
- if (sFlow.getShzt() == 1) {
|
|
|
|
- record.setApprovalStatus(1);
|
|
|
|
- } else {
|
|
|
|
- record.setApprovalStatus(2);
|
|
|
|
- }
|
|
|
|
|
|
+ record.setApprovalStatus(2);
|
|
}
|
|
}
|
|
- recordList.add(record);
|
|
|
|
|
|
+ }
|
|
|
|
+ approvalRecords.add(record);
|
|
|
|
+ }
|
|
|
|
+ flowMapper.insertRecordBatch(approvalRecords);
|
|
|
|
+
|
|
|
|
+ // ------------------------------ 监管账户解除 ----------------------------------
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 查询oracle监管账户,根据监管账户查询mysql账户信息,声明监管账户解除业务并插入mysql,更新账户表账户解除日期
|
|
|
|
+ */
|
|
|
|
+ List<OracleAccount> oracleAccounts = applyMapper.selectRelieveSuperviseAccount(oracleRelieve.getAppId());
|
|
|
|
+
|
|
|
|
+ for (OracleAccount oracleAccount : oracleAccounts) {
|
|
|
|
+ if (oracleAccount != null && StringUtils.isEmpty(oracleAccount.getAccount())) {
|
|
|
|
+ Account account = accountMapper.selectByAccountNO(oracleAccount.getAccount());
|
|
|
|
+ SuperviseRelieve superviseRelieve = new SuperviseRelieve(account, org, project, oracleRelieve);
|
|
|
|
+ mySqlMapper.insertSuperviseRelieve(oracleAccount.getAccount());
|
|
|
|
+ // 更新账户解除日期
|
|
|
|
+ accountMapper.updateCancelDate(account.getId(), superviseRelieve.getUpdateTime());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- mySqlMapper.insertSuperviseRelieve(superviseRelieveList);
|
|
|
|
- recordList.forEach(item -> System.out.println(">>>>>> item ===" + item));
|
|
|
|
- flowMapper.insertRecordBatch(recordList);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|