Merge remote-tracking branch 'origin/dev' into dev

dev
huwei 2026-07-08 13:07:57 +08:00
commit 85ff19750f
7 changed files with 34 additions and 55 deletions

View File

@ -37,7 +37,8 @@ public class GbsUserSyncInterceptor implements WebMvcConfigurer {
"/**/org-info/save/**", "/**/org-info/save/**",
"/**/account/save/**", "/**/account/save/**",
"/**/account/sendMessage/**", "/**/account/sendMessage/**",
"/**/file/**" "/**/file/**",
"/**/tree/**"
}; };
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {

View File

@ -1,18 +1,12 @@
package org.qinan.safetyeval.adapter.web; package org.qinan.safetyeval.adapter.web;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.qinan.safetyeval.client.dto.PageResponse;
import org.qinan.safetyeval.client.dto.SingleResponse;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.qinan.safetyeval.client.api.OrgDepartmentApi; import org.qinan.safetyeval.client.api.OrgDepartmentApi;
import org.qinan.safetyeval.client.co.OrgDepartmentCO; import org.qinan.safetyeval.client.co.OrgDepartmentCO;
import org.qinan.safetyeval.client.dto.OrgDepartmentAddCmd; import org.qinan.safetyeval.client.dto.*;
import org.qinan.safetyeval.client.dto.OrgDepartmentModifyCmd; import org.qinan.safetyeval.infrastructure.dataobject.base.Req;
import org.qinan.safetyeval.client.dto.OrgDepartmentPageQuery;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -53,8 +47,8 @@ public class OrgDepartmentController {
@ApiOperation("删除部门") @ApiOperation("删除部门")
@PostMapping("/delete") @PostMapping("/delete")
public SingleResponse<Void> delete(@ApiParam("主键ID") @RequestParam String id) { public SingleResponse<Void> delete(@ApiParam("主键ID") @RequestBody Req<Long> req) {
return orgDepartmentApi.delete(Long.parseLong(id)); return orgDepartmentApi.delete(req.getData());
} }
@ApiOperation("分页查询部门") @ApiOperation("分页查询部门")

View File

@ -1,5 +1,6 @@
package org.qinan.safetyeval.app.executor; 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.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;
@ -14,6 +15,8 @@ import org.qinan.safetyeval.domain.query.PageResult;
import org.qinan.safetyeval.domain.service.AccountDomainService; import org.qinan.safetyeval.domain.service.AccountDomainService;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter; import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
import org.qinan.safetyeval.infrastructure.adapter.gbs.GbsUserFacadeClient; 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.qinan.safetyeval.infrastructure.remote.SmsRemote;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -40,6 +43,8 @@ public class AccountExecutor implements AccountApi {
private String publicKey; private String publicKey;
@Autowired @Autowired
private SmsRemote smsRemote; private SmsRemote smsRemote;
@Autowired
private OrgInfoMapper orgInfoMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -104,6 +109,7 @@ public class AccountExecutor implements AccountApi {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public SingleResponse<AccountCO> syncUserToGBS(String account) { public SingleResponse<AccountCO> syncUserToGBS(String account) {
AccountEntity result = accountDomainService.syncUserToGBS(account); AccountEntity result = accountDomainService.syncUserToGBS(account);
// 同步gbs用户 // 同步gbs用户
@ -112,9 +118,20 @@ 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) {
defPassword = result.getPassword();
}
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey); String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey);
userAddCmd.setPassword(encrypt); userAddCmd.setPassword(encrypt);
try {
gbsUserFacadeClient.add(userAddCmd); 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)); return SingleResponse.success(toCO(result));
} }

View File

@ -1,24 +1,14 @@
package org.qinan.safetyeval.app.executor; 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.UserAddCmd;
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd; 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.MD5;
import com.zcloud.gbscommon.utils.Sm2Util; 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.OrgPersonnelChangeRecorder;
import org.qinan.safetyeval.app.support.OrgPersonnelViewEnricher; import org.qinan.safetyeval.app.support.OrgPersonnelViewEnricher;
import org.qinan.safetyeval.client.api.OrgPersonnelApi; import org.qinan.safetyeval.client.api.OrgPersonnelApi;
import org.qinan.safetyeval.client.co.OrgPersonnelCO; import org.qinan.safetyeval.client.co.OrgPersonnelCO;
import org.qinan.safetyeval.client.dto.OrgPersonnelAddCmd; import org.qinan.safetyeval.client.dto.*;
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.domain.entity.OrgPersonnelEntity; import org.qinan.safetyeval.domain.entity.OrgPersonnelEntity;
import org.qinan.safetyeval.domain.exception.BizException; import org.qinan.safetyeval.domain.exception.BizException;
import org.qinan.safetyeval.domain.exception.ErrorCode; 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.OrgPersonnelQuery;
import org.qinan.safetyeval.domain.query.PageResult; import org.qinan.safetyeval.domain.query.PageResult;
import org.qinan.safetyeval.domain.service.OrgPersonnelDomainService; 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.auth.AuthUserContextAdapter;
import org.qinan.safetyeval.infrastructure.adapter.gbs.GbsUserFacadeClient; 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.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;

View File

@ -101,6 +101,7 @@ public enum ErrorCode {
// gbs // gbs
GBS_USER_ERROR("04-01-001", "gbs用户未登录"), GBS_USER_ERROR("04-01-001", "gbs用户未登录"),
GBS_USER_SYNC_ERROR("04-01-002", "gbs用户同步错误"),
/** /**

View File

@ -65,11 +65,11 @@ public class AccountDomainService {
// throw new BizException(ErrorCode.ACCOUNT_EXISTS); // throw new BizException(ErrorCode.ACCOUNT_EXISTS);
return found; return found;
} }
AccountEntity foundByPhone = accountGateway.foundByPhone(phone); // AccountEntity foundByPhone = accountGateway.foundByPhone(phone);
if (foundByPhone != null && !excludeId.equals(foundByPhone.getId())) { // if (foundByPhone != null && (excludeId == null || !excludeId.equals(foundByPhone.getId()))) {
// throw new BizException(ErrorCode.PHONE_EXISTS, foundByPhone.getAccount()); //// throw new BizException(ErrorCode.PHONE_EXISTS, foundByPhone.getAccount());
return foundByPhone; // return foundByPhone;
} // }
return null; return null;
} }

View File

@ -1,27 +0,0 @@
package org.qinan.safetyeval.start.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
/**
*
*/
@Configuration
public class WebCorsConfig {
@Bean
public CorsFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
config.addAllowedOriginPattern("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
config.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}