dev
luotaiqian 2026-08-04 17:17:53 +08:00
parent 32cdda3115
commit 30f5df84d4
1 changed files with 25 additions and 14 deletions

View File

@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.qinan.safetyeval.client.api.QualFilingExpertApi;
import org.qinan.safetyeval.client.co.QualFilingExpertCO;
import org.qinan.safetyeval.client.dto.*;
import org.qinan.safetyeval.domain.entity.OrgPersonnelEntity;
import org.qinan.safetyeval.domain.entity.QualFilingExpertEntity;
import org.qinan.safetyeval.domain.query.PageResult;
import org.qinan.safetyeval.domain.query.QualFilingExpertQuery;
@ -60,20 +61,7 @@ public class QualFilingExpertExecutor implements QualFilingExpertApi {
@Transactional(rollbackFor = Exception.class)
public SingleResponse<QualFilingExpertCO> add(QualFilingExpertAddCmd cmd) {
// 添加底座用户
UserAddCmd userAddCmd = new UserAddCmd();
userAddCmd.setAccount(cmd.getAccount());
userAddCmd.setTenantId(AuthContext.getTenantId());
userAddCmd.setName(cmd.getUserName());
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey);
userAddCmd.setPassword(encrypt);
RoleDeptAddCmd roleDept = new RoleDeptAddCmd();
roleDept.setRoleCode(authRoleCodeExpert);
roleDept.setDeptId(expertDeptId);
userAddCmd.setRoleDepts(Collections.singletonList(roleDept));
Long userId = systemRemote.addUserIfAbsentAndAppendRole(userAddCmd
, Collections.singletonList(authRoleCodeExpert));
Long userId = addUserIfAbsentAndAppendRole(cmd);
// 添加专家
QualFilingExpertEntity entity = new QualFilingExpertEntity();
@ -88,6 +76,29 @@ public class QualFilingExpertExecutor implements QualFilingExpertApi {
return SingleResponse.success(toCO(result));
}
/**
* addUserIfAbsentAndAppendRole
*
* @return Long
*/
public Long addUserIfAbsentAndAppendRole(QualFilingExpertAddCmd personnelEntity) {
// 添加底座用户
UserAddCmd userAddCmd = new UserAddCmd();
userAddCmd.setAccount(personnelEntity.getAccount());
userAddCmd.setTenantId(AuthContext.getTenantId());
userAddCmd.setName(personnelEntity.getUserName());
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey);
userAddCmd.setPassword(encrypt);
RoleDeptAddCmd roleDept = new RoleDeptAddCmd();
roleDept.setRoleCode(authRoleCodeExpert);
roleDept.setDeptId(expertDeptId);
userAddCmd.setRoleDepts(Collections.singletonList(roleDept));
return systemRemote.addUserIfAbsentAndAppendRole(userAddCmd
, Collections.singletonList(authRoleCodeExpert));
}
@Override
public SingleResponse<QualFilingExpertCO> get(Long id) {
QualFilingExpertEntity entity = qualFilingExpertDomainService.get(id);