Commit 61f16ac2 by zhangkb

判断报表3数据是否存在地方加同步锁机制,防止重复数据插入。

parent 6a786477
......@@ -130,11 +130,9 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
indicatorsReportService.deleteReportThreeDataByParam(currentDate,
new ArrayList<String>(compareObjMap.keySet()),code);
for(CompareUnitDef unitDef : currentCompareUnitDef) {
synchronized(this){
indicatorsReportService.dealDriveIndReportThreeData(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
unitDef.getDate(),code);
}
}
}
if("0".equals(isTest)) {
......
......@@ -153,9 +153,13 @@ public class IndicatorsReportService {
findByIndIdAndDateAndCompareIdAndSort(indId, date, compareId,code);
if(!calResults.isEmpty()) {
for(DriveIndCalResultDef calResult : calResults) {
//判断是否存在
IndicatorsReportThree indReportData = reportThreeMapper.getByParam(
calResult.getCompareObj(), date, type, code);
IndicatorsReportThree indReportData = null;
//多线程查询会导致重复数据插入问题
synchronized(this){
//判断是否存在
indReportData = reportThreeMapper.getByParam(
calResult.getCompareObj(), date, type, code);
}
if(indReportData == null) {
indReportData = new IndicatorsReportThree();
}
......
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