Commit f190a9a3 authored by xinglei's avatar xinglei

*)修改实体

parent ca3b5fac
package com.yeejoin.amos.latentdanger.common.enums;
package com.yeejoin.amos.boot.biz.common.enums;
/**
* 规则请求枚举
......@@ -6,9 +6,15 @@ package com.yeejoin.amos.latentdanger.common.enums;
*
*/
public enum RuleTypeEnum {
// 防火监督
计划提交("计划提交", "addPlan","auditPage"),
计划审核("计划审核", "planAudit", ""),
计划生成("计划生成", "addPlanTask", null),
计划完成("计划完成", "planCompleted", null),
// 隐患
隐患第一次提交("隐患提交", "addLatentDanger"),
隐患审核("隐患审核", "dangerAudit");
隐患第一次提交("隐患提交", "addLatentDanger", null),
隐患审核("隐患审核", "dangerAudit", null);
/**
* 名称,描述
......@@ -18,6 +24,10 @@ public enum RuleTypeEnum {
* 编码
*/
private String code;
/**
* 跳转地址
*/
private String url;
public String getName() {
return name;
......@@ -35,8 +45,26 @@ public enum RuleTypeEnum {
this.code = code;
}
private RuleTypeEnum(String name, String code){
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
RuleTypeEnum(String name, String code, String url) {
this.name = name;
this.code = code;
this.url = url;
}
public static RuleTypeEnum getEnumByCode(String field){
for (RuleTypeEnum constants : values()) {
if (constants.getCode().equals(field)) {
return constants;
}
}
return null;
}
}
......@@ -8,13 +8,7 @@ package com.yeejoin.amos.supervision.common.enums;
public enum RuleTypeEnum {
GETCONTENT("维保项获取","getContent"),
CHECKRESULT("结果校验","checkResult" ),
// 防火监督
计划提交("计划提交", "addPlan"),
计划审核("计划审核", "planAudit"),
计划生成("计划生成", "addPlanTask"),
计划完成("计划完成", "planCompleted");
CHECKRESULT("结果校验","checkResult" );
/**
* 名称,描述
......
......@@ -13,6 +13,7 @@ import com.google.common.collect.Sets;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author: xl
......@@ -16,7 +17,7 @@ import java.util.List;
@RuleFact(value = "巡检计划",project = "消息规则")
public class PlanRo implements Serializable {
private static final long serialVersionUID = 3847767788621939352L;
private static final long serialVersionUID = -3493714205659077324L;
@Label("计划名称")
private String name;
......@@ -50,4 +51,7 @@ public class PlanRo implements Serializable {
@Label(value = "终端标识")
private String terminal;
@Label(value = "扩展参数")
private Map<String, String> extras;
}
......@@ -29,6 +29,7 @@ import com.yeejoin.amos.supervision.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.supervision.business.vo.CheckInfoVo;
import com.yeejoin.amos.supervision.business.vo.CheckVo;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.*;
......@@ -1574,7 +1575,7 @@ public class CheckServiceImpl implements ICheckService {
Plan plan = planService.queryPlanById(planTask.getPlanId());
// 计划完成,规则推送消息
if (PlanStatusEnum.COMPLETED.getValue() == plan.getStatus()){
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划完成.getCode());
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划完成);
}
// p_plan_task_detail更新隐患个数
......
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.param.PlanInfoPageParam;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanService;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
import com.yeejoin.amos.supervision.core.common.request.AddPlanRequest;
import com.yeejoin.amos.supervision.core.common.response.PlanPointRespone;
......@@ -227,9 +228,9 @@ public class PlanServiceImpl implements IPlanService {
}
try {
if (ValidationUtil.isEmpty(status)){
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交.getCode()); // 计划提交
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交); // 计划提交
} else {
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核.getCode(), ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
}
} catch (Exception e) {
log.info("规则调用失败");
......
......@@ -29,7 +29,7 @@ import com.yeejoin.amos.supervision.business.vo.PlanTaskVo;
import com.yeejoin.amos.supervision.common.enums.PlanStatusEnum;
import com.yeejoin.amos.supervision.common.enums.PlanTaskDetailIsFinishEnum;
import com.yeejoin.amos.supervision.common.enums.PlanTaskFinishStatusEnum;
import com.yeejoin.amos.supervision.common.enums.RuleTypeEnum;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.AppCheckInputRespone;
import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
......@@ -528,7 +528,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 2.保存执行数据明细表
planTaskDetail.saveAndFlush(planTaskDetailInstance);
// 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划生成.getCode());
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划生成);
}
// 定时任务监控
jobService.planTaskAddJob(planTask);
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.supervision.business.dto.PlanRo;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
......@@ -11,7 +12,9 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author: xl
......@@ -34,14 +37,14 @@ public class RulePlanService {
@Autowired
private JCSFeignClient jcsFeignClient;
public Boolean addPlanRule(Plan plan, List<String> userIds, String ruleType) throws Exception {
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType);
//触发规则
ruleTrigger.publish(planRo, packageId, new String[0]);
return true;
}
public Boolean addPlanAuditRule(Plan plan, List<String> userIds, String ruleType, String excuteStateName) throws Exception {
public Boolean addPlanAuditRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, String excuteStateName) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType);
planRo.setExcuteStateName(excuteStateName);
......@@ -50,13 +53,19 @@ public class RulePlanService {
return true;
}
private PlanRo buildPlanRo(Plan plan, List<String> userIds, String ruleType) {
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType) {
PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo);
planRo.setMsgType(msgType);
planRo.setRuleType(ruleType);
planRo.setRuleType(ruleType.getCode());
planRo.setRelationId(String.valueOf(plan.getId()));
if (!ValidationUtil.isEmpty(ruleType.getUrl())){
Map<String, String> map = new HashMap<>();
map.put("url", ruleType.getUrl());
planRo.setExtras(map);
}
if (ValidationUtil.isEmpty(userIds)) {
String leadPeopleIds = plan.getLeadPeopleIds();
if (!ValidationUtil.isEmpty(plan.getUserId()) && !leadPeopleIds.contains(plan.getUserId())) {
......
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