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,25 +175,54 @@ public class IndicatorsReportService { ...@@ -175,25 +175,54 @@ 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) {
List<DriveIndCalResultDef> calDatas = driveIndCalResultDefMapper.findReportData(code,date); for(String indId : indIds) {
List<IndicatorsReportOne> datas = new ArrayList<>(); Map<String,Object> paramMap = new HashMap<>();
for(DriveIndCalResultDef calData : calDatas) { paramMap.put("indId", indId);
//判断是否存在 paramMap.put("date", date);
String type = this.getCompareType(calData.getDate()); paramMap.put("compareObjs", compareObjs);
IndicatorsReportOne indReportData = reportOneMapper.getByParam( //获取所有考核指标结果
calData.getIndId(), calData.getCompareObj(), calData.getDate(), type); List<DriveIndCalResultDef> calDatas = driveIndCalResultDefMapper
if(indReportData==null) { .findByIndIdAndDateAndCompareObjIn(paramMap);
indReportData = new IndicatorsReportOne(); List<IndicatorsReportOne> datas = new ArrayList<>();
for(DriveIndCalResultDef calData : calDatas) {
//判断是否存在
String type = this.getCompareType(calData.getDate());
IndicatorsReportOne indReportData = reportOneMapper.getByParam(
calData.getIndId(), calData.getCompareObj(), calData.getDate(), type);
if(indReportData==null) {
indReportData = new IndicatorsReportOne();
}
indReportData.setCode(calData.getCode());
indReportData.setCompareType(type);
indReportData.setUnit(calData.getUnit());
indReportData = this.fillReportOneData(calData, indReportData);
datas.add(indReportData);
} }
indReportData.setCode(calData.getCode()); //计算增幅排名
indReportData.setCompareType(type); if(!datas.isEmpty()) {
indReportData.setUnit(calData.getUnit()); //获取指标正反属性
indReportData = this.fillReportOneData(calData, indReportData); DriveIndDef driveIndDef = driveIndDefMapper.selectByPrimaryKey(indId);
datas.add(indReportData); 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,10 +434,13 @@ public class IndicatorsReportService { ...@@ -405,10 +434,13 @@ 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())) {
rankMap.put(currentCalData.getCompareObj(), //如果本次考核结果排位和同期考核结果配位都存在
String.valueOf((currentCalData.getRank()-sameCalData.getRank()))); if(currentCalData.getRank()!=null && sameCalData.getRank()!=null) {
if((currentCalData.getRank()-sameCalData.getRank())>0) { rankMap.put(currentCalData.getCompareObj(),
improveNum+=1; String.valueOf((currentCalData.getRank()-sameCalData.getRank())));
if((currentCalData.getRank()-sameCalData.getRank())>0) {
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