Commit 517be623 authored by zhangyingbin's avatar zhangyingbin

tzs注册新增配置文件is.ugp条件控制 是否同步至ugp库

parent 075cca45
......@@ -120,6 +120,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Value("${org.filter.group.seq}")
private Long groupSeq;
@Value("${is.ugp}")
private boolean isUgp;
@Override
@Transactional(rollbackFor = Exception.class)
public RegUnitInfoDto registerUnit(RegUnitInfoDto model) {
......@@ -136,22 +139,26 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 3.2 自动创建:调用平台进行创建单位、用户信息
this.createCompanyAndUser(regUnitInfo);
//多线程同步ugp信息(tzs和ugp一起后放开)
// String token = RequestContext.getToken();
// String appKey = RequestContext.getAppKey();
// String product = RequestContext.getProduct();
// Callable callable = new Callable(){
// @Override
// public Object call() throws Exception {
// RequestContext.setToken(token);
// RequestContext.setAppKey(appKey);
// RequestContext.setProduct(product);
// //同步企业至ugp,成功返回true,失败返回false
// return ugpServiceFeignClient.syncCompany(model);
// }
// };
// FutureTask<ResponseModel<Boolean>> future = new FutureTask(callable);
// Thread thread = new Thread(future);
// thread.start();
FutureTask<ResponseModel<Boolean>> future = null;
if(isUgp) {
String token = RequestContext.getToken();
String appKey = RequestContext.getAppKey();
String product = RequestContext.getProduct();
Callable callable = new Callable() {
@Override
public Object call() throws Exception {
RequestContext.setToken(token);
RequestContext.setAppKey(appKey);
RequestContext.setProduct(product);
//同步企业至ugp,成功返回true,失败返回false
return ugpServiceFeignClient.syncCompany(model);
}
};
future = new FutureTask(callable);
Thread thread = new Thread(future);
thread.start();
}
// 1.插入单位注册许可信息表:tz_base_unit_licence
......@@ -190,9 +197,11 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
model.setRegUnitIc(Bean.toModel(regUnitIc, new RegUnitIcDto()));
//获取多线程执行结果 true成功 false失败(tzs和ugp一起后放开)
// if(!future.get().getResult()){
// throw new Exception("UGP信息同步失败");
// }
if(isUgp) {
if (!future.get().getResult()) {
throw new Exception("UGP信息同步失败");
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
......
......@@ -166,3 +166,6 @@ appCode.gasBottle.image=studio_normalapp_3404491,upload/tzs/amos_studio/9C968B74
# 特种设备安全追溯
appCode.safety.image=studio_normalapp_4391091,upload/tzs/amos_studio/-28367904-1135092464.png
# 若tzs和ugp一起,则true
is.ugp=false
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment