Commit 55038a8d by zhangkb

修改计算报表1数据逻辑

parent c4ed7c77
......@@ -75,14 +75,6 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
}
if(numberOfConfirm>1) {
Map<String,String> compareObjMap = new HashMap<>();
//整合指标本期同期报表数据
logger.info("进行date:"+currentDate+" 指标本期同期报表数据整合");
if(StringUtils.isBlank(code)) {
code = "43";
}
indicatorsReportService.dealReportOne(code, currentDate);
//整合考核指标报表数据2
for(CompareUnitDef unitDef : currentCompareUnitDef) {
if(StringUtils.isNotBlank(unitDef.getIndIds()) &&
......@@ -93,6 +85,11 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
for(String compareObj : compareObjsList) {
compareObjMap.put(compareObj, compareObj);
}
//整合指标本期同期报表数据
indicatorsReportService.dealReportOne(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), unitDef.getDate());
//整合考核指标报表数据2
indicatorsReportService.dealDriveIndReportTwoData(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
......
......@@ -22,8 +22,9 @@ public class IndicatorReportCtrl {
@ApiOperation(value = "整合指标本期同期报表数据", notes = "整合指标本期同期报表数据")
@PostMapping(value = "/dealReportOne")
public String dealReportOne(@RequestParam String code,@RequestParam Integer date) {
indicatorsReportService.dealReportOne(code,date);
public String dealReportOne(@RequestParam String compareUnitId,@RequestParam List<String> indIds,
@RequestParam List<String> compareObjs,@RequestParam Integer date) {
indicatorsReportService.dealReportOne(compareUnitId,indIds,compareObjs,date);
return "考核指标本期同期报表数据开始整合...";
}
......
......@@ -29,6 +29,7 @@ public class IndicatorsReportOne {
private String currentValue;//本期值
private String lastSameValue;// 同期值
private String valueRate;//同比
private String valueRateRank;//同比增幅排名
private String currentRank;//本期排名
private String lastSameRank;//同期排名
private String currentScore;//本期综合评分
......
......@@ -175,25 +175,54 @@ public class IndicatorsReportService {
//整合指标本期同期指标报表数据
@Async
public String dealReportOne(String code,Integer date) {
//获取所有考核指标结果
List<DriveIndCalResultDef> calDatas = driveIndCalResultDefMapper.findReportData(code,date);
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();
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
.findByIndIdAndDateAndCompareObjIn(paramMap);
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);
indReportData.setUnit(calData.getUnit());
indReportData = this.fillReportOneData(calData, 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";
}
......@@ -405,10 +434,13 @@ public class IndicatorsReportService {
&&!"Infinite".equals(sameCalData.getValue())
&& !"NaN".equals(currentCalData.getValue())
&&!"Infinite".equals(currentCalData.getValue())) {
rankMap.put(currentCalData.getCompareObj(),
String.valueOf((currentCalData.getRank()-sameCalData.getRank())));
if((currentCalData.getRank()-sameCalData.getRank())>0) {
improveNum+=1;
//如果本次考核结果排位和同期考核结果配位都存在
if(currentCalData.getRank()!=null && sameCalData.getRank()!=null) {
rankMap.put(currentCalData.getCompareObj(),
String.valueOf((currentCalData.getRank()-sameCalData.getRank())));
if((currentCalData.getRank()-sameCalData.getRank())>0) {
improveNum+=1;
}
}
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