diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java index 9a7eb8ec6..03770e7f0 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileStationInfoServiceImpl.java @@ -307,7 +307,7 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { // 创建一个新的站点对应部门 SysDept dept = sysDeptService.createStationDept(Long.valueOf(merchantInfo.getDeptId()), pileStationInfo.getStationName(), pileStationInfo.getStationAdminName(), pileStationInfo.getStationTel()); - pileStationInfo.setDeptId(String.valueOf(dept.getDeptId())); + Long newDeptId = dept.getDeptId(); // 修改账号归属部门 SysUser user = new SysUser(); @@ -315,13 +315,16 @@ public class PileStationInfoServiceImpl implements IPileStationInfoService { List userList = userService.selectUserList(user); if (CollectionUtils.isNotEmpty(userList)) { for (SysUser sysUser : userList) { - sysUser.setDeptId(dept.getDeptId()); + sysUser.setDeptId(newDeptId); userService.updateUser(sysUser); } } // 逻辑删除老的部门 sysDeptService.deleteDeptById(Long.parseLong(pileStationInfo.getDeptId())); + + // 设置新部门id + pileStationInfo.setDeptId(String.valueOf(newDeptId)); } }