Merge remote-tracking branch 'origin/dev' into dev
commit
becfabee80
|
|
@ -1,5 +1,6 @@
|
|||
package org.qinan.safetyeval.app.executor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jjb.saas.system.client.user.request.UserAddCmd;
|
||||
import com.zcloud.gbscommon.utils.MD5;
|
||||
import com.zcloud.gbscommon.utils.Sm2Util;
|
||||
|
|
@ -14,6 +15,8 @@ import org.qinan.safetyeval.domain.query.PageResult;
|
|||
import org.qinan.safetyeval.domain.service.AccountDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.gbs.GbsUserFacadeClient;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.OrgInfoDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.OrgInfoMapper;
|
||||
import org.qinan.safetyeval.infrastructure.remote.SmsRemote;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -40,6 +43,8 @@ public class AccountExecutor implements AccountApi {
|
|||
private String publicKey;
|
||||
@Autowired
|
||||
private SmsRemote smsRemote;
|
||||
@Autowired
|
||||
private OrgInfoMapper orgInfoMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -104,6 +109,7 @@ public class AccountExecutor implements AccountApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SingleResponse<AccountCO> syncUserToGBS(String account) {
|
||||
AccountEntity result = accountDomainService.syncUserToGBS(account);
|
||||
// 同步gbs用户
|
||||
|
|
@ -112,9 +118,20 @@ public class AccountExecutor implements AccountApi {
|
|||
userAddCmd.setAccount(result.getAccount());
|
||||
userAddCmd.setTenantId(result.getTenantId());
|
||||
userAddCmd.setName(result.getUserName());
|
||||
if (result.getPassword() != null) {
|
||||
defPassword = result.getPassword();
|
||||
}
|
||||
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey);
|
||||
userAddCmd.setPassword(encrypt);
|
||||
try {
|
||||
gbsUserFacadeClient.add(userAddCmd);
|
||||
} catch (Exception e) {
|
||||
// 回滚数据, 清除account表示数据,orgInfo数据
|
||||
orgInfoMapper.delete(new LambdaQueryWrapper<OrgInfoDO>()
|
||||
.eq(OrgInfoDO::getCreateId, result.getId()));
|
||||
accountDomainService.delete(result.getId());
|
||||
throw new BizException(ErrorCode.GBS_USER_SYNC_ERROR);
|
||||
}
|
||||
return SingleResponse.success(toCO(result));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,14 @@
|
|||
package org.qinan.safetyeval.app.executor;
|
||||
|
||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||
import com.jjb.saas.system.client.user.request.FacadeUserAddCmd;
|
||||
import com.jjb.saas.system.client.user.request.UserAddCmd;
|
||||
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.zcloud.gbscommon.utils.MD5;
|
||||
import com.zcloud.gbscommon.utils.Sm2Util;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.qinan.safetyeval.app.support.OrgPersonnelChangeRecorder;
|
||||
import org.qinan.safetyeval.app.support.OrgPersonnelViewEnricher;
|
||||
import org.qinan.safetyeval.client.api.OrgPersonnelApi;
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelCO;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.qinan.safetyeval.client.dto.*;
|
||||
import org.qinan.safetyeval.domain.entity.OrgPersonnelEntity;
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.qinan.safetyeval.domain.exception.ErrorCode;
|
||||
|
|
@ -26,8 +16,11 @@ import org.qinan.safetyeval.domain.gateway.OrgResignApplyGateway;
|
|||
import org.qinan.safetyeval.domain.query.OrgPersonnelQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.domain.service.OrgPersonnelDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.gbs.GbsUserFacadeClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public enum ErrorCode {
|
|||
|
||||
// gbs
|
||||
GBS_USER_ERROR("04-01-001", "gbs用户未登录"),
|
||||
GBS_USER_SYNC_ERROR("04-01-002", "gbs用户同步错误"),
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ public class AccountDomainService {
|
|||
// throw new BizException(ErrorCode.ACCOUNT_EXISTS);
|
||||
return found;
|
||||
}
|
||||
AccountEntity foundByPhone = accountGateway.foundByPhone(phone);
|
||||
if (foundByPhone != null && !excludeId.equals(foundByPhone.getId())) {
|
||||
// throw new BizException(ErrorCode.PHONE_EXISTS, foundByPhone.getAccount());
|
||||
return foundByPhone;
|
||||
}
|
||||
// AccountEntity foundByPhone = accountGateway.foundByPhone(phone);
|
||||
// if (foundByPhone != null && (excludeId == null || !excludeId.equals(foundByPhone.getId()))) {
|
||||
//// throw new BizException(ErrorCode.PHONE_EXISTS, foundByPhone.getAccount());
|
||||
// return foundByPhone;
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue