dev-deployment
luotaiqian 2026-06-29 17:55:33 +08:00
parent 4b11b61a71
commit 437d6ec1c1
5 changed files with 38 additions and 9 deletions

View File

@ -75,18 +75,15 @@ public class OrgPersonnelExecutor implements OrgPersonnelApi {
OrgPersonnelEntity result = orgPersonnelDomainService.add(entity);
OrgPersonnelCO co = toCO(result);
enrich(co);
//todo 同步用户信息GBS
UserAddCmd userAddCmd = new UserAddCmd();
userAddCmd.setId(result.getId());
userAddCmd.setAccount(result.getAccount());
userAddCmd.setIdCard(result.getIdCardNo());
userAddCmd.setTenantId(result.getTenantId());
syncGbsUser("add user", new Runnable() {
@Override
public void run() {
userAddCmd.setName(result.getUserName());
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey);
userAddCmd.setPassword(encrypt);
gbsUserFacadeClient.add(userAddCmd);
}
});
return SingleResponse.success(co);
}

View File

@ -29,6 +29,11 @@ public class BizException extends RuntimeException {
this.code = errorCode.getCode();
}
public BizException(String errorCode, String message) {
super(message);
this.code = errorCode;
}
public String getCode() {
return code;
}

View File

@ -1,17 +1,21 @@
package org.qinan.safetyeval.infrastructure.adapter.gbs;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.system.client.user.facade.UserFacade;
import com.jjb.saas.system.client.user.request.RoleDeptAddCmd;
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.UserUpdateQuitCmd;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.qinan.safetyeval.domain.exception.BizException;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
@RequiredArgsConstructor
public class GbsUserFacadeClient {
@DubboReference(protocol = "dubbo", url = "${safety-eval.gbs-user-sync.user-facade-url:}")
@ -23,9 +27,12 @@ public class GbsUserFacadeClient {
RoleDeptAddCmd roleDeptAddCmd = new RoleDeptAddCmd();
roleDeptAddCmd.setDeptId(2069596397920849920L);
roleDeptAddCmd.setRoleId(2069671307598893058L);
roleDeptAddCmd.setRoleCode("b5d8d972b4e948aeb04063ad77fdc196");
list.add(roleDeptAddCmd);
cmd.setRoleDepts(list);
userFacade.add(cmd);
SingleResponse<Long> singleResponse = userFacade.add(cmd);
if (singleResponse.isSuccess()) {
throw new BizException(singleResponse.getErrCode(), singleResponse.getErrMessage());
}
}
public void delete(Long userId) {

View File

@ -0,0 +1,18 @@
package org.qinan.safetyeval.infrastructure.adapter.gbs;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.system.client.user.request.UserAddCmd;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 使 GBS
*/
@FeignClient(name = "jjb-saas-system")
public interface GbsUserFacadeFeignClient {
@PostMapping(value = "/system/operation/users", consumes = "application/json")
SingleResponse<Long> addUser(@RequestBody UserAddCmd cmd);
}

View File

@ -4,6 +4,7 @@ import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
@ -22,6 +23,7 @@ import java.util.List;
*/
@SpringBootApplication(scanBasePackages = {"org.qinan.safetyeval", "com.jjb.saas"})
@EnableDubbo
@EnableFeignClients(basePackages = {"org.qinan.safetyeval", "com.jjb.saas"})
public class SafetyEvalApplication {
public static void main(String[] args) {