Commit a720beb5 authored by tianbo's avatar tianbo

修改并行stream引起数据丢失问题(list.add非原子操作)

parent b86478b9
...@@ -1403,7 +1403,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1403,7 +1403,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Map<Long, CheckObjectDto> map = new HashMap<>(companyList.size()); Map<Long, CheckObjectDto> map = new HashMap<>(companyList.size());
companyList.forEach(e -> map.put(e.getSequenceNbr(), e)); companyList.forEach(e -> map.put(e.getSequenceNbr(), e));
Set<? extends Map.Entry<Long, ? extends CheckObjectDto>> entries = map.entrySet(); Set<? extends Map.Entry<Long, ? extends CheckObjectDto>> entries = map.entrySet();
entries.parallelStream().forEach(entry -> { entries.stream().forEach(entry -> {
CheckObjectDto value = entry.getValue(); CheckObjectDto value = entry.getValue();
if (!ObjectUtils.isEmpty(value)) { if (!ObjectUtils.isEmpty(value)) {
Long parent = ObjectUtils.isEmpty(value.getParentId()) ? 0L : Long.parseLong(value.getParentId()); Long parent = ObjectUtils.isEmpty(value.getParentId()) ? 0L : Long.parseLong(value.getParentId());
...@@ -1412,7 +1412,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1412,7 +1412,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
int num = orgUsrTreeDto.getNum() + value.getNum(); int num = orgUsrTreeDto.getNum() + value.getNum();
orgUsrTreeDto.setNum(num); orgUsrTreeDto.setNum(num);
} else { } else {
if (value.getBizOrgType().equals(OrgPersonEnum.公司.getKey())) { if (value.getBizOrgType().equals(OrgPersonEnum.公司.getKey()) && null == value.getParentId()) {
list.add(value); list.add(value);
} }
} }
......
...@@ -1938,7 +1938,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -1938,7 +1938,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
} }
} catch (Exception e) { } catch (Exception e) {
} }
Map<String, Object> finalBuildingAbsolutePositionMap = buildingAbsolutePositionMap; Map<String, Object> finalBuildingAbsolutePositionMap =
ValidationUtil.isEmpty(buildingAbsolutePositionMap) ? new HashMap<>() : buildingAbsolutePositionMap;
iPage.getRecords().forEach(danger -> { iPage.getRecords().forEach(danger -> {
if (!ValidationUtil.isEmpty(danger.getStructureId()) && !ValidationUtil.isEmpty(finalBuildingAbsolutePositionMap.get(danger.getStructureId().toString()))) { if (!ValidationUtil.isEmpty(danger.getStructureId()) && !ValidationUtil.isEmpty(finalBuildingAbsolutePositionMap.get(danger.getStructureId().toString()))) {
danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId().toString()).toString()); danger.setStructureName(finalBuildingAbsolutePositionMap.get(danger.getStructureId().toString()).toString());
......
...@@ -1270,7 +1270,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService { ...@@ -1270,7 +1270,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患评审通过)) { if (executeTypeEnum.equals(LatentDangerExcuteTypeEnum.隐患评审通过)) {
latentDangerBo.setReformLimitDate(DateUtil.str2Date(executeParam.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT)); latentDangerBo.setReformLimitDate(DateUtil.str2Date(executeParam.getReformLimitDate(), DateUtil.DATETIME_DEFAULT_FORMAT));
latentDangerBo.setDangerLevel(executeParam.getDangerLevel().toString()); latentDangerBo.setDangerLevel(executeParam.getDangerLevel().toString());
JSONObject reformJsonObject = JSONObject.parseObject(latentDangerBo.getReformJson()); // JSONObject reformJsonObject = JSONObject.parseObject(latentDangerBo.getReformJson());
JSONObject reformJsonObject = executeParam.getFlowJson();
if (ValidationUtil.isEmpty(reformJsonObject)) { if (ValidationUtil.isEmpty(reformJsonObject)) {
reformJsonObject = new JSONObject(); reformJsonObject = new JSONObject();
} }
......
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