Commit 304c57f2 by zhangkb

对标单元运算和报告生成添加机构编码进行标识

parent 422bdbc0
...@@ -49,7 +49,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{ ...@@ -49,7 +49,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
code = beforeCompareUnitCalMsg.getCode(); code = beforeCompareUnitCalMsg.getCode();
logger.info("进行date:"+sameDate+" 的对标单元计算....."); logger.info("进行date:"+sameDate+" 的对标单元计算.....");
//计算同期对标单元 //计算同期对标单元
StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(compareUnitDefs); StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(
compareUnitDefs,beforeCompareUnitCalMsg.getCode());
ActorRef startCompareUnitCalActor = this.getContext().actorOf(Props.create( ActorRef startCompareUnitCalActor = this.getContext().actorOf(Props.create(
StartCompareUnitCalActor.class,()-> new StartCompareUnitCalActor(getSelf()))); StartCompareUnitCalActor.class,()-> new StartCompareUnitCalActor(getSelf())));
startCompareUnitCalActor.tell(startCompareUnitCalMsg, getSelf()); startCompareUnitCalActor.tell(startCompareUnitCalMsg, getSelf());
...@@ -67,7 +68,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{ ...@@ -67,7 +68,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
currentDate = currentCompareUnitDef.get(0).getDate(); currentDate = currentCompareUnitDef.get(0).getDate();
logger.info("进行date:"+currentDate+" 的对标单元计算....."); logger.info("进行date:"+currentDate+" 的对标单元计算.....");
//计算同期对标单元 //计算同期对标单元
StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(currentCompareUnitDef); StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(
currentCompareUnitDef,code);
ActorRef startCompareUnitCalActor = this.getContext().actorOf(Props.create( ActorRef startCompareUnitCalActor = this.getContext().actorOf(Props.create(
StartCompareUnitCalActor.class,()-> new StartCompareUnitCalActor(getSelf()))); StartCompareUnitCalActor.class,()-> new StartCompareUnitCalActor(getSelf())));
startCompareUnitCalActor.tell(startCompareUnitCalMsg, getSelf()); startCompareUnitCalActor.tell(startCompareUnitCalMsg, getSelf());
...@@ -90,12 +92,13 @@ public class BeforeCompareUnitCalActor extends AbstractActor{ ...@@ -90,12 +92,13 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
//整合指标本期同期报表数据 //整合指标本期同期报表数据
indicatorsReportService.dealReportOne( indicatorsReportService.dealReportOne(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")), unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), unitDef.getDate()); Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), code);
//整合考核指标报表数据2 //整合考核指标报表数据2
indicatorsReportService.dealDriveIndReportTwoData( indicatorsReportService.dealDriveIndReportTwoData(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")), unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), unitDef.getDate()); Arrays.asList(unitDef.getCompareObjs().split(",")), unitDef.getDate(),code);
} }
} }
...@@ -103,18 +106,18 @@ public class BeforeCompareUnitCalActor extends AbstractActor{ ...@@ -103,18 +106,18 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
logger.info("进行date:"+currentDate+" 基础项本期同期报表数据整合"); logger.info("进行date:"+currentDate+" 基础项本期同期报表数据整合");
if(!compareObjMap.isEmpty()) { if(!compareObjMap.isEmpty()) {
List<String> compareObjs = new ArrayList<String>(compareObjMap.keySet()); List<String> compareObjs = new ArrayList<String>(compareObjMap.keySet());
indicatorsReportService.dealBaseIndReportOneData(currentDate, compareObjs); indicatorsReportService.dealBaseIndReportOneData(currentDate, compareObjs, code);
} }
//整合考核指标报表数据3 //整合考核指标报表数据3
logger.info("进行date:"+currentDate+" 指标报表3数据整合"); logger.info("进行date:"+currentDate+" 指标报表3数据整合");
//删除历史数据 //删除历史数据
indicatorsReportService.deleteReportThreeDataByParam(currentDate, indicatorsReportService.deleteReportThreeDataByParam(currentDate,
new ArrayList<String>(compareObjMap.keySet())); new ArrayList<String>(compareObjMap.keySet()),code);
for(CompareUnitDef unitDef : currentCompareUnitDef) { for(CompareUnitDef unitDef : currentCompareUnitDef) {
indicatorsReportService.dealDriveIndReportThreeData( indicatorsReportService.dealDriveIndReportThreeData(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")), unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
unitDef.getDate()); unitDef.getDate(),code);
} }
logger.info("本期同期对标单元计算完成"); logger.info("本期同期对标单元计算完成");
......
...@@ -48,6 +48,8 @@ public class CompareUnitCalActor extends AbstractActor{ ...@@ -48,6 +48,8 @@ public class CompareUnitCalActor extends AbstractActor{
private List<String> compareObjsList = new ArrayList<>();//考核对象list private List<String> compareObjsList = new ArrayList<>();//考核对象list
private String code;//机构编码
private final ActorRef startCompareUnitCalActor;//定义父actor private final ActorRef startCompareUnitCalActor;//定义父actor
static public Props props(ActorRef startCompareUnitCalActor) { static public Props props(ActorRef startCompareUnitCalActor) {
...@@ -68,6 +70,7 @@ public class CompareUnitCalActor extends AbstractActor{ ...@@ -68,6 +70,7 @@ public class CompareUnitCalActor extends AbstractActor{
firstExe = compareUnitDef.getFirstExe(); firstExe = compareUnitDef.getFirstExe();
averageObj = compareUnitDef.getAverageObj(); averageObj = compareUnitDef.getAverageObj();
objScoreRuleId = compareUnitDef.getObjScoreRuleId(); objScoreRuleId = compareUnitDef.getObjScoreRuleId();
code = compareUnitCalMsg.getCode();
//新增运行日志记录 //新增运行日志记录
CompareUnitCalLog compCalLog = new CompareUnitCalLog(compareId,date, CompareUnitCalLog compCalLog = new CompareUnitCalLog(compareId,date,
...@@ -89,7 +92,7 @@ public class CompareUnitCalActor extends AbstractActor{ ...@@ -89,7 +92,7 @@ public class CompareUnitCalActor extends AbstractActor{
for(String indId : indIdsList) { for(String indId : indIdsList) {
DriveIndIdCalMsg driveIndIdCalMsg = new DriveIndIdCalMsg( DriveIndIdCalMsg driveIndIdCalMsg = new DriveIndIdCalMsg(
compareUnitDef.getCompareId(),indId,compareObjsList,compareUnitDef.getDate(), compareUnitDef.getCompareId(),indId,compareObjsList,compareUnitDef.getDate(),
firstExe,averageObj,compCalLogId); firstExe,averageObj,compCalLogId,compareUnitCalMsg.getCode());
//start akka //start akka
ActorRef driveIndIdCalActor = this.getContext() ActorRef driveIndIdCalActor = this.getContext()
.actorOf(Props.create(DriveIndIdCalActor.class, .actorOf(Props.create(DriveIndIdCalActor.class,
......
...@@ -49,6 +49,8 @@ public class DriveIndIdCalActor extends AbstractActor{ ...@@ -49,6 +49,8 @@ public class DriveIndIdCalActor extends AbstractActor{
private String firstExe;//是否先执行 0:否 1:是 private String firstExe;//是否先执行 0:否 1:是
private String averageObj;//平均分参考对象 private String averageObj;//平均分参考对象
private String code;//机构编码
private final ActorRef compareUnitCalActor;//定义父actor private final ActorRef compareUnitCalActor;//定义父actor
...@@ -71,6 +73,7 @@ public class DriveIndIdCalActor extends AbstractActor{ ...@@ -71,6 +73,7 @@ public class DriveIndIdCalActor extends AbstractActor{
firstExe = driveIndIdCalMsg.getFirstExe(); firstExe = driveIndIdCalMsg.getFirstExe();
averageObj = driveIndIdCalMsg.getAverageObj(); averageObj = driveIndIdCalMsg.getAverageObj();
compareObjSize = compareObjs.size(); compareObjSize = compareObjs.size();
code = driveIndIdCalMsg.getCode();
//日志记录id //日志记录id
Integer compCalLogId = driveIndIdCalMsg.getCompCalLogId(); Integer compCalLogId = driveIndIdCalMsg.getCompCalLogId();
...@@ -82,7 +85,7 @@ public class DriveIndIdCalActor extends AbstractActor{ ...@@ -82,7 +85,7 @@ public class DriveIndIdCalActor extends AbstractActor{
dimValueList.add(dimDateObj); dimValueList.add(dimDateObj);
DriveIndIdObjCalMsg driveIndIdObjCalMsg = new DriveIndIdObjCalMsg(compareId, DriveIndIdObjCalMsg driveIndIdObjCalMsg = new DriveIndIdObjCalMsg(compareId,
indId,compareObj,date,dimValueList,compCalLogId); indId,compareObj,date,dimValueList,compCalLogId,driveIndIdCalMsg.getCode());
ActorRef driveIndIdObjCalActor = this.getContext() ActorRef driveIndIdObjCalActor = this.getContext()
.actorOf(Props.create(DriveIndIdObjCalActor.class, .actorOf(Props.create(DriveIndIdObjCalActor.class,
()->new DriveIndIdObjCalActor(getSelf()))); ()->new DriveIndIdObjCalActor(getSelf())));
...@@ -111,8 +114,9 @@ public class DriveIndIdCalActor extends AbstractActor{ ...@@ -111,8 +114,9 @@ public class DriveIndIdCalActor extends AbstractActor{
String actualAverage = "0.0";//实际平均分 String actualAverage = "0.0";//实际平均分
if(StringUtils.isNotBlank(averageObj)) { if(StringUtils.isNotBlank(averageObj)) {
provinceDriveIndCalResult = driveIndCalResultService.findCompareObjInfo( provinceDriveIndCalResult = driveIndCalResultService.findCompareObjInfo(
calIndAverageAndRankMsg.getDriveIndId(), calIndAverageAndRankMsg.getDate(), calIndAverageAndRankMsg.getDriveIndId(),
averageObj); calIndAverageAndRankMsg.getDate(),
averageObj,code);
} }
if(provinceDriveIndCalResult!=null) { if(provinceDriveIndCalResult!=null) {
//获取实际平均分 //获取实际平均分
...@@ -151,7 +155,7 @@ public class DriveIndIdCalActor extends AbstractActor{ ...@@ -151,7 +155,7 @@ public class DriveIndIdCalActor extends AbstractActor{
Map<String,String> scoreMap = indScorecardService.calculateIndiScore( Map<String,String> scoreMap = indScorecardService.calculateIndiScore(
driveIndCalResult.getIndId(), driveIndCalResult.getDate(), driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), scoreCardId, driveIndCalResult.getCompareObj(), scoreCardId,
driveIndCalResult.getCompareId(),compareObjs); driveIndCalResult.getCompareId(),compareObjs,code);
driveIndCalResult.setScore(scoreMap.get("score")); driveIndCalResult.setScore(scoreMap.get("score"));
driveIndCalResult.setImproveScore(scoreMap.get("improveScore")); driveIndCalResult.setImproveScore(scoreMap.get("improveScore"));
dataList.add(driveIndCalResult); dataList.add(driveIndCalResult);
...@@ -160,7 +164,7 @@ public class DriveIndIdCalActor extends AbstractActor{ ...@@ -160,7 +164,7 @@ public class DriveIndIdCalActor extends AbstractActor{
//批量保存修改 //批量保存修改
driveIndCalResultService.batchSaveOrUpdate(dataList); driveIndCalResultService.batchSaveOrUpdate(dataList);
//整合本期同期报表数据 //整合本期同期报表数据
indiReportService.dealReportOneDatas(dataList); //indiReportService.dealReportOneDatas(dataList);
//清空list //清空list
dataList.clear(); dataList.clear();
......
...@@ -92,6 +92,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{ ...@@ -92,6 +92,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
driveIndId = driveIndIdObjCalMsg.getIndId(); driveIndId = driveIndIdObjCalMsg.getIndId();
//日志记录id //日志记录id
compCalLogId = driveIndIdObjCalMsg.getCompCalLogId(); compCalLogId = driveIndIdObjCalMsg.getCompCalLogId();
code = driveIndIdObjCalMsg.getCode();
List<String> indIdList = new ArrayList<>();//定义存储从考核指标公式解析出来的基础指标id List<String> indIdList = new ArrayList<>();//定义存储从考核指标公式解析出来的基础指标id
...@@ -108,7 +109,6 @@ public class DriveIndIdObjCalActor extends AbstractActor{ ...@@ -108,7 +109,6 @@ public class DriveIndIdObjCalActor extends AbstractActor{
unit = driveIndDef.getIndUnit();//指标单位 unit = driveIndDef.getIndUnit();//指标单位
indType = driveIndDef.getIndRule();//指标类型:正向 反向 indType = driveIndDef.getIndRule();//指标类型:正向 反向
scoreCardId = driveIndDef.getIndCalScoreRule();//指标评分规则 scoreCardId = driveIndDef.getIndCalScoreRule();//指标评分规则
code = driveIndDef.getCode();
//获取考核指标的公式 //获取考核指标的公式
driveIndFormula = driveIndDef.getIndFormat(); driveIndFormula = driveIndDef.getIndFormat();
...@@ -197,7 +197,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{ ...@@ -197,7 +197,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
} }
//判断结果表中是否已存在该结果数据,存在则覆盖 //判断结果表中是否已存在该结果数据,存在则覆盖
DriveIndCalResultDef driveIndCalResult = driveIndCalResultService. DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
findCalResultDataIsExist(compareId, compareObj, driveIndId, date); findCalResultDataIsExist(compareId, compareObj, driveIndId, date, code);
if(driveIndCalResult==null) { if(driveIndCalResult==null) {
driveIndCalResult = new DriveIndCalResultDef(compareId, driveIndCalResult = new DriveIndCalResultDef(compareId,
driveIndId,compareObj,date,driveIndValue,unit, driveIndId,compareObj,date,driveIndValue,unit,
......
...@@ -40,6 +40,8 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -40,6 +40,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
private List<CompareUnitDef> calTypeExeList = new ArrayList<>();//存储对标单元单位评分规则calType不为0的对标单元list private List<CompareUnitDef> calTypeExeList = new ArrayList<>();//存储对标单元单位评分规则calType不为0的对标单元list
private String code = null;//机构编码
private final ActorRef beforeCompareUnitActor;//定义父actor private final ActorRef beforeCompareUnitActor;//定义父actor
static public Props props(ActorRef beforeCompareUnitActor) { static public Props props(ActorRef beforeCompareUnitActor) {
...@@ -54,6 +56,7 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -54,6 +56,7 @@ public class StartCompareUnitCalActor extends AbstractActor{
public Receive createReceive() { public Receive createReceive() {
return receiveBuilder() return receiveBuilder()
.match(StartCompareUnitCalMsg.class,startCompareUnitCalMsg -> { .match(StartCompareUnitCalMsg.class,startCompareUnitCalMsg -> {
code = startCompareUnitCalMsg.getCode();
List<CompareUnitDef> compareUnitDefs = startCompareUnitCalMsg.getCompareInitDefs(); List<CompareUnitDef> compareUnitDefs = startCompareUnitCalMsg.getCompareInitDefs();
//将对标单元进行分类,需要先执行的先开始进行对标计算 //将对标单元进行分类,需要先执行的先开始进行对标计算
for(CompareUnitDef unitDef : compareUnitDefs) { for(CompareUnitDef unitDef : compareUnitDefs) {
...@@ -76,7 +79,8 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -76,7 +79,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
afterExeUnitSize = afterExeList.size(); afterExeUnitSize = afterExeList.size();
if(!firstExeList.isEmpty()) { if(!firstExeList.isEmpty()) {
for(CompareUnitDef unitDef : firstExeList) { for(CompareUnitDef unitDef : firstExeList) {
CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef); CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef,
startCompareUnitCalMsg.getCode());
ActorRef compareUnitCalActor = this.getContext() ActorRef compareUnitCalActor = this.getContext()
.actorOf(Props.create(CompareUnitCalActor.class, .actorOf(Props.create(CompareUnitCalActor.class,
()->new CompareUnitCalActor(getSelf()))); ()->new CompareUnitCalActor(getSelf())));
...@@ -85,7 +89,8 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -85,7 +89,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
}else { }else {
if(!afterExeList.isEmpty()) { if(!afterExeList.isEmpty()) {
for(CompareUnitDef unitDef : afterExeList) { for(CompareUnitDef unitDef : afterExeList) {
CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef); CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef,
startCompareUnitCalMsg.getCode());
ActorRef compareUnitCalActor = this.getContext() ActorRef compareUnitCalActor = this.getContext()
.actorOf(Props.create(CompareUnitCalActor.class, .actorOf(Props.create(CompareUnitCalActor.class,
()->new CompareUnitCalActor(getSelf()))); ()->new CompareUnitCalActor(getSelf())));
...@@ -104,7 +109,8 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -104,7 +109,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
//再执行后执行的actor //再执行后执行的actor
if(!afterExeList.isEmpty()) { if(!afterExeList.isEmpty()) {
for(CompareUnitDef unitDef : afterExeList) { for(CompareUnitDef unitDef : afterExeList) {
CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef); CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef,
code);
ActorRef compareUnitCalActor = this.getContext() ActorRef compareUnitCalActor = this.getContext()
.actorOf(Props.create(CompareUnitCalActor.class, .actorOf(Props.create(CompareUnitCalActor.class,
()->new CompareUnitCalActor(getSelf()))); ()->new CompareUnitCalActor(getSelf())));
...@@ -118,7 +124,7 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -118,7 +124,7 @@ public class StartCompareUnitCalActor extends AbstractActor{
scoreRuleServer.calObjScore(unitDef.getCompareId(), scoreRuleServer.calObjScore(unitDef.getCompareId(),
Arrays.asList(unitDef.getIndIds().split(",")), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), unitDef.getObjScoreRuleId()); unitDef.getDate(), unitDef.getObjScoreRuleId(),code);
} }
} }
//发送确认消息给父actor //发送确认消息给父actor
...@@ -136,7 +142,7 @@ public class StartCompareUnitCalActor extends AbstractActor{ ...@@ -136,7 +142,7 @@ public class StartCompareUnitCalActor extends AbstractActor{
scoreRuleServer.calObjScore(unitDef.getCompareId(), scoreRuleServer.calObjScore(unitDef.getCompareId(),
Arrays.asList(unitDef.getIndIds().split(",")), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), unitDef.getObjScoreRuleId()); unitDef.getDate(), unitDef.getObjScoreRuleId(),code);
} }
} }
//发送确认消息给父actor //发送确认消息给父actor
......
...@@ -12,8 +12,11 @@ public class CompareUnitCalMsg implements Serializable{ ...@@ -12,8 +12,11 @@ public class CompareUnitCalMsg implements Serializable{
private CompareUnitDef compareUnitDef; private CompareUnitDef compareUnitDef;
public CompareUnitCalMsg(CompareUnitDef compareUnitDef) { private String code;
public CompareUnitCalMsg(CompareUnitDef compareUnitDef,String code) {
this.compareUnitDef = compareUnitDef; this.compareUnitDef = compareUnitDef;
this.code = code;
} }
public CompareUnitDef getCompareUnitDef() { public CompareUnitDef getCompareUnitDef() {
...@@ -23,4 +26,12 @@ public class CompareUnitCalMsg implements Serializable{ ...@@ -23,4 +26,12 @@ public class CompareUnitCalMsg implements Serializable{
public void setCompareUnitDef(CompareUnitDef compareUnitDef) { public void setCompareUnitDef(CompareUnitDef compareUnitDef) {
this.compareUnitDef = compareUnitDef; this.compareUnitDef = compareUnitDef;
} }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
} }
...@@ -17,9 +17,10 @@ public class DriveIndIdCalMsg implements Serializable{ ...@@ -17,9 +17,10 @@ public class DriveIndIdCalMsg implements Serializable{
private String firstExe; private String firstExe;
private String averageObj;//平均分参考对象 private String averageObj;//平均分参考对象
private Integer compCalLogId;//运行日志记录id private Integer compCalLogId;//运行日志记录id
private String code;//机构编码
public DriveIndIdCalMsg(String compareId,String indId,List<String> compareObj,Integer date, public DriveIndIdCalMsg(String compareId,String indId,List<String> compareObj,Integer date,
String firstExe,String averageObj,Integer compCalLogId) { String firstExe,String averageObj,Integer compCalLogId,String code) {
this.compareId = compareId; this.compareId = compareId;
this.indId = indId; this.indId = indId;
this.compareObj.addAll(compareObj); this.compareObj.addAll(compareObj);
...@@ -27,6 +28,7 @@ public class DriveIndIdCalMsg implements Serializable{ ...@@ -27,6 +28,7 @@ public class DriveIndIdCalMsg implements Serializable{
this.firstExe = firstExe; this.firstExe = firstExe;
this.averageObj = averageObj; this.averageObj = averageObj;
this.compCalLogId = compCalLogId; this.compCalLogId = compCalLogId;
this.code = code;
} }
public String getCompareId() { public String getCompareId() {
...@@ -74,4 +76,12 @@ public class DriveIndIdCalMsg implements Serializable{ ...@@ -74,4 +76,12 @@ public class DriveIndIdCalMsg implements Serializable{
public void setCompCalLogId(Integer compCalLogId) { public void setCompCalLogId(Integer compCalLogId) {
this.compCalLogId = compCalLogId; this.compCalLogId = compCalLogId;
} }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
} }
...@@ -18,15 +18,17 @@ public class DriveIndIdObjCalMsg implements Serializable{ ...@@ -18,15 +18,17 @@ public class DriveIndIdObjCalMsg implements Serializable{
private Integer date; private Integer date;
private List<DimValue> dimValues = new ArrayList<>();//维度值list private List<DimValue> dimValues = new ArrayList<>();//维度值list
private Integer compCalLogId;//运行日志记录id private Integer compCalLogId;//运行日志记录id
private String code;//机构编码
public DriveIndIdObjCalMsg(String compareId,String indId,String compareObj, public DriveIndIdObjCalMsg(String compareId,String indId,String compareObj,
Integer date,List<DimValue> dimValues,Integer compCalLogId) { Integer date,List<DimValue> dimValues,Integer compCalLogId,String code) {
this.compareId = compareId; this.compareId = compareId;
this.indId = indId; this.indId = indId;
this.compareObj = compareObj; this.compareObj = compareObj;
this.date = date; this.date = date;
this.dimValues.addAll(dimValues); this.dimValues.addAll(dimValues);
this.compCalLogId = compCalLogId; this.compCalLogId = compCalLogId;
this.code = code;
} }
public String getCompareId() { public String getCompareId() {
...@@ -67,4 +69,12 @@ public class DriveIndIdObjCalMsg implements Serializable{ ...@@ -67,4 +69,12 @@ public class DriveIndIdObjCalMsg implements Serializable{
public void setCompCalLogId(Integer compCalLogId) { public void setCompCalLogId(Integer compCalLogId) {
this.compCalLogId = compCalLogId; this.compCalLogId = compCalLogId;
} }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
} }
...@@ -16,8 +16,9 @@ public class StartCompareUnitCalMsg implements Serializable{ ...@@ -16,8 +16,9 @@ public class StartCompareUnitCalMsg implements Serializable{
private String code; private String code;
public StartCompareUnitCalMsg(List<CompareUnitDef> compareInitDefs) { public StartCompareUnitCalMsg(List<CompareUnitDef> compareInitDefs,String code) {
this.compareInitDefs.addAll(compareInitDefs); this.compareInitDefs.addAll(compareInitDefs);
this.code = code;
} }
public List<CompareUnitDef> getCompareInitDefs() { public List<CompareUnitDef> getCompareInitDefs() {
......
...@@ -145,8 +145,9 @@ public class IndScorecardCtrl { ...@@ -145,8 +145,9 @@ public class IndScorecardCtrl {
@PostMapping(value = "/calculateIndiScore") @PostMapping(value = "/calculateIndiScore")
public Map<String,String> calculateIndiScore(@RequestParam String indId,@RequestParam int date, public Map<String,String> calculateIndiScore(@RequestParam String indId,@RequestParam int date,
@RequestParam String compareObj,@RequestParam Integer indScorecardId, @RequestParam String compareObj,@RequestParam Integer indScorecardId,
@RequestParam String compareId,@RequestBody List<String> compareObjs) throws Exception{ @RequestParam String compareId,@RequestBody List<String> compareObjs,
@RequestParam String code) throws Exception{
return indScorecardService.calculateIndiScore(indId, date, compareObj, return indScorecardService.calculateIndiScore(indId, date, compareObj,
indScorecardId,compareId,compareObjs); indScorecardId,compareId,compareObjs,code);
} }
} }
...@@ -146,7 +146,7 @@ public class ObjScoreRuleCtrl { ...@@ -146,7 +146,7 @@ public class ObjScoreRuleCtrl {
public void calculateObjectScore( public void calculateObjectScore(
@RequestParam String compareId,@RequestParam List<String> indIds, @RequestParam String compareId,@RequestParam List<String> indIds,
@RequestParam List<String> compareObjs,@RequestParam int date, @RequestParam List<String> compareObjs,@RequestParam int date,
@RequestParam Integer scoreRuleId){ @RequestParam Integer scoreRuleId,@RequestParam String code){
scoreRuleService.calObjScore(compareId, indIds, compareObjs, date, scoreRuleId); scoreRuleService.calObjScore(compareId, indIds, compareObjs, date, scoreRuleId,code);
} }
} }
...@@ -132,7 +132,8 @@ public class ShortboardRuleCtrl { ...@@ -132,7 +132,8 @@ public class ShortboardRuleCtrl {
@ApiOperation(value = "根据指标关联的短板规则筛选短板单位", notes = "根据指标关联的短板规则筛选短板单位") @ApiOperation(value = "根据指标关联的短板规则筛选短板单位", notes = "根据指标关联的短板规则筛选短板单位")
@PostMapping(value = "/getShortboardObj") @PostMapping(value = "/getShortboardObj")
public List<Map<String,Object>> getObjShortboard(@RequestParam String compareId,@RequestParam int date, public List<Map<String,Object>> getObjShortboard(@RequestParam String compareId,@RequestParam int date,
@RequestParam List<String> compareObjs,@RequestParam List<String> driveIds)throws Exception{ @RequestParam List<String> compareObjs,@RequestParam List<String> driveIds,
return shortboardRuleService.getObjShortboard(compareId, date, compareObjs, driveIds); @RequestParam String code)throws Exception{
return shortboardRuleService.getObjShortboard(compareId, date, compareObjs, driveIds, code);
} }
} }
...@@ -24,7 +24,8 @@ public class IndexReportCtrl { ...@@ -24,7 +24,8 @@ public class IndexReportCtrl {
@ApiOperation(value = "获取特定指标信息", notes = "获取特定指标信息") @ApiOperation(value = "获取特定指标信息", notes = "获取特定指标信息")
@PostMapping(value = "/getIndicatorInfo") @PostMapping(value = "/getIndicatorInfo")
public List<Map<String, Object>> dealReportOne(@RequestBody Map<String,Integer> indIdMap,@RequestParam String compareObj) { public List<Map<String, Object>> dealReportOne(@RequestBody Map<String,Integer> indIdMap,
return indexReportService.getLatestIndiInfo(indIdMap, compareObj); @RequestParam String compareObj, @RequestParam String code) {
return indexReportService.getLatestIndiInfo(indIdMap, compareObj, code);
} }
} }
...@@ -29,29 +29,32 @@ public class IndicatorReportCtrl { ...@@ -29,29 +29,32 @@ public class IndicatorReportCtrl {
@ApiOperation(value = "整合指标本期同期报表数据", notes = "整合指标本期同期报表数据") @ApiOperation(value = "整合指标本期同期报表数据", notes = "整合指标本期同期报表数据")
@PostMapping(value = "/dealReportOne") @PostMapping(value = "/dealReportOne")
public String dealReportOne(@RequestParam String compareUnitId,@RequestParam List<String> indIds, public String dealReportOne(@RequestParam String compareUnitId,@RequestParam List<String> indIds,
@RequestParam List<String> compareObjs,@RequestParam Integer date) { @RequestParam List<String> compareObjs,@RequestParam Integer date,@RequestParam String code) {
indicatorsReportService.dealReportOne(compareUnitId,indIds,compareObjs,date); indicatorsReportService.dealReportOne(compareUnitId,indIds,compareObjs,date,code);
return "考核指标本期同期报表数据开始整合..."; return "考核指标本期同期报表数据开始整合...";
} }
@ApiOperation(value = "整合基础项本期同期报表数据", notes = "整合基础项本期同期报表数据") @ApiOperation(value = "整合基础项本期同期报表数据", notes = "整合基础项本期同期报表数据")
@PostMapping(value = "/dealBaseReportOne") @PostMapping(value = "/dealBaseReportOne")
public String dealBaseReportOne(@RequestParam Integer date,@RequestParam List<String> compareObjs) { public String dealBaseReportOne(@RequestParam Integer date,
indicatorsReportService.dealBaseIndReportOneData(date, compareObjs); @RequestParam List<String> compareObjs,@RequestParam String code) {
indicatorsReportService.dealBaseIndReportOneData(date, compareObjs,code);
return "基础项本期同期报表数据开始整合..."; return "基础项本期同期报表数据开始整合...";
} }
@ApiOperation(value = "整合考核指标报表数据2", notes = "整合考核指标报表数据2") @ApiOperation(value = "整合考核指标报表数据2", notes = "整合考核指标报表数据2")
@PostMapping(value = "/dealDriveReportTwo") @PostMapping(value = "/dealDriveReportTwo")
public String dealDriveReportTwo(@RequestParam String compareUnitId,@RequestParam List<String> indIds, public String dealDriveReportTwo(@RequestParam String compareUnitId,@RequestParam List<String> indIds,
@RequestParam List<String> compareObjs,@RequestParam Integer date) { @RequestParam List<String> compareObjs,@RequestParam Integer date,
indicatorsReportService.dealDriveIndReportTwoData(compareUnitId, indIds, compareObjs, date); @RequestParam String code) {
indicatorsReportService.dealDriveIndReportTwoData(compareUnitId, indIds, compareObjs, date, code);
return "整合考核指标报表数据2开始整合..."; return "整合考核指标报表数据2开始整合...";
} }
@ApiOperation(value = "整合考核指标报表数据3", notes = "整合考核指标报表数据3") @ApiOperation(value = "整合考核指标报表数据3", notes = "整合考核指标报表数据3")
@PostMapping(value = "/dealDriveReportThree") @PostMapping(value = "/dealDriveReportThree")
public String dealDriveReportThree(@RequestBody List<CompareUnitDef> compareUnitList) { public String dealDriveReportThree(@RequestBody List<CompareUnitDef> compareUnitList,
@RequestParam String code) {
Map<String,String> compareObjMap = new HashMap<>(); Map<String,String> compareObjMap = new HashMap<>();
Integer date = null; Integer date = null;
for(CompareUnitDef unitDef : compareUnitList) { for(CompareUnitDef unitDef : compareUnitList) {
...@@ -65,11 +68,11 @@ public class IndicatorReportCtrl { ...@@ -65,11 +68,11 @@ public class IndicatorReportCtrl {
} }
//删除历史数据 //删除历史数据
indicatorsReportService.deleteReportThreeDataByParam(date, indicatorsReportService.deleteReportThreeDataByParam(date,
new ArrayList<String>(compareObjMap.keySet())); new ArrayList<String>(compareObjMap.keySet()),code);
for(CompareUnitDef unitDef : compareUnitList) { for(CompareUnitDef unitDef : compareUnitList) {
indicatorsReportService.dealDriveIndReportThreeData( indicatorsReportService.dealDriveIndReportThreeData(
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")), unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
unitDef.getDate()); unitDef.getDate(),code);
} }
return "完成考核指标报表数据3整合"; return "完成考核指标报表数据3整合";
} }
......
...@@ -26,4 +26,5 @@ public class ObjScoreCalResult { ...@@ -26,4 +26,5 @@ public class ObjScoreCalResult {
private String improveValue;//考核对象改善得分 private String improveValue;//考核对象改善得分
private String scoreSumValue;//指标总积分 private String scoreSumValue;//指标总积分
private Integer indCount;//指标个数 private Integer indCount;//指标个数
private String code;//机构编码
} }
...@@ -30,4 +30,5 @@ public class IndicatorsReportThree { ...@@ -30,4 +30,5 @@ public class IndicatorsReportThree {
private Integer indImproveAfterThreeCount;//指标提升排名末三的指标个数 private Integer indImproveAfterThreeCount;//指标提升排名末三的指标个数
private String indImproveRate;//指标提升率 private String indImproveRate;//指标提升率
private Integer effectiveIndCount;//有效的指标个数 private Integer effectiveIndCount;//有效的指标个数
private String code;//机构编码
} }
...@@ -44,4 +44,5 @@ public class IndicatorsReportTwo { ...@@ -44,4 +44,5 @@ public class IndicatorsReportTwo {
private String sameImproveHeadThreeDesc;//同比提升前三描述 private String sameImproveHeadThreeDesc;//同比提升前三描述
private String sameImproveAfterThree;//同比提升末三 private String sameImproveAfterThree;//同比提升末三
private String sameImproveAfterThreeDesc;//同比提升末三描述 private String sameImproveAfterThreeDesc;//同比提升末三描述
private String code;//系统编码
} }
...@@ -19,7 +19,7 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult ...@@ -19,7 +19,7 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult
@Param("compareObj") String compareObj); @Param("compareObj") String compareObj);
public DriveIndCalResultDef findByIndIdAndDateAndCompareObj(@Param("indId") String indId, public DriveIndCalResultDef findByIndIdAndDateAndCompareObj(@Param("indId") String indId,
@Param("date") int date,@Param("compareObj") String compareObj); @Param("date") int date,@Param("compareObj") String compareObj,@Param("code") String code);
public List<DriveIndCalResultDef> findByIndIdAndDate(@Param("indId") String indId, public List<DriveIndCalResultDef> findByIndIdAndDate(@Param("indId") String indId,
@Param("date") int date); @Param("date") int date);
...@@ -34,19 +34,19 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult ...@@ -34,19 +34,19 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult
@Param("indId") String indId,@Param("date") int date); @Param("indId") String indId,@Param("date") int date);
public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareIdAndSort(@Param("indId") String indId, public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareIdAndSort(@Param("indId") String indId,
@Param("date") int date,@Param("compareId") String compareId); @Param("date") int date,@Param("compareId") String compareId,@Param("code") String code);
public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareId(@Param("indId") String indId, public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareId(@Param("indId") String indId,
@Param("date") int date,@Param("compareId") String compareId); @Param("date") int date,@Param("compareId") String compareId);
public List<DriveIndCalResultDef> findByCompareObjAndDate(@Param("compareObj") String compareObj, public List<DriveIndCalResultDef> findByCompareObjAndDate(@Param("compareObj") String compareObj,
@Param("date") int date); @Param("date") int date,@Param("code") String code);
public List<DriveIndCalResultDef> findByCompareObjAndDateAndIndIdIn(Map<String,Object> param); public List<DriveIndCalResultDef> findByCompareObjAndDateAndIndIdIn(Map<String,Object> param);
public DriveIndCalResultDef findByCompareIdAndCompareObjAndIndIdAndDate( public DriveIndCalResultDef findByCompareIdAndCompareObjAndIndIdAndDate(
@Param("compareId") String compareId,@Param("compareObj") String compareObj, @Param("compareId") String compareId,@Param("compareObj") String compareObj,
@Param("indId") String indId,@Param("date") Integer date); @Param("indId") String indId,@Param("date") Integer date,@Param("code") String code);
public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareObjIn(Map<String,Object> param); public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareObjIn(Map<String,Object> param);
...@@ -62,5 +62,5 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult ...@@ -62,5 +62,5 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult
//根据指标编号和对标单位根据对标时间降序获取指标考核结果 //根据指标编号和对标单位根据对标时间降序获取指标考核结果
public List<DriveIndCalResultDef> findByIndIdAndCompareObjOrderByDateDesc(@Param("indId") String indId, public List<DriveIndCalResultDef> findByIndIdAndCompareObjOrderByDateDesc(@Param("indId") String indId,
@Param("compareObj") String compareObj); @Param("compareObj") String compareObj,@Param("code") String code);
} }
...@@ -12,7 +12,7 @@ import tk.mybatis.mapper.common.BaseMapper; ...@@ -12,7 +12,7 @@ import tk.mybatis.mapper.common.BaseMapper;
@Mapper @Mapper
public interface ObjScoreCalResultMapper extends BaseMapper<ObjScoreCalResult>{ public interface ObjScoreCalResultMapper extends BaseMapper<ObjScoreCalResult>{
public ObjScoreCalResult getObjScoreCalResultByParam(@Param("compareId")String compareId, public ObjScoreCalResult getObjScoreCalResultByParam(@Param("compareId")String compareId,
@Param("compareObj")String compareObj,@Param("date")Integer date); @Param("compareObj")String compareObj,@Param("date")Integer date,@Param("code") String code);
public void batchSave(@Param("datas")List<ObjScoreCalResult> datas); public void batchSave(@Param("datas")List<ObjScoreCalResult> datas);
......
...@@ -13,7 +13,7 @@ import tk.mybatis.mapper.common.BaseMapper; ...@@ -13,7 +13,7 @@ import tk.mybatis.mapper.common.BaseMapper;
public interface ReportOneMapper extends BaseMapper<IndicatorsReportOne>{ public interface ReportOneMapper extends BaseMapper<IndicatorsReportOne>{
public IndicatorsReportOne getByParam(@Param("indId")String indId, public IndicatorsReportOne getByParam(@Param("indId")String indId,
@Param("compareObj")String compareObj,@Param("date")Integer date, @Param("compareObj")String compareObj,@Param("date")Integer date,
@Param("type")String type); @Param("type")String type,@Param("code")String code);
public void batchSave(@Param("datas")List<IndicatorsReportOne> datas); public void batchSave(@Param("datas")List<IndicatorsReportOne> datas);
......
...@@ -13,7 +13,7 @@ import tk.mybatis.mapper.common.BaseMapper; ...@@ -13,7 +13,7 @@ import tk.mybatis.mapper.common.BaseMapper;
@Mapper @Mapper
public interface ReportThreeMapper extends BaseMapper<IndicatorsReportThree>{ public interface ReportThreeMapper extends BaseMapper<IndicatorsReportThree>{
public IndicatorsReportThree getByParam(@Param("compareObj")String compareObj, public IndicatorsReportThree getByParam(@Param("compareObj")String compareObj,
@Param("date")Integer date,@Param("type")String type); @Param("date")Integer date,@Param("type")String type,@Param("code")String code);
public void batchSave(@Param("datas")List<IndicatorsReportThree> datas); public void batchSave(@Param("datas")List<IndicatorsReportThree> datas);
......
...@@ -12,7 +12,7 @@ import tk.mybatis.mapper.common.BaseMapper; ...@@ -12,7 +12,7 @@ import tk.mybatis.mapper.common.BaseMapper;
@Mapper @Mapper
public interface ReportTwoMapper extends BaseMapper<IndicatorsReportTwo>{ public interface ReportTwoMapper extends BaseMapper<IndicatorsReportTwo>{
public IndicatorsReportTwo getDataByParam(@Param("indId")String indId,@Param("compareUnitId")String compareUnitId, public IndicatorsReportTwo getDataByParam(@Param("indId")String indId,@Param("compareUnitId")String compareUnitId,
@Param("date")Integer date,@Param("type")String type); @Param("date")Integer date,@Param("type")String type,@Param("code")String code);
public void batchSave(@Param("datas")List<IndicatorsReportTwo> datas); public void batchSave(@Param("datas")List<IndicatorsReportTwo> datas);
......
...@@ -57,13 +57,16 @@ public class DriveIndCalResultService { ...@@ -57,13 +57,16 @@ public class DriveIndCalResultService {
return driveIndCalResultDefMapper.selectByPrimaryKey(id); return driveIndCalResultDefMapper.selectByPrimaryKey(id);
} }
public DriveIndCalResultDef findCompareObjInfo(String driveIndId,int date,String compareObj) { public DriveIndCalResultDef findCompareObjInfo(String driveIndId,int date,String compareObj,
return driveIndCalResultDefMapper.findByIndIdAndDateAndCompareObj(driveIndId,date,compareObj); String code) {
return driveIndCalResultDefMapper.findByIndIdAndDateAndCompareObj(driveIndId,date,
compareObj,code);
} }
public DriveIndCalResultDef findCalResultDataIsExist(String compareId,String compareObj, public DriveIndCalResultDef findCalResultDataIsExist(String compareId,String compareObj,
String indId,int date) { String indId,int date,String code) {
return driveIndCalResultDefMapper.findByCompareIdAndCompareObjAndIndIdAndDate(compareId, compareObj, indId, date); return driveIndCalResultDefMapper.findByCompareIdAndCompareObjAndIndIdAndDate(compareId,
compareObj, indId, date,code);
} }
public List<DriveIndCalResultDef> findByCompareIdAndDate(String compareId,Integer date){ public List<DriveIndCalResultDef> findByCompareIdAndDate(String compareId,Integer date){
...@@ -81,8 +84,8 @@ public class DriveIndCalResultService { ...@@ -81,8 +84,8 @@ public class DriveIndCalResultService {
} }
//启动回流actor //启动回流actor
final ActorSystem system = ActorSystem.create("CompareUnitCalAkka");//创建akka final ActorSystem system = ActorSystem.create("CompareUnitCalAkka");//创建akka
StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(sameCompareUnitList); StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(
startCompareUnitCalMsg.setCode(code); sameCompareUnitList,code);
ActorRef beforeCompareUnitCalActor = system.actorOf(Props.create( ActorRef beforeCompareUnitCalActor = system.actorOf(Props.create(
BeforeCompareUnitCalActor.class,()-> new BeforeCompareUnitCalActor())); BeforeCompareUnitCalActor.class,()-> new BeforeCompareUnitCalActor()));
beforeCompareUnitCalActor.tell(startCompareUnitCalMsg, ActorRef.noSender()); beforeCompareUnitCalActor.tell(startCompareUnitCalMsg, ActorRef.noSender());
......
...@@ -140,7 +140,7 @@ public class IndScorecardService { ...@@ -140,7 +140,7 @@ public class IndScorecardService {
} }
public Map<String,String> calculateIndiScore(String indId,int date,String compareObj, public Map<String,String> calculateIndiScore(String indId,int date,String compareObj,
Integer indScorecardId,String compareId,List<String> compareObjs) throws Exception{ Integer indScorecardId,String compareId,List<String> compareObjs,String code) throws Exception{
Map<String,String> result = new HashMap<>(); Map<String,String> result = new HashMap<>();
Gson gson = new Gson(); Gson gson = new Gson();
String indScoreValue = "0.0"; String indScoreValue = "0.0";
...@@ -160,7 +160,7 @@ public class IndScorecardService { ...@@ -160,7 +160,7 @@ public class IndScorecardService {
String unit = driveIndDef.getIndUnit(); String unit = driveIndDef.getIndUnit();
List<DriveIndCalResultDef> currentDriveResult = driveIndCalResultDefMapper List<DriveIndCalResultDef> currentDriveResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareIdAndSort(indId, date,compareId); .findByIndIdAndDateAndCompareIdAndSort(indId, date,compareId,code);
if(!currentDriveResult.isEmpty()) { if(!currentDriveResult.isEmpty()) {
//过滤考核指标结果集无效值 //过滤考核指标结果集无效值
Iterator<DriveIndCalResultDef> it=currentDriveResult.iterator(); Iterator<DriveIndCalResultDef> it=currentDriveResult.iterator();
...@@ -174,7 +174,7 @@ public class IndScorecardService { ...@@ -174,7 +174,7 @@ public class IndScorecardService {
int currentDriveResultSize = currentDriveResult.size(); int currentDriveResultSize = currentDriveResult.size();
//根据indId,date,compareObj获取考核结果 //根据indId,date,compareObj获取考核结果
DriveIndCalResultDef currentCompareObjResult = driveIndCalResultDefMapper DriveIndCalResultDef currentCompareObjResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, date, compareObj); .findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
if(currentCompareObjResult!=null) { if(currentCompareObjResult!=null) {
String average = currentCompareObjResult.getAverage(); String average = currentCompareObjResult.getAverage();
...@@ -256,7 +256,8 @@ public class IndScorecardService { ...@@ -256,7 +256,8 @@ public class IndScorecardService {
if("1".equals(scoreCard.getIsIncluScore())) {//纳入单位得分计算 if("1".equals(scoreCard.getIsIncluScore())) {//纳入单位得分计算
//同期 //同期
DriveIndCalResultDef sameCompareObjResult = driveIndCalResultDefMapper DriveIndCalResultDef sameCompareObjResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, (date-100), compareObj); .findByIndIdAndDateAndCompareObj(indId, (date-100),
compareObj,code);
if(sameCompareObjResult!=null) { if(sameCompareObjResult!=null) {
List<ImproveScoreDef> importScoreDefList = new ArrayList<>(); List<ImproveScoreDef> importScoreDefList = new ArrayList<>();
if(StringUtils.isNotBlank(scoreCard.getImproveScoreItemJson())) { if(StringUtils.isNotBlank(scoreCard.getImproveScoreItemJson())) {
...@@ -266,7 +267,8 @@ public class IndScorecardService { ...@@ -266,7 +267,8 @@ public class IndScorecardService {
} }
double improveScore = this.calImproveValue(acsType, unit, double improveScore = this.calImproveValue(acsType, unit,
importScoreDefList, currentCompareObjResult, importScoreDefList, currentCompareObjResult,
sameCompareObjResult,compareObjs,driveIndDef.getGrowCalType()); sameCompareObjResult,compareObjs,
driveIndDef.getGrowCalType(),code);
if(scoreCard.getLimitScore()!=null) { if(scoreCard.getLimitScore()!=null) {
if(improveScore>scoreCard.getLimitScore()) { if(improveScore>scoreCard.getLimitScore()) {
improveScore = scoreCard.getLimitScore(); improveScore = scoreCard.getLimitScore();
...@@ -292,8 +294,8 @@ public class IndScorecardService { ...@@ -292,8 +294,8 @@ public class IndScorecardService {
} }
private double calImproveValue(String acsType,String unit,List<ImproveScoreDef> importScoreDefList, private double calImproveValue(String acsType,String unit,List<ImproveScoreDef> importScoreDefList,
DriveIndCalResultDef current,DriveIndCalResultDef same, DriveIndCalResultDef current,DriveIndCalResultDef same,List<String> compareObjs,
List<String> compareObjs,String growCalType) { String growCalType,String code) {
double sumValue = 0; double sumValue = 0;
for(ImproveScoreDef scoreDef : importScoreDefList) { for(ImproveScoreDef scoreDef : importScoreDefList) {
// 0:同期排位比 1:单位同期比 // 0:同期排位比 1:单位同期比
...@@ -307,7 +309,7 @@ public class IndScorecardService { ...@@ -307,7 +309,7 @@ public class IndScorecardService {
for(String compareObj : compareObjs) { for(String compareObj : compareObjs) {
DriveIndCalResultDef sameCompareObjResult = driveIndCalResultDefMapper DriveIndCalResultDef sameCompareObjResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(current.getIndId(), .findByIndIdAndDateAndCompareObj(current.getIndId(),
(current.getDate()-100), compareObj); (current.getDate()-100), compareObj,code);
if(sameCompareObjResult!=null) { if(sameCompareObjResult!=null) {
values.put(compareObj, sameCompareObjResult.getValue()); values.put(compareObj, sameCompareObjResult.getValue());
}else { }else {
......
...@@ -159,7 +159,7 @@ public class IndicatorsValueService { ...@@ -159,7 +159,7 @@ public class IndicatorsValueService {
for(String indId : indIds) { for(String indId : indIds) {
//获取本期值 //获取本期值
DriveIndCalResultDef driveIndCalResult = driveIndCalResultDefMapper DriveIndCalResultDef driveIndCalResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, date, compareObj); .findByIndIdAndDateAndCompareObj(indId, date, compareObj,null);
if(driveIndCalResult!=null) { if(driveIndCalResult!=null) {
scoreValue.add(driveIndCalResult.getScore()); scoreValue.add(driveIndCalResult.getScore());
if(!"No".equals(driveIndCalResult.getImproveScore())) {//改善提升如果是纳入单位得分计算的 if(!"No".equals(driveIndCalResult.getImproveScore())) {//改善提升如果是纳入单位得分计算的
...@@ -265,11 +265,11 @@ public class IndicatorsValueService { ...@@ -265,11 +265,11 @@ public class IndicatorsValueService {
Map<String,String> dataMap = new HashMap<>(); Map<String,String> dataMap = new HashMap<>();
//获取本期值 //获取本期值
DriveIndCalResultDef driveIndCalResult = driveIndCalResultDefMapper DriveIndCalResultDef driveIndCalResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, date, compareObj); .findByIndIdAndDateAndCompareObj(indId, date, compareObj,null);
//获取同期值 //获取同期值
DriveIndCalResultDef sameDriveIndCalResult = driveIndCalResultDefMapper DriveIndCalResultDef sameDriveIndCalResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, (date-100), compareObj); .findByIndIdAndDateAndCompareObj(indId, (date-100), compareObj,null);
if(sameDriveIndCalResult!=null) {//存在 if(sameDriveIndCalResult!=null) {//存在
valueMap.put(compareObj, sameDriveIndCalResult.getValue()); valueMap.put(compareObj, sameDriveIndCalResult.getValue());
}else { }else {
...@@ -768,9 +768,9 @@ public class IndicatorsValueService { ...@@ -768,9 +768,9 @@ public class IndicatorsValueService {
result.put(compareObj, 0); result.put(compareObj, 0);
//获取本期考核指标值结果 //获取本期考核指标值结果
DriveIndCalResultDef currentResult = driveIndCalResultDefMapper DriveIndCalResultDef currentResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, date, compareObj); .findByIndIdAndDateAndCompareObj(indId, date, compareObj,null);
DriveIndCalResultDef sameResult = driveIndCalResultDefMapper DriveIndCalResultDef sameResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, (date-100), compareObj); .findByIndIdAndDateAndCompareObj(indId, (date-100), compareObj,null);
//获取同期考核指标值结果 //获取同期考核指标值结果
if(currentResult!=null && sameResult!=null) { if(currentResult!=null && sameResult!=null) {
result.put(compareObj, (sameResult.getRank()-currentResult.getRank())); result.put(compareObj, (sameResult.getRank()-currentResult.getRank()));
...@@ -784,7 +784,7 @@ public class IndicatorsValueService { ...@@ -784,7 +784,7 @@ public class IndicatorsValueService {
List<DriveIndCalResultDef> currentDriveResult = new ArrayList<>(); List<DriveIndCalResultDef> currentDriveResult = new ArrayList<>();
if(StringUtils.isNotBlank(compareId)) { if(StringUtils.isNotBlank(compareId)) {
currentDriveResult = driveIndCalResultDefMapper currentDriveResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareIdAndSort(indId, date, compareId); .findByIndIdAndDateAndCompareIdAndSort(indId, date, compareId,null);
}else { }else {
currentDriveResult = driveIndCalResultDefMapper currentDriveResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndSortAndActualAverageIsNotNull(indId, date); .findByIndIdAndDateAndSortAndActualAverageIsNotNull(indId, date);
...@@ -810,7 +810,7 @@ public class IndicatorsValueService { ...@@ -810,7 +810,7 @@ public class IndicatorsValueService {
compareId = "SCC006"; compareId = "SCC006";
} }
sameDriveResult = driveIndCalResultDefMapper sameDriveResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareIdAndSort(indId, (date-100),compareId); .findByIndIdAndDateAndCompareIdAndSort(indId, (date-100),compareId,null);
}else { }else {
sameDriveResult = driveIndCalResultDefMapper.findByIndIdAndDateAndSortAndActualAverageIsNotNull( sameDriveResult = driveIndCalResultDefMapper.findByIndIdAndDateAndSortAndActualAverageIsNotNull(
indId, date); indId, date);
......
...@@ -123,7 +123,7 @@ public class ScoreRuleService { ...@@ -123,7 +123,7 @@ public class ScoreRuleService {
//计算组内考核指标平均值或者总和 type:0 计算地区所有纳入考核指标平均数 3指标总得分 //计算组内考核指标平均值或者总和 type:0 计算地区所有纳入考核指标平均数 3指标总得分
private ObjScoreCalResult calGroupIndAverageOrSum(ObjScoreCalResult objResult,ScoreRule scoreRule, private ObjScoreCalResult calGroupIndAverageOrSum(ObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String type){ String compareObj,int date,String type,String code){
objResult.setCompareObj(compareObj); objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0"); objResult.setScoreValue("0.0");
objResult.setImproveValue("0.0"); objResult.setImproveValue("0.0");
...@@ -137,7 +137,7 @@ public class ScoreRuleService { ...@@ -137,7 +137,7 @@ public class ScoreRuleService {
//List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. //List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
//findByCompareObjAndDateAndIndIdIn(paremMap); //findByCompareObjAndDateAndIndIdIn(paremMap);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByCompareObjAndDate(compareObj, date); findByCompareObjAndDate(compareObj, date, code);
int indCount = 0;//定义用户记录纳入考核指标个数 int indCount = 0;//定义用户记录纳入考核指标个数
List<String> values = new ArrayList<>(); List<String> values = new ArrayList<>();
List<String> improveValues = new ArrayList<>(); List<String> improveValues = new ArrayList<>();
...@@ -207,7 +207,7 @@ public class ScoreRuleService { ...@@ -207,7 +207,7 @@ public class ScoreRuleService {
} }
private ObjScoreCalResult calSingleIndWeight(ObjScoreCalResult objResult,ScoreRule scoreRule, private ObjScoreCalResult calSingleIndWeight(ObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date){ String compareObj,int date,String code){
objResult.setCompareObj(compareObj); objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0"); objResult.setScoreValue("0.0");
objResult.setImproveValue("0.0"); objResult.setImproveValue("0.0");
...@@ -225,7 +225,7 @@ public class ScoreRuleService { ...@@ -225,7 +225,7 @@ public class ScoreRuleService {
for(String indId : indIdList) { for(String indId : indIdList) {
//根据日期,对标对象和考核的指标获取考核指标结果详情 //根据日期,对标对象和考核的指标获取考核指标结果详情
DriveIndCalResultDef calresultOp = driveIndCalResultDefMapper. DriveIndCalResultDef calresultOp = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(indId, date, compareObj); findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
if(calresultOp!=null) { if(calresultOp!=null) {
//auth:zhangkb time:2020-7-15 desc:填充对标对象描述 //auth:zhangkb time:2020-7-15 desc:填充对标对象描述
objResult.setCompareObjDesc(calresultOp.getCompareObjDesc()); objResult.setCompareObjDesc(calresultOp.getCompareObjDesc());
...@@ -292,7 +292,7 @@ public class ScoreRuleService { ...@@ -292,7 +292,7 @@ public class ScoreRuleService {
//按照指标类别进行分类分别计算平均分后再跟类别权重相乘后相加得到最终分数 //按照指标类别进行分类分别计算平均分后再跟类别权重相乘后相加得到最终分数
private ObjScoreCalResult calIndCatalogTypeAverage(ObjScoreCalResult objResult,ScoreRule scoreRule, private ObjScoreCalResult calIndCatalogTypeAverage(ObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date){ String compareObj,int date,String code){
Gson gson = new Gson(); Gson gson = new Gson();
objResult.setCompareObj(compareObj); objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0"); objResult.setScoreValue("0.0");
...@@ -301,7 +301,7 @@ public class ScoreRuleService { ...@@ -301,7 +301,7 @@ public class ScoreRuleService {
//根据对标对象,日期查找该对标对象对标的所有指标结果 //根据对标对象,日期查找该对标对象对标的所有指标结果
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByCompareObjAndDate(compareObj, date); findByCompareObjAndDate(compareObj, date, code);
double scoreValue = 0.0; double scoreValue = 0.0;
double improveValue = 0.0; double improveValue = 0.0;
if(!calResults.isEmpty()) { if(!calResults.isEmpty()) {
...@@ -380,7 +380,7 @@ public class ScoreRuleService { ...@@ -380,7 +380,7 @@ public class ScoreRuleService {
//根据单位评分规则计算单位分数 //根据单位评分规则计算单位分数
public void calObjScore(String compareId,List<String> indIds, public void calObjScore(String compareId,List<String> indIds,
List<String> compareObjs,int date,Integer scoreRuleId) { List<String> compareObjs,int date,Integer scoreRuleId,String code) {
//根据单位得分评分卡id获取评分卡详情 //根据单位得分评分卡id获取评分卡详情
ScoreRule scoreRule = this.getById(scoreRuleId); ScoreRule scoreRule = this.getById(scoreRuleId);
List<ObjScoreCalResult> datas = new ArrayList<>(); List<ObjScoreCalResult> datas = new ArrayList<>();
...@@ -389,23 +389,23 @@ public class ScoreRuleService { ...@@ -389,23 +389,23 @@ public class ScoreRuleService {
for(String compareObj : compareObjs) { for(String compareObj : compareObjs) {
//判断库表是否已存在改结果数据 //判断库表是否已存在改结果数据
ObjScoreCalResult objScoreCalResult = objScoreCalResultMapper. ObjScoreCalResult objScoreCalResult = objScoreCalResultMapper.
getObjScoreCalResultByParam(compareId, compareObj, date); getObjScoreCalResultByParam(compareId, compareObj, date, code);
if(objScoreCalResult == null) { if(objScoreCalResult == null) {
objScoreCalResult = new ObjScoreCalResult(); objScoreCalResult = new ObjScoreCalResult();
} }
//计算类型:0 地区所有纳入评价的考核指标平均数 //计算类型:0 地区所有纳入评价的考核指标平均数
if("0".equals(scoreRule.getCalType())) { if("0".equals(scoreRule.getCalType())) {
objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule, objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule,
compareObj, date, scoreRule.getCalType()); compareObj, date, scoreRule.getCalType(),code);
}else if("1".equals(scoreRule.getCalType())) {//1 根据目录类别分类算平均分后根据权重计算考核指标 }else if("1".equals(scoreRule.getCalType())) {//1 根据目录类别分类算平均分后根据权重计算考核指标
objScoreCalResult = this.calIndCatalogTypeAverage(objScoreCalResult, scoreRule, objScoreCalResult = this.calIndCatalogTypeAverage(objScoreCalResult, scoreRule,
compareObj, date); compareObj, date, code);
}else if("2".equals(scoreRule.getCalType())){//2单个指标权重计算 }else if("2".equals(scoreRule.getCalType())){//2单个指标权重计算
objScoreCalResult = this.calSingleIndWeight(objScoreCalResult ,scoreRule, objScoreCalResult = this.calSingleIndWeight(objScoreCalResult ,scoreRule,
compareObj, date); compareObj, date, code);
}else {//3:指标总得分 }else {//3:指标总得分
objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule, objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule,
compareObj, date, scoreRule.getCalType()); compareObj, date, scoreRule.getCalType(),code);
} }
objScoreCalResult.setCompareId(compareId); objScoreCalResult.setCompareId(compareId);
......
...@@ -121,7 +121,7 @@ public class ShortboardRuleService { ...@@ -121,7 +121,7 @@ public class ShortboardRuleService {
for(ShortboardItem shortboardItem : shortboardItems) { for(ShortboardItem shortboardItem : shortboardItems) {
shortboardType.append(shortboardItem.getType()).append(";");//拼接短板类型 shortboardType.append(shortboardItem.getType()).append(";");//拼接短板类型
List<DriveIndCalResultDef> driveIndCalResults = this.selectShortboardObj( List<DriveIndCalResultDef> driveIndCalResults = this.selectShortboardObj(
shortboardItem, compareObjs, driveId, date); shortboardItem, compareObjs, driveId, date, code);
if(status==0) { if(status==0) {
compareCalResults.addAll(driveIndCalResults); compareCalResults.addAll(driveIndCalResults);
status = 1; status = 1;
...@@ -161,7 +161,7 @@ public class ShortboardRuleService { ...@@ -161,7 +161,7 @@ public class ShortboardRuleService {
//根据指标关联的短板规则筛选短板单位 //根据指标关联的短板规则筛选短板单位
public List<Map<String,Object>> getObjShortboard(String compareId,int date, public List<Map<String,Object>> getObjShortboard(String compareId,int date,
List<String> compareObjs,List<String> driveIds)throws Exception{ List<String> compareObjs,List<String> driveIds,String code)throws Exception{
List<Map<String,Object>> result = new ArrayList<>(); List<Map<String,Object>> result = new ArrayList<>();
Gson gson = new Gson(); Gson gson = new Gson();
int status = 0; int status = 0;
...@@ -180,7 +180,7 @@ public class ShortboardRuleService { ...@@ -180,7 +180,7 @@ public class ShortboardRuleService {
fromJson(shortboardRule.getShortboardItemJson(), new TypeToken<List<ShortboardItem>>(){}.getType()); fromJson(shortboardRule.getShortboardItemJson(), new TypeToken<List<ShortboardItem>>(){}.getType());
for(ShortboardItem shortboardItem : shortboardItems) { for(ShortboardItem shortboardItem : shortboardItems) {
List<DriveIndCalResultDef> driveIndCalResults = this.selectShortboardObj( List<DriveIndCalResultDef> driveIndCalResults = this.selectShortboardObj(
shortboardItem, compareObjs, driveId, date); shortboardItem, compareObjs, driveId, date, code);
if(status==0) { if(status==0) {
compareCalResults.addAll(driveIndCalResults); compareCalResults.addAll(driveIndCalResults);
status = 1; status = 1;
...@@ -204,26 +204,26 @@ public class ShortboardRuleService { ...@@ -204,26 +204,26 @@ public class ShortboardRuleService {
} }
private List<DriveIndCalResultDef> selectShortboardObj(ShortboardItem shortboardItem, private List<DriveIndCalResultDef> selectShortboardObj(ShortboardItem shortboardItem,
List<String> compareObjs,String driveId,int date) throws Exception{ List<String> compareObjs,String driveId,int date,String code) throws Exception{
String type = shortboardItem.getType(); String type = shortboardItem.getType();
List<DriveIndCalResultDef> result = new ArrayList<>(); List<DriveIndCalResultDef> result = new ArrayList<>();
if("0".equals(type)) {//均值 if("0".equals(type)) {//均值
result = this.selectAverageShortboard(shortboardItem, compareObjs, driveId, date); result = this.selectAverageShortboard(shortboardItem, compareObjs, driveId, date, code);
}else if("1".equals(type)) {//最大值 }else if("1".equals(type)) {//最大值
result = this.selectMaxShortboard(shortboardItem, compareObjs, driveId, date); result = this.selectMaxShortboard(shortboardItem, compareObjs, driveId, date, code);
}else if("2".equals(type)) {//最小值 }else if("2".equals(type)) {//最小值
result = this.selectMinShortboard(shortboardItem, compareObjs, driveId, date); result = this.selectMinShortboard(shortboardItem, compareObjs, driveId, date, code);
}else if("3".equals(type)) {//排名 }else if("3".equals(type)) {//排名
result = this.selectRankShortboard(shortboardItem, compareObjs, driveId, date); result = this.selectRankShortboard(shortboardItem, compareObjs, driveId, date, code);
}else {//历史同期 }else {//历史同期
result = this.selectSametimeShortboard(shortboardItem, compareObjs, driveId, date); result = this.selectSametimeShortboard(shortboardItem, compareObjs, driveId, date, code);
} }
return result; return result;
} }
//短板筛选规则为均值 //短板筛选规则为均值
private List<DriveIndCalResultDef> selectAverageShortboard(ShortboardItem shortboardItem, private List<DriveIndCalResultDef> selectAverageShortboard(ShortboardItem shortboardItem,
List<String> compareObjs,String driveId,int date) throws Exception{ List<String> compareObjs,String driveId,int date,String code) throws Exception{
List<DriveIndCalResultDef> filterCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果 List<DriveIndCalResultDef> filterCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果
List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果 List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果
//根据考核指标id获取考核指标 //根据考核指标id获取考核指标
...@@ -232,6 +232,7 @@ public class ShortboardRuleService { ...@@ -232,6 +232,7 @@ public class ShortboardRuleService {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("indId", driveId); paramMap.put("indId", driveId);
paramMap.put("date", date); paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs); paramMap.put("compareObjs", compareObjs);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap); findByIndIdAndDateAndCompareObjIn(paramMap);
...@@ -316,7 +317,7 @@ public class ShortboardRuleService { ...@@ -316,7 +317,7 @@ public class ShortboardRuleService {
//短板筛选规则为最大值 //短板筛选规则为最大值
private List<DriveIndCalResultDef> selectMaxShortboard(ShortboardItem shortboardItem, private List<DriveIndCalResultDef> selectMaxShortboard(ShortboardItem shortboardItem,
List<String> compareObjs,String driveId,int date) throws Exception{ List<String> compareObjs,String driveId,int date,String code) throws Exception{
List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果 List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果
//根据考核指标id获取考核指标 //根据考核指标id获取考核指标
DriveIndDef driveIndDef = driveIndDefService.getById(driveId); DriveIndDef driveIndDef = driveIndDefService.getById(driveId);
...@@ -324,6 +325,7 @@ public class ShortboardRuleService { ...@@ -324,6 +325,7 @@ public class ShortboardRuleService {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("indId", driveId); paramMap.put("indId", driveId);
paramMap.put("date", date); paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs); paramMap.put("compareObjs", compareObjs);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap); findByIndIdAndDateAndCompareObjIn(paramMap);
...@@ -360,7 +362,7 @@ public class ShortboardRuleService { ...@@ -360,7 +362,7 @@ public class ShortboardRuleService {
//短板筛选规则为最小值 //短板筛选规则为最小值
private List<DriveIndCalResultDef> selectMinShortboard(ShortboardItem shortboardItem, private List<DriveIndCalResultDef> selectMinShortboard(ShortboardItem shortboardItem,
List<String> compareObjs,String driveId,int date) throws Exception{ List<String> compareObjs,String driveId,int date,String code) throws Exception{
List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果 List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果
//根据考核指标id获取考核指标 //根据考核指标id获取考核指标
DriveIndDef driveIndDef = driveIndDefService.getById(driveId); DriveIndDef driveIndDef = driveIndDefService.getById(driveId);
...@@ -368,6 +370,7 @@ public class ShortboardRuleService { ...@@ -368,6 +370,7 @@ public class ShortboardRuleService {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("indId", driveId); paramMap.put("indId", driveId);
paramMap.put("date", date); paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs); paramMap.put("compareObjs", compareObjs);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap);//根据考核指标id,日期和对标对象获取对标结果 findByIndIdAndDateAndCompareObjIn(paramMap);//根据考核指标id,日期和对标对象获取对标结果
...@@ -409,12 +412,13 @@ public class ShortboardRuleService { ...@@ -409,12 +412,13 @@ public class ShortboardRuleService {
//短板筛选规则为排名(默认是选排名最后第几名的单位为短板) //短板筛选规则为排名(默认是选排名最后第几名的单位为短板)
private List<DriveIndCalResultDef> selectRankShortboard(ShortboardItem shortboardItem, private List<DriveIndCalResultDef> selectRankShortboard(ShortboardItem shortboardItem,
List<String> compareObjs,String driveId,int date) { List<String> compareObjs,String driveId,int date,String code) {
List<DriveIndCalResultDef> filterCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果 List<DriveIndCalResultDef> filterCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果
List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果 List<DriveIndCalResultDef> realCalResults = new ArrayList<>();//用于保存符合过滤条件的指标结果
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("indId", driveId); paramMap.put("indId", driveId);
paramMap.put("date", date); paramMap.put("date", date);
paramMap.put("code", code);
paramMap.put("compareObjs", compareObjs); paramMap.put("compareObjs", compareObjs);
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObjIn(paramMap);//根据考核指标id,日期和对标对象获取对标结果 findByIndIdAndDateAndCompareObjIn(paramMap);//根据考核指标id,日期和对标对象获取对标结果
...@@ -444,7 +448,7 @@ public class ShortboardRuleService { ...@@ -444,7 +448,7 @@ public class ShortboardRuleService {
//短板筛选规则为历史同期 //短板筛选规则为历史同期
private List<DriveIndCalResultDef> selectSametimeShortboard(ShortboardItem shortboardItem, private List<DriveIndCalResultDef> selectSametimeShortboard(ShortboardItem shortboardItem,
List<String> compareObjs,String driveId,int date) throws Exception{ List<String> compareObjs,String driveId,int date,String code) throws Exception{
List<DriveIndCalResultDef> realCalResults = new ArrayList<>(); List<DriveIndCalResultDef> realCalResults = new ArrayList<>();
//根据考核指标id获取考核指标 //根据考核指标id获取考核指标
DriveIndDef driveIndDef = driveIndDefService.getById(driveId); DriveIndDef driveIndDef = driveIndDefService.getById(driveId);
...@@ -452,10 +456,10 @@ public class ShortboardRuleService { ...@@ -452,10 +456,10 @@ public class ShortboardRuleService {
for(String compareObj : compareObjs) { for(String compareObj : compareObjs) {
//获取本期 //获取本期
DriveIndCalResultDef currentIndCalResult = driveIndCalResultDefMapper. DriveIndCalResultDef currentIndCalResult = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(driveId,date,compareObj); findByIndIdAndDateAndCompareObj(driveId,date,compareObj,code);
//获取同期 //获取同期
DriveIndCalResultDef sameIndCalResult = driveIndCalResultDefMapper. DriveIndCalResultDef sameIndCalResult = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj); findByIndIdAndDateAndCompareObj(driveId,(date-100),compareObj,code);
if(currentIndCalResult!=null && sameIndCalResult!=null) { if(currentIndCalResult!=null && sameIndCalResult!=null) {
if(!"NaN".equals(currentIndCalResult.getValue()) && if(!"NaN".equals(currentIndCalResult.getValue()) &&
!"Infinite".equals(currentIndCalResult.getValue()) && !"Infinite".equals(currentIndCalResult.getValue()) &&
......
...@@ -29,7 +29,8 @@ public class IndexReportService { ...@@ -29,7 +29,8 @@ public class IndexReportService {
private DriveIndDefMapper driveIndDefMapper; private DriveIndDefMapper driveIndDefMapper;
//获取省指标信息 //获取省指标信息
public List<Map<String,Object>> getLatestIndiInfo(Map<String,Integer> indIdMap,String compareObj){ public List<Map<String,Object>> getLatestIndiInfo(Map<String,Integer> indIdMap,String compareObj,
String code){
List<Map<String,Object>> result = new ArrayList<>(); List<Map<String,Object>> result = new ArrayList<>();
if(!indIdMap.isEmpty()) { if(!indIdMap.isEmpty()) {
for(Map.Entry<String, Integer> entry : indIdMap.entrySet()) { for(Map.Entry<String, Integer> entry : indIdMap.entrySet()) {
...@@ -42,7 +43,7 @@ public class IndexReportService { ...@@ -42,7 +43,7 @@ public class IndexReportService {
indMap.put("indUnit", driveIndDef.getIndUnit()); indMap.put("indUnit", driveIndDef.getIndUnit());
//根据指标编号和对标对象获取最新的对标考核数据 //根据指标编号和对标对象获取最新的对标考核数据
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper. List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByIndIdAndCompareObjOrderByDateDesc(entry.getKey(), compareObj); findByIndIdAndCompareObjOrderByDateDesc(entry.getKey(), compareObj, code);
int date = 0; int date = 0;
indMap.put("value", ""); indMap.put("value", "");
indMap.put("rate", ""); indMap.put("rate", "");
...@@ -52,7 +53,8 @@ public class IndexReportService { ...@@ -52,7 +53,8 @@ public class IndexReportService {
date = calResults.get(0).getDate(); date = calResults.get(0).getDate();
//获取同期值 //获取同期值
DriveIndCalResultDef sameResult = driveIndCalResultDefMapper. DriveIndCalResultDef sameResult = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(entry.getKey(), (date-100), compareObj); findByIndIdAndDateAndCompareObj(entry.getKey(), (date-100),
compareObj, code);
if(sameResult!=null) { if(sameResult!=null) {
//获取指标的同比类型以及指标的正反向类型 //获取指标的同比类型以及指标的正反向类型
String growCalType = driveIndDef.getGrowCalType(); String growCalType = driveIndDef.getGrowCalType();
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
where where
ind_id = #{indId} and ind_id = #{indId} and
compare_obj = #{compareObj} and compare_obj = #{compareObj} and
date = #{date} date = #{date} and
code = #{code}
</select> </select>
<select id="findByIndIdAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" > <select id="findByIndIdAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
...@@ -75,7 +76,8 @@ ...@@ -75,7 +76,8 @@
where where
ind_id = #{indId} and ind_id = #{indId} and
date = #{date} and date = #{date} and
compare_id = #{compareId} order by rank asc compare_id = #{compareId} and
code = #{code} order by rank asc
</select> </select>
<select id="findByIndIdAndDateAndCompareId" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" > <select id="findByIndIdAndDateAndCompareId" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
...@@ -92,7 +94,8 @@ ...@@ -92,7 +94,8 @@
from drive_ind_cal_result_def from drive_ind_cal_result_def
where where
compare_obj = #{compareObj} and compare_obj = #{compareObj} and
date = #{date} date = #{date} and
code = #{code}
</select> </select>
<select id="findByCompareObjAndDateAndIndIdIn" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" > <select id="findByCompareObjAndDateAndIndIdIn" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
...@@ -114,7 +117,8 @@ ...@@ -114,7 +117,8 @@
compare_id = #{compareId} and compare_id = #{compareId} and
compare_obj = #{compareObj} and compare_obj = #{compareObj} and
ind_id = #{indId} and ind_id = #{indId} and
date = #{date} date = #{date} and
code = #{code}
</select> </select>
<select id="findByIndIdAndDateAndCompareObjIn" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" > <select id="findByIndIdAndDateAndCompareObjIn" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
...@@ -123,6 +127,7 @@ ...@@ -123,6 +127,7 @@
where where
ind_id = #{indId} and ind_id = #{indId} and
date = #{date} and date = #{date} and
code = #{code} and
compare_obj in compare_obj in
<foreach item="id" collection="compareObjs" open="(" close=")" separator=","> <foreach item="id" collection="compareObjs" open="(" close=")" separator=",">
#{id} #{id}
...@@ -227,7 +232,8 @@ ...@@ -227,7 +232,8 @@
from drive_ind_cal_result_def from drive_ind_cal_result_def
where where
ind_id=#{indId} and ind_id=#{indId} and
compare_obj=#{compareObj} compare_obj=#{compareObj} and
code = #{code}
ORDER BY date desc ORDER BY date desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,20 +4,22 @@ ...@@ -4,20 +4,22 @@
<select id="getObjScoreCalResultByParam" resultType="com.keymobile.indicators.model.entity.objscorerule.ObjScoreCalResult" > <select id="getObjScoreCalResultByParam" resultType="com.keymobile.indicators.model.entity.objscorerule.ObjScoreCalResult" >
select * select *
from obj_score_cal_result from obj_score_cal_result
where compare_id=#{compareId} and where
compare_obj=#{compareObj} and compare_id=#{compareId} and
date=#{date} compare_obj=#{compareObj} and
date=#{date} and
code=#{code}
</select> </select>
<insert id="batchSave" parameterType="java.util.List"> <insert id="batchSave" parameterType="java.util.List">
insert into obj_score_cal_result( insert into obj_score_cal_result(
compare_id, compare_obj, compare_obj_desc, ind_ids, date, score_value, improve_value, compare_id, compare_obj, compare_obj_desc, ind_ids, date, score_value, improve_value,
score_sum_value, ind_count) score_sum_value, ind_count, code)
values values
<foreach collection="datas" item="val" separator=","> <foreach collection="datas" item="val" separator=",">
( (
#{val.compareId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.indIds}, #{val.date}, #{val.compareId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.indIds}, #{val.date},
#{val.scoreValue},#{val.improveValue},#{val.scoreSumValue},#{val.indCount}) #{val.scoreValue},#{val.improveValue},#{val.scoreSumValue},#{val.indCount},#{val.code})
</foreach> </foreach>
</insert> </insert>
...@@ -52,6 +54,9 @@ ...@@ -52,6 +54,9 @@
<if test="val.indCount != null"> <if test="val.indCount != null">
ind_count = #{val.indCount}, ind_count = #{val.indCount},
</if> </if>
<if test="val.code != null">
code = #{val.code},
</if>
</set> </set>
where id = ${val.id} where id = ${val.id}
</foreach> </foreach>
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
ind_id = #{indId} and ind_id = #{indId} and
compare_obj = #{compareObj} and compare_obj = #{compareObj} and
compare_date = #{date} and compare_date = #{date} and
compare_type = #{type} compare_type = #{type} and
code = #{code}
</select> </select>
<insert id="batchSave" parameterType="java.util.List"> <insert id="batchSave" parameterType="java.util.List">
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
where where
compare_obj = #{compareObj} and compare_obj = #{compareObj} and
compare_date = #{date} and compare_date = #{date} and
compare_type = #{type} compare_type = #{type} and
code = #{code}
</select> </select>
<delete id="deleteByParam" parameterType="map"> <delete id="deleteByParam" parameterType="map">
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
where where
compare_date = #{date} and compare_date = #{date} and
compare_type = #{type} and compare_type = #{type} and
code = #{code} and
compare_obj in compare_obj in
<foreach item="compareObj" collection="compareObjs" open="(" close=")" separator=","> <foreach item="compareObj" collection="compareObjs" open="(" close=")" separator=",">
#{compareObj} #{compareObj}
...@@ -27,14 +29,15 @@ ...@@ -27,14 +29,15 @@
compare_obj, compare_obj_desc, compare_date, compare_type, batter_average_ind_count, compare_obj, compare_obj_desc, compare_date, compare_type, batter_average_ind_count,
bad_average_ind_count, rank_head_three_ind_count, rank_after_three_ind_count, bad_average_ind_count, rank_head_three_ind_count, rank_after_three_ind_count,
ind_improve_count, ind_improve_head_three_count, ind_improve_after_three_count, ind_improve_count, ind_improve_head_three_count, ind_improve_after_three_count,
ind_improve_rate,effective_ind_count) ind_improve_rate,effective_ind_count,code)
values values
<foreach collection="datas" item="val" separator=","> <foreach collection="datas" item="val" separator=",">
( (
#{val.compareObj}, #{val.compareObjDesc}, #{val.compareDate}, #{val.compareType}, #{val.compareObj}, #{val.compareObjDesc}, #{val.compareDate}, #{val.compareType},
#{val.batterAverageIndCount}, #{val.badAverageIndCount}, #{val.rankHeadThreeIndCount}, #{val.batterAverageIndCount}, #{val.badAverageIndCount}, #{val.rankHeadThreeIndCount},
#{val.rankAfterThreeIndCount}, #{val.indImproveCount}, #{val.indImproveHeadThreeCount}, #{val.rankAfterThreeIndCount}, #{val.indImproveCount}, #{val.indImproveHeadThreeCount},
#{val.indImproveAfterThreeCount}, #{val.indImproveRate}, #{val.effectiveIndCount} #{val.indImproveAfterThreeCount}, #{val.indImproveRate}, #{val.effectiveIndCount},
#{val.code}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -79,9 +82,12 @@ ...@@ -79,9 +82,12 @@
<if test="val.indImproveRate != null"> <if test="val.indImproveRate != null">
ind_improve_rate = #{val.indImproveRate}, ind_improve_rate = #{val.indImproveRate},
</if> </if>
<if test="val.effectiveIndCount != null"> <if test="val.effectiveIndCount != null">
effective_ind_count = #{val.effectiveIndCount}, effective_ind_count = #{val.effectiveIndCount},
</if> </if>
<if test="val.code != null">
code = #{val.code},
</if>
</set> </set>
where id = ${val.id} where id = ${val.id}
</foreach> </foreach>
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
ind_id = #{indId} and ind_id = #{indId} and
compare_unit_id = #{compareUnitId} and compare_unit_id = #{compareUnitId} and
compare_date = #{date} and compare_date = #{date} and
compare_type = #{type} compare_type = #{type} and
code = #{code}
</select> </select>
<insert id="batchSave" parameterType="java.util.List"> <insert id="batchSave" parameterType="java.util.List">
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
same_actual_average,average_rate,trend,current_average,best_unit,best_unit_desc,best_unit_value, same_actual_average,average_rate,trend,current_average,best_unit,best_unit_desc,best_unit_value,
best_average_units,same_improve_units,rank_head_three,rank_head_three_desc,rank_after_three, best_average_units,same_improve_units,rank_head_three,rank_head_three_desc,rank_after_three,
rank_after_three_desc,same_improve_head_three,same_improve_head_three_desc,same_improve_after_three, rank_after_three_desc,same_improve_head_three,same_improve_head_three_desc,same_improve_after_three,
same_improve_after_three_desc,same_average) same_improve_after_three_desc,same_average,code)
values values
<foreach collection="datas" item="val" separator=","> <foreach collection="datas" item="val" separator=",">
( (
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
#{val.trend},#{val.currentAverage},#{val.bestUnit},#{val.bestUnitDesc},#{val.bestUnitValue}, #{val.trend},#{val.currentAverage},#{val.bestUnit},#{val.bestUnitDesc},#{val.bestUnitValue},
#{val.bestAverageUnits},#{val.sameImproveUnits},#{val.rankHeadThree},#{val.rankHeadThreeDesc}, #{val.bestAverageUnits},#{val.sameImproveUnits},#{val.rankHeadThree},#{val.rankHeadThreeDesc},
#{val.rankAfterThree},#{val.rankAfterThreeDesc},#{val.sameImproveHeadThree},#{val.sameImproveHeadThreeDesc}, #{val.rankAfterThree},#{val.rankAfterThreeDesc},#{val.sameImproveHeadThree},#{val.sameImproveHeadThreeDesc},
#{val.sameImproveAfterThree},#{val.sameImproveAfterThreeDesc},#{val.sameAverage} #{val.sameImproveAfterThree},#{val.sameImproveAfterThreeDesc},#{val.sameAverage},#{val.code}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -116,6 +117,9 @@ ...@@ -116,6 +117,9 @@
<if test="val.sameAverage != null"> <if test="val.sameAverage != null">
same_average = #{val.sameAverage}, same_average = #{val.sameAverage},
</if> </if>
<if test="val.code != null">
code = #{val.code},
</if>
</set> </set>
where id = ${val.id} where id = ${val.id}
</foreach> </foreach>
......
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