dev:人员导入(部门岗位反哺版)
parent
5c57c12ea4
commit
9b98f81d2c
|
|
@ -126,46 +126,6 @@ public class UserAddExe {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void importUserTable(MultipartFile file){
|
|
||||||
UserE userE = new UserE();
|
|
||||||
Long corpinfoId = AuthContext.getTenantId();
|
|
||||||
|
|
||||||
Map<String, Long> roleMap = userRepository.getRoleMap();
|
|
||||||
|
|
||||||
|
|
||||||
CorpInfoDO corpInfoDO = corpInfoRepository.getById(corpinfoId);
|
|
||||||
// 部门数据
|
|
||||||
List<DepartmentDO> departmentDOList = departmentRepository.listByCorpInfoId(corpinfoId);
|
|
||||||
// 岗位数据
|
|
||||||
List<PostDO> postDOList = postRepository.listByCorpInfoId(corpinfoId);
|
|
||||||
// 用户名数据
|
|
||||||
List<UserDO> userDOList = userRepository.listByCorpInfoId(corpinfoId);
|
|
||||||
// 企业端-人员类型字典
|
|
||||||
List<ConfDictTreeCO> confDictCOList = confDictTreeFacade.listByAppKeyAndParentIdTree("0bb989ecada5470c87635018ece9f327", 1986379731994513408L);
|
|
||||||
Map<String, String> dictMap = new HashMap<>();
|
|
||||||
if(CollectionUtil.isNotEmpty(confDictCOList)){
|
|
||||||
dictMap = confDictCOList.stream().collect(Collectors.toMap(ConfDictTreeCO::getDictLabel, ConfDictTreeCO::getDictValue));
|
|
||||||
}
|
|
||||||
List<UserE> userEList = userE.parseImportTemplateData(file,
|
|
||||||
BeanUtil.copyToList(departmentDOList, DepartmentE.class),
|
|
||||||
BeanUtil.copyToList(postDOList, PostE.class),
|
|
||||||
BeanUtil.copyToList(userDOList, UserE.class),
|
|
||||||
roleMap,
|
|
||||||
dictMap);
|
|
||||||
|
|
||||||
// 批量插入用户
|
|
||||||
for (UserE uE : userEList){
|
|
||||||
userGateway.add(uE);
|
|
||||||
String corpName = null;
|
|
||||||
if(corpInfoDO != null && !ObjectUtils.isEmpty(corpInfoDO.getCorpName())){
|
|
||||||
corpName = corpInfoDO.getCorpName();
|
|
||||||
}
|
|
||||||
UserEmploymentLogE userEmploymentLogE = new UserEmploymentLogE();
|
|
||||||
userEmploymentLogE.initAdd(userEmploymentLogE, corpName, userE.getId());
|
|
||||||
userEmploymentLogGateway.add(userEmploymentLogE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCorpInfo(CorpInfoAddCmd cmd) {
|
public void addCorpInfo(CorpInfoAddCmd cmd) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,9 @@ public class UserImportExe {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void importUserTable(MultipartFile file) {
|
public void importUserTable(MultipartFile file) {
|
||||||
Long corpinfoId = AuthContext.getTenantId();
|
Long corpinfoId = AuthContext.getTenantId();
|
||||||
|
if(corpinfoId == null){
|
||||||
|
throw new BizException("未选择租户");
|
||||||
|
}
|
||||||
|
|
||||||
CorpInfoDO corpInfoDO = corpInfoRepository.getById(corpinfoId);
|
CorpInfoDO corpInfoDO = corpInfoRepository.getById(corpinfoId);
|
||||||
// 角色数据
|
// 角色数据
|
||||||
|
|
@ -104,7 +107,6 @@ public class UserImportExe {
|
||||||
try {
|
try {
|
||||||
processSingleUser(importEntity, corpinfoId, corpInfoDO, departmentDOList, postDOList, userDOList, roleCOMultiResponse.getData());
|
processSingleUser(importEntity, corpinfoId, corpInfoDO, departmentDOList, postDOList, userDOList, roleCOMultiResponse.getData());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("导入用户失败: " + importEntity.getUsername());
|
|
||||||
throw new BizException("导入用户失败: " + importEntity.getUsername() + ", 原因: " + e.getMessage());
|
throw new BizException("导入用户失败: " + importEntity.getUsername() + ", 原因: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.basic.info.api.UserServiceI;
|
import com.zcloud.basic.info.api.UserServiceI;
|
||||||
import com.zcloud.basic.info.command.UserAddExe;
|
import com.zcloud.basic.info.command.UserAddExe;
|
||||||
|
import com.zcloud.basic.info.command.UserImportExe;
|
||||||
import com.zcloud.basic.info.command.UserRemoveExe;
|
import com.zcloud.basic.info.command.UserRemoveExe;
|
||||||
import com.zcloud.basic.info.command.UserUpdateExe;
|
import com.zcloud.basic.info.command.UserUpdateExe;
|
||||||
import com.zcloud.basic.info.command.query.UserQueryExe;
|
import com.zcloud.basic.info.command.query.UserQueryExe;
|
||||||
|
|
@ -32,6 +33,7 @@ public class UserServiceImpl implements UserServiceI {
|
||||||
private final UserUpdateExe userUpdateExe;
|
private final UserUpdateExe userUpdateExe;
|
||||||
private final UserRemoveExe userRemoveExe;
|
private final UserRemoveExe userRemoveExe;
|
||||||
private final UserQueryExe userQueryExe;
|
private final UserQueryExe userQueryExe;
|
||||||
|
private final UserImportExe userImportExe;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResponse<UserCO> listPage(UserPageQry qry) {
|
public PageResponse<UserCO> listPage(UserPageQry qry) {
|
||||||
|
|
@ -65,7 +67,7 @@ public class UserServiceImpl implements UserServiceI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importUserTable(MultipartFile file) {
|
public void importUserTable(MultipartFile file) {
|
||||||
userAddExe.importUserTable(file);
|
userImportExe.importUserTable(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue