Commit e0873d9f authored by 刘林's avatar 刘林

fix(jg):西安属地导入更新

parent 4d2149c8
......@@ -388,4 +388,20 @@ public class XiAnElevatorExcelDto extends BaseDto {
@ApiModelProperty(value = "电梯状态")
@ExcelProperty(value = "电梯状态", converter = EquStateConverter.class)
private String equState;
@ApiModelProperty(value = "所属辖区")
@ExcelProperty(value = "所属辖区")
private String supervisionDepartment;
@ApiModelProperty(value = "所属辖区代码")
@ExcelProperty(value = "所属辖区代码")
private String supervisionDepartmentCode;
@ApiModelProperty(value = "市场监管所")
@ExcelProperty(value = "市场监管所")
private String supervisionOffice;
@ApiModelProperty(value = "市场监管所代码")
@ExcelProperty(value = "市场监管所代码")
private String supervisionOfficeCode;
}
\ No newline at end of file
......@@ -640,8 +640,10 @@ public class XiAnDataDockServiceImpl {
log.info("解析第{}行数据:{}", rowIndex, JSON.toJSONString(data));
if (data.getEquList() != null && !data.getEquList().isEmpty()) {
checkCommonInfo(data, rowError);
} else {
} else if (data.getBusinessId() != null && !data.getBusinessId().isEmpty()){
checkResumeInfo(data, rowError);
}else{
checkSupervisionInfo(data, rowError);
}
data.setIsCompleteXa(1);
if (!StringUtils.isBlank(rowError)) {
......@@ -653,6 +655,10 @@ public class XiAnDataDockServiceImpl {
}
}
private void checkSupervisionInfo(XiAnElevatorExcelDto data, StringBuffer rowError) {
checkNotBlank(data.getRecord(), "注册代码不能为空;", rowError);
}
private void checkResumeInfo(XiAnElevatorExcelDto data, StringBuffer rowError) {
checkNotBlank(data.getResumeSeq(), "监管履历主键不能为空;", rowError);
checkNotBlank(data.getBusinessType(), "业务类型不能为空;", rowError);
......
......@@ -14,6 +14,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
......@@ -2202,6 +2204,7 @@ public class DataDockServiceImpl {
public void saveElevatorDataInTransaction(Map<String, Object> equ, String dataSource, String remark) {
String record = Optional.ofNullable(equ.get("record")).map(String::valueOf).orElse(UUID.randomUUID().toString());
String equList = Optional.ofNullable(equ.get("equList")).map(String::valueOf).orElse("");
String businessId = Optional.ofNullable(equ.get("businessId")).map(String::valueOf).orElse("");
String isCompleteXa = Optional.ofNullable(equ.get("isCompleteXa")).map(String::valueOf).orElse("");
String useRegistrationCode = Optional.ofNullable(equ.get("useOrgCode")).map(String::valueOf).orElse("").trim();
try {
......@@ -2220,14 +2223,20 @@ public class DataDockServiceImpl {
if (!useRegistrationCode.isEmpty()){
this.handleHistoryEquip(equ);//历史登记
}
} else {
} else if (!businessId.isEmpty()){
this.saveResumeInfo(equ);
equ.put("record", equ.get("resumeSeq"));
equ.put("xaSerial", equ.get("resumeSeq"));
}else{
String orgBranchName = (String) Optional.ofNullable(equ.get("supervisionOffice"))
.orElseGet(() -> equ.get("supervisionDepartment"));
String orgBranchCode = (String) Optional.ofNullable(equ.get("supervisionOfficeCode"))
.orElseGet(() -> equ.get("supervisionDepartmentCode"));
this.updateOrgBranchInfo(record, orgBranchName, orgBranchCode);
}
} catch (Exception e) {
esEquipmentCategory.deleteById(record);
superviseInfoMapper.deleteDataAll(Collections.singletonList(record));
// esEquipmentCategory.deleteById(record);
// superviseInfoMapper.deleteDataAll(Collections.singletonList(record));
ExcelImportErrorLogDto errorLogDto = JSON.parseObject(toJSONString(equ), ExcelImportErrorLogDto.class);
errorLogDto.setErrorInfo(e.getMessage());
excelImportErrorLogDao.save(errorLogDto);
......@@ -2237,6 +2246,54 @@ public class DataDockServiceImpl {
}
}
@GlobalTransactional(rollbackFor = Exception.class)
public void updateOrgBranchInfo(String record, String orgBranchName, String orgBranchCode) {
this.updateSupervisionInfo(record, orgBranchName, orgBranchCode);
this.updateEsOrgBranch(record, orgBranchName, orgBranchCode);
this.updateUseRegistrationInfo(record, orgBranchName, orgBranchCode);
}
private void updateUseRegistrationInfo(String record, String orgBranchName, String orgBranchCode) {
Optional.ofNullable(
idxBizJgRegisterInfoMapper.selectOne(
new QueryWrapper<IdxBizJgRegisterInfo>()
.lambda()
.eq(IdxBizJgRegisterInfo::getRecord, record)
))
.map(IdxBizJgRegisterInfo::getUseOrgCode)
.ifPresent(useOrgCode -> jgUseRegistrationManageService.update(
new LambdaUpdateWrapper<JgUseRegistrationManage>()
.set(JgUseRegistrationManage::getSuperviseOrgCode, orgBranchCode)
.set(JgUseRegistrationManage::getSuperviseOrgName, orgBranchName)
.eq(JgUseRegistrationManage::getUseRegistrationCode, useOrgCode)
.eq(JgUseRegistrationManage::getIsDoBusiness, 0)
));
Optional.ofNullable(
jgRelationEquipMapper.selectOne(
new QueryWrapper<JgUseRegistrationEq>()
.lambda()
.eq(JgUseRegistrationEq::getEquId, record)
.eq(JgUseRegistrationEq::getIsDelete, false)
))
.map(JgUseRegistrationEq::getEquipTransferId)
.ifPresent(equipTransferId -> jgUseRegistrationServiceImpl.update(
new LambdaUpdateWrapper<JgUseRegistration>()
.set(JgUseRegistration::getSupervisionOrgCode, orgBranchCode)
.eq(JgUseRegistration::getSequenceNbr, equipTransferId)
));
}
private void updateSupervisionInfo(String record, String orgBranchName, String orgBranchCode) {
idxBizJgSupervisionInfoService.update(
new IdxBizJgSupervisionInfo()
.setOrgBranchName(orgBranchName)
.setOrgBranchCode(orgBranchCode),
new QueryWrapper<IdxBizJgSupervisionInfo>()
.lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, record)
);
}
private void saveResumeInfo(Map<String, Object> equ) {
JgResumeInfoDto resumeInfoDto = JSON.parseObject(JSON.toJSONString(equ), JgResumeInfoDto.class);
resumeInfoDto.setEquId(Objects.toString(equ.get("resumeSeq"), ""));
......@@ -2515,6 +2572,15 @@ public class DataDockServiceImpl {
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
}
public void updateEsOrgBranch(String record, String orgBranchName, String orgBranchCode) {
HashMap<String, Map<String, Object>> objMap = new HashMap<>();
HashMap<String, Object> param = new HashMap<>();
param.put("ORG_BRANCH_CODE", orgBranchCode);
param.put("ORG_BRANCH_NAME", orgBranchName);
objMap.put(record, param);
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
}
private void rollBackForDelRedisData() {
FlowingEquipRedisContext.getContext().forEach(e -> EquipUsedCheckStrategyContext.getUsedStrategy(DEFINITION_KEY).delDataForCheckWithKey(e.getData(), e.getRedisKey()));
}
......
......@@ -2122,6 +2122,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.eq(JgRegistrationHistory::getCurrentDocumentId, useRegistration.getSequenceNbr())
.set(JgRegistrationHistory::getIsDelete, true)
);
this.clearDataForCheckEquipRepeatUsed(useRegistration);
});
}
......
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