Commit c1bcd2a86ddb5274583908eae6110613a161cf6d
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/DataImportTaskServiceImpl.java
View file @
c1bcd2a
| ... | ... | @@ -84,7 +84,7 @@ |
| 84 | 84 | for (Map map:list) { |
| 85 | 85 | try { |
| 86 | 86 | // organization |
| 87 | - if (StringUtils.isBlank(organization.getForeignId()) || !organization.getForeignId().equals(map.get("H_ID"))) { | |
| 87 | + if (StringUtils.isBlank(organization.getForeignId()) || !map.get("H_ID").equals(organization.getForeignId())) { | |
| 88 | 88 | if (!organizationMap.containsKey(map.get("H_ID").toString())) { |
| 89 | 89 | organization = new Organization(); |
| 90 | 90 | organization.setForeignId(map.get("H_ID").toString()); |
| ... | ... | @@ -105,12 +105,10 @@ |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Departments |
| 108 | - if (StringUtils.isBlank(departments.getForeignId()) || !departments.getForeignId().equals(map.get("D_ID"))) { | |
| 109 | - if (!organization.getDepartmentsMap().containsKey(map.get("D_ID").toString())) { | |
| 110 | - departments = new Departments(); | |
| 111 | - departments.setForeignId(map.get("D_ID").toString()); | |
| 112 | - organization.getDepartmentsMap().put(departments.getForeignId(), departments); | |
| 113 | - } | |
| 108 | + if (StringUtils.isBlank(departments.getForeignId()) || !map.get("D_ID").toString().equals(departments.getForeignId())) { | |
| 109 | + departments = new Departments(); | |
| 110 | + departments.setForeignId(map.get("D_ID").toString()); | |
| 111 | + organization.getDepartmentsMap().put(departments.getForeignId(), departments); | |
| 114 | 112 | departments.setPublishName("system"); |
| 115 | 113 | departments.setType(2); |
| 116 | 114 | departments.setPublishId(0); |
| ... | ... | @@ -122,12 +120,10 @@ |
| 122 | 120 | } |
| 123 | 121 | |
| 124 | 122 | // users |
| 125 | - if (StringUtils.isBlank(users.getForeignId()) || !users.getForeignId().equals(map.get("U_ID"))) { | |
| 126 | - if (!departments.getUsersMap().containsKey(map.get("U_ID").toString())) { | |
| 127 | - users = new Users(); | |
| 128 | - users.setForeignId(map.get("U_ID").toString()); | |
| 129 | - departments.getUsersMap().put(users.getForeignId(), users); | |
| 130 | - } | |
| 123 | + if (StringUtils.isBlank(users.getForeignId()) || !map.get("U_ID").toString().equals(users.getForeignId())) { | |
| 124 | + users = new Users(); | |
| 125 | + users.setForeignId(map.get("U_ID").toString()); | |
| 126 | + departments.getUsersMap().put(users.getForeignId(), users); | |
| 131 | 127 | users.setPublishId(0); |
| 132 | 128 | users.setPublishName("system"); |
| 133 | 129 | users.setOrgId(organization.getId()); |
| 134 | 130 | |
| 135 | 131 | |
| 136 | 132 | |
| 137 | 133 | |
| 138 | 134 | |
| 139 | 135 | |
| 140 | 136 | |
| 141 | 137 | |
| ... | ... | @@ -161,41 +157,44 @@ |
| 161 | 157 | UsersQuery usersQuery = new UsersQuery(); |
| 162 | 158 | for (Organization o:organizationMap.values()) { |
| 163 | 159 | try { |
| 164 | - organizationQuery.setForeignId(organization.getForeignId()); | |
| 160 | + organizationQuery.setForeignId(o.getForeignId()); | |
| 165 | 161 | List<Organization> organizationList = organizationService.queryOrganization(organizationQuery); |
| 166 | 162 | if (organizationList != null && organizationList.size() > 0) { |
| 167 | 163 | for (Organization odb:organizationList) { |
| 168 | - organization.setId(odb.getId()); | |
| 169 | - organizationService.updateOrganization(organization); | |
| 164 | + o.setId(odb.getId()); | |
| 165 | + organizationService.updateOrganization(o); | |
| 170 | 166 | } |
| 171 | 167 | } else { |
| 172 | - organization.setCreated(organization.getModified()); | |
| 173 | - organizationService.addOrganization(organization); | |
| 168 | + o.setCreated(o.getModified()); | |
| 169 | + organizationService.addOrganization(o); | |
| 174 | 170 | } |
| 175 | 171 | for (Departments d:organization.getDepartmentsMap().values()) { |
| 176 | - departments.setOrgId(organization.getId()); | |
| 177 | - departmentsQuery.setForeignId(departments.getForeignId()); | |
| 172 | + d.setOrgId(o.getId()); | |
| 173 | + departmentsQuery.setForeignId(d.getForeignId()); | |
| 178 | 174 | List<Departments> departmentsList = departmentsService.queryDepartments(departmentsQuery); |
| 179 | 175 | if (departmentsList != null && departmentsList.size() > 0) { |
| 180 | 176 | for (Departments dd:departmentsList) { |
| 181 | - departments.setId(dd.getId()); | |
| 182 | - departmentsService.updateDepartments(departments); | |
| 177 | + d.setId(dd.getId()); | |
| 178 | + departmentsService.updateDepartments(d); | |
| 183 | 179 | } |
| 184 | 180 | } else { |
| 185 | - departments.setCreated(departments.getModified()); | |
| 186 | - departmentsService.addDepartments(departments); | |
| 181 | + d.setCreated(d.getModified()); | |
| 182 | + departmentsService.addDepartments(d); | |
| 187 | 183 | } |
| 188 | 184 | for (Users u:departments.getUsersMap().values()) { |
| 189 | - usersQuery.setForeignId(users.getForeignId()); | |
| 185 | + u.setOrgId(o.getId()); | |
| 186 | + u.setDeptId(d.getId()); | |
| 187 | + u.setKsId(d.getId()); | |
| 188 | + usersQuery.setForeignId(u.getForeignId()); | |
| 190 | 189 | List<Users> usersList = usersService.queryUsers(usersQuery); |
| 191 | 190 | if (usersList != null && usersList.size() > 0) { |
| 192 | 191 | for (Users du:usersList) { |
| 193 | - users.setId(du.getId()); | |
| 194 | - usersService.updateUsers(users); | |
| 192 | + u.setId(du.getId()); | |
| 193 | + usersService.updateUsers(u); | |
| 195 | 194 | } |
| 196 | 195 | } else { |
| 197 | - users.setCreated(users.getModified()); | |
| 198 | - usersService.addUsers(users); | |
| 196 | + u.setCreated(u.getModified()); | |
| 197 | + usersService.addUsers(u); | |
| 199 | 198 | } |
| 200 | 199 | } |
| 201 | 200 | } |
platform-mommyData/src/main/resources/earlyOrm/Plat.xml
View file @
c1bcd2a