|
@@ -12,7 +12,9 @@ import com.ktg.common.enums.BusinessType;
|
|
|
import com.ktg.common.utils.SecurityUtils;
|
|
import com.ktg.common.utils.SecurityUtils;
|
|
|
import com.ktg.common.utils.StringUtils;
|
|
import com.ktg.common.utils.StringUtils;
|
|
|
import com.ktg.common.utils.poi.ExcelUtil;
|
|
import com.ktg.common.utils.poi.ExcelUtil;
|
|
|
|
|
+import com.ktg.iscs.domain.IsUserUnit;
|
|
|
import com.ktg.iscs.domain.IsUserWorkstation;
|
|
import com.ktg.iscs.domain.IsUserWorkstation;
|
|
|
|
|
+import com.ktg.iscs.service.IIsUserUnitService;
|
|
|
import com.ktg.iscs.service.IIsUserWorkstationService;
|
|
import com.ktg.iscs.service.IIsUserWorkstationService;
|
|
|
import com.ktg.system.service.ISysPostService;
|
|
import com.ktg.system.service.ISysPostService;
|
|
|
import com.ktg.system.service.ISysRoleService;
|
|
import com.ktg.system.service.ISysRoleService;
|
|
@@ -52,6 +54,8 @@ public class SysUserController extends BaseController
|
|
|
private ISysPostService postService;
|
|
private ISysPostService postService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IIsUserWorkstationService iIsUserWorkstationService;
|
|
private IIsUserWorkstationService iIsUserWorkstationService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IIsUserUnitService iIsUserUnitService;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -114,6 +118,7 @@ public class SysUserController extends BaseController
|
|
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
|
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
|
|
ajax.put("workstationIds", iIsUserWorkstationService.selectWorkstationListByUserId(userId));
|
|
ajax.put("workstationIds", iIsUserWorkstationService.selectWorkstationListByUserId(userId));
|
|
|
|
|
+ ajax.put("unitIds", iIsUserUnitService.getUnitIds(userId));
|
|
|
}
|
|
}
|
|
|
return ajax;
|
|
return ajax;
|
|
|
}
|
|
}
|
|
@@ -155,6 +160,17 @@ public class SysUserController extends BaseController
|
|
|
}
|
|
}
|
|
|
iIsUserWorkstationService.saveBatch(isUserWorkstations);
|
|
iIsUserWorkstationService.saveBatch(isUserWorkstations);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 关联单位
|
|
|
|
|
+ if (user.getUnitIds() != null && user.getUnitIds().length > 0) {
|
|
|
|
|
+ ArrayList<IsUserUnit> userUnits = new ArrayList<>();
|
|
|
|
|
+ for (Long unitId : user.getUnitIds()) {
|
|
|
|
|
+ IsUserUnit isUserUnit = new IsUserUnit();
|
|
|
|
|
+ isUserUnit.setUserId(user.getUserId());
|
|
|
|
|
+ isUserUnit.setUnitId(unitId);
|
|
|
|
|
+ userUnits.add(isUserUnit);
|
|
|
|
|
+ }
|
|
|
|
|
+ iIsUserUnitService.saveBatch(userUnits);
|
|
|
|
|
+ }
|
|
|
return toAjax(true);
|
|
return toAjax(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -185,7 +201,7 @@ public class SysUserController extends BaseController
|
|
|
if (user.getWorkstationIds() != null && user.getWorkstationIds().length > 0) {
|
|
if (user.getWorkstationIds() != null && user.getWorkstationIds().length > 0) {
|
|
|
iIsUserWorkstationService.remove(Wrappers.<IsUserWorkstation>lambdaQuery()
|
|
iIsUserWorkstationService.remove(Wrappers.<IsUserWorkstation>lambdaQuery()
|
|
|
.eq(IsUserWorkstation::getUserId, user.getUserId()));
|
|
.eq(IsUserWorkstation::getUserId, user.getUserId()));
|
|
|
- ArrayList<IsUserWorkstation> isUserWorkstations = new ArrayList<>();
|
|
|
|
|
|
|
+ List<IsUserWorkstation> isUserWorkstations = new ArrayList<>();
|
|
|
for (Long workstationId : user.getWorkstationIds()) {
|
|
for (Long workstationId : user.getWorkstationIds()) {
|
|
|
IsUserWorkstation isUserWorkstation = new IsUserWorkstation();
|
|
IsUserWorkstation isUserWorkstation = new IsUserWorkstation();
|
|
|
isUserWorkstation.setUserId(user.getUserId());
|
|
isUserWorkstation.setUserId(user.getUserId());
|
|
@@ -194,6 +210,19 @@ public class SysUserController extends BaseController
|
|
|
}
|
|
}
|
|
|
iIsUserWorkstationService.saveBatch(isUserWorkstations);
|
|
iIsUserWorkstationService.saveBatch(isUserWorkstations);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 关联单位
|
|
|
|
|
+ if (user.getUnitIds() != null && user.getUnitIds().length > 0) {
|
|
|
|
|
+ iIsUserUnitService.remove(Wrappers.<IsUserUnit>lambdaQuery()
|
|
|
|
|
+ .eq(IsUserUnit::getUserId, user.getUserId()));
|
|
|
|
|
+ List<IsUserUnit> userUnits = new ArrayList<>();
|
|
|
|
|
+ for (Long unitId : user.getUnitIds()) {
|
|
|
|
|
+ IsUserUnit isUserUnit = new IsUserUnit();
|
|
|
|
|
+ isUserUnit.setUserId(user.getUserId());
|
|
|
|
|
+ isUserUnit.setUnitId(unitId);
|
|
|
|
|
+ userUnits.add(isUserUnit);
|
|
|
|
|
+ }
|
|
|
|
|
+ iIsUserUnitService.saveBatch(userUnits);
|
|
|
|
|
+ }
|
|
|
return toAjax(true);
|
|
return toAjax(true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -216,6 +245,11 @@ public class SysUserController extends BaseController
|
|
|
iIsUserWorkstationService.remove(Wrappers.<IsUserWorkstation>lambdaQuery()
|
|
iIsUserWorkstationService.remove(Wrappers.<IsUserWorkstation>lambdaQuery()
|
|
|
.in(IsUserWorkstation::getUserId, userIds));
|
|
.in(IsUserWorkstation::getUserId, userIds));
|
|
|
}
|
|
}
|
|
|
|
|
+ // 关联单位
|
|
|
|
|
+ if (userIds.length > 0) {
|
|
|
|
|
+ iIsUserUnitService.remove(Wrappers.<IsUserUnit>lambdaQuery()
|
|
|
|
|
+ .in(IsUserUnit::getUserId, userIds));
|
|
|
|
|
+ }
|
|
|
return toAjax(true);
|
|
return toAjax(true);
|
|
|
}
|
|
}
|
|
|
|
|
|