|
|
@@ -108,65 +108,59 @@ public class JobTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // TODO: 2024-9-25 从广联达获取mdm项目
|
|
|
protected void pullProjectFromGldMaster() throws Exception {
|
|
|
-// Connection connection = null;
|
|
|
-// try {
|
|
|
-// connection = dataSource.getConnection();
|
|
|
-// connection.setAutoCommit(false);
|
|
|
-//
|
|
|
-// List<GldProject> existGLDList = jdbcClient.getJdbcList(new HashMap<>(), GldProject.class, connection);
|
|
|
-// List<ProjectInfo> existProjList = jdbcClient.getJdbcList(new HashMap<>(), ProjectInfo.class, connection);
|
|
|
-// List<GldProject> list = gldMasterService.getGetProject();
|
|
|
-// for (GldProject model : list) {
|
|
|
-// List<GldProject> filterList = existGLDList.stream().filter(exist -> model.getId().equals(exist.getId()))
|
|
|
-// .collect(Collectors.toList());
|
|
|
-// if (filterList.size() > 0) {
|
|
|
-// jdbcClient.jdbcUpdateById(model, connection);
|
|
|
-// } else {
|
|
|
-// jdbcClient.jdbcInsert(model, connection);
|
|
|
-// }
|
|
|
-// List<ProjectInfo> filterProjList = existProjList.stream()
|
|
|
-// .filter(exist -> model.getId().equals(exist.getId())).collect(Collectors.toList());
|
|
|
-// ProjectInfo info = new ProjectInfo();
|
|
|
-// info.setId(model.getId());
|
|
|
-// info.setProjectAddr(model.getAddress());
|
|
|
-// info.setProjectName(model.getProjectName());
|
|
|
-// info.setProjectNo(model.getCode());
|
|
|
-// if (model.getActive()) {
|
|
|
-// info.setProjectStatus("active");
|
|
|
-// } else {
|
|
|
-// info.setProjectStatus("inactive");
|
|
|
-// }
|
|
|
-// info.setGldProjectId(null);
|
|
|
-// GldDept gldDept = new GldDept();
|
|
|
-// gldDept.setId(model.getDeptId());
|
|
|
-// gldDept = jdbcClient.getJdbcModel(gldDept, connection);
|
|
|
-// if (StringUtil.isEmpty(gldDept.getCode())) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// SysDept dept = new SysDept();
|
|
|
-// dept.setCode(gldDept.getCode());
|
|
|
-// dept = jdbcClient.getJdbcModel(dept, connection);
|
|
|
-// if (StringUtil.isEmpty(dept.getDeptId())) {
|
|
|
-// info.setDeptId((long) 1);
|
|
|
-// } else {
|
|
|
-// info.setDeptId(dept.getDeptId());
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (filterProjList.size() > 0) {
|
|
|
-// jdbcClient.jdbcUpdateById(info, connection);
|
|
|
-// } else {
|
|
|
-// jdbcClient.jdbcInsert(info, connection);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// connection.commit();
|
|
|
-// } catch (Exception e) {
|
|
|
-// connection.rollback();
|
|
|
-// throw e;
|
|
|
-// } finally {
|
|
|
-// jdbcClient.finallyExecute(connection);
|
|
|
-// }
|
|
|
+ Connection connection = null;
|
|
|
+ try {
|
|
|
+ connection = dataSource.getConnection();
|
|
|
+ connection.setAutoCommit(false);
|
|
|
+
|
|
|
+ List<GldMdmProject> existGLDList = jdbcClient.getJdbcList(new HashMap<>(), GldMdmProject.class, connection);
|
|
|
+ List<ProjectInfo> existProjList = jdbcClient.getJdbcList(new HashMap<>(), ProjectInfo.class, connection);
|
|
|
+ List<GldMdmProject> list = gldMasterService.getGetMDMProject();
|
|
|
+ for (GldMdmProject model : list) {
|
|
|
+ List<GldMdmProject> filterList = existGLDList.stream().filter(exist -> model.getId().equals(exist.getId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (filterList.size() > 0) {
|
|
|
+ jdbcClient.jdbcUpdateById(model, connection);
|
|
|
+ } else {
|
|
|
+ jdbcClient.jdbcInsert(model, connection);
|
|
|
+ }
|
|
|
+ List<ProjectInfo> filterProjList = existProjList.stream()
|
|
|
+ .filter(exist -> model.getProjectCode().equals(exist.getProjectNo())).collect(Collectors.toList());
|
|
|
+ ProjectInfo info = new ProjectInfo();
|
|
|
+ info.setProjectName(model.getProjectName());
|
|
|
+ info.setProjectNo(model.getProjectCode());
|
|
|
+ if (StringUtil.isNotEmpty(model.getStatus())&&"1".equals(model.getStatus())) {
|
|
|
+ info.setProjectStatus("active");
|
|
|
+ } else {
|
|
|
+ info.setProjectStatus("inactive");
|
|
|
+ }
|
|
|
+ info.setGldProjectId(model.getGlodonProjectId());
|
|
|
+
|
|
|
+ SysDept dept = new SysDept();
|
|
|
+ dept.setCode(model.getProjectBelongingUnit());
|
|
|
+ dept = jdbcClient.getJdbcModel(dept, connection);
|
|
|
+ if (StringUtil.isEmpty(dept.getDeptId())) {
|
|
|
+ info.setDeptId((long) 1);
|
|
|
+ } else {
|
|
|
+ info.setDeptId(dept.getDeptId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (filterProjList.size() > 0) {
|
|
|
+ info.setId(filterProjList.get(0).getId());
|
|
|
+ jdbcClient.jdbcUpdateById(info, connection);
|
|
|
+ } else {
|
|
|
+ info.setId((long)0);
|
|
|
+ jdbcClient.jdbcInsert(info, connection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ connection.commit();
|
|
|
+ } catch (Exception e) {
|
|
|
+ connection.rollback();
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ jdbcClient.finallyExecute(connection);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
protected void pullTenantFromGldMaster() throws Exception {
|