Merge remote-tracking branch 'origin/dev' into dev
commit
85ff19750f
|
|
@ -37,7 +37,8 @@ public class GbsUserSyncInterceptor implements WebMvcConfigurer {
|
|||
"/**/org-info/save/**",
|
||||
"/**/account/save/**",
|
||||
"/**/account/sendMessage/**",
|
||||
"/**/file/**"
|
||||
"/**/file/**",
|
||||
"/**/tree/**"
|
||||
};
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
package org.qinan.safetyeval.adapter.web;
|
||||
|
||||
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.ApiParam;
|
||||
import org.qinan.safetyeval.client.api.OrgDepartmentApi;
|
||||
import org.qinan.safetyeval.client.co.OrgDepartmentCO;
|
||||
import org.qinan.safetyeval.client.dto.OrgDepartmentAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgDepartmentModifyCmd;
|
||||
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.qinan.safetyeval.client.dto.*;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.base.Req;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -53,8 +47,8 @@ public class OrgDepartmentController {
|
|||
|
||||
@ApiOperation("删除部门")
|
||||
@PostMapping("/delete")
|
||||
public SingleResponse<Void> delete(@ApiParam("主键ID") @RequestParam String id) {
|
||||
return orgDepartmentApi.delete(Long.parseLong(id));
|
||||
public SingleResponse<Void> delete(@ApiParam("主键ID") @RequestBody Req<Long> req) {
|
||||
return orgDepartmentApi.delete(req.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("分页查询部门")
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
gbsUserFacadeClient.add(userAddCmd);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue