Commit cdc30f16 by zhangkb

计算报表3方法添加同步锁处理。

parent 61f16ac2
...@@ -132,7 +132,7 @@ public class IndicatorsReportService { ...@@ -132,7 +132,7 @@ public class IndicatorsReportService {
reportThreeMapper.deleteByParam(paramMap); reportThreeMapper.deleteByParam(paramMap);
} }
public void dealDriveIndReportThreeData(String compareId,List<String> indIds, public synchronized void dealDriveIndReportThreeData(String compareId,List<String> indIds,
Integer date,String code) { Integer date,String code) {
List<IndicatorsReportThree> dataList = new ArrayList<>(); List<IndicatorsReportThree> dataList = new ArrayList<>();
String type = this.getCompareType(date); String type = this.getCompareType(date);
...@@ -154,12 +154,9 @@ public class IndicatorsReportService { ...@@ -154,12 +154,9 @@ public class IndicatorsReportService {
if(!calResults.isEmpty()) { if(!calResults.isEmpty()) {
for(DriveIndCalResultDef calResult : calResults) { for(DriveIndCalResultDef calResult : calResults) {
IndicatorsReportThree indReportData = null; IndicatorsReportThree indReportData = null;
//多线程查询会导致重复数据插入问题
synchronized(this){
//判断是否存在 //判断是否存在
indReportData = reportThreeMapper.getByParam( indReportData = reportThreeMapper.getByParam(
calResult.getCompareObj(), date, type, code); calResult.getCompareObj(), date, type, code);
}
if(indReportData == null) { if(indReportData == null) {
indReportData = new IndicatorsReportThree(); 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