Commit fd87055a by zhangkb

对标单元计算添加对标单元目录信息保存区分同部门间的对标运算隔离

parent e9f9a9d5
......@@ -45,6 +45,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
private String isTest = null;//试运行,0:试运行 1:正式运行
private Integer compCalLogId=null;
private String path = null;//对标单元目录id
@Override
public Receive createReceive() {
......@@ -57,6 +59,7 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
code = beforeCompareUnitCalMsg.getCode();
isTest = beforeCompareUnitCalMsg.getIsTest();
compCalLogId = beforeCompareUnitCalMsg.getCompCalLogId();
path = beforeCompareUnitCalMsg.getPath();
if("0".equals(isTest)) {
logger.info("进行date:"+sameDate+" 的对标单元试运行计算.....日志id:"+compCalLogId);
}else {
......@@ -70,6 +73,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
startCompareUnitCalMsg.setUser(beforeCompareUnitCalMsg.getUser());
startCompareUnitCalMsg.setCompCalLogId(compCalLogId);
//设置对标单元目录
startCompareUnitCalMsg.setPath(path);
ActorRef startCompareUnitCalActor = this.getContext().actorOf(Props.create(
StartCompareUnitCalActor.class,()-> new StartCompareUnitCalActor(getSelf())));
......@@ -96,6 +101,8 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
StartCompareUnitCalMsg startCompareUnitCalMsg = new StartCompareUnitCalMsg(
currentCompareUnitDef,code,isTest);
startCompareUnitCalMsg.setCompCalLogId(compCalLogId);
//设置对标单元目录
startCompareUnitCalMsg.setPath(path);
ActorRef startCompareUnitCalActor = this.getContext().actorOf(Props.create(
StartCompareUnitCalActor.class,()-> new StartCompareUnitCalActor(getSelf())));
......@@ -106,8 +113,7 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
if("1".equals(isTest)) {//正式对标单元运算才进行报表数据生成
Map<String,String> compareObjMap = new HashMap<>();
logger.info("进行date:"+currentDate+" 指标本期同期报表数据和考核指标报表数据2数据整合");
//整合考核指标报表数据2
for(CompareUnitDef unitDef : currentCompareUnitDef) {
if(StringUtils.isNotBlank(unitDef.getIndIds()) &&
StringUtils.isNotBlank(unitDef.getCompareObjs())) {
......@@ -118,13 +124,13 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
compareObjMap.put(compareObj, compareObj);
}
//整合指标本期同期报表数据
indicatorsReportService.dealReportOne(
indicatorsReportService.dealReportOne(path,
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), code);
//整合考核指标报表数据2
indicatorsReportService.dealDriveIndReportTwoData(
indicatorsReportService.dealDriveIndReportTwoData(path,
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")), unitDef.getDate(),code);
}
......@@ -140,10 +146,10 @@ public class BeforeCompareUnitCalActor extends AbstractActor{
//整合考核指标报表数据3
logger.info("进行date:"+currentDate+" 指标报表3数据整合");
//删除历史数据
indicatorsReportService.deleteReportThreeDataByParam(currentDate,
indicatorsReportService.deleteReportThreeDataByParam(path,currentDate,
new ArrayList<String>(compareObjMap.keySet()),code);
for(CompareUnitDef unitDef : currentCompareUnitDef) {
indicatorsReportService.dealDriveIndReportThreeData(
indicatorsReportService.dealDriveIndReportThreeData(path,
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
unitDef.getDate(),code);
}
......
......@@ -51,8 +51,11 @@ public class CompareUnitCalActor extends AbstractActor{
private String code;//机构编码
private Integer compCalLogId;
private String isTest;
private String path;//对标单元目录
private final ActorRef startCompareUnitCalActor;//定义父actor
static public Props props(ActorRef startCompareUnitCalActor) {
......@@ -78,6 +81,7 @@ public class CompareUnitCalActor extends AbstractActor{
code = compareUnitCalMsg.getCode();
isTest = compareUnitCalMsg.getIsTest();
compCalLogId = compareUnitCalMsg.getCompCalLogId();
path = compareUnitCalMsg.getPath();
// //新增运行日志记录
// CompareUnitCalLog compCalLog = new CompareUnitCalLog(compareId,date,
// System.currentTimeMillis()+"","0");
......@@ -104,6 +108,8 @@ public class CompareUnitCalActor extends AbstractActor{
compareUnitDef.getCompareId(),indId,compareObjsList,compareUnitDef.getDate(),
firstExe,averageObj,compCalLogId,compareUnitCalMsg.getCode(),
compareUnitCalMsg.getIsTest());
//设置对标单元目录
driveIndIdCalMsg.setPath(path);
//start akka
ActorRef driveIndIdCalActor = this.getContext()
.actorOf(Props.create(DriveIndIdCalActor.class,
......@@ -164,8 +170,7 @@ public class CompareUnitCalActor extends AbstractActor{
})
.build();
}catch (Exception e){
e.printStackTrace();
logger.error("error:",e);
CompareUnitCalLog compCalLog = compareUnitCalLogService.findById(compCalLogId);
if(compCalLog!=null){
compCalLog.setEndTime(System.currentTimeMillis()+"");
......
......@@ -62,6 +62,8 @@ public class DriveIndIdCalActor extends AbstractActor{
private String isTest;
private Integer compCalLogId;
private String path;//对标单元目录
private final ActorRef compareUnitCalActor;//定义父actor
......@@ -89,6 +91,8 @@ public class DriveIndIdCalActor extends AbstractActor{
compareObjSize = compareObjs.size();
code = driveIndIdCalMsg.getCode();
isTest = driveIndIdCalMsg.getIsTest();
//对标单元目录
path = driveIndIdCalMsg.getPath();
//日志记录id
compCalLogId = driveIndIdCalMsg.getCompCalLogId();
......@@ -103,6 +107,8 @@ public class DriveIndIdCalActor extends AbstractActor{
DriveIndIdObjCalMsg driveIndIdObjCalMsg = new DriveIndIdObjCalMsg(compareId,
indId, compareObj, date, dimValueList, compCalLogId,
driveIndIdCalMsg.getCode(), driveIndIdCalMsg.getIsTest());
//设置对标单元目录
driveIndIdObjCalMsg.setPath(path);
ActorRef driveIndIdObjCalActor = this.getContext()
.actorOf(Props.create(DriveIndIdObjCalActor.class,
() -> new DriveIndIdObjCalActor(getSelf())));
......@@ -115,6 +121,8 @@ public class DriveIndIdCalActor extends AbstractActor{
String indType = calIndAverageAndRankMsg.getIndType();//指标类型:正向 反向
Integer scoreCardId = calIndAverageAndRankMsg.getScoreCardId();//评分卡id
Integer compCalLogId = calIndAverageAndRankMsg.getCompCalLogId();//记录日志id
//对标单元目录
String compareCatalog = calIndAverageAndRankMsg.getPath();
if (!"-1".equals(id)) {
valueMap.put(id, value);
compareObjs.add(calIndAverageAndRankMsg.getCompareObj());
......@@ -130,9 +138,14 @@ public class DriveIndIdCalActor extends AbstractActor{
String actualAverage = "0.0";//实际平均分
if (StringUtils.isNotBlank(averageObj)) {
if ("0".equals(isTest)) {
// TestDriveIndCalResultDef provinceDriveIndCalResult =
// testDriveIndCalResultService.findCompareObjInfo(
// calIndAverageAndRankMsg.getDriveIndId(),
// calIndAverageAndRankMsg.getDate(),
// averageObj, code);
TestDriveIndCalResultDef provinceDriveIndCalResult =
testDriveIndCalResultService.findCompareObjInfo(
calIndAverageAndRankMsg.getDriveIndId(),
compareCatalog, calIndAverageAndRankMsg.getDriveIndId(),
calIndAverageAndRankMsg.getDate(),
averageObj, code);
if (provinceDriveIndCalResult != null) {
......@@ -140,9 +153,14 @@ public class DriveIndIdCalActor extends AbstractActor{
actualAverage = provinceDriveIndCalResult.getValue();
}
} else {
// DriveIndCalResultDef provinceDriveIndCalResult =
// driveIndCalResultService.findCompareObjInfo(
// calIndAverageAndRankMsg.getDriveIndId(),
// calIndAverageAndRankMsg.getDate(),
// averageObj, code);
DriveIndCalResultDef provinceDriveIndCalResult =
driveIndCalResultService.findCompareObjInfo(
calIndAverageAndRankMsg.getDriveIndId(),
compareCatalog, calIndAverageAndRankMsg.getDriveIndId(),
calIndAverageAndRankMsg.getDate(),
averageObj, code);
if (provinceDriveIndCalResult != null) {
......@@ -202,10 +220,10 @@ public class DriveIndIdCalActor extends AbstractActor{
findById(Integer.parseInt(entry.getKey()));
if (driveIndCalResult != null) {
//计算分数
Map<String, String> scoreMap = indScorecardService.calculateIndiScore(
driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), scoreCardId,
driveIndCalResult.getCompareId(), compareObjs, code);
Map<String, String> scoreMap = indScorecardService.calculateIndiScore(compareCatalog,
driveIndCalResult.getCompareId(),driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), scoreCardId, compareObjs, code);
//填充指标分数和改善提升分数
driveIndCalResult.setScore(scoreMap.get("score"));
driveIndCalResult.setImproveScore(scoreMap.get("improveScore"));
testDataList.add(driveIndCalResult);
......@@ -216,10 +234,10 @@ public class DriveIndIdCalActor extends AbstractActor{
findById(Integer.parseInt(entry.getKey()));
if (driveIndCalResult != null) {
//计算分数
Map<String, String> scoreMap = indScorecardService.calculateIndiScore(
driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), scoreCardId,
driveIndCalResult.getCompareId(), compareObjs, code);
Map<String, String> scoreMap = indScorecardService.calculateIndiScore(compareCatalog,
driveIndCalResult.getCompareId(),driveIndCalResult.getIndId(), driveIndCalResult.getDate(),
driveIndCalResult.getCompareObj(), scoreCardId, compareObjs, code);
//填充指标分数和改善提升分数
driveIndCalResult.setScore(scoreMap.get("score"));
driveIndCalResult.setImproveScore(scoreMap.get("improveScore"));
dataList.add(driveIndCalResult);
......@@ -253,8 +271,7 @@ public class DriveIndIdCalActor extends AbstractActor{
})
.build();
}catch (Exception e){
e.printStackTrace();
logger.error("error:",e);
CompareUnitCalLog compCalLog = compareUnitCalLogService.findById(compCalLogId);
if(compCalLog!=null){
compCalLog.setEndTime(System.currentTimeMillis()+"");
......
......@@ -79,6 +79,8 @@ public class DriveIndIdObjCalActor extends AbstractActor{
private Integer compCalLogId = null;
private String path = null;//对标单元目录
private final ActorRef driveIndIdCalActor;//定义父actor
static public Props props(ActorRef driveIndIdCalActor) {
......@@ -103,6 +105,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
compCalLogId = driveIndIdObjCalMsg.getCompCalLogId();
code = driveIndIdObjCalMsg.getCode();
isTest = driveIndIdObjCalMsg.getIsTest();
path = driveIndIdObjCalMsg.getPath();
List<String> indIdList = new ArrayList<>();//定义存储从考核指标公式解析出来的基础指标id
......@@ -113,7 +116,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(-1,
compareId, driveIndId, compareObj, date, "NaN",
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId);
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId,path);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
} else {
unit = driveIndDef.getIndUnit();//指标单位
......@@ -138,7 +141,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
driveIndIdObjCalMsg.getCode());
//传入日志id
getBaseIndValueMsg.setCompCalLogId(compCalLogId);
//取根据基础指标id和维度去基础指标表取对应的指标值actor
ActorRef getBaseIndValueActor = this.getContext()
.actorOf(Props.create(GetBaseIndValueActor.class,
() -> new GetBaseIndValueActor()));
......@@ -223,48 +226,73 @@ public class DriveIndIdObjCalActor extends AbstractActor{
}
if ("0".equals(isTest)) {//试运行
//判断结果表中是否已存在该结果数据,存在则覆盖
TestDriveIndCalResultDef driveIndCalResult = testDriveIndCalResultService.
findCalResultDataIsExist(compareId, compareObj, driveIndId, date, code);
if (driveIndCalResult == null) {
driveIndCalResult = new TestDriveIndCalResultDef(compareId,
driveIndId, compareObj, date, driveIndValue, unit,
"1", "1", "admin", code, baseIndValueMsg.getCompareObjDesc());
} else {
driveIndCalResult.setCode(code);
driveIndCalResult.setUnit(unit);
driveIndCalResult.setValue(driveIndValue);
driveIndCalResult.setLastUpdateTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
//TestDriveIndCalResultDef driveIndCalResult = testDriveIndCalResultService.
//findCalResultDataIsExist(compareId, compareObj, driveIndId, date, code);
try {
TestDriveIndCalResultDef driveIndCalResult = testDriveIndCalResultService.
findCalResultDataIsExistByCatalog(path, compareObj, driveIndId, date, code);
if (driveIndCalResult == null) {
driveIndCalResult = new TestDriveIndCalResultDef(compareId,
driveIndId, compareObj, date, driveIndValue, unit,
"1", "1", "admin", code, baseIndValueMsg.getCompareObjDesc());
//设置对标单元目录
driveIndCalResult.setCompareCatalog(path);
} else {
driveIndCalResult.setCode(code);
driveIndCalResult.setUnit(unit);
driveIndCalResult.setValue(driveIndValue);
driveIndCalResult.setLastUpdateTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
driveIndCalResult.setCompareCatalog(path);
}
//保存进考核指标结果表中
testDriveIndCalResultService.saveOrUpdate(driveIndCalResult);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(driveIndCalResult.getId(),
compareId, driveIndId, compareObj, date, driveIndValue,
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId,path);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
} catch (Exception e) {
logger.error("compareCatalog:"+path+";compareObj:"+compareObj+
";driveIndId:"+driveIndId+";date:"+date+";code:"+code+
" have no only one");
throw new Exception(e);
}
//保存进考核指标结果表中
testDriveIndCalResultService.saveOrUpdate(driveIndCalResult);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(driveIndCalResult.getId(),
compareId, driveIndId, compareObj, date, driveIndValue,
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
} else {
//判断结果表中是否已存在该结果数据,存在则覆盖
DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
findCalResultDataIsExist(compareId, compareObj, driveIndId, date, code);
if (driveIndCalResult == null) {
driveIndCalResult = new DriveIndCalResultDef(compareId,
driveIndId, compareObj, date, driveIndValue, unit,
"1", "1", "admin", code, baseIndValueMsg.getCompareObjDesc());
} else {
driveIndCalResult.setCode(code);
driveIndCalResult.setUnit(unit);
driveIndCalResult.setValue(driveIndValue);
driveIndCalResult.setLastUpdateTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
//DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
//findCalResultDataIsExist(compareId, compareObj, driveIndId, date, code);
try {
//根据对标单元目录进行查找
DriveIndCalResultDef driveIndCalResult = driveIndCalResultService.
findCalResultDataIsExistByCatalog(path, compareObj, driveIndId, date, code);
if (driveIndCalResult == null) {
driveIndCalResult = new DriveIndCalResultDef(compareId,
driveIndId, compareObj, date, driveIndValue, unit,
"1", "1", "admin", code, baseIndValueMsg.getCompareObjDesc());
//设置对标单元路径
driveIndCalResult.setCompareCatalog(path);
} else {
driveIndCalResult.setCode(code);
driveIndCalResult.setUnit(unit);
driveIndCalResult.setValue(driveIndValue);
driveIndCalResult.setLastUpdateTime(DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
driveIndCalResult.setCompareCatalog(path);
}
//保存进考核指标结果表中
driveIndCalResultService.saveOrUpdate(driveIndCalResult);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(driveIndCalResult.getId(),
compareId, driveIndId, compareObj, date, driveIndValue,
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId,path);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
} catch (Exception e) {
logger.error("compareCatalog:"+path+";compareObj:"+compareObj+
";driveIndId:"+driveIndId+";date:"+date+";code:"+code+
" have no only one");
throw new Exception(e);
}
//保存进考核指标结果表中
driveIndCalResultService.saveOrUpdate(driveIndCalResult);
//返回指标值回去算平均值和排名
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(driveIndCalResult.getId(),
compareId, driveIndId, compareObj, date, driveIndValue,
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
}
} catch (Exception e) {
......@@ -307,7 +335,7 @@ public class DriveIndIdObjCalActor extends AbstractActor{
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(-1,
compareId, driveIndId, compareObj, date, "NaN",
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId);
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId,path);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
}
} else {
......@@ -319,14 +347,14 @@ public class DriveIndIdObjCalActor extends AbstractActor{
CalIndAverageAndRankMsg driveIndAverageAndRankMsg =
new CalIndAverageAndRankMsg(-1,
compareId, driveIndId, compareObj, date, "NaN",
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId);
unit, indType, scoreCardId, averageDriveIndFormula, compCalLogId,path);
driveIndIdCalActor.tell(driveIndAverageAndRankMsg, ActorRef.noSender());
}
}
})
.build();
}catch (Exception e){
e.printStackTrace();
logger.error("error:",e);
CompareUnitCalLog compCalLog = compareUnitCalLogService.findById(compCalLogId);
if(compCalLog!=null){
compCalLog.setEndTime(System.currentTimeMillis()+"");
......
......@@ -51,6 +51,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
private String isTest = null;//试运行,0:试运行 1:正式运行
private Integer compCalLogId = null;
private String path = null;//对标单元目录
private final ActorRef beforeCompareUnitActor;//定义父actor
static public Props props(ActorRef beforeCompareUnitActor) {
......@@ -72,9 +74,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
String user = startCompareUnitCalMsg.getUser();
compCalLogId = startCompareUnitCalMsg.getCompCalLogId();
List<CompareUnitDef> compareUnitDefs = startCompareUnitCalMsg.getCompareInitDefs();
path = startCompareUnitCalMsg.getPath();
//将对标单元进行分类,需要先执行的先开始进行对标计算
for (CompareUnitDef unitDef : compareUnitDefs) {
if ("1".equals(unitDef.getFirstExe())) {
firstExeList.add(unitDef);
......@@ -101,6 +102,8 @@ public class StartCompareUnitCalActor extends AbstractActor{
//运算者
compareUnitCalMsg.setUser(user);
compareUnitCalMsg.setCompCalLogId(compCalLogId);
//设置对标单元目录
compareUnitCalMsg.setPath(path);
ActorRef compareUnitCalActor = this.getContext()
.actorOf(Props.create(CompareUnitCalActor.class,
......@@ -114,6 +117,9 @@ public class StartCompareUnitCalActor extends AbstractActor{
startCompareUnitCalMsg.getCode(),
startCompareUnitCalMsg.getIsTest());
compareUnitCalMsg.setCompCalLogId(compCalLogId);
//设置对标单元目录
compareUnitCalMsg.setPath(path);
ActorRef compareUnitCalActor = this.getContext()
.actorOf(Props.create(CompareUnitCalActor.class,
() -> new CompareUnitCalActor(getSelf())));
......@@ -139,6 +145,9 @@ public class StartCompareUnitCalActor extends AbstractActor{
CompareUnitCalMsg compareUnitCalMsg = new CompareUnitCalMsg(unitDef,
code, isTest);
compareUnitCalMsg.setCompCalLogId(compCalLogId);
//设置对标单元目录
compareUnitCalMsg.setPath(path);
ActorRef compareUnitCalActor = this.getContext()
.actorOf(Props.create(CompareUnitCalActor.class,
() -> new CompareUnitCalActor(getSelf())));
......@@ -159,12 +168,12 @@ public class StartCompareUnitCalActor extends AbstractActor{
for (CompareUnitDef unitDef : calTypeExeList) {
//试运行
if ("0".equals(isTest)) {
testScoreRuleServer.testCalObjScore(unitDef.getCompareId(),
testScoreRuleServer.testCalObjScore(path,unitDef.getCompareId(),
Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), unitDef.getObjScoreRuleId(), code);
} else {
scoreRuleServer.calObjScore(unitDef.getCompareId(),
scoreRuleServer.calObjScore(path,unitDef.getCompareId(),
Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), unitDef.getObjScoreRuleId(), code);
......@@ -193,12 +202,12 @@ public class StartCompareUnitCalActor extends AbstractActor{
for (CompareUnitDef unitDef : calTypeExeList) {
//试运行
if ("0".equals(isTest)) {
testScoreRuleServer.testCalObjScore(unitDef.getCompareId(),
testScoreRuleServer.testCalObjScore(path,unitDef.getCompareId(),
Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), unitDef.getObjScoreRuleId(), code);
} else {
scoreRuleServer.calObjScore(unitDef.getCompareId(),
scoreRuleServer.calObjScore(path,unitDef.getCompareId(),
Arrays.asList(unitDef.getIndIds().split(",")),
Arrays.asList(unitDef.getCompareObjs().split(",")),
unitDef.getDate(), unitDef.getObjScoreRuleId(), code);
......
......@@ -19,10 +19,11 @@ public class CalIndAverageAndRankMsg implements Serializable{
private Integer scoreCardId;
private String indFormula;
private Integer compCalLogId;
private String path;//对标单元目录
public CalIndAverageAndRankMsg(Integer id,String compareId,String driveIndId,String compareObj,
Integer date,String driveIndValue,String unit,String indType,Integer scoreCardId,
String indFormula,Integer compCalLogId) {
String indFormula,Integer compCalLogId,String path) {
this.id = id;
this.compareId = compareId;
this.driveIndId = driveIndId;
......@@ -34,6 +35,7 @@ public class CalIndAverageAndRankMsg implements Serializable{
this.scoreCardId = scoreCardId;
this.indFormula = indFormula;
this.compCalLogId = compCalLogId;
this.path = path;
}
public Integer getId() {
......@@ -104,4 +106,12 @@ public class CalIndAverageAndRankMsg implements Serializable{
public void setCompCalLogId(Integer compCalLogId) {
this.compCalLogId = compCalLogId;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
......@@ -19,6 +19,9 @@ public class CompareUnitCalMsg implements Serializable{
private String user;
private Integer compCalLogId;
private String path;//对标单元目录
public CompareUnitCalMsg(CompareUnitDef compareUnitDef,String code,String isTest) {
this.compareUnitDef = compareUnitDef;
this.code = code;
......@@ -64,4 +67,12 @@ public class CompareUnitCalMsg implements Serializable{
public void setIsTest(String isTest) {
this.isTest = isTest;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
......@@ -19,6 +19,7 @@ public class DriveIndIdCalMsg implements Serializable{
private Integer compCalLogId;//运行日志记录id
private String code;//机构编码
private String isTest;//试运行 0:试运行 1:正式运行
private String path;//对标单元目录
public DriveIndIdCalMsg(String compareId,String indId,List<String> compareObj,Integer date,
String firstExe,String averageObj,Integer compCalLogId,String code,String isTest) {
......@@ -94,4 +95,12 @@ public class DriveIndIdCalMsg implements Serializable{
public void setIsTest(String isTest) {
this.isTest = isTest;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
......@@ -20,6 +20,7 @@ public class DriveIndIdObjCalMsg implements Serializable{
private Integer compCalLogId;//运行日志记录id
private String code;//机构编码
private String isTest;//试运行
private String path;//对标单元目录
public DriveIndIdObjCalMsg(String compareId,String indId,String compareObj,
Integer date,List<DimValue> dimValues,Integer compCalLogId,
......@@ -88,4 +89,12 @@ public class DriveIndIdObjCalMsg implements Serializable{
public void setIsTest(String isTest) {
this.isTest = isTest;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
......@@ -143,11 +143,11 @@ public class IndScorecardCtrl {
@ApiOperation(value = "根据评分卡计算指标分数", notes = "根据评分卡计算指标分数")
@PostMapping(value = "/calculateIndiScore")
public Map<String,String> calculateIndiScore(@RequestParam String indId,@RequestParam int date,
public Map<String,String> calculateIndiScore(@RequestParam String compareCatalog,
@RequestParam String compareId,@RequestParam String indId,@RequestParam int date,
@RequestParam String compareObj,@RequestParam Integer indScorecardId,
@RequestParam String compareId,@RequestBody List<String> compareObjs,
@RequestParam String code) throws Exception{
return indScorecardService.calculateIndiScore(indId, date, compareObj,
indScorecardId,compareId,compareObjs,code);
@RequestBody List<String> compareObjs,@RequestParam String code) throws Exception{
return indScorecardService.calculateIndiScore(compareCatalog,compareId,indId, date, compareObj,
indScorecardId,compareObjs,code);
}
}
......@@ -143,10 +143,10 @@ public class ObjScoreRuleCtrl {
@ApiOperation(value = "根据单位评分规则计算单位评分", notes = "根据单位评分规则计算单位评分")
@PostMapping(value = "/calculateObjectScore")
public void calculateObjectScore(
public void calculateObjectScore(@RequestParam String compareCatalog,
@RequestParam String compareId,@RequestParam List<String> indIds,
@RequestParam List<String> compareObjs,@RequestParam int date,
@RequestParam Integer scoreRuleId,@RequestParam String code){
scoreRuleService.calObjScore(compareId, indIds, compareObjs, date, scoreRuleId,code);
scoreRuleService.calObjScore(compareCatalog,compareId, indIds, compareObjs, date, scoreRuleId,code);
}
}
......@@ -28,9 +28,10 @@ public class IndicatorReportCtrl {
@ApiOperation(value = "整合指标本期同期报表数据", notes = "整合指标本期同期报表数据")
@PostMapping(value = "/dealReportOne")
public String dealReportOne(@RequestParam String compareUnitId,@RequestParam List<String> indIds,
public String dealReportOne(@RequestParam String compareCatalog,
@RequestParam String compareUnitId,@RequestParam List<String> indIds,
@RequestParam List<String> compareObjs,@RequestParam Integer date,@RequestParam String code) {
indicatorsReportService.dealReportOne(compareUnitId,indIds,compareObjs,date,code);
indicatorsReportService.dealReportOne(compareCatalog,compareUnitId,indIds,compareObjs,date,code);
return "考核指标本期同期报表数据开始整合...";
}
......@@ -44,17 +45,18 @@ public class IndicatorReportCtrl {
@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,
@RequestParam String code) {
indicatorsReportService.dealDriveIndReportTwoData(compareUnitId, indIds, compareObjs, date, code);
public String dealDriveReportTwo(@RequestParam String compareCatalog,@RequestParam String compareUnitId,
@RequestParam List<String> indIds,@RequestParam List<String> compareObjs,
@RequestParam Integer date,@RequestParam String code) {
indicatorsReportService.dealDriveIndReportTwoData(compareCatalog,compareUnitId, indIds,
compareObjs, date, code);
return "整合考核指标报表数据2开始整合...";
}
@ApiOperation(value = "整合考核指标报表数据3", notes = "整合考核指标报表数据3")
@PostMapping(value = "/dealDriveReportThree")
public String dealDriveReportThree(@RequestBody List<CompareUnitDef> compareUnitList,
@RequestParam String code) throws Exception{
@RequestParam String code,@RequestParam String compareCatalog) throws Exception{
Map<String,String> compareObjMap = new HashMap<>();
Integer date = null;
for(CompareUnitDef unitDef : compareUnitList) {
......@@ -67,10 +69,10 @@ public class IndicatorReportCtrl {
date = unitDef.getDate();
}
//删除历史数据
indicatorsReportService.deleteReportThreeDataByParam(date,
indicatorsReportService.deleteReportThreeDataByParam(compareCatalog,date,
new ArrayList<String>(compareObjMap.keySet()),code);
for(CompareUnitDef unitDef : compareUnitList) {
indicatorsReportService.dealDriveIndReportThreeData(
indicatorsReportService.dealDriveIndReportThreeData(compareCatalog,
unitDef.getCompareId(), Arrays.asList(unitDef.getIndIds().split(",")),
unitDef.getDate(),code);
}
......
......@@ -40,6 +40,7 @@ public class DriveIndCalResultDef {
private String improveScore;//改善提升得分
private String actualAverage;//实际平均数:用于省对市的操作,如果有全省的基础项数据,直接拿全省的基础项数据算考核指标做为其实际平均值
private String code;//编码标识
private String compareCatalog;//对标单元目录
public DriveIndCalResultDef() {
super();
......
......@@ -28,4 +28,5 @@ public class ObjScoreCalResult {
private String scoreSumValue;//指标总积分
private Integer indCount;//指标个数
private String code;//机构编码
private String compareCatalog;//对标单元目录
}
......@@ -40,4 +40,5 @@ public class IndicatorsReportOne {
private BigDecimal lastSameScore;//同期综合评分
private BigDecimal lastSameImprove;//同期改善提升评分
private String code;//编码标识
private String compareCatalog;//对标单元目录
}
......@@ -41,4 +41,5 @@ public class IndicatorsReportThree {
private Integer rankLastThreeCount;//排名末三指标个数
private String code;//机构编码
private String compareCatalog;//对标单元目录
}
......@@ -60,4 +60,5 @@ public class IndicatorsReportTwo {
private String rankLastThreeDesc;//排名末三描述
private String code;//系统编码
private String compareCatalog;//对标单元目录
}
......@@ -39,6 +39,7 @@ public class TestDriveIndCalResultDef {
private String improveScore;//改善提升得分
private String actualAverage;//实际平均数:用于省对市的操作,如果有全省的基础项数据,直接拿全省的基础项数据算考核指标做为其实际平均值
private String code;//编码标识
private String compareCatalog;//对标单元目录
public TestDriveIndCalResultDef() {
super();
......
......@@ -27,4 +27,5 @@ public class TestObjScoreCalResult {
private String scoreSumValue;//指标总积分
private Integer indCount;//指标个数
private String code;//机构编码
private String compareCatalog;//对标单元目录
}
......@@ -21,6 +21,15 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult
public DriveIndCalResultDef findByIndIdAndDateAndCompareObj(@Param("indId") String indId,
@Param("date") int date,@Param("compareObj") String compareObj,@Param("code") String code);
//根据对标单元目录
public DriveIndCalResultDef findByIndIdAndDateAndCompareObjAndCompareCatalog(@Param("indId") String indId,
@Param("date") int date,@Param("compareObj") String compareObj,@Param("code") String code,
@Param("compareCatalog") String compareCatalog);
public DriveIndCalResultDef findByCompareCatalogAndIndIdAndDateAndCompareObj(
@Param("compareCatalog") String compareCatalog,@Param("indId") String indId,
@Param("date") int date,@Param("compareObj") String compareObj,@Param("code") String code);
public List<DriveIndCalResultDef> findByIndIdAndDate(@Param("indId") String indId,
@Param("date") int date);
......@@ -36,18 +45,30 @@ public interface DriveIndCalResultDefMapper extends BaseMapper<DriveIndCalResult
public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareIdAndSort(@Param("indId") String indId,
@Param("date") int date,@Param("compareId") String compareId,@Param("code") String code);
public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareCatalogAndSort(@Param("indId") String indId,
@Param("date") int date,@Param("compareCatalog") String compareCatalog,@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("code") String code);
//使用对标单元目录进行过滤
public List<DriveIndCalResultDef> findByCompareCatalogAndCompareObjAndDate(@Param("compareCatalog") String compareCatalog,
@Param("compareObj") String compareObj,@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("code") String code);
//根据目录单元目录查找对标结果
public DriveIndCalResultDef findByCompareCatalogAndCompareObjAndIndIdAndDate(
@Param("compareCatalog") String compareCatalog,@Param("compareObj") String compareObj,
@Param("indId") String indId,@Param("date") Integer date,@Param("code") String code);
public List<DriveIndCalResultDef> findByIndIdAndDateAndCompareObjIn(Map<String,Object> param);
public List<DriveIndCalResultDef> findByCompareIdAndDate(@Param("compareId")String compareId,
......
......@@ -15,6 +15,11 @@ public interface ObjScoreCalResultMapper extends BaseMapper<ObjScoreCalResult>{
public ObjScoreCalResult getObjScoreCalResultByParam(@Param("compareId")String compareId,
@Param("compareObj")String compareObj,@Param("date")Integer date,@Param("code") String code);
//使用对标单元目录进行过滤
public ObjScoreCalResult getObjScoreCalResultByCompareCatalog(@Param("compareCatalog")String compareCatalog,
@Param("compareId")String compareId,@Param("compareObj")String compareObj,
@Param("date")Integer date,@Param("code") String code);
public void batchSave(@Param("datas")List<ObjScoreCalResult> datas);
public void batchUpdate(@Param("datas")List<ObjScoreCalResult> datas);
......
......@@ -14,7 +14,8 @@ 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("code")String code);
@Param("type")String type,@Param("code")String code,
@Param("compareCatalog")String compareCatalog);
public void batchSave(@Param("datas")List<IndicatorsReportOne> datas);
......
......@@ -13,7 +13,8 @@ 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("code")String code);
@Param("date")Integer date,@Param("type")String type,
@Param("code")String code,@Param("compareCatalog")String compareCatalog);
public void batchSave(@Param("datas")List<IndicatorsReportThree> datas);
......
......@@ -12,8 +12,9 @@ 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("code")String code);
public IndicatorsReportTwo getDataByParam(@Param("indId")String indId,
@Param("date")Integer date,@Param("type")String type,@Param("code")String code,
@Param("compareCatalog")String compareCatalog);
public void batchSave(@Param("datas")List<IndicatorsReportTwo> datas);
......
......@@ -15,13 +15,27 @@ public interface TestDriveIndCalResultDefMapper extends BaseMapper<TestDriveIndC
public List<TestDriveIndCalResultDef> findByCompareObjAndDate(@Param("compareObj") String compareObj,
@Param("date") int date,@Param("code") String code);
//使用对标单元目录过滤
public List<TestDriveIndCalResultDef> findByCompareCatalogAndCompareObjAndDate(@Param("compareCatalog") String compareCatalog,
@Param("compareObj") String compareObj,@Param("date") int date,@Param("code") String code);
public TestDriveIndCalResultDef findByIndIdAndDateAndCompareObj(@Param("indId") String indId,
@Param("date") int date,@Param("compareObj") String compareObj,@Param("code") String code);
//使用对标单元目录过滤
public TestDriveIndCalResultDef findByCompareCatalogAndIndIdAndDateAndCompareObj(
@Param("compareCatalog") String compareCatalog,@Param("indId") String indId,
@Param("date") int date,@Param("compareObj") String compareObj,@Param("code") String code);
public TestDriveIndCalResultDef findByCompareIdAndCompareObjAndIndIdAndDate(
@Param("compareId") String compareId,@Param("compareObj") String compareObj,
@Param("indId") String indId,@Param("date") Integer date,@Param("code") String code);
//根据对标单元目录查找对标结果表是否存在
public TestDriveIndCalResultDef findByCompareCatalogAndCompareObjAndIndIdAndDate(
@Param("compareCatalog") String compareCatalog,@Param("compareObj") String compareObj,
@Param("indId") String indId,@Param("date") Integer date,@Param("code") String code);
//批量保存
public void batchSave(@Param("datas")List<TestDriveIndCalResultDef> datas);
//批量修改
......
......@@ -15,6 +15,10 @@ public interface TestObjScoreCalResultMapper extends BaseMapper<TestObjScoreCalR
public TestObjScoreCalResult getTestObjScoreCalResultByParam(@Param("compareId")String compareId,
@Param("compareObj")String compareObj,@Param("date")Integer date,@Param("code") String code);
//根据对标单元目录获取
public TestObjScoreCalResult getTestObjScoreCalResultByCompareCatalog(@Param("compareCatalog")String compareCatalog,
@Param("compareObj")String compareObj,@Param("date")Integer date,@Param("code") String code);
public void batchSave(@Param("datas")List<TestObjScoreCalResult> datas);
public void batchUpdate(@Param("datas")List<TestObjScoreCalResult> datas);
......
......@@ -87,12 +87,26 @@ public class DriveIndCalResultService {
compareObj,code);
}
//根据对标单元目录
public DriveIndCalResultDef findCompareObjInfo(String compareCatalog,String driveIndId,int date,String compareObj,
String code) {
return driveIndCalResultDefMapper.findByCompareCatalogAndIndIdAndDateAndCompareObj(
compareCatalog, driveIndId, date, compareObj, code);
}
public DriveIndCalResultDef findCalResultDataIsExist(String compareId,String compareObj,
String indId,int date,String code) {
return driveIndCalResultDefMapper.findByCompareIdAndCompareObjAndIndIdAndDate(compareId,
compareObj, indId, date,code);
}
//根据对标单元目录查找对标结果是否存在
public DriveIndCalResultDef findCalResultDataIsExistByCatalog(String compareCatalog,String compareObj,
String indId,int date,String code) {
return driveIndCalResultDefMapper.findByCompareCatalogAndCompareObjAndIndIdAndDate(compareCatalog,
compareObj, indId, date, code);
}
public List<DriveIndCalResultDef> findByCompareIdAndDate(String compareId,Integer date){
return driveIndCalResultDefMapper.findByCompareIdAndDate(compareId, date);
}
......@@ -114,9 +128,9 @@ public class DriveIndCalResultService {
compareIds.add(unitDef.getCompareId());
sameDate = date;
}
//对标运算前先删除相关旧数据
this.deleteCompareUnitData(compareIds, currentDate, sameDate, code,isTest);
Thread.sleep(3000);
//对标运算前先删除相关旧数据
this.deleteCompareUnitData(compareIds, currentDate, sameDate, code,isTest);
Thread.sleep(3000);
//新增运行日志记录
CompareUnitCalLog compCalLog = new CompareUnitCalLog(path,currentDate,
......@@ -134,6 +148,8 @@ public class DriveIndCalResultService {
sameCompareUnitList,code,isTest);
startCompareUnitCalMsg.setCompCalLogId(compCalLogId);
//author:zhangkb time:2020-12-12 desc:将path参数传入对标计算中
startCompareUnitCalMsg.setPath(path);
ActorRef beforeCompareUnitCalActor = system.actorOf(Props.create(
BeforeCompareUnitCalActor.class,()-> new BeforeCompareUnitCalActor()));
......@@ -162,7 +178,6 @@ public class DriveIndCalResultService {
param2.put("compareIds", compareIds);
param2.put("dates", param2Dates);
if("1".equals(isTest)){
//删除数据
reportOneMapper.deleteByCompareIdInAndDateIn(param1);
......@@ -173,8 +188,6 @@ public class DriveIndCalResultService {
testDriveIndCalResultDefMapper.deleteByCompareIdInAndDateIn(param2);
testObjScoreCalResultMapper.deleteByCompareIdInAndDateIn(param2);
}
}
}
......
......@@ -139,8 +139,8 @@ public class IndScorecardService {
return result;
}
public Map<String,String> calculateIndiScore(String indId,int date,String compareObj,
Integer indScorecardId,String compareId,List<String> compareObjs,String code) throws Exception{
public Map<String,String> calculateIndiScore(String compareCatalog,String compareId,String indId,int date,String compareObj,
Integer indScorecardId,List<String> compareObjs,String code) throws Exception{
Map<String,String> result = new HashMap<>();
Gson gson = new Gson();
String indScoreValue = "0.0";
......@@ -161,6 +161,9 @@ public class IndScorecardService {
List<DriveIndCalResultDef> currentDriveResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareIdAndSort(indId, date,compareId,code);
//List<DriveIndCalResultDef> currentDriveResult = driveIndCalResultDefMapper
//.findByIndIdAndDateAndCompareCatalogAndSort(indId,date,compareCatalog,code);
if(!currentDriveResult.isEmpty()) {
//过滤考核指标结果集无效值
Iterator<DriveIndCalResultDef> it=currentDriveResult.iterator();
......@@ -173,8 +176,12 @@ public class IndScorecardService {
}
int currentDriveResultSize = currentDriveResult.size();
//根据indId,date,compareObj获取考核结果
// DriveIndCalResultDef currentCompareObjResult = driveIndCalResultDefMapper
// .findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
//改用添加对标单元目录做为条件过滤
DriveIndCalResultDef currentCompareObjResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
.findByIndIdAndDateAndCompareObjAndCompareCatalog(indId, date,
compareObj, code, compareCatalog);
if(currentCompareObjResult!=null) {
String average = currentCompareObjResult.getAverage();
......@@ -255,9 +262,13 @@ public class IndScorecardService {
//改善提升
if("1".equals(scoreCard.getIsIncluScore())) {//纳入单位得分计算
//同期
// DriveIndCalResultDef sameCompareObjResult = driveIndCalResultDefMapper
// .findByIndIdAndDateAndCompareObj(indId, (date-100),
// compareObj,code);
//改用添加对标单元目录做为过滤条件
DriveIndCalResultDef sameCompareObjResult = driveIndCalResultDefMapper
.findByIndIdAndDateAndCompareObj(indId, (date-100),
compareObj,code);
.findByIndIdAndDateAndCompareObjAndCompareCatalog(indId, (date-100),
compareObj,code,compareCatalog);
if(sameCompareObjResult!=null) {
List<ImproveScoreDef> importScoreDefList = new ArrayList<>();
if(StringUtils.isNotBlank(scoreCard.getImproveScoreItemJson())) {
......
......@@ -122,8 +122,8 @@ public class ScoreRuleService {
}
//计算组内考核指标平均值或者总和 type:0 计算地区所有纳入考核指标平均数 3指标总得分
private ObjScoreCalResult calGroupIndAverageOrSum(ObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String type,String code){
private ObjScoreCalResult calGroupIndAverageOrSum(String compareCatalog,ObjScoreCalResult objResult,
ScoreRule scoreRule,String compareObj,int date,String type,String code){
objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0");
objResult.setImproveValue("0.0");
......@@ -136,8 +136,11 @@ public class ScoreRuleService {
//paremMap.put("indIds", indIds);
//List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
//findByCompareObjAndDateAndIndIdIn(paremMap);
// List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
// findByCompareObjAndDate(compareObj, date, code);
//改用添加对标单元目录过滤
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByCompareObjAndDate(compareObj, date, code);
findByCompareCatalogAndCompareObjAndDate(compareCatalog,compareObj, date, code);
int indCount = 0;//定义用户记录纳入考核指标个数
List<String> values = new ArrayList<>();
List<String> improveValues = new ArrayList<>();
......@@ -206,7 +209,7 @@ public class ScoreRuleService {
return objResult;
}
private ObjScoreCalResult calSingleIndWeight(ObjScoreCalResult objResult,ScoreRule scoreRule,
private ObjScoreCalResult calSingleIndWeight(String compareCatalog,ObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String code){
objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0");
......@@ -227,7 +230,7 @@ public class ScoreRuleService {
for(String indId : indIdList) {
//根据日期,对标对象和考核的指标获取考核指标结果详情
DriveIndCalResultDef calresultOp = driveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
findByIndIdAndDateAndCompareObjAndCompareCatalog(indId, date, compareObj, code, compareCatalog);
if(calresultOp!=null) {
//auth:zhangkb time:2020-7-15 desc:填充对标对象描述
objResult.setCompareObjDesc(calresultOp.getCompareObjDesc());
......@@ -304,7 +307,7 @@ public class ScoreRuleService {
}
//按照指标类别进行分类分别计算平均分后再跟类别权重相乘后相加得到最终分数
private ObjScoreCalResult calIndCatalogTypeAverage(ObjScoreCalResult objResult,ScoreRule scoreRule,
private ObjScoreCalResult calIndCatalogTypeAverage(String compareCatalog,ObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String code){
Gson gson = new Gson();
objResult.setCompareObj(compareObj);
......@@ -313,8 +316,11 @@ public class ScoreRuleService {
objResult.setDate(date);
//根据对标对象,日期查找该对标对象对标的所有指标结果
// List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
// findByCompareObjAndDate(compareObj, date, code);
//改用添加对标单元目录进行过滤
List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
findByCompareObjAndDate(compareObj, date, code);
findByCompareCatalogAndCompareObjAndDate(compareCatalog,compareObj, date, code);
double scoreValue = 0.0;
double improveValue = 0.0;
double scoreSumValue = 0.0;
......@@ -396,7 +402,7 @@ public class ScoreRuleService {
}
//根据单位评分规则计算单位分数
public void calObjScore(String compareId,List<String> indIds,
public void calObjScore(String compareCatalog,String compareId,List<String> indIds,
List<String> compareObjs,int date,Integer scoreRuleId,String code) {
//根据单位得分评分卡id获取评分卡详情
ScoreRule scoreRule = this.getById(scoreRuleId);
......@@ -405,28 +411,31 @@ public class ScoreRuleService {
if(!indIds.isEmpty() && !compareObjs.isEmpty()) {
for(String compareObj : compareObjs) {
//判断库表是否已存在改结果数据
// ObjScoreCalResult objScoreCalResult = objScoreCalResultMapper.
// getObjScoreCalResultByParam(compareId, compareObj, date, code);
//改用添加对标单元目录过滤
ObjScoreCalResult objScoreCalResult = objScoreCalResultMapper.
getObjScoreCalResultByParam(compareId, compareObj, date, code);
getObjScoreCalResultByCompareCatalog(compareCatalog,compareId, compareObj, date, code);
if(objScoreCalResult == null) {
objScoreCalResult = new ObjScoreCalResult();
}
objScoreCalResult.setCode(code);
//计算类型:0 地区所有纳入评价的考核指标平均数
if("0".equals(scoreRule.getCalType())) {
objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule,
compareObj, date, scoreRule.getCalType(),code);
objScoreCalResult = this.calGroupIndAverageOrSum(compareCatalog,objScoreCalResult,
scoreRule, compareObj, date, scoreRule.getCalType(),code);
}else if("1".equals(scoreRule.getCalType())) {//1 根据目录类别分类算平均分后根据权重计算考核指标
objScoreCalResult = this.calIndCatalogTypeAverage(objScoreCalResult, scoreRule,
compareObj, date, code);
objScoreCalResult = this.calIndCatalogTypeAverage(compareCatalog,objScoreCalResult,
scoreRule, compareObj, date, code);
}else if("2".equals(scoreRule.getCalType())){//2单个指标权重计算
objScoreCalResult = this.calSingleIndWeight(objScoreCalResult ,scoreRule,
objScoreCalResult = this.calSingleIndWeight(compareCatalog,objScoreCalResult ,scoreRule,
compareObj, date, code);
}else {//3:指标总得分
objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule,
compareObj, date, scoreRule.getCalType(),code);
objScoreCalResult = this.calGroupIndAverageOrSum(compareCatalog,objScoreCalResult,
scoreRule, compareObj, date, scoreRule.getCalType(),code);
}
objScoreCalResult.setCompareCatalog(compareCatalog);
objScoreCalResult.setCompareId(compareId);
objScoreCalResult.setCode(code);
datas.add(objScoreCalResult);
}
//进行综合评价和改善提升总分排名
......
......@@ -28,12 +28,25 @@ public class TestDriveIndCalResultService {
driveIndId, date, compareObj, code);
}
//根据对标单元目录
public TestDriveIndCalResultDef findCompareObjInfo(String compareCatalog,String driveIndId,int date,String compareObj,
String code) {
return testDriveIndCalResultDefMapper.findByCompareCatalogAndIndIdAndDateAndCompareObj(
compareCatalog, driveIndId, date, compareObj, code);
}
public TestDriveIndCalResultDef findCalResultDataIsExist(String compareId,String compareObj,
String indId,int date,String code) {
return testDriveIndCalResultDefMapper.
findByCompareIdAndCompareObjAndIndIdAndDate(compareId, compareObj, indId, date, code);
}
public TestDriveIndCalResultDef findCalResultDataIsExistByCatalog(String compareCatalog,String compareObj,
String indId,int date,String code) {
return testDriveIndCalResultDefMapper.
findByCompareCatalogAndCompareObjAndIndIdAndDate(compareCatalog, compareObj, indId, date, code);
}
public int saveOrUpdate(TestDriveIndCalResultDef driveIndCalResult) {
if(driveIndCalResult.getId()==null) {
testDriveIndCalResultDefMapper.insert(driveIndCalResult);
......
......@@ -44,7 +44,7 @@ public class TestScoreRuleService {
private static final Pattern P = Pattern.compile("(\\[[^\\]]*\\])");
//根据单位评分规则计算单位分数
public void testCalObjScore(String compareId,List<String> indIds,
public void testCalObjScore(String compareCatalog,String compareId,List<String> indIds,
List<String> compareObjs,int date,Integer scoreRuleId,String code) {
//根据单位得分评分卡id获取评分卡详情
ScoreRule scoreRule = this.getById(scoreRuleId);
......@@ -53,27 +53,31 @@ public class TestScoreRuleService {
if(!indIds.isEmpty() && !compareObjs.isEmpty()) {
for(String compareObj : compareObjs) {
//判断库表是否已存在改结果数据
// TestObjScoreCalResult objScoreCalResult = testObjScoreCalResultMapper.
// getTestObjScoreCalResultByParam(compareId, compareObj, date, code);
//改用对标单元目录过滤
TestObjScoreCalResult objScoreCalResult = testObjScoreCalResultMapper.
getTestObjScoreCalResultByParam(compareId, compareObj, date, code);
getTestObjScoreCalResultByCompareCatalog(compareCatalog, compareObj, date, code);
if(objScoreCalResult == null) {
objScoreCalResult = new TestObjScoreCalResult();
}
//计算类型:0 地区所有纳入评价的考核指标平均数
if("0".equals(scoreRule.getCalType())) {
objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule,
objScoreCalResult = this.calGroupIndAverageOrSum(compareCatalog, objScoreCalResult, scoreRule,
compareObj, date, scoreRule.getCalType(),code);
}else if("1".equals(scoreRule.getCalType())) {//1 根据目录类别分类算平均分后根据权重计算考核指标
objScoreCalResult = this.calIndCatalogTypeAverage(objScoreCalResult, scoreRule,
objScoreCalResult = this.calIndCatalogTypeAverage(compareCatalog, objScoreCalResult, scoreRule,
compareObj, date, code);
}else if("2".equals(scoreRule.getCalType())){//2单个指标权重计算
objScoreCalResult = this.calSingleIndWeight(objScoreCalResult ,scoreRule,
objScoreCalResult = this.calSingleIndWeight(compareCatalog, objScoreCalResult ,scoreRule,
compareObj, date, code);
}else {//3:指标总得分
objScoreCalResult = this.calGroupIndAverageOrSum(objScoreCalResult, scoreRule,
objScoreCalResult = this.calGroupIndAverageOrSum(compareCatalog,objScoreCalResult, scoreRule,
compareObj, date, scoreRule.getCalType(),code);
}
objScoreCalResult.setCode(code);
objScoreCalResult.setCompareCatalog(compareCatalog);
objScoreCalResult.setCompareId(compareId);
datas.add(objScoreCalResult);
}
//批量新增或修改
......@@ -85,7 +89,7 @@ public class TestScoreRuleService {
}
//计算组内考核指标平均值或者总和 type:0 计算地区所有纳入考核指标平均数 3指标总得分
private TestObjScoreCalResult calGroupIndAverageOrSum(TestObjScoreCalResult objResult,ScoreRule scoreRule,
private TestObjScoreCalResult calGroupIndAverageOrSum(String compareCatalog,TestObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String type,String code){
objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0");
......@@ -99,8 +103,11 @@ public class TestScoreRuleService {
//paremMap.put("indIds", indIds);
//List<DriveIndCalResultDef> calResults = driveIndCalResultDefMapper.
//findByCompareObjAndDateAndIndIdIn(paremMap);
// List<TestDriveIndCalResultDef> calResults = testDriveIndCalResultDefMapper.
// findByCompareObjAndDate(compareObj, date, code);
//改用对标单元目录进行过滤
List<TestDriveIndCalResultDef> calResults = testDriveIndCalResultDefMapper.
findByCompareObjAndDate(compareObj, date, code);
findByCompareCatalogAndCompareObjAndDate(compareCatalog,compareObj, date, code);
int indCount = 0;//定义用户记录纳入考核指标个数
List<String> values = new ArrayList<>();
List<String> improveValues = new ArrayList<>();
......@@ -169,7 +176,7 @@ public class TestScoreRuleService {
return objResult;
}
private TestObjScoreCalResult calSingleIndWeight(TestObjScoreCalResult objResult,ScoreRule scoreRule,
private TestObjScoreCalResult calSingleIndWeight(String compareCatalog,TestObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String code){
objResult.setCompareObj(compareObj);
objResult.setScoreValue("0.0");
......@@ -187,8 +194,11 @@ public class TestScoreRuleService {
}
for(String indId : indIdList) {
//根据日期,对标对象和考核的指标获取考核指标结果详情
// TestDriveIndCalResultDef calresultOp = testDriveIndCalResultDefMapper.
// findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
//改用对标单元目录进行过滤
TestDriveIndCalResultDef calresultOp = testDriveIndCalResultDefMapper.
findByIndIdAndDateAndCompareObj(indId, date, compareObj, code);
findByCompareCatalogAndIndIdAndDateAndCompareObj(compareCatalog,indId, date, compareObj, code);
if(calresultOp!=null) {
//auth:zhangkb time:2020-7-15 desc:填充对标对象描述
objResult.setCompareObjDesc(calresultOp.getCompareObjDesc());
......@@ -254,7 +264,7 @@ public class TestScoreRuleService {
}
//按照指标类别进行分类分别计算平均分后再跟类别权重相乘后相加得到最终分数
private TestObjScoreCalResult calIndCatalogTypeAverage(TestObjScoreCalResult objResult,ScoreRule scoreRule,
private TestObjScoreCalResult calIndCatalogTypeAverage(String compareCatalog,TestObjScoreCalResult objResult,ScoreRule scoreRule,
String compareObj,int date,String code){
Gson gson = new Gson();
objResult.setCompareObj(compareObj);
......@@ -263,8 +273,11 @@ public class TestScoreRuleService {
objResult.setDate(date);
//根据对标对象,日期查找该对标对象对标的所有指标结果
// List<TestDriveIndCalResultDef> calResults = testDriveIndCalResultDefMapper.
// findByCompareObjAndDate(compareObj, date, code);
//改用对标单元目录进行过滤
List<TestDriveIndCalResultDef> calResults = testDriveIndCalResultDefMapper.
findByCompareObjAndDate(compareObj, date, code);
findByCompareCatalogAndCompareObjAndDate(compareCatalog, compareObj, date, code);
double scoreValue = 0.0;
double improveValue = 0.0;
if(!calResults.isEmpty()) {
......
......@@ -36,6 +36,28 @@
code = #{code}
</select>
<select id="findByIndIdAndDateAndCompareObjAndCompareCatalog" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
where
ind_id = #{indId} and
compare_obj = #{compareObj} and
date = #{date} and
code = #{code} and
comare_catalog = #{compareCatalog}
</select>
<select id="findByCompareCatalogAndIndIdAndDateAndCompareObj" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
where
compare_catalog = #{compareCatalog} and
ind_id = #{indId} and
compare_obj = #{compareObj} and
date = #{date} and
code = #{code}
</select>
<select id="findByIndIdAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
......@@ -80,6 +102,16 @@
code = #{code} order by `rank` asc
</select>
<select id="findByIndIdAndDateAndCompareCatalogAndSort" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
where
ind_id = #{indId} and
date = #{date} and
compare_catalog = #{compareCatalog} and
code = #{code} order by `rank` asc
</select>
<select id="findByIndIdAndDateAndCompareId" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
......@@ -98,6 +130,16 @@
code = #{code}
</select>
<select id="findByCompareCatalogAndCompareObjAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
where
compare_obj = #{compareObj} and
date = #{date} and
code = #{code} and
compare_catalog = #{compareCatalog}
</select>
<select id="findByCompareObjAndDateAndIndIdIn" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
......@@ -121,6 +163,17 @@
code = #{code}
</select>
<select id="findByCompareCatalogAndCompareObjAndIndIdAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
where
compare_catalog = #{compareCatalog} and
compare_obj = #{compareObj} and
ind_id = #{indId} and
date = #{date} and
code = #{code}
</select>
<select id="findByIndIdAndDateAndCompareObjIn" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from drive_ind_cal_result_def
......@@ -128,6 +181,7 @@
ind_id = #{indId} and
date = #{date} and
code = #{code} and
compare_catalog = #{compareCatalog} and
compare_obj in
<foreach item="id" collection="compareObjs" open="(" close=")" separator=",">
#{id}
......@@ -156,13 +210,14 @@
insert into drive_ind_cal_result_def(
compare_id, ind_id, compare_obj, compare_obj_desc, date, value, unit, type,
is_right, last_update_time, last_updater, average, `rank`, score, improve_score,
actual_average, code)
actual_average, code, compare_catalog)
values
<foreach collection="datas" item="val" separator=",">
(
#{val.compareId}, #{val.indId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.date},
#{val.value},#{val.unit},#{val.type},#{val.isRight},#{val.lastUpdateTime},#{val.lastUpdater},
#{val.average},#{val.rank},#{val.score},#{val.improveScore},#{val.actualAverage},#{val.code}
#{val.average},#{val.rank},#{val.score},#{val.improveScore},#{val.actualAverage},#{val.code},
#{val.compareCatalog}
)
</foreach>
</insert>
......@@ -222,6 +277,9 @@
<if test="val.code != null">
code = #{val.code},
</if>
<if test="val.compareCatalog != null">
compare_catalog = #{val.compareCatalog},
</if>
</set>
where id = ${val.id}
</foreach>
......
......@@ -11,6 +11,17 @@
code=#{code}
</select>
<select id="getObjScoreCalResultByCompareCatalog" 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} and
code=#{code} and
compare_catalog=#{compareCatalog}
</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,
......
......@@ -10,6 +10,9 @@
compare_date = #{date} and
compare_type = #{type} and
code = #{code}
<if test="compareCatalog!=null">
and compare_catalog = #{compareCatalog}
</if>
</select>
<insert id="batchSave" parameterType="java.util.List">
......@@ -17,7 +20,7 @@
ind_id, ind_name, compare_obj, compare_obj_desc, compare_date, compare_type, unit, depart,
catalog_type, current_value, last_same_value, value_rate, current_rank, last_same_rank,
current_score, current_improve, last_same_score, last_same_improve, code, value_rate_rank,
compare_unit_id)
compare_unit_id, compare_catalog)
values
<foreach collection="datas" item="val" separator=",">
(
......@@ -25,7 +28,7 @@
#{val.compareType},#{val.unit},#{val.depart},#{val.catalogType},#{val.currentValue},
#{val.lastSameValue},#{val.valueRate},#{val.currentRank},#{val.lastSameRank},
#{val.currentScore},#{val.currentImprove},#{val.lastSameScore},#{val.lastSameImprove},
#{val.code},#{val.valueRateRank},#{val.compareUnitId}
#{val.code},#{val.valueRateRank},#{val.compareUnitId},#{val.compareCatalog}
)
</foreach>
</insert>
......@@ -97,6 +100,9 @@
<if test="val.compareUnitId != null">
compare_unit_id = #{val.compareUnitId},
</if>
<if test="val.compareCatalog != null">
compare_catalog = #{val.compareCatalog},
</if>
</set>
where id = ${val.id}
</foreach>
......
......@@ -8,7 +8,8 @@
compare_obj = #{compareObj} and
compare_date = #{date} and
compare_type = #{type} and
code = #{code}
code = #{code} and
compare_catalog = #{compreCatalog}
</select>
<delete id="deleteByParam" parameterType="map">
......@@ -18,6 +19,7 @@
compare_date = #{date} and
compare_type = #{type} and
code = #{code} and
compare_catalog = #{compreCatalog} and
compare_obj in
<foreach item="compareObj" collection="compareObjs" open="(" close=")" separator=",">
#{compareObj}
......@@ -30,7 +32,8 @@
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_reduce_count,rank_one_count,rank_two_count,
rank_three_count,rank_last_one_count,rank_last_two_count,rank_last_three_count,code)
rank_three_count,rank_last_one_count,rank_last_two_count,rank_last_three_count,code,
compare_catalog)
values
<foreach collection="datas" item="val" separator=",">
(
......@@ -39,7 +42,8 @@
#{val.rankAfterThreeIndCount}, #{val.indImproveCount}, #{val.indImproveHeadThreeCount},
#{val.indImproveAfterThreeCount}, #{val.indImproveRate}, #{val.effectiveIndCount},
#{val.indReduceCount},#{val.rankOneCount},#{val.rankTwoCount},#{val.rankThreeCount},
#{val.rankLastOneCount},#{val.rankLastTwoCount},#{val.rankLastThreeCount},#{val.code}
#{val.rankLastOneCount},#{val.rankLastTwoCount},#{val.rankLastThreeCount},#{val.code},
#{val.compareCatalog}
)
</foreach>
</insert>
......
......@@ -6,10 +6,10 @@
from indicators_report_two
where
ind_id = #{indId} and
compare_unit_id = #{compareUnitId} and
compare_date = #{date} and
compare_type = #{type} and
code = #{code}
code = #{code} and
compare_catalog = #{compareCatalog}
</select>
<insert id="batchSave" parameterType="java.util.List">
......@@ -20,7 +20,7 @@
rank_after_three_desc,same_improve_head_three,same_improve_head_three_desc,same_improve_after_three,
same_improve_after_three_desc,same_average,rank_one,rank_one_desc,rank_two,rank_two_desc,
rank_three,rank_three_desc,rank_last_one,rank_last_one_desc,rank_last_two,rank_last_two_desc,
rank_last_three,rank_last_three_desc,code)
rank_last_three,rank_last_three_desc,code,compare_catalog)
values
<foreach collection="datas" item="val" separator=",">
(
......@@ -32,7 +32,7 @@
#{val.sameImproveAfterThree},#{val.sameImproveAfterThreeDesc},#{val.sameAverage},
#{val.rankOne},#{val.rankOneDesc},#{val.rankTwo},#{val.rankTwoDesc},#{val.rankThree},
#{val.rankThreeDesc},#{val.rankLastOne},#{val.rankLastOneDesc},#{val.rankLastTwo},
#{val.rankLastTwoDesc},#{val.rankLastThree},#{val.rankLastThreeDesc},#{val.code}
#{val.rankLastTwoDesc},#{val.rankLastThree},#{val.rankLastThreeDesc},#{val.code},#{val.compareCatalog}
)
</foreach>
</insert>
......@@ -161,6 +161,9 @@
<if test="val.code != null">
code = #{val.code},
</if>
<if test="val.compareCatalog != null">
compare_catalog = #{val.compareCatalog},
</if>
</set>
where id = ${val.id}
</foreach>
......
......@@ -10,6 +10,16 @@
code = #{code}
</select>
<select id="findByCompareCatalogAndCompareObjAndDate" resultType="com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef" >
select *
from test_drive_ind_cal_result_def
where
compare_obj = #{compareObj} and
date = #{date} and
code = #{code} and
compare_catalog = #{compareCatalog}
</select>
<select id="findByIndIdAndDateAndCompareObj" resultType="com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef" >
select *
from test_drive_ind_cal_result_def
......@@ -20,6 +30,17 @@
code = #{code}
</select>
<select id="findByCompareCatalogAndIndIdAndDateAndCompareObj" resultType="com.keymobile.indicators.model.entity.testrun.TestDriveIndCalResultDef" >
select *
from test_drive_ind_cal_result_def
where
compare_catalog = #{compareCatalog} and
ind_id = #{indId} and
compare_obj = #{compareObj} and
date = #{date} and
code = #{code}
</select>
<select id="findByCompareIdAndCompareObjAndIndIdAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from test_drive_ind_cal_result_def
......@@ -31,17 +52,29 @@
code = #{code}
</select>
<select id="findByCompareCatalogAndCompareObjAndIndIdAndDate" resultType="com.keymobile.indicators.model.entity.indicators.DriveIndCalResultDef" >
select *
from test_drive_ind_cal_result_def
where
compare_catalog = #{compareCatalog} and
compare_obj = #{compareObj} and
ind_id = #{indId} and
date = #{date} and
code = #{code}
</select>
<insert id="batchSave" parameterType="java.util.List">
insert into test_drive_ind_cal_result_def(
compare_id, ind_id, compare_obj, compare_obj_desc, date, value, unit, type,
is_right, last_update_time, last_updater, average, `rank`, score, improve_score,
actual_average, code)
actual_average, code, compare_catalog)
values
<foreach collection="datas" item="val" separator=",">
(
#{val.compareId}, #{val.indId}, #{val.compareObj}, #{val.compareObjDesc}, #{val.date},
#{val.value},#{val.unit},#{val.type},#{val.isRight},#{val.lastUpdateTime},#{val.lastUpdater},
#{val.average},#{val.rank},#{val.score},#{val.improveScore},#{val.actualAverage},#{val.code}
#{val.average},#{val.rank},#{val.score},#{val.improveScore},#{val.actualAverage},#{val.code},
#{val.compareCatalog}
)
</foreach>
</insert>
......@@ -101,6 +134,9 @@
<if test="val.code != null">
code = #{val.code},
</if>
<if test="val.compareCatalog != null">
compare_catalog = #{val.compareCatalog},
</if>
</set>
where id = ${val.id}
</foreach>
......
......@@ -11,15 +11,26 @@
code=#{code}
</select>
<select id="getTestObjScoreCalResultByCompareCatalog" resultType="com.keymobile.indicators.model.entity.testrun.TestObjScoreCalResult" >
select *
from test_obj_score_cal_result
where
compare_catalog=#{compareCatalog} and
compare_obj=#{compareObj} and
date=#{date} and
code=#{code}
</select>
<insert id="batchSave" parameterType="java.util.List">
insert into test_obj_score_cal_result(
compare_id, compare_obj, compare_obj_desc, ind_ids, date, score_value, improve_value,
score_sum_value, ind_count, code)
score_sum_value, ind_count, code, compare_catalog)
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.code})
#{val.scoreValue},#{val.improveValue},#{val.scoreSumValue},#{val.indCount},#{val.code},
#{val.compareCatalog})
</foreach>
</insert>
......@@ -57,6 +68,9 @@
<if test="val.code != null">
code = #{val.code},
</if>
<if test="val.compareCatalog != null">
compare_catalog = #{val.compareCatalog},
</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