Commit 4dd21d34 authored by chenzhao's avatar chenzhao

现场问题-更名登记审批接口超时

parent 3e73e7d4
......@@ -2538,60 +2538,112 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*
* @param paramMap 更新的参数
*/
@Override
// @Override
// public Map<String, Object> commonUpdateEsDataByIds(Map<String, Map<String, Object>> paramMap) {
// if (paramMap.isEmpty()) {
// return null;
// }
// String oldUscUnitCreditCode = "";
// String oldUscUnitName = "";
// Map<String, Object> resultMap = new HashMap<>();
// for (Map.Entry<String, Map<String, Object>> entry : paramMap.entrySet()) {
// String record = entry.getKey();
// Map<String, Object> childMap = entry.getValue();
// if (!childMap.isEmpty()) {
// ESEquipmentCategoryDto oldData = null;
// // 获取Es中旧的数据
// Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
// if (!ObjectUtils.isEmpty(optional)) {
// oldData = optional.get();
// oldUscUnitCreditCode = oldData.getUSC_UNIT_CREDIT_CODE();
// oldUscUnitName = oldData.getUSC_UNIT_NAME();
// }
// // 获取Es中新的参数
// ESEquipmentCategoryDto newData = JSON.parseObject(toJSONString(childMap), ESEquipmentCategoryDto.class);
// String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
// String newUscUnitName = newData.getUSC_UNIT_NAME();
//
// // 删除Es中旧的数据
// if (!ObjectUtils.isEmpty(oldData)) {
// esEquipmentCategory.deleteById(record);
// // 整合新旧数据
// Bean.copyExistPropertis(newData, oldData);
// // 处理施工单位信息[去重]
// if (!ValidationUtil.isEmpty(newUscUnitCreditCode)) {
// // if (!ValidationUtil.isEmpty(oldUscUnitCreditCode)) {
// // if (!oldUscUnitCreditCode.contains(newUscUnitCreditCode)) {
// // oldData.setUSC_UNIT_CREDIT_CODE(oldUscUnitCreditCode + "," + newUscUnitCreditCode);
// // oldData.setUSC_UNIT_NAME(oldUscUnitName + "," + newUscUnitName);
// // }
// // } else {
// oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
// oldData.setUSC_UNIT_NAME(newUscUnitName);
// // }
// }
//
// }
// if (!ObjectUtils.isEmpty(oldData)) {
// oldData.setREC_DATE(System.currentTimeMillis());
// ESEquipmentCategoryDto saveData = esEquipmentCategory.save(oldData);
//
// // 组装返回数据
// resultMap.put(record, saveData);
// }
// }
//
// }
// return resultMap;
// }
@Override
public Map<String, Object> commonUpdateEsDataByIds(Map<String, Map<String, Object>> paramMap) {
if (paramMap.isEmpty()) {
return null;
}
String oldUscUnitCreditCode = "";
String oldUscUnitName = "";
Map<String, Object> resultMap = new HashMap<>();
Map<String, ESEquipmentCategoryDto> oldDataMap = new HashMap<>();
List<ESEquipmentCategoryDto> saveList = new ArrayList<>();
// 批量获取旧数据
for (String record : paramMap.keySet()) {
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
optional.ifPresent(dto -> oldDataMap.put(record, dto));
}
for (Map.Entry<String, Map<String, Object>> entry : paramMap.entrySet()) {
String record = entry.getKey();
Map<String, Object> childMap = entry.getValue();
if (!childMap.isEmpty()) {
ESEquipmentCategoryDto oldData = null;
// 获取Es中旧的数据
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (!ObjectUtils.isEmpty(optional)) {
oldData = optional.get();
oldUscUnitCreditCode = oldData.getUSC_UNIT_CREDIT_CODE();
oldUscUnitName = oldData.getUSC_UNIT_NAME();
}
// 获取Es中新的参数
ESEquipmentCategoryDto newData = JSON.parseObject(toJSONString(childMap), ESEquipmentCategoryDto.class);
String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
String newUscUnitName = newData.getUSC_UNIT_NAME();
// 删除Es中旧的数据
if (!ObjectUtils.isEmpty(oldData)) {
esEquipmentCategory.deleteById(record);
// 整合新旧数据
ESEquipmentCategoryDto oldData = oldDataMap.get(record);
ESEquipmentCategoryDto newData = JSON.parseObject(JSON.toJSONString(childMap), ESEquipmentCategoryDto.class);
if (oldData != null) {
Bean.copyExistPropertis(newData, oldData);
// 处理施工单位信息[去重]
String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
String newUscUnitName = newData.getUSC_UNIT_NAME();
if (!ValidationUtil.isEmpty(newUscUnitCreditCode)) {
// if (!ValidationUtil.isEmpty(oldUscUnitCreditCode)) {
// if (!oldUscUnitCreditCode.contains(newUscUnitCreditCode)) {
// oldData.setUSC_UNIT_CREDIT_CODE(oldUscUnitCreditCode + "," + newUscUnitCreditCode);
// oldData.setUSC_UNIT_NAME(oldUscUnitName + "," + newUscUnitName);
// }
// } else {
oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
oldData.setUSC_UNIT_NAME(newUscUnitName);
// }
oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
oldData.setUSC_UNIT_NAME(newUscUnitName);
}
}
if (!ObjectUtils.isEmpty(oldData)) {
oldData.setREC_DATE(System.currentTimeMillis());
ESEquipmentCategoryDto saveData = esEquipmentCategory.save(oldData);
// 组装返回数据
resultMap.put(record, saveData);
saveList.add(oldData);
}
}
}
// 批量删除旧数据
esEquipmentCategory.deleteAll(oldDataMap.values());
// 批量保存新数据
Iterable<ESEquipmentCategoryDto> savedData = esEquipmentCategory.saveAll(saveList);
// 组装返回数据
Map<String, Object> resultMap = new HashMap<>();
savedData.forEach(dto -> resultMap.put(dto.getSEQUENCE_NBR(), dto));
return resultMap;
}
......
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