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

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

parent 927adf84
......@@ -113,13 +113,14 @@ public class DemoWebApiController {
for (WindowEntity windowEntity : windowEntities) {
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 (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());
windowEntity.setDeptId(deptEntity.getId());
windowService.getDao().update(windowEntity);
WindowEntity temp = new WindowEntity();
temp.setId(windowEntity.getId());
temp.setDeptId(deptEntity.getId());
windowService.getDao().update(temp);
// windowService.update(windowEntity);
}
......@@ -128,12 +129,14 @@ public class DemoWebApiController {
//更新窗口事项中的部门id
List<WindowMatterEntity> windowMatterEntities = windowMatterService.find(new WindowMatterQuery());
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 (deptEntity.getId() != windowMatterEntity.getDeptId()) {
windowMatterEntity.setDeptId(deptEntity.getId());
windowMatterEntity.setDeptCode(deptEntity.getDeptNumber());
windowMatterService.getDao().update(windowMatterEntity);
if (deptEntity.getId() != windowMatterEntity.getDeptId()&&windowMatterEntity.getDeptName().trim().equals(deptEntity.getName())) {
WindowMatterEntity temp = new WindowMatterEntity();
temp.setId(windowMatterEntity.getId());
temp.setDeptId(deptEntity.getId());
temp.setDeptCode(deptEntity.getDeptNumber());
windowMatterService.getDao().update(temp);
// windowMatterService.update(windowMatterEntity);
}
}
......@@ -141,13 +144,14 @@ public class DemoWebApiController {
List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(new SiteMatterQuery());
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 (deptEntity.getId() != siteMatterEntity.getDeptId()) {
siteMatterEntity.setDeptId(deptEntity.getId());
siteMatterEntity.setDeptCode(deptEntity.getDeptNumber());
siteMatterService.getDao().update(siteMatterEntity);
if (deptEntity.getId() != siteMatterEntity.getDeptId()&&siteMatterEntity.getDeptName().trim().equals(deptEntity.getName().trim())) {
SiteMatterEntity temp = new SiteMatterEntity();
temp.setId(siteMatterEntity.getId());
temp.setDeptId(deptEntity.getId());
temp.setDeptCode(deptEntity.getDeptNumber());
siteMatterService.getDao().update(temp);
//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