dev-deployment
parent
4b11b61a71
commit
437d6ec1c1
|
|
@ -75,18 +75,15 @@ public class OrgPersonnelExecutor implements OrgPersonnelApi {
|
||||||
OrgPersonnelEntity result = orgPersonnelDomainService.add(entity);
|
OrgPersonnelEntity result = orgPersonnelDomainService.add(entity);
|
||||||
OrgPersonnelCO co = toCO(result);
|
OrgPersonnelCO co = toCO(result);
|
||||||
enrich(co);
|
enrich(co);
|
||||||
//todo 同步用户信息GBS
|
|
||||||
UserAddCmd userAddCmd = new UserAddCmd();
|
UserAddCmd userAddCmd = new UserAddCmd();
|
||||||
userAddCmd.setId(result.getId());
|
userAddCmd.setId(result.getId());
|
||||||
userAddCmd.setAccount(result.getAccount());
|
userAddCmd.setAccount(result.getAccount());
|
||||||
userAddCmd.setIdCard(result.getIdCardNo());
|
userAddCmd.setIdCard(result.getIdCardNo());
|
||||||
userAddCmd.setTenantId(result.getTenantId());
|
userAddCmd.setTenantId(result.getTenantId());
|
||||||
syncGbsUser("add user", new Runnable() {
|
userAddCmd.setName(result.getUserName());
|
||||||
@Override
|
String encrypt = Sm2Util.encryptHex(MD5.md5(defPassword), publicKey);
|
||||||
public void run() {
|
userAddCmd.setPassword(encrypt);
|
||||||
gbsUserFacadeClient.add(userAddCmd);
|
gbsUserFacadeClient.add(userAddCmd);
|
||||||
}
|
|
||||||
});
|
|
||||||
return SingleResponse.success(co);
|
return SingleResponse.success(co);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,11 @@ public class BizException extends RuntimeException {
|
||||||
this.code = errorCode.getCode();
|
this.code = errorCode.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BizException(String errorCode, String message) {
|
||||||
|
super(message);
|
||||||
|
this.code = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
package org.qinan.safetyeval.infrastructure.adapter.gbs;
|
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.facade.UserFacade;
|
||||||
import com.jjb.saas.system.client.user.request.RoleDeptAddCmd;
|
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.UserAddCmd;
|
||||||
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
||||||
import com.jjb.saas.system.client.user.request.UserUpdateQuitCmd;
|
import com.jjb.saas.system.client.user.request.UserUpdateQuitCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.qinan.safetyeval.domain.exception.BizException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class GbsUserFacadeClient {
|
public class GbsUserFacadeClient {
|
||||||
|
|
||||||
@DubboReference(protocol = "dubbo", url = "${safety-eval.gbs-user-sync.user-facade-url:}")
|
@DubboReference(protocol = "dubbo", url = "${safety-eval.gbs-user-sync.user-facade-url:}")
|
||||||
|
|
@ -23,9 +27,12 @@ public class GbsUserFacadeClient {
|
||||||
RoleDeptAddCmd roleDeptAddCmd = new RoleDeptAddCmd();
|
RoleDeptAddCmd roleDeptAddCmd = new RoleDeptAddCmd();
|
||||||
roleDeptAddCmd.setDeptId(2069596397920849920L);
|
roleDeptAddCmd.setDeptId(2069596397920849920L);
|
||||||
roleDeptAddCmd.setRoleId(2069671307598893058L);
|
roleDeptAddCmd.setRoleId(2069671307598893058L);
|
||||||
roleDeptAddCmd.setRoleCode("b5d8d972b4e948aeb04063ad77fdc196");
|
list.add(roleDeptAddCmd);
|
||||||
cmd.setRoleDepts(list);
|
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) {
|
public void delete(Long userId) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
|
||||||
|
|
@ -22,6 +23,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(scanBasePackages = {"org.qinan.safetyeval", "com.jjb.saas"})
|
@SpringBootApplication(scanBasePackages = {"org.qinan.safetyeval", "com.jjb.saas"})
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
|
@EnableFeignClients(basePackages = {"org.qinan.safetyeval", "com.jjb.saas"})
|
||||||
public class SafetyEvalApplication {
|
public class SafetyEvalApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue