zhanglei 2026-07-08 21:07:16 +08:00
parent 323a05bcfe
commit face3d5355
1 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jjb.saas.system.client.user.request.UserAddCmd; import com.jjb.saas.system.client.user.request.UserAddCmd;
import com.zcloud.gbscommon.utils.MD5; import com.zcloud.gbscommon.utils.MD5;
import com.zcloud.gbscommon.utils.Sm2Util; import com.zcloud.gbscommon.utils.Sm2Util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.qinan.safetyeval.client.api.AccountApi; import org.qinan.safetyeval.client.api.AccountApi;
import org.qinan.safetyeval.client.co.AccountCO; import org.qinan.safetyeval.client.co.AccountCO;
import org.qinan.safetyeval.client.dto.*; import org.qinan.safetyeval.client.dto.*;
@ -30,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
* @author safety-eval * @author safety-eval
*/ */
@Service @Service
@Slf4j
public class AccountExecutor implements AccountApi { public class AccountExecutor implements AccountApi {
@Lazy @Lazy
@ -118,10 +121,12 @@ public class AccountExecutor implements AccountApi {
userAddCmd.setAccount(result.getAccount()); userAddCmd.setAccount(result.getAccount());
userAddCmd.setTenantId(result.getTenantId()); userAddCmd.setTenantId(result.getTenantId());
userAddCmd.setName(result.getUserName()); userAddCmd.setName(result.getUserName());
if (result.getPassword() != null) { String pas = defPassword;
defPassword = result.getPassword(); if (StringUtils.isNotBlank(result.getPassword())) {
pas = result.getPassword();
} }
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey); log.info("同步用户密码:{}", pas);
String encrypt = Sm2Util.encryptHex(MD5.md5(pas), publicKey);
userAddCmd.setPassword(encrypt); userAddCmd.setPassword(encrypt);
try { try {
gbsUserFacadeClient.add(userAddCmd); gbsUserFacadeClient.add(userAddCmd);
@ -129,7 +134,7 @@ public class AccountExecutor implements AccountApi {
// 回滚数据, 清除account表示数据,orgInfo数据 // 回滚数据, 清除account表示数据,orgInfo数据
orgInfoMapper.delete(new LambdaQueryWrapper<OrgInfoDO>() orgInfoMapper.delete(new LambdaQueryWrapper<OrgInfoDO>()
.eq(OrgInfoDO::getCreateId, result.getId())); .eq(OrgInfoDO::getCreateId, result.getId()));
accountDomainService.delete(result.getId());
throw new BizException(ErrorCode.GBS_USER_SYNC_ERROR); throw new BizException(ErrorCode.GBS_USER_SYNC_ERROR);
} }
return SingleResponse.success(toCO(result)); return SingleResponse.success(toCO(result));