Commit beae889b authored by 刘林's avatar 刘林

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

parent ba2fa5e4
......@@ -978,4 +978,13 @@ public class XiAnEquipInfoExcelDto extends BaseDto {
@ExcelProperty(value = "运载工具数量和类型")
@ApiModelProperty(value = "运载工具数量和类型")
private String numberAndTypeOfVehicles;
@ApiModelProperty(value = "原设备代码")
@ExcelIgnore
private String originalEquCode;
@ApiModelProperty(value = "序号")
@ExcelProperty(value = "序号")
private String xaSerial;
}
\ No newline at end of file
......@@ -295,7 +295,10 @@ public class XiAnDataDockServiceImpl {
if (equCodeList.contains(data.getEquCode())) {
rowError.append("设备代码不能重复;");
}
this.checkEquCodeUniqueness(data.getEquCode(), rowError);
if (this.checkEquCodeUniqueness(data.getEquCode())){
data.setOriginalEquCode(data.getEquCode());
data.setEquCodeType("2");
}
} else {
data.setEquCode("");
}
......@@ -360,7 +363,7 @@ public class XiAnDataDockServiceImpl {
// 使用信息
//checkNotBlank(data.getUseUnitCode(), "使用单位统一社会信用代码不能为空;", rowError);
//Optional.ofNullable(data.getUseUnitCode()).ifPresent(v -> checkCreditCode(v, "使用单位统一社会信用代码格式不正确;", rowError));
checkNotBlank(data.getUseUnit(), "使用单位名称不能为空;", rowError);
//checkNotBlank(data.getUseUnit(), "使用单位名称不能为空;", rowError);
// 设计信息
//checkNotBlank(data.getDesignUnitCreditCode(), "设计单位统一社会信用代码不能为空;", rowError);
Optional.ofNullable(data.getDesignUnitCreditCode()).ifPresent(v -> checkCreditCode(v, "设计单位统一社会信用代码格式不正确;", rowError));
......@@ -435,14 +438,10 @@ public class XiAnDataDockServiceImpl {
/**
* 根据设备代码检查唯一性
*
* @param equCode
* @param rowError
* @param equCode 设备代码
*/
private void checkEquCodeUniqueness(String equCode, StringBuffer rowError) {
Boolean bool = jgServiceFeignClient.selectByEquCodeAndClaimStatus(equCode);
if (bool) {
rowError.append("设备代码系统中已存在;");
}
private boolean checkEquCodeUniqueness(String equCode) {
return jgServiceFeignClient.selectByEquCodeAndClaimStatus(equCode);
}
/**
......
......@@ -335,20 +335,56 @@ public class DataDockServiceImpl {
log.error("数据===>{}", JSONObject.toJSONString(equ));
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(JSON.toJSONString(equ), IdxBizJgSupervisionInfo.class);
log.error("数据===hou>{}", JSONObject.toJSONString(supervisionInfo));
if (!ObjectUtils.isEmpty(supervisionInfo)) {
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(new Date());
// 根据使用单位所在监管所写入属地监管部门
if (ObjectUtils.isEmpty(supervisionInfo)) return;
supervisionInfo.setRecord(record);
supervisionInfo.setRecDate(new Date());
// 获取符合条件的公司 Map
Map<String, String> countyMap;
try {
countyMap = Optional.ofNullable(Privilege.companyClient.queryAgencyList("county").getResult())
.orElse(Collections.emptyList())
.stream()
.filter(v -> "1442687786065854466".equals(String.valueOf(v.getParentId())))
.collect(Collectors.toMap(CompanyModel::getCompanyCode, CompanyModel::getCompanyName, (a, b) -> a));
} catch (Exception e) {
throw new RuntimeException(e);
}
// 提取 companyCode
String companyCode = Optional.ofNullable(equ.get("equCodeType"))
.filter(type -> Objects.equals(type, 1)).flatMap(type -> Optional.ofNullable(equ.get("equCode"))
.map(String::valueOf).map(String::trim)
.filter(code -> code.length() >= 9)
.map(code -> code.substring(3, 9)))
.orElse("");
// 直接获取公司名称
String companyName = countyMap.get(companyCode);
if (companyName != null) {
supervisionInfo.setOrgBranchCode(companyCode);
supervisionInfo.setOrgBranchName(companyName);
} else {
// 通过 useUnitCode 查询属地监管部门
String useUnitCode = String.valueOf(equ.get("useUnitCode")).trim();
CompanyModel companyModel = Privilege.companyClient.queryByCompanyCode(useUnitCode).getResult();
Optional.ofNullable(companyModel).ifPresent(com -> {
String superOrgCode = com.getOrgCode().substring(0, com.getOrgCode().lastIndexOf("*"));
supervisionInfo.setOrgBranchCode(superOrgCode);
CompanyModel compnay = JSON.parseObject(toJSONString(JSON.parseObject(toJSONString(Privilege.companyClient.queryByOrgcode(superOrgCode).getResult())).get("compnay")), CompanyModel.class);
supervisionInfo.setOrgBranchName(compnay.getCompanyName());
});
idxBizJgSupervisionInfoService.save(supervisionInfo);
if (companyModel != null) {
String orgCode = companyModel.getOrgCode();
if (orgCode != null && orgCode.contains("*")) {
String superOrgCode = orgCode.substring(0, orgCode.lastIndexOf("*"));
supervisionInfo.setOrgBranchCode(superOrgCode);
Optional.ofNullable(Privilege.companyClient.queryByOrgcode(superOrgCode).getResult())
.map(result -> JSON.parseObject(JSON.toJSONString(result)).getString("compnay"))
.map(json -> JSON.parseObject(json, CompanyModel.class))
.map(CompanyModel::getCompanyName)
.ifPresent(supervisionInfo::setOrgBranchName);
}
} else {
supervisionInfo.setOrgBranchCode("610100");
supervisionInfo.setOrgBranchName("西安市市场监督管理局");
}
}
idxBizJgSupervisionInfoService.save(supervisionInfo);
}
/**
......
......@@ -222,5 +222,15 @@ public class IdxBizJgRegisterInfo extends TzsBaseEntity {
@TableField("\"INSTALLATION_IS_COMPLETE\"")
private String installationIsComplete;
/**
* 原设备代码-西安数据导入使用
*/
@TableField("\"ORIGINAL_EQU_CODE\"")
private String originalEquCode;
/**
* 序号-西安数据导入使用
*/
@TableField("\"XA_SERIAL\"")
private String xaSerial;
}
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