Commit febeb799 authored by 赵啸非's avatar 赵啸非

修改根据业务查询部门逻辑

parent be4fc0cd
...@@ -116,6 +116,7 @@ public class DemoWebApiController { ...@@ -116,6 +116,7 @@ public class DemoWebApiController {
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(deptName)); DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(deptName));
if (!ObjectUtils.isEmpty(deptEntity)) { if (!ObjectUtils.isEmpty(deptEntity)) {
if (deptEntity.getId() != windowEntity.getDeptId()) { if (deptEntity.getId() != windowEntity.getDeptId()) {
log.info("部门:{},更新部门id:orgin deptId:{} ,updateDeptId:{}", deptName, windowEntity.getDeptId(), deptEntity.getId());
windowEntity.setDeptId(deptEntity.getId()); windowEntity.setDeptId(deptEntity.getId());
windowService.update(windowEntity); windowService.update(windowEntity);
} }
...@@ -124,25 +125,24 @@ public class DemoWebApiController { ...@@ -124,25 +125,24 @@ public class DemoWebApiController {
//更新窗口事项中的部门id //更新窗口事项中的部门id
List<WindowMatterEntity> windowMatterEntities = windowMatterService.find(new WindowMatterQuery()); List<WindowMatterEntity> windowMatterEntities = windowMatterService.find(new WindowMatterQuery());
for (WindowMatterEntity windowMatterEntity : windowMatterEntities) { for (WindowMatterEntity windowMatterEntity : windowMatterEntities) {
if(!ObjectUtils.isEmpty(windowMatterEntity.getDeptCode())){ DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(windowMatterEntity.getDeptName()));
DeptEntity extCache = deptService.getExtCache(windowMatterEntity.getDeptCode()); if (!ObjectUtils.isEmpty(deptEntity)) {
if (!ObjectUtils.isEmpty(extCache)) { if (deptEntity.getId() != windowMatterEntity.getDeptId()) {
if (extCache.getId() != windowMatterEntity.getDeptId()) { windowMatterEntity.setDeptId(deptEntity.getId());
windowMatterEntity.setDeptId(extCache.getId()); windowMatterEntity.setDeptCode(deptEntity.getDeptNumber());
windowMatterService.update(windowMatterEntity); windowMatterService.update(windowMatterEntity);
}
} }
} }
} }
List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(new SiteMatterQuery()); List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(new SiteMatterQuery());
for (SiteMatterEntity siteMatterEntity : siteMatterEntities) { for (SiteMatterEntity siteMatterEntity : siteMatterEntities) {
if(ObjectUtils.isEmpty(siteMatterEntity.getDeptCode())) continue; if (ObjectUtils.isEmpty(siteMatterEntity.getDeptCode())) continue;
DeptEntity extCache = deptService.getExtCache(siteMatterEntity.getDeptCode()); DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(siteMatterEntity.getDeptName()));
if (!ObjectUtils.isEmpty(extCache)) { if (!ObjectUtils.isEmpty(deptEntity)) {
if (extCache.getId() != siteMatterEntity.getDeptId()) { if (deptEntity.getId() != siteMatterEntity.getDeptId()) {
siteMatterEntity.setDeptId(extCache.getId()); siteMatterEntity.setDeptId(deptEntity.getId());
siteMatterEntity.setDeptCode(deptEntity.getDeptNumber());
siteMatterService.update(siteMatterEntity); siteMatterService.update(siteMatterEntity);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment