|
@@ -3,6 +3,7 @@ package com.ims.eval.schedule;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.ims.common.utils.DateUtils;
|
|
|
import com.ims.common.utils.FormulaUtils;
|
|
|
+import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.entity.EvaluationDeptBusinessAssessment;
|
|
|
import com.ims.eval.entity.EvaluationWarningInfo;
|
|
|
import com.ims.eval.entity.EvaluationWarningRule;
|
|
@@ -49,8 +50,8 @@ public class EvaluationWarningSchedule {
|
|
|
/**
|
|
|
* 年度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 23 * * ?") // cron表达式: 每天23点触发
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 23 * * ?") // cron表达式: 每天23点触发
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningRuleResolveNDKP(){
|
|
|
List<EvaluationWarningRule> list = warningRuleService.warningRuleList(null, null, TYPE_NDKP, true);
|
|
|
List<Map<String, Object>> companys = evaluationService.getCompanyWarning(TYPE_NDKP);
|
|
@@ -64,8 +65,8 @@ public class EvaluationWarningSchedule {
|
|
|
/**
|
|
|
* 季度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 23 * * ?") // cron表达式: 每天23点触发
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 23 * * ?") // cron表达式: 每天23点触发
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningRuleResolveJDKP(){
|
|
|
List<EvaluationWarningRule> list = warningRuleService.warningRuleList(null, null, TYPE_JDKP, true);
|
|
|
List<Map<String, Object>> companys = evaluationService.getCompanyWarning(TYPE_JDKP);
|
|
@@ -79,8 +80,8 @@ public class EvaluationWarningSchedule {
|
|
|
/**
|
|
|
* 月度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 23 * * ?") // cron表达式: 每天23点触发
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 23 * * ?") // cron表达式: 每天23点触发
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningRuleResolveYDKP(){
|
|
|
List<EvaluationWarningRule> list = warningRuleService.warningRuleList(null, null, TYPE_YDKP, true);
|
|
|
List<Map<String, Object>> companys = evaluationService.getCompanyWarning(TYPE_YDKP);
|
|
@@ -96,114 +97,117 @@ public class EvaluationWarningSchedule {
|
|
|
/**
|
|
|
* 单位年度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 0 1 4 ?") // cron表达式: 每年4月1号0点触发
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 0 1 4 ?") // cron表达式: 每年4月1号0点触发
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningEvaluationNDKP(){
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
List<OrganizationEvaluation> list = evaluationService.list(null, TYPE_NDKP, year, null);
|
|
|
|
|
|
- String company = "";
|
|
|
+ String company = "公司本部";
|
|
|
String title = "单位年度考评";
|
|
|
String content = "";
|
|
|
if (list == null || list.size() == 0) {
|
|
|
content = "单位年度考评计划未建立";
|
|
|
- company = "公司本部";
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
+ }
|
|
|
+ Optional<OrganizationEvaluation> optional = list.stream().filter(item -> item.getStage().contains("未启动")).findFirst();
|
|
|
+ if (optional.isPresent()){
|
|
|
+ content = "单位年度考评流程未启动";
|
|
|
+ company = StringUtils.isNotEmpty(optional.get().getCreateOrgName()) ? optional.get().getCreateOrgName() : company;
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
}
|
|
|
- Optional<OrganizationEvaluation> optional = list.stream().filter(item -> item.getStage().equals("流程未启动")).findFirst();
|
|
|
- content = optional.isPresent() ? "单位年度考评流程未启动" : content;
|
|
|
- company = optional.isPresent() ? optional.get().getCreateOrgName() : company;
|
|
|
-
|
|
|
- saveWarningInfo(null, null, title, content, null, 0, 0, company);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 单位季度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 5 20 1 1,4,7,10 ?") // cron表达式: 每个季度的第一个月的20号的5执行一次
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 5 20 1 1,4,7,10 ?") // cron表达式: 每个季度的第一个月的20号的5执行一次
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningEvaluationJDKP(){
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
String season = String.valueOf(DateUtils.getSeason(cal.getTime()));
|
|
|
List<OrganizationEvaluation> list = evaluationService.list(null, TYPE_JDKP, year, season);
|
|
|
|
|
|
- String company = "";
|
|
|
+ String company = "公司本部";
|
|
|
String title = "单位季度考评";
|
|
|
String content = "";
|
|
|
if (list == null || list.size() == 0) {
|
|
|
content = "单位季度考评计划未建立";
|
|
|
- company = "公司本部";
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
+ }
|
|
|
+ Optional<OrganizationEvaluation> optional = list.stream().filter(item -> item.getStage().contains("未启动")).findFirst();
|
|
|
+ if (optional.isPresent()){
|
|
|
+ content = "单位季度考评流程未启动";
|
|
|
+ company = StringUtils.isNotEmpty(optional.get().getCreateOrgName()) ? optional.get().getCreateOrgName() : company;
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
}
|
|
|
- Optional<OrganizationEvaluation> optional = list.stream().filter(item -> item.getStage().equals("流程未启动")).findFirst();
|
|
|
- content = optional.isPresent() ? "单位季度考评流程未启动" : content;
|
|
|
- company = optional.isPresent() ? optional.get().getCreateOrgName() : company;
|
|
|
-
|
|
|
- saveWarningInfo(null, null, title, content, null, 0, 0, company);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 单位月度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 7 5 * ?") // cron表达式: 每月5日上午7点触发
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 7 5 * ?") // cron表达式: 每月5日上午7点触发
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningEvaluationYDKP(){
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
String month = String.valueOf(cal.get(Calendar.MONTH) + 1);
|
|
|
List<OrganizationEvaluation> list = evaluationService.list(null, TYPE_YDKP, year, month);
|
|
|
|
|
|
- String company = "";
|
|
|
+ String company = "公司本部";
|
|
|
String title = "单位月度考评";
|
|
|
String content = "";
|
|
|
if (list == null || list.size() == 0) {
|
|
|
content = "单位月度考评计划未建立";
|
|
|
- company = "公司本部";
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
+ }
|
|
|
+ Optional<OrganizationEvaluation> optional = list.stream().filter(item -> item.getStage().contains("未启动")).findFirst();
|
|
|
+ if (optional.isPresent()){
|
|
|
+ content = "单位季度考评流程未启动";
|
|
|
+ company = StringUtils.isNotEmpty(optional.get().getCreateOrgName()) ? optional.get().getCreateOrgName() : company;
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
}
|
|
|
- Optional<OrganizationEvaluation> optional = list.stream().filter(item -> item.getStage().equals("流程未启动")).findFirst();
|
|
|
- content = optional.isPresent() ? "单位月度考评流程未启动" : content;
|
|
|
- company = optional.isPresent() ? optional.get().getCreateOrgName() : company;
|
|
|
-
|
|
|
- saveWarningInfo(null, null, title, content, null, 0, 0, company);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 部门年度考评
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 0 1 4 ?") // cron表达式: 每年4月1号0点触发
|
|
|
- @Scheduled(cron="0/50 * * * * ?")
|
|
|
+ @Scheduled(cron = "0 0 0 1 4 ?") // cron表达式: 每年4月1号0点触发
|
|
|
+// @Scheduled(cron="0/50 * * * * ?")
|
|
|
public void warningEvaluationDeptYDKP(){
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
String year = String.valueOf(cal.get(Calendar.YEAR));
|
|
|
List<EvaluationDeptBusinessAssessment> list = assessmentService.list(year);
|
|
|
|
|
|
- String company = "";
|
|
|
+ String company = "公司部门";
|
|
|
String title = "部门年度考评";
|
|
|
String content = "";
|
|
|
if (list == null || list.size() == 0) {
|
|
|
content = "部门年度考评计划未建立";
|
|
|
- company = "公司部门";
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
+ }
|
|
|
+ Optional<EvaluationDeptBusinessAssessment> optional = list.stream().filter(item -> item.getStage().contains("未启动")).findFirst();
|
|
|
+ if (optional.isPresent()){
|
|
|
+ content = "部门年度考评计划流程未启动";
|
|
|
+ company = optional.isPresent() ? optional.get().getDeptName() : company;
|
|
|
+ saveWarningInfo(null, null, title, content, null, null, null, company);
|
|
|
}
|
|
|
- Optional<EvaluationDeptBusinessAssessment> optional = list.stream().filter(item -> item.getStage().equals("流程未启动")).findFirst();
|
|
|
- content = optional.isPresent() ? "部门年度考评计划流程未启动" : content;
|
|
|
- company = optional.isPresent() ? optional.get().getDeptName() : company;
|
|
|
-
|
|
|
- saveWarningInfo(null, null, title, content, null, 0, 0, company);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void calculate(List<EvaluationWarningRule> rules, List<Map<String, Object>> companys, String type){
|
|
|
- Calendar cal = Calendar.getInstance();
|
|
|
Map<Object, List<Map<String, Object>>> collect = companys.stream().collect(Collectors.groupingBy(m -> m.get("indicator_id")));
|
|
|
for (EvaluationWarningRule rule : rules){
|
|
|
if (!isFocus(rule, type)){
|
|
|
continue;
|
|
|
}
|
|
|
String company = "";
|
|
|
- double targetValue = 0;
|
|
|
- double completeValue = 0;
|
|
|
+ String targetValue = null;
|
|
|
+ String completeValue = null;
|
|
|
String expression = rule.getExpression();
|
|
|
List<Map<String, Object>> list = collect.get(rule.getIndicatorId());
|
|
|
for (Map<String, Object> mp : list){
|
|
@@ -211,8 +215,8 @@ public class EvaluationWarningSchedule {
|
|
|
//替换表达式数值
|
|
|
expression.replace("[" + mp.get("option_code") + "]", String.valueOf(mp.get("quantified_value")));
|
|
|
}
|
|
|
- targetValue = mp.containsKey("JHZ") ? (double) mp.get("JHZ") : mp.containsKey("DBZ") ? (double) mp.get("DBZ") : 0;
|
|
|
- completeValue = mp.containsKey("WCZ") ? (double) mp.get("WCZ") : 0;
|
|
|
+ targetValue = mp.containsKey("JHZ") ? (String) mp.get("JHZ") : mp.containsKey("DBZ") ? (String) mp.get("DBZ") : mp.containsKey("MBZ") ? (String) mp.get("MBZ") : null;
|
|
|
+ completeValue = mp.containsKey("WCZ") ? (String) mp.get("WCZ") : null;
|
|
|
company = mp.containsKey("organization_short_name") ? String.valueOf(mp.get("organization_short_name")) : company;
|
|
|
}
|
|
|
/**
|
|
@@ -226,7 +230,7 @@ public class EvaluationWarningSchedule {
|
|
|
}
|
|
|
|
|
|
private void saveWarningInfo(String binSection, String indicatorId, String title, String content,
|
|
|
- String ruleId, double targetValue, double completeValue, String company){
|
|
|
+ String ruleId, String targetValue, String completeValue, String company){
|
|
|
EvaluationWarningInfo info = new EvaluationWarningInfo();
|
|
|
info.setBinSection(binSection);
|
|
|
info.setIndicatorId(indicatorId);
|