|
@@ -112,8 +112,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
@Resource
|
|
|
private BizOrgService bizOrgService;
|
|
|
|
|
|
-// @Resource
|
|
|
-// private BizUploadImage uploadImage;
|
|
|
+ @Resource
|
|
|
+ private UploadImage uploadImage;
|
|
|
|
|
|
@Override
|
|
|
public Page<BizUser> page(BizUserPageParam bizUserPageParam) {
|
|
@@ -122,8 +122,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
queryWrapper.lambda().and(q -> q.like(BizUser::getAccount, bizUserPageParam.getSearchKey())
|
|
|
.or().like(BizUser::getName, bizUserPageParam.getSearchKey()));
|
|
|
}
|
|
|
- if (ObjectUtil.isNotEmpty(bizUserPageParam.getOrgId())) {
|
|
|
- queryWrapper.lambda().eq(BizUser::getOrgId, bizUserPageParam.getOrgId());
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserPageParam.getParentId())) {
|
|
|
+ queryWrapper.lambda().eq(BizUser::getOrgId, bizUserPageParam.getParentId());
|
|
|
}
|
|
|
if (ObjectUtil.isNotEmpty(bizUserPageParam.getUserStatus())) {
|
|
|
queryWrapper.lambda().eq(BizUser::getUserStatus, bizUserPageParam.getUserStatus());
|
|
@@ -151,11 +151,26 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
@Override
|
|
|
public void add(String empNo, String account, String name, String orgId, String departmentId, String workLocationId, String nickname, String gender, String homeAddress, String detailAddress, String idCardNumber, String phone, String emergencyPhone, String entryDate, MultipartFile avatar) throws IOException {
|
|
|
checkParam(empNo,account,phone,orgId);
|
|
|
+
|
|
|
BizUser bizUser = new BizUser();
|
|
|
bizUser.setEmpNo(empNo);
|
|
|
bizUser.setAccount(account);
|
|
|
+
|
|
|
bizUser.setName(name);
|
|
|
bizUser.setOrgId(orgId);
|
|
|
+ BizOrg bizOrg = bizOrgService.getById(orgId);
|
|
|
+ if ("0".equals(bizOrg.getParentId())){
|
|
|
+ List<BizOrg> bizOrgs = bizOrgService.list(new QueryWrapper<BizOrg>().lambda().eq(BizOrg::getParentId, orgId));
|
|
|
+ if (ObjectUtil.isNotEmpty(bizOrgs)){
|
|
|
+ bizUser.setLastLoginOrgId(bizOrgs.get(0).getId());
|
|
|
+ }
|
|
|
+ bizUser.setAccountType(1);
|
|
|
+ bizUser.setPlatformType(1);
|
|
|
+ }else {
|
|
|
+ bizUser.setLastLoginOrgId(orgId);
|
|
|
+ bizUser.setAccountType(2);
|
|
|
+ bizUser.setPlatformType(2);
|
|
|
+ }
|
|
|
bizUser.setDepartmentId(departmentId);
|
|
|
bizUser.setWorkLocationId(workLocationId);
|
|
|
bizUser.setNickname(nickname);
|
|
@@ -166,11 +181,11 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
bizUser.setPhone(phone);
|
|
|
bizUser.setEmergencyPhone(emergencyPhone);
|
|
|
bizUser.setEntryDate(entryDate);
|
|
|
-// String avatarUrl = uploadImage.getImageCom(avatar);
|
|
|
-// if (avatarUrl.equals("上传失败")){
|
|
|
-// throw new CommonException("图片上传失败!");
|
|
|
-// }
|
|
|
-// bizUser.setAvatar(avatarUrl);
|
|
|
+ String avatarUrl = uploadImage.getImageCom(avatar);
|
|
|
+ if (avatarUrl.equals("上传失败")){
|
|
|
+ throw new CommonException("图片上传失败!");
|
|
|
+ }
|
|
|
+ bizUser.setAvatar(avatarUrl);
|
|
|
// 设置密码
|
|
|
bizUser.setPassword(CommonCryptogramUtil.doHashValue(devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_PASSWORD_KEY)));
|
|
|
// 设置状态
|
|
@@ -224,8 +239,16 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
bizUser.setAccount(account);
|
|
|
bizUser.setName(name);
|
|
|
bizUser.setOrgId(orgId);
|
|
|
- bizUser.setDepartmentId(departmentId);
|
|
|
- bizUser.setWorkLocationId(workLocationId);
|
|
|
+ BizOrg bizOrg = bizOrgService.getById(orgId);
|
|
|
+ if ("0".equals(bizOrg.getParentId())){
|
|
|
+ bizUser.setAccountType(1);
|
|
|
+ bizUser.setDepartmentId(null);
|
|
|
+ bizUser.setWorkLocationId(null);
|
|
|
+ }else {
|
|
|
+ bizUser.setAccountType(2);
|
|
|
+ bizUser.setDepartmentId(departmentId);
|
|
|
+ bizUser.setWorkLocationId(workLocationId);
|
|
|
+ }
|
|
|
bizUser.setNickname(nickname);
|
|
|
bizUser.setGender(gender);
|
|
|
bizUser.setHomeAddress(homeAddress);
|
|
@@ -234,14 +257,13 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
bizUser.setPhone(phone);
|
|
|
bizUser.setEmergencyPhone(emergencyPhone);
|
|
|
bizUser.setEntryDate(entryDate);
|
|
|
-// if (ObjectUtil.isNotEmpty(avatar)){
|
|
|
-// String avatarUrl = uploadImage.getImageCom(avatar);
|
|
|
-// if (avatarUrl.equals("上传失败")){
|
|
|
-// throw new CommonException("图片上传失败!");
|
|
|
-// }
|
|
|
-// bizUser.setAvatar(avatarUrl);
|
|
|
-// }
|
|
|
-
|
|
|
+ if (ObjectUtil.isNotEmpty(avatar)){
|
|
|
+ String avatarUrl = uploadImage.getImageCom(avatar);
|
|
|
+ if (avatarUrl.equals("上传失败")){
|
|
|
+ throw new CommonException("图片上传失败!");
|
|
|
+ }
|
|
|
+ bizUser.setAvatar(avatarUrl);
|
|
|
+ }
|
|
|
this.updateById(bizUser);
|
|
|
|
|
|
// 发布更新事件
|
|
@@ -604,6 +626,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
|
|
|
@Override
|
|
|
public List<Tree<String>> orgTreeSelector() {
|
|
|
+ String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
|
|
|
LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
// 校验数据范围
|
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
@@ -612,7 +635,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
// 获取所有机构
|
|
|
List<BizOrg> allOrgList = bizOrgService.list();
|
|
|
- loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId, true)));
|
|
|
+ loginUserDataScope.forEach(orgId1 -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId1, true)));
|
|
|
List<String> loginUserDataScopeFullList = bizOrgSet.stream().map(BizOrg::getId).collect(Collectors.toList());
|
|
|
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScopeFullList);
|
|
|
} else {
|
|
@@ -706,4 +729,18 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
|
lambdaQueryWrapper.orderByAsc(BizUser::getSortCode);
|
|
|
return this.page(CommonPageRequest.defaultPage(), lambdaQueryWrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateLastLoginOrgId(BizUserLastLoginParam bizUserLastLoginParam) {
|
|
|
+ BizUser bizUser = this.queryEntity(bizUserLastLoginParam.getId());
|
|
|
+ bizUser.setLastLoginOrgId(bizUserLastLoginParam.getCutId());
|
|
|
+ this.updateById(bizUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updatePlatformType(BizUserPlatformParam bizUserPlatformParam) {
|
|
|
+ BizUser bizUser = this.queryEntity(bizUserPlatformParam.getId());
|
|
|
+ bizUser.setPlatformType(bizUserPlatformParam.getPlatformType());
|
|
|
+ this.updateById(bizUser);
|
|
|
+ }
|
|
|
}
|