Commit 758aa43c authored by 刘林's avatar 刘林

fix(jg):西安数据导入接口修改

parent d230bab0
...@@ -298,6 +298,7 @@ public class XiAnDataDockServiceImpl { ...@@ -298,6 +298,7 @@ public class XiAnDataDockServiceImpl {
if (this.checkEquCodeUniqueness(data.getEquCode())){ if (this.checkEquCodeUniqueness(data.getEquCode())){
data.setOriginalEquCode(data.getEquCode()); data.setOriginalEquCode(data.getEquCode());
data.setEquCodeType("2"); data.setEquCodeType("2");
data.setEquCode("");
} }
} else { } else {
data.setEquCode(""); data.setEquCode("");
......
...@@ -116,7 +116,17 @@ public class DataDockServiceImpl { ...@@ -116,7 +116,17 @@ public class DataDockServiceImpl {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class)
public boolean xiAnSaveEquipmentData(List<Map<String, Object>> equLists) { public boolean xiAnSaveEquipmentData(List<Map<String, Object>> equLists) {
CompletableFuture.allOf(equLists.stream().map(equ -> CompletableFuture.runAsync(() -> saveEquipmentDataInTransaction(equ, "jg_his_xa", null))).toArray(CompletableFuture[]::new)).join(); String appKey = RequestContext.getAppKey();
String product = RequestContext.getProduct();
String token = RequestContext.getToken();
CompletableFuture.allOf(
equLists.stream().map(equ -> CompletableFuture.runAsync(() -> {
RequestContext.setAppKey(appKey);
RequestContext.setProduct(product);
RequestContext.setToken(token);
saveEquipmentDataInTransaction(equ, "jg_his_xa", null);
})).toArray(CompletableFuture[]::new)
).join();
return Boolean.TRUE; return Boolean.TRUE;
} }
...@@ -350,17 +360,17 @@ public class DataDockServiceImpl { ...@@ -350,17 +360,17 @@ public class DataDockServiceImpl {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
// 提取 companyCode String companyCode = "1".equals(equ.get("equCodeType"))
String companyCode = Optional.ofNullable(equ.get("equCodeType")) ? String.valueOf(equ.get("equCode"))
.filter(type -> Objects.equals(type, 1)).flatMap(type -> Optional.ofNullable(equ.get("equCode")) : String.valueOf(equ.get("originalEquCode"));
.map(String::valueOf).map(String::trim)
.filter(code -> code.length() >= 9)
.map(code -> code.substring(3, 9)))
.orElse("");
companyCode = companyCode.trim();
if (companyCode.length() > 9) {
companyCode = companyCode.substring(4, 10);
}
// 直接获取公司名称 // 直接获取公司名称
String companyName = countyMap.get(companyCode); String companyName = countyMap.get(companyCode);
if (companyName != null) { if (companyName != null && !companyName.trim().isEmpty()) {
supervisionInfo.setOrgBranchCode(companyCode); supervisionInfo.setOrgBranchCode(companyCode);
supervisionInfo.setOrgBranchName(companyName); supervisionInfo.setOrgBranchName(companyName);
} else { } else {
......
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