Commit 304c57f2 by zhangkb

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

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