Commit 917f4e27 authored by 赵啸非's avatar 赵啸非

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

parent 927adf84
...@@ -113,13 +113,14 @@ public class DemoWebApiController { ...@@ -113,13 +113,14 @@ public class DemoWebApiController {
for (WindowEntity windowEntity : windowEntities) { for (WindowEntity windowEntity : windowEntities) {
String deptName = windowEntity.getDeptName(); String deptName = windowEntity.getDeptName();
//根据部门名称查询部门 //根据部门名称查询部门
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()&&deptEntity.getName().trim().equals(windowEntity.getDeptName().trim())) {
log.info("部门:{},更新部门id:orgin deptId:{} ,updateDeptId:{}", deptName, windowEntity.getDeptId(), deptEntity.getId()); log.info("部门:{},更新部门id:orgin deptId:{} ,updateDeptId:{}", deptName, windowEntity.getDeptId(), deptEntity.getId());
windowEntity.setDeptId(deptEntity.getId()); WindowEntity temp = new WindowEntity();
temp.setId(windowEntity.getId());
windowService.getDao().update(windowEntity); temp.setDeptId(deptEntity.getId());
windowService.getDao().update(temp);
// windowService.update(windowEntity); // windowService.update(windowEntity);
} }
...@@ -128,12 +129,14 @@ public class DemoWebApiController { ...@@ -128,12 +129,14 @@ 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) {
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(windowMatterEntity.getDeptName())); DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(windowMatterEntity.getDeptName()+"%"));
if (!ObjectUtils.isEmpty(deptEntity)) { if (!ObjectUtils.isEmpty(deptEntity)) {
if (deptEntity.getId() != windowMatterEntity.getDeptId()) { if (deptEntity.getId() != windowMatterEntity.getDeptId()&&windowMatterEntity.getDeptName().trim().equals(deptEntity.getName())) {
windowMatterEntity.setDeptId(deptEntity.getId()); WindowMatterEntity temp = new WindowMatterEntity();
windowMatterEntity.setDeptCode(deptEntity.getDeptNumber()); temp.setId(windowMatterEntity.getId());
windowMatterService.getDao().update(windowMatterEntity); temp.setDeptId(deptEntity.getId());
temp.setDeptCode(deptEntity.getDeptNumber());
windowMatterService.getDao().update(temp);
// windowMatterService.update(windowMatterEntity); // windowMatterService.update(windowMatterEntity);
} }
} }
...@@ -141,13 +144,14 @@ public class DemoWebApiController { ...@@ -141,13 +144,14 @@ public class DemoWebApiController {
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; DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(siteMatterEntity.getDeptName()+"%"));
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(siteMatterEntity.getDeptName()));
if (!ObjectUtils.isEmpty(deptEntity)) { if (!ObjectUtils.isEmpty(deptEntity)) {
if (deptEntity.getId() != siteMatterEntity.getDeptId()) { if (deptEntity.getId() != siteMatterEntity.getDeptId()&&siteMatterEntity.getDeptName().trim().equals(deptEntity.getName().trim())) {
siteMatterEntity.setDeptId(deptEntity.getId()); SiteMatterEntity temp = new SiteMatterEntity();
siteMatterEntity.setDeptCode(deptEntity.getDeptNumber()); temp.setId(siteMatterEntity.getId());
siteMatterService.getDao().update(siteMatterEntity); temp.setDeptId(deptEntity.getId());
temp.setDeptCode(deptEntity.getDeptNumber());
siteMatterService.getDao().update(temp);
//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