Commit 55038a8d by zhangkb

修改计算报表1数据逻辑

parent c4ed7c77
...@@ -75,14 +75,6 @@ public class BeforeCompareUnitCalActor extends AbstractActor{ ...@@ -75,14 +75,6 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
} }
if(numberOfConfirm>1) { if(numberOfConfirm>1) {
Map<String,String> compareObjMap = new HashMap<>(); Map<String,String> compareObjMap = new HashMap<>();
//整合指标本期同期报表数据
logger.info("进行date:"+currentDate+" 指标本期同期报表数据整合");
if(StringUtils.isBlank(code)) {
code = "43";
}
indicatorsReportService.dealReportOne(code, currentDate);
//整合考核指标报表数据2 //整合考核指标报表数据2
for(CompareUnitDef unitDef : currentCompareUnitDef) { for(CompareUnitDef unitDef : currentCompareUnitDef) {
if(StringUtils.isNotBlank(unitDef.getIndIds()) && if(StringUtils.isNotBlank(unitDef.getIndIds()) &&
...@@ -93,6 +85,11 @@ public class BeforeCompareUnitCalActor extends AbstractActor{ ...@@ -93,6 +85,11 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
for(String compareObj : compareObjsList) { for(String compareObj : compareObjsList) {
compareObjMap.put(compareObj, compareObj); compareObjMap.put(compareObj, compareObj);
} }
//整合指标本期同期报表数据
indicatorsReportService.dealReportOne(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), unitDef.getDate());
//整合考核指标报表数据2 //整合考核指标报表数据2
indicatorsReportService.dealDriveIndReportTwoData( indicatorsReportService.dealDriveIndReportTwoData(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")), unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
......
...@@ -22,8 +22,9 @@ public class IndicatorReportCtrl { ...@@ -22,8 +22,9 @@ public class IndicatorReportCtrl {
@ApiOperation(value = "整合指标本期同期报表数据", notes = "整合指标本期同期报表数据") @ApiOperation(value = "整合指标本期同期报表数据", notes = "整合指标本期同期报表数据")
@PostMapping(value = "/dealReportOne") @PostMapping(value = "/dealReportOne")
public String dealReportOne(@RequestParam String code,@RequestParam Integer date) { public String dealReportOne(@RequestParam String compareUnitId,@RequestParam List<String> indIds,
indicatorsReportService.dealReportOne(code,date); @RequestParam List<String> compareObjs,@RequestParam Integer date) {
indicatorsReportService.dealReportOne(compareUnitId,indIds,compareObjs,date);
return "考核指标本期同期报表数据开始整合..."; return "考核指标本期同期报表数据开始整合...";
} }
......
...@@ -29,6 +29,7 @@ public class IndicatorsReportOne { ...@@ -29,6 +29,7 @@ public class IndicatorsReportOne {
private String currentValue;//本期值 private String currentValue;//本期值
private String lastSameValue;// 同期值 private String lastSameValue;// 同期值
private String valueRate;//同比 private String valueRate;//同比
private String valueRateRank;//同比增幅排名
private String currentRank;//本期排名 private String currentRank;//本期排名
private String lastSameRank;//同期排名 private String lastSameRank;//同期排名
private String currentScore;//本期综合评分 private String currentScore;//本期综合评分
......
...@@ -175,9 +175,16 @@ public class IndicatorsReportService { ...@@ -175,9 +175,16 @@ public class IndicatorsReportService {
//整合指标本期同期指标报表数据 //整合指标本期同期指标报表数据
@Async @Async
public String dealReportOne(String code,Integer date) { public String dealReportOne(String compareId,List<String> indIds,
List<String> compareObjs,Integer date) {
for(String indId : indIds) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("indId", indId);
paramMap.put("date", date);
paramMap.put("compareObjs", compareObjs);
//获取所有考核指标结果 //获取所有考核指标结果
List<DriveIndCalResultDef> calDatas = driveIndCalResultDefMapper.findReportData(code,date); List<DriveIndCalResultDef> calDatas = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObjIn(paramMap);
List<IndicatorsReportOne> datas = new ArrayList<>(); List<IndicatorsReportOne> datas = new ArrayList<>();
for(DriveIndCalResultDef calData : calDatas) { for(DriveIndCalResultDef calData : calDatas) {
//判断是否存在 //判断是否存在
...@@ -193,7 +200,29 @@ public class IndicatorsReportService { ...@@ -193,7 +200,29 @@ public class IndicatorsReportService {
indReportData = this.fillReportOneData(calData, indReportData); indReportData = this.fillReportOneData(calData, indReportData);
datas.add(indReportData); datas.add(indReportData);
} }
//计算增幅排名
if(!datas.isEmpty()) {
//获取指标正反属性
DriveIndDef driveIndDef = driveIndDefMapper.selectByPrimaryKey(indId);
if(driveIndDef!=null) {
String indRule = driveIndDef.getIndRule();
Map<String,String> valueRate = new HashMap<>();
for(IndicatorsReportOne indReportData : datas) {
valueRate.put(indReportData.getCompareObj(), indReportData.getValueRate());
}
//增幅排名
Map<String,Integer> valueRateRank = CalculateUtils.rankValue(valueRate, indRule);
for(Map.Entry<String,Integer> map : valueRateRank.entrySet()) {
for(IndicatorsReportOne indReportData : datas) {
if(map.getKey().equals(indReportData.getCompareObj())) {
indReportData.setValueRateRank(map.getValue()+"");
}
}
}
}
}
this.batchSaveOrUpdate(datas);//批量新增或修改 this.batchSaveOrUpdate(datas);//批量新增或修改
}
return "deal indicators report one success"; return "deal indicators report one success";
} }
...@@ -405,11 +434,14 @@ public class IndicatorsReportService { ...@@ -405,11 +434,14 @@ public class IndicatorsReportService {
&&!"Infinite".equals(sameCalData.getValue()) &&!"Infinite".equals(sameCalData.getValue())
&& !"NaN".equals(currentCalData.getValue()) && !"NaN".equals(currentCalData.getValue())
&&!"Infinite".equals(currentCalData.getValue())) { &&!"Infinite".equals(currentCalData.getValue())) {
//如果本次考核结果排位和同期考核结果配位都存在
if(currentCalData.getRank()!=null && sameCalData.getRank()!=null) {
rankMap.put(currentCalData.getCompareObj(), rankMap.put(currentCalData.getCompareObj(),
String.valueOf((currentCalData.getRank()-sameCalData.getRank()))); String.valueOf((currentCalData.getRank()-sameCalData.getRank())));
if((currentCalData.getRank()-sameCalData.getRank())>0) { if((currentCalData.getRank()-sameCalData.getRank())>0) {
improveNum+=1; improveNum+=1;
} }
}
break; break;
} }
} }
......
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