Commit 21a0af50 authored by xukaiqiang's avatar xukaiqiang

1

parent e7fc3d0d
...@@ -68,6 +68,9 @@ public class Fmea extends BasicEntity { ...@@ -68,6 +68,9 @@ public class Fmea extends BasicEntity {
@Column(name = "risk_source_id") @Column(name = "risk_source_id")
private Long riskSourceId; private Long riskSourceId;
@Column(name = "risk_level_id")
private Long riskLevelId;
private BigDecimal rpni; private BigDecimal rpni;
@Lob @Lob
...@@ -76,16 +79,16 @@ public class Fmea extends BasicEntity { ...@@ -76,16 +79,16 @@ public class Fmea extends BasicEntity {
private RiskSource riskSource; private RiskSource riskSource;
@Column(name = "company_leader") @Column(name = "company_leader")
private Integer companyLeader; private Long companyLeader;
@Column(name = "department_leader") @Column(name = "department_leader")
private Integer departmentLeader; private Long departmentLeader;
@Column(name = "group_leader") @Column(name = "group_leader")
private Integer groupLeader; private Long groupLeader;
@Column(name = "person_leader") @Column(name = "person_leader")
private Integer personLeader; private Long personLeader;
@Column(name = "identify_user") @Column(name = "identify_user")
private Integer identifyUser; private Integer identifyUser;
...@@ -263,35 +266,35 @@ public class Fmea extends BasicEntity { ...@@ -263,35 +266,35 @@ public class Fmea extends BasicEntity {
this.rpn = rpn; this.rpn = rpn;
} }
public Integer getCompanyLeader() { public Long getCompanyLeader() {
return companyLeader; return companyLeader;
} }
public void setCompanyLeader(Integer companyLeader) { public void setCompanyLeader(Long companyLeader) {
this.companyLeader = companyLeader; this.companyLeader = companyLeader;
} }
public Integer getDepartmentLeader() { public Long getDepartmentLeader() {
return departmentLeader; return departmentLeader;
} }
public void setDepartmentLeader(Integer departmentLeader) { public void setDepartmentLeader(Long departmentLeader) {
this.departmentLeader = departmentLeader; this.departmentLeader = departmentLeader;
} }
public Integer getGroupLeader() { public Long getGroupLeader() {
return groupLeader; return groupLeader;
} }
public void setGroupLeader(Integer groupLeader) { public void setGroupLeader(Long groupLeader) {
this.groupLeader = groupLeader; this.groupLeader = groupLeader;
} }
public Integer getPersonLeader() { public Long getPersonLeader() {
return personLeader; return personLeader;
} }
public void setPersonLeader(Integer personLeader) { public void setPersonLeader(Long personLeader) {
this.personLeader = personLeader; this.personLeader = personLeader;
} }
...@@ -310,4 +313,12 @@ public class Fmea extends BasicEntity { ...@@ -310,4 +313,12 @@ public class Fmea extends BasicEntity {
public void setIdentifyMethod(String identifyMethod) { public void setIdentifyMethod(String identifyMethod) {
this.identifyMethod = identifyMethod; this.identifyMethod = identifyMethod;
} }
public Long getRiskLevelId() {
return riskLevelId;
}
public void setRiskLevelId(Long riskLevelId) {
this.riskLevelId = riskLevelId;
}
} }
\ No newline at end of file
...@@ -27,6 +27,8 @@ public class FmeaPointInputitem extends BasicEntity { ...@@ -27,6 +27,8 @@ public class FmeaPointInputitem extends BasicEntity {
private Long inputItemId; private Long inputItemId;
private Long riskSourceId;
public Long getPointInputitemId() { public Long getPointInputitemId() {
return PointInputitemId; return PointInputitemId;
} }
...@@ -59,4 +61,13 @@ public class FmeaPointInputitem extends BasicEntity { ...@@ -59,4 +61,13 @@ public class FmeaPointInputitem extends BasicEntity {
public Long getInputItemId() { public Long getInputItemId() {
return inputItemId; return inputItemId;
} }
@Transient
public Long getRiskSourceId() {
return riskSourceId;
}
public void setRiskSourceId(Long riskSourceId) {
this.riskSourceId = riskSourceId;
}
} }
\ No newline at end of file
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.util.HashMap;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService; import com.yeejoin.amos.fas.business.service.intfc.IRiskFactorService;
import com.yeejoin.amos.fas.business.util.CommonPageParamUtil; import com.yeejoin.amos.fas.business.util.CommonPageParamUtil;
...@@ -21,89 +9,90 @@ import com.yeejoin.amos.fas.dao.entity.RiskFactor; ...@@ -21,89 +9,90 @@ import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil; import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.security.entity.User; import com.yeejoin.amos.security.entity.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/riskFactor") @RequestMapping("/api/riskFactor")
@Api("危险因素api") @Api("危险因素api")
public class RiskFactorController extends BaseController { public class RiskFactorController extends BaseController {
private final Logger log = LoggerFactory.getLogger(RiskFactorController.class); private final Logger log = LoggerFactory.getLogger(RiskFactorController.class);
@Autowired @Autowired
IRiskFactorService iRiskFactorService; IRiskFactorService iRiskFactorService;
/**
* 危险因素分页查询 /**
* * 危险因素分页查询
* @param id */
* @return @ApiOperation(httpMethod = "POST", value = "危险因素查询", notes = "危险因素查询")
*/ @RequestMapping(value = "/pagelist", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST",value = "危险因素查询", notes = "危险因素查询") public CommonResponse queryRiskFactorPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@RequestMapping(value = "/pagelist", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
public CommonResponse queryRiskFactorPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { Page<HashMap<String, Object>> list = iRiskFactorService.queryRiskFactorPage(param);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable); return CommonResponseUtil.success(list);
Page<HashMap<String, Object>> list = iRiskFactorService.queryRiskFactorPage(param); }
return CommonResponseUtil.success(list);
}
/**
* 危险因素查询,不分页
/** */
* 危险因素查询,不分页 @ApiOperation(httpMethod = "GET", value = "危险因素查询不分页", notes = "危险因素查询不分页")
* @RequestMapping(value = "/all-list", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
* @param id public CommonResponse queryRiskFactor() {
* @return List<RiskFactor> list = iRiskFactorService.queryRiskFactor();
*/ return CommonResponseUtil.success(list);
@ApiOperation(httpMethod = "GET",value = "危险因素查询不分页", notes = "危险因素查询不分页") }
@RequestMapping(value = "/all-list", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryRiskFactor() { /**
List<RiskFactor> list = iRiskFactorService.queryRiskFactor(); * 危险因素新增及维护
return CommonResponseUtil.success(list); */
} @ApiOperation(httpMethod = "POST", value = "危险因素新增及维护", notes = "危险因素新增及维护")
@RequestMapping(value = "/editRiskFactor", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
/** public CommonResponse checkPlanAdd(@ApiParam(value = "危险因素对象", required = true) @RequestBody RiskFactor param) {
* 危险因素新增及维护 try {
* @param param Long count = iRiskFactorService.countRepeatData(param);
* @return if (count > 0) {
*/ return CommonResponseUtil.failure("危险因素名称重复:" + param.getName());
@ApiOperation(httpMethod = "POST", value = "危险因素新增及维护", notes = "危险因素新增及维护") }
@RequestMapping(value = "/editRiskFactor", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) User user = getUserInfo();
public CommonResponse checkPlanAdd(@ApiParam(value = "危险因素对象", required = true) @RequestBody RiskFactor param) { HashMap<String, Object> map = new HashMap<>();
try { map.put("org_code", user.getCompany().getCompCode());
Long count = iRiskFactorService.countRepeatData(param); map.put("user_id", user.getId());
if (count > 0) { map.put("dept_id", user.getDepartment() == null ? "0" : user.getDepartment().getId());
return CommonResponseUtil.failure("危险因素名称重复:" + param.getName()); map.put("param", param);
} iRiskFactorService.editRiskFactor(map);
User user = getUserInfo(); return CommonResponseUtil.success();
HashMap<String,Object> map = new HashMap<String,Object>(); } catch (Exception e) {
map.put("org_code", user.getCompany().getCompCode()); log.error(e.getMessage(), e);
map.put("user_id", user.getId()); return CommonResponseUtil.failure("危险因素编辑失败:" + e.getMessage());
map.put("dept_id", user.getDepartment() == null ?"0":user.getDepartment().getId()); }
map.put("param", param); }
iRiskFactorService.editRiskFactor(map);
return CommonResponseUtil.success(); /**
} catch (Exception e) { * 危险因素删除(支持批量)
log.error(e.getMessage(),e); */
return CommonResponseUtil.failure("危险因素编辑失败:"+e.getMessage()); @ApiOperation(httpMethod = "POST", value = "删除危险因素", notes = "删除危险因素")
} @RequestMapping(value = "/deleteRiskFactorById", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
} public CommonResponse deleteRiskFactorById(@ApiParam(value = "危险因素ID", required = true) @RequestBody Long[] param) {
try {
/** iRiskFactorService.detRiskFactor(param);
* 危险因素删除(支持批量) return CommonResponseUtil.success();
* @param param } catch (Exception e) {
* @return log.error(e.getMessage(), e);
*/ return CommonResponseUtil.failure(e.getMessage() + ",危险因素删除失败");
@ApiOperation(httpMethod = "POST", value = "删除危险因素", notes = "删除危险因素") }
@RequestMapping(value = "/deleteRiskFactorById", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) }
public CommonResponse deleteRiskFactorById(@ApiParam(value = "危险因素ID", required = true) @RequestBody Long[] param) {
try {
iRiskFactorService.detRiskFactor(param);
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(),e);
return CommonResponseUtil.failure(e.getMessage()+",危险因素删除失败");
}
}
} }
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import java.util.HashMap;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskLevelService; import com.yeejoin.amos.fas.business.service.intfc.IRiskLevelService;
import com.yeejoin.amos.fas.business.util.CommonPageParamUtil; import com.yeejoin.amos.fas.business.util.CommonPageParamUtil;
...@@ -22,88 +9,92 @@ import com.yeejoin.amos.fas.dao.entity.RiskLevel; ...@@ -22,88 +9,92 @@ import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import com.yeejoin.amos.op.core.util.CommonResponseUtil; import com.yeejoin.amos.op.core.util.CommonResponseUtil;
import com.yeejoin.amos.security.entity.User; import com.yeejoin.amos.security.entity.User;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/riskLevel") @RequestMapping("/api/riskLevel")
@Api("风险等级api") @Api("风险等级api")
public class RiskLevelController extends BaseController { public class RiskLevelController extends BaseController {
private final Logger log = LoggerFactory.getLogger(RiskLevelController.class);
@Autowired private final Logger log = LoggerFactory.getLogger(RiskLevelController.class);
IRiskLevelService iRiskLevelService;
/** @Autowired
* 风险等级分页查询 IRiskLevelService iRiskLevelService;
*
* @param id /**
* @return * 风险等级分页查询
*/ */
@ApiOperation(httpMethod = "POST",value = "风险等级查询", notes = "风险等级查询") @ApiOperation(httpMethod = "POST", value = "风险等级查询", notes = "风险等级查询")
@RequestMapping(value = "/pagelist", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/pagelist", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryRiskLevelPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, public CommonResponse queryRiskLevelPage(@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable); CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> list = iRiskLevelService.queryRiskLevelPage(param); Page<HashMap<String, Object>> list = iRiskLevelService.queryRiskLevelPage(param);
return CommonResponseUtil.success(list); return CommonResponseUtil.success(list);
} }
/** /**
* 风险等级查询,不分页 * 风险等级查询,不分页
* */
* @param id @ApiOperation(httpMethod = "GET", value = "风险等级查询不分页", notes = "风险等级查询不分页")
* @return @RequestMapping(value = "/all-list", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
*/ public CommonResponse queryRiskLevel(@ApiParam(value = "模型id") @RequestParam(required = false) Long id) {
@ApiOperation(httpMethod = "GET",value = "风险等级查询不分页", notes = "风险等级查询不分页") List<RiskLevel> list = iRiskLevelService.queryRiskLevel(id);
@RequestMapping(value = "/all-list", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) return CommonResponseUtil.success(list);
public CommonResponse queryRiskLevel(@ApiParam(value = "模型id", required = false) @RequestParam(required = false) Long id ) { }
List<RiskLevel> list = iRiskLevelService.queryRiskLevel(id);
return CommonResponseUtil.success(list); /**
} * 风险等级新增及维护
*/
/** @ApiOperation(httpMethod = "POST", value = "风险等级新增及维护", notes = "风险等级新增及维护")
* 风险等级新增及维护 @RequestMapping(value = "/editRiskLevel", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
* @param param public CommonResponse checkPlanAdd(@ApiParam(value = "风险等级对象", required = true) @RequestBody RiskLevel param) {
* @return try {
*/ Long count = iRiskLevelService.countRepeatData(param);
@ApiOperation(httpMethod = "POST", value = "风险等级新增及维护", notes = "风险等级新增及维护") if (count > 0) {
@RequestMapping(value = "/editRiskLevel", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) return CommonResponseUtil.failure("风险等级重复:" + param.getLevel() + "级");
public CommonResponse checkPlanAdd(@ApiParam(value = "风险等级对象", required = true) @RequestBody RiskLevel param) { }
try { User user = getUserInfo();
Long count = iRiskLevelService.countRepeatData(param); HashMap<String, Object> map = new HashMap<>();
if (count > 0) { map.put("org_code", user.getCompany().getCompCode());
return CommonResponseUtil.failure("风险等级重复:" + param.getLevel() + "级"); map.put("user_id", user.getId());
} map.put("param", param);
User user = getUserInfo(); iRiskLevelService.editRiskLevel(map);
HashMap<String,Object> map = new HashMap<String,Object>(); return CommonResponseUtil.success();
map.put("org_code", user.getCompany().getCompCode()); } catch (Exception e) {
map.put("user_id", user.getId()); log.error(e.getMessage(), e);
map.put("param", param); return CommonResponseUtil.failure("风险等级编辑失败:" + e.getMessage());
iRiskLevelService.editRiskLevel(map); }
return CommonResponseUtil.success(); }
} catch (Exception e) {
log.error(e.getMessage(),e); /**
return CommonResponseUtil.failure("风险等级编辑失败:"+e.getMessage()); * 风险等级删除(支持批量)
} */
} @ApiOperation(httpMethod = "POST", value = "删除风险等级", notes = "删除风险等级")
@RequestMapping(value = "/deleteRiskLevelById", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
/** public CommonResponse deletePlanById(@ApiParam(value = "风险等级ID", required = true) @RequestBody Long[] param) {
* 风险等级删除(支持批量) try {
* @param param iRiskLevelService.detRiskLevel(param);
* @return return CommonResponseUtil.success();
*/ } catch (Exception e) {
@ApiOperation(httpMethod = "POST", value = "删除风险等级", notes = "删除风险等级") log.error(e.getMessage(), e);
@RequestMapping(value = "/deleteRiskLevelById", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) return CommonResponseUtil.failure(e.getMessage() + ",风险等级删除失败");
public CommonResponse deletePlanById(@ApiParam(value = "风险等级ID", required = true) @RequestBody Long[] param) { }
try { }
iRiskLevelService.detRiskLevel(param);
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(),e);
return CommonResponseUtil.failure(e.getMessage()+",风险等级删除失败");
}
}
} }
...@@ -569,7 +569,8 @@ public class RiskSourceController extends BaseController { ...@@ -569,7 +569,8 @@ public class RiskSourceController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "上传巡检数据", notes = "上传巡检数据") @ApiOperation(httpMethod = "PUT", value = "上传巡检数据", notes = "上传巡检数据")
@RequestMapping(value = "/data/patroldata", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT) @RequestMapping(value = "/data/patroldata", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse postPatrolData(@RequestBody ProtalDataRo protalData) throws Exception { public CommonResponse postPatrolData(@RequestBody ProtalDataRo protalData) throws Exception {
return CommonResponseUtil.success(riskSourceService.processProtalData(protalData)); riskSourceService.processProtalData(protalData);
return CommonResponseUtil.success();
} }
@Authorization(ingore = true) @Authorization(ingore = true)
......
...@@ -2,24 +2,26 @@ package com.yeejoin.amos.fas.business.feign; ...@@ -2,24 +2,26 @@ package com.yeejoin.amos.fas.business.feign;
import com.yeejoin.amos.fas.business.service.model.BasicsRo; import com.yeejoin.amos.fas.business.service.model.BasicsRo;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus; import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo;
import com.yeejoin.amos.op.core.util.ApplicationConfig; import com.yeejoin.amos.op.core.util.ApplicationConfig;
import com.yeejoin.amos.op.core.util.Constants; import com.yeejoin.amos.op.core.util.Constants;
import com.yeejoin.amos.op.core.util.JSONUtil; import com.yeejoin.amos.op.core.util.JSONUtil;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
*
* <pre> * <pre>
* 规则模型系统远程调用 * 规则模型系统远程调用
* </pre> * </pre>
...@@ -28,72 +30,66 @@ import java.util.Map; ...@@ -28,72 +30,66 @@ import java.util.Map;
* @version $Id: RemoteRuleServer.java, v 0.1 2019年5月7日 下午5:52:21 amos Exp $ * @version $Id: RemoteRuleServer.java, v 0.1 2019年5月7日 下午5:52:21 amos Exp $
*/ */
@Service("remoteRuleServer") @Service("remoteRuleServer")
public class RemoteRuleServer public class RemoteRuleServer {
{
@Autowired @Autowired
private ApplicationConfig applicationConfig; private ApplicationConfig applicationConfig;
private final RestTemplate restTemplate; private final RestTemplate restTemplate;
private final Logger log = LoggerFactory.getLogger(RemoteRuleServer.class);
private ObjectMapper objectMapper = new ObjectMapper(); private ObjectMapper objectMapper = new ObjectMapper();
public RemoteRuleServer()
{ public RemoteRuleServer() {
this.restTemplate = new RestTemplate(); this.restTemplate = new RestTemplate();
} }
/** /**
* * 触发风险点规则
* <pre>
* 触发规则
* </pre>
*
* @param resFact 触发规则对象
* @param packageId 规范规则包
* @return
*/ */
public Object fireRule(BasicsRo resFact, String packageId) throws Exception public Object fireRule(RiskSourceRuleRo riskSourceRuleRo, String packageId) throws Exception {
{ Map<String, String> map = new HashMap<>();
Map<String, String> map = new HashMap<String, String>(); String data = JSONUtil.toJson(riskSourceRuleRo);
map.put("resFact", JSONUtil.toJson(resFact)); map.put("resFact", data);
map.put("packageId", packageId); map.put("packageId", packageId);
map.put("className", resFact.getClass().getName()); map.put("className", riskSourceRuleRo.getClass().getName());
String url = applicationConfig.getParamValueStr("params.remoteRuleUrl"); String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type); headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString()); headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers); HttpEntity<Map<String, String>> formEntity = new HttpEntity<>(map, headers);
ResponseEntity responseEntity = restTemplate.exchange(url + "urule/rule/fireRule", ResponseEntity responseEntity = restTemplate.exchange(url + "urule/rule/fireRule",
HttpMethod.POST, formEntity, String.class); HttpMethod.POST, formEntity, String.class);
responseEntity.getBody(); responseEntity.getBody();
Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(),Map.class); Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(), Map.class);
if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS) ) if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS)) {
{ log.info("调用规则服务成功,请求参数:" + formEntity.toString());
return commonResponse.get("dataList"); return commonResponse.get("dataList");
} }
return null; return null;
} }
/** /**
*
* <pre> * <pre>
* 触发规则流 * 触发规则流
* </pre> * </pre>
* *
* @param resFact 触发规则对象 * @param resFact 触发规则对象
* @param packageId 规范规则包 * @param packageId 规范规则包
* @param processId 规则流id * @param processId 规则流id
* @return * @return
*/ */
public Object fireRuleFlow(BasicsRo resFact, String packageId, String processId)throws Exception public Object fireRuleFlow(BasicsRo resFact, String packageId, String processId) throws Exception {
{
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put("resFact", JSONUtil.toJson(resFact)); map.put("resFact", JSONUtil.toJson(resFact));
map.put("packageId", packageId); map.put("packageId", packageId);
map.put("processId", processId); map.put("processId", processId);
map.put("className", resFact.getClass().getName()); map.put("className", resFact.getClass().getName());
String url = applicationConfig.getParamValueStr("params.remoteRuleUrl"); String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType MediaType type = MediaType
.parseMediaType("application/json; charset=UTF-8"); .parseMediaType("application/json; charset=UTF-8");
...@@ -105,18 +101,16 @@ public class RemoteRuleServer ...@@ -105,18 +101,16 @@ public class RemoteRuleServer
HttpMethod.POST, formEntity, String.class); HttpMethod.POST, formEntity, String.class);
Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(),Map.class); Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(), Map.class);
if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS) ) if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS)) {
{
return commonResponse.get("dataList"); return commonResponse.get("dataList");
} }
return null; return null;
} }
public Object autoProcessContingency(ContingencyDeviceStatus contingencyDeviceStatus) throws Exception { public Object autoProcessContingency(ContingencyDeviceStatus contingencyDeviceStatus) throws Exception {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
String url = applicationConfig.getParamValueStr("params.remoteRuleUrl"); String url = applicationConfig.getParamValueStr("params.remoteRuleUrl");
// String url = "http://172.16.10.70:8080/"; // String url = "http://172.16.10.70:8080/";
...@@ -128,20 +122,19 @@ public class RemoteRuleServer ...@@ -128,20 +122,19 @@ public class RemoteRuleServer
HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers); HttpEntity<Map<String, String>> formEntity = new HttpEntity<Map<String, String>>(map, headers);
String urlParams = "batchNo=%s&stepCode=%s&buttonCode=%s&confirm=%s&contingencyPlanId=%s&stepState=%s"; String urlParams = "batchNo=%s&stepCode=%s&buttonCode=%s&confirm=%s&contingencyPlanId=%s&stepState=%s";
String.format(urlParams, String.format(urlParams,
contingencyDeviceStatus.getButtonCode(), contingencyDeviceStatus.getButtonCode(),
contingencyDeviceStatus.getStepCode(), contingencyDeviceStatus.getStepCode(),
contingencyDeviceStatus.getConfirm(), contingencyDeviceStatus.getConfirm(),
contingencyDeviceStatus.getContingencyPlanId(), contingencyDeviceStatus.getContingencyPlanId(),
contingencyDeviceStatus.getStepState()); contingencyDeviceStatus.getStepState());
ResponseEntity responseEntity = restTemplate.exchange(url + "/api/timeline/fire?" + urlParams, ResponseEntity responseEntity = restTemplate.exchange(url + "/api/timeline/fire?" + urlParams,
HttpMethod.PUT, formEntity, String.class); HttpMethod.PUT, formEntity, String.class);
Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(),Map.class); Map commonResponse = objectMapper.readValue(responseEntity.getBody().toString(), Map.class);
if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS) ) if (commonResponse != null && commonResponse.get("result").equals(Constants.RESULT_SUCCESS)) {
{
return commonResponse.get("dataList"); return commonResponse.get("dataList");
} }
return null; return null;
} }
} }
\ No newline at end of file
package com.yeejoin.amos.fas.business.jpush;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.Notification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AppMessagePushService {
protected static final Logger log = LoggerFactory.getLogger(AppMessagePushService.class);
@Value("${params.isPush}")
private String isPush;
private static final String APP_KEY = "1b3f7b961200f4b236811dfe";
private static final String MASTER_SECRET = "8b650e645fb3a43c96be02b2";
private static JPushClient jpushClient = new JPushClient(MASTER_SECRET, APP_KEY);
public void sendMessage(List<PushMsgParam> responses) {
try {
if (responses != null && "true".equals(isPush)) {
for (PushMsgParam response : responses) {
PushPayload payload = buildPushPayload(response);
jpushClient.sendPush(payload);
}
}
} catch (Exception e) {
log.error("极光推送异常", e);
}
}
private PushPayload buildPushPayload(PushMsgParam response) {
if (JPushTypeEnum.ALL.getCode().equals(response.getType())) {
return PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.all())
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
} else if (JPushTypeEnum.TAG.getCode().equals(response.getType())) {
return PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.tag(response.getRecivers()))
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
} else {
return PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.alias(response.getRecivers()))
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
}
}
public void sendMessage(PushMsgParam response) {
try {
if (null != response && "true".equals(isPush)) {
PushPayload payload = PushPayload.newBuilder().setPlatform(Platform.android())
.setAudience(Audience.all())
.setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
.build();
jpushClient.sendPush(payload);
}
} catch (Exception e) {
log.error("极光推送异常", e);
}
}
}
package com.yeejoin.amos.fas.business.jpush;
/**
* JPush 推送类型
* @author maoying
*
*/
public enum JPushTypeEnum {
ALL("广播","1"),
TAG("标签","2" ),
ALIAS("别名", "3");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
private JPushTypeEnum(String name, String code){
this.name = name;
this.code = code;
}
public static JPushTypeEnum getEnum(String code) {
JPushTypeEnum jPushTypeEnum = null;
for(JPushTypeEnum type: JPushTypeEnum.values()) {
if (type.getCode().equals(code)) {
jPushTypeEnum = type;
break;
}
}
return jPushTypeEnum;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
package com.yeejoin.amos.fas.business.jpush;
import java.util.List;
import java.util.Map;
public class PushMsgParam {
/**
* 标题
*/
private String subject;
/**
* 消息内容
*/
private String content;
/**
* 邮件地址
*/
private String[] emails;
/**
* jpush接收人
*/
private List<String> recivers;
//
/**
* jpush参数传递
*/
Map<String, String> extras;
/**
* jpush发送类型:1:广播;2:标签;3:别名
*/
private String type = "3";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public List<String> getRecivers() {
return recivers;
}
public void setRecivers(List<String> recivers) {
this.recivers = recivers;
}
public Map<String, String> getExtras() {
return extras;
}
public void setExtras(Map<String, String> extras) {
this.extras = extras;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String[] getEmails() {
return emails;
}
public void setEmails(String[] emails) {
this.emails = emails;
}
}
...@@ -89,25 +89,25 @@ public class FmeaServiceImpl implements IFmeaService { ...@@ -89,25 +89,25 @@ public class FmeaServiceImpl implements IFmeaService {
} }
public void updateRpniInfo(Long riskSourceId) { // public void updateRpniInfo(Long riskSourceId) {
//
//
new Thread(() -> // new Thread(() ->
{ // {
String batchNo = UUID.randomUUID().toString(); // String batchNo = UUID.randomUUID().toString();
//
List<RiskSource> riskSources = new ArrayList<>(); // List<RiskSource> riskSources = new ArrayList<>();
//
RiskSource riskSource = this.iRiskSourceDao.findById(riskSourceId); // RiskSource riskSource = this.iRiskSourceDao.findById(riskSourceId);
riskSources.add(riskSource); // riskSources.add(riskSource);
try { // try {
asymbleWithParent(batchNo, riskSources, RiskFactor.class.getSimpleName()); // asymbleWithParent(batchNo, riskSources, RiskFactor.class.getSimpleName());
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
}).start(); // }).start();
//
} // }
@Override @Override
public int queryControlObjCount(String[] ids) { public int queryControlObjCount(String[] ids) {
...@@ -119,47 +119,47 @@ public class FmeaServiceImpl implements IFmeaService { ...@@ -119,47 +119,47 @@ public class FmeaServiceImpl implements IFmeaService {
return 0;//没有关联对象 return 0;//没有关联对象
} }
private boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from) throws Exception { // private boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from) throws Exception {
if (!CollectionUtils.isEmpty(riskSourceList)) { // if (!CollectionUtils.isEmpty(riskSourceList)) {
for (RiskSource riskSource : riskSourceList) { // for (RiskSource riskSource : riskSourceList) {
//当前规则 // //当前规则
RiskSourceRo riskSourceRo = this.transfer(bacthNo, riskSource, from, new BigDecimal(0)); // RiskSourceRo riskSourceRo = this.transfer(bacthNo, riskSource, from, new BigDecimal(0));
//
Object result = remoteRuleServer.fireRule(riskSourceRo, "风险管控/riskFactor"); // Object result = remoteRuleServer.fireRule(riskSourceRo, "风险管控/riskFactor");
BigDecimal RPNi = updateRpn(result, riskSource, null); // BigDecimal RPNi = updateRpn(result, riskSource, null);
//处理返回结果 // //处理返回结果
//
//反查 父级风险点,取得处于第二级的父级风险点 // //反查 父级风险点,取得处于第二级的父级风险点
findParent(bacthNo, riskSource, RPNi); // findParent(bacthNo, riskSource, RPNi);
} // }
} // }
return true; // return true;
} // }
/** // /**
* 查询父节点风险点 // * 查询父节点风险点
* // *
* @param riskSource // * @param riskSource
* @param RPNi // * @param RPNi
* @return // * @return
*/ // */
private BigDecimal findParent(String bacthNo, RiskSource riskSource, // private BigDecimal findParent(String bacthNo, RiskSource riskSource,
BigDecimal RPNi) throws Exception { // BigDecimal RPNi) throws Exception {
if (riskSource != null && riskSource.getId() != 0 && RPNi.doubleValue() != 0) { // if (riskSource != null && riskSource.getId() != 0 && RPNi.doubleValue() != 0) {
RiskSource parent = this.iRiskSourceDao.findOne(riskSource.getParentId()); // RiskSource parent = this.iRiskSourceDao.findOne(riskSource.getParentId());
if (null != parent) { // if (null != parent) {
RiskSourceRo parentRiskResource = this.transfer(bacthNo, parent, "child", RPNi); // RiskSourceRo parentRiskResource = this.transfer(bacthNo, parent, "child", RPNi);
Object result = remoteRuleServer.fireRule(parentRiskResource, "风险管控/riskFactorParent"); // Object result = remoteRuleServer.fireRule(parentRiskResource, "风险管控/riskFactorParent");
updateRpn(result, parent, RPNi); // updateRpn(result, parent, RPNi);
//
if (parent.getParentId() != 0) // if (parent.getParentId() != 0)
this.findParent(bacthNo, parent, RPNi); // this.findParent(bacthNo, parent, RPNi);
} // }
} // }
//
return RPNi; // return RPNi;
} // }
private RiskSourceRo transfer(String bacthNo, RiskSource riskSource, String from, BigDecimal rpni) { private RiskSourceRo transfer(String bacthNo, RiskSource riskSource, String from, BigDecimal rpni) {
......
...@@ -29,6 +29,9 @@ import com.yeejoin.amos.fas.business.dao.repository.IRpnChangeLogDao; ...@@ -29,6 +29,9 @@ import com.yeejoin.amos.fas.business.dao.repository.IRpnChangeLogDao;
import com.yeejoin.amos.fas.business.dao.repository.IUserDao; import com.yeejoin.amos.fas.business.dao.repository.IUserDao;
import com.yeejoin.amos.fas.business.feign.RemoteRuleServer; import com.yeejoin.amos.fas.business.feign.RemoteRuleServer;
import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer; import com.yeejoin.amos.fas.business.feign.RemoteWebSocketServer;
import com.yeejoin.amos.fas.business.jpush.AppMessagePushService;
import com.yeejoin.amos.fas.business.jpush.JPushTypeEnum;
import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.business.param.AlarmParam; import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam; import com.yeejoin.amos.fas.business.param.FmeaBindParam;
...@@ -42,6 +45,7 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyRo; ...@@ -42,6 +45,7 @@ import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
import com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo; import com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.service.model.ProtalDataRo; import com.yeejoin.amos.fas.business.service.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.service.model.RiskSourceRo; import com.yeejoin.amos.fas.business.service.model.RiskSourceRo;
import com.yeejoin.amos.fas.business.service.model.RiskSourceRuleRo;
import com.yeejoin.amos.fas.business.util.DateUtils; import com.yeejoin.amos.fas.business.util.DateUtils;
import com.yeejoin.amos.fas.business.util.JexlUtil; import com.yeejoin.amos.fas.business.util.JexlUtil;
import com.yeejoin.amos.fas.business.vo.EquipCommunicationData; import com.yeejoin.amos.fas.business.vo.EquipCommunicationData;
...@@ -78,6 +82,7 @@ import org.springframework.scheduling.annotation.Async; ...@@ -78,6 +82,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import org.typroject.tyboot.component.cache.enumeration.CacheType; import org.typroject.tyboot.component.cache.enumeration.CacheType;
...@@ -125,6 +130,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -125,6 +130,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
private IRiskSourceDao iRiskSourceDao; private IRiskSourceDao iRiskSourceDao;
@Autowired @Autowired
private AppMessagePushService appMessagePushService;
@Autowired
private IFmeaDao iFmeaDao; private IFmeaDao iFmeaDao;
@Autowired @Autowired
...@@ -409,7 +417,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -409,7 +417,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (!CollectionUtils.isEmpty(returnList)) { if (!CollectionUtils.isEmpty(returnList)) {
fmeaEquipmentPointMapper.saveBatch(returnList); fmeaEquipmentPointMapper.saveBatch(returnList);
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
rsDataQueue.addAbnormalMessage(fmeaId); rsDataQueue.addEquipmentMessage(fmeaId);
} }
return returnList; return returnList;
} }
...@@ -431,7 +439,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -431,7 +439,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (!CollectionUtils.isEmpty(returnList)) { if (!CollectionUtils.isEmpty(returnList)) {
fmeaPointInputitemMapper.saveBatch(returnList); fmeaPointInputitemMapper.saveBatch(returnList);
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
rsDataQueue.addAbnormalMessage(fmeaId); rsDataQueue.addPatrolMessage(fmeaId);
} }
return returnList; return returnList;
} }
...@@ -475,11 +483,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -475,11 +483,11 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
deviceData.setMonitor(equipment.getName()); deviceData.setMonitor(equipment.getName());
deviceData.setEquimentId(String.valueOf(equipment.getId())); deviceData.setEquimentId(String.valueOf(equipment.getId()));
Object result = remoteRuleServer.fireRule(deviceData, "风险管控/fireEquiment"); //Object result = remoteRuleServer.fireRule(deviceData, "风险管控/fireEquiment");
//处理返回结果 //处理返回结果
List<RiskSource> riskSources = this.riskSourceMapper.queryByFireEqument(deviceData.getFireEquimentId()); List<RiskSource> riskSources = this.riskSourceMapper.queryByFireEqument(deviceData.getFireEquimentId());
asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), deviceData.getFireEquimentId(), deviceData.getNodeState(), null, null); //asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), deviceData.getFireEquimentId(), deviceData.getNodeState(), null, null);
alermContingency(deviceData.getBatchNo(), fireEquipment, equipment); alermContingency(deviceData.getBatchNo(), fireEquipment, equipment);
} }
...@@ -541,49 +549,49 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -541,49 +549,49 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
public boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from, Long fromId, String nodeState, String originalNodeState, List<FmeaPointInputitem> pointInputitems) throws Exception { // public boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from, Long fromId, String nodeState, String originalNodeState, List<FmeaPointInputitem> pointInputitems) throws Exception {
if (!CollectionUtils.isEmpty(riskSourceList)) { // if (!CollectionUtils.isEmpty(riskSourceList)) {
for (RiskSource riskSource : riskSourceList) { // for (RiskSource riskSource : riskSourceList) {
//当前规则 // //当前规则
RiskSourceRo riskSourceRo = this.transfer(bacthNo, riskSource, from, nodeState, originalNodeState, new BigDecimal(0), pointInputitems); // RiskSourceRo riskSourceRo = this.transfer(bacthNo, riskSource, from, nodeState, originalNodeState, new BigDecimal(0), pointInputitems);
//
Object result = remoteRuleServer.fireRule(riskSourceRo, PACKAGE_ID); // Object result = remoteRuleServer.fireRule(riskSourceRo, PACKAGE_ID);
//BigDecimal RPNi = updateRpn(result,riskSource,null,fromId); // //BigDecimal RPNi = updateRpn(result,riskSource,null,fromId);
//处理返回结果 // //处理返回结果
//
//反查 父级风险点,取得处于第二级的父级风险点 // //反查 父级风险点,取得处于第二级的父级风险点
findParent(bacthNo, riskSource, nodeState, originalNodeState, new BigDecimal(0), fromId); // findParent(bacthNo, riskSource, nodeState, originalNodeState, new BigDecimal(0), fromId);
} // }
} // }
return true; // return true;
} // }
/**
* 查询父节点风险点
*
* @param riskSource
* @param nodeState
* @param originalNodeState
* @param RPNi
* @return
*/
private BigDecimal findParent(String bacthNo, RiskSource riskSource, String nodeState, String originalNodeState,
BigDecimal RPNi, Long fromId) throws Exception {
if (riskSource != null && riskSource.getId() != 0 && RPNi.doubleValue() != 0) {
RiskSource parent = this.iRiskSourceDao.findById(riskSource.getParentId());
if (null != parent) {
RiskSourceRo parentRiskResource = this.transfer(bacthNo, parent, "child", nodeState, originalNodeState,
RPNi, null);
Object result = remoteRuleServer.fireRule(parentRiskResource, "风险管控/parentRisk");
//updateRpn(result, parent, RPNi, fromId);
if (parent.getParentId() != 0)
this.findParent(bacthNo, parent, nodeState, originalNodeState, RPNi, fromId);
}
}
return RPNi; // /**
} // * 查询父节点风险点
// *
// * @param riskSource
// * @param nodeState
// * @param originalNodeState
// * @param RPNi
// * @return
// */
// private BigDecimal findParent(String bacthNo, RiskSource riskSource, String nodeState, String originalNodeState,
// BigDecimal RPNi, Long fromId) throws Exception {
// if (riskSource != null && riskSource.getId() != 0 && RPNi.doubleValue() != 0) {
// RiskSource parent = this.iRiskSourceDao.findById(riskSource.getParentId());
// if (null != parent) {
// RiskSourceRo parentRiskResource = this.transfer(bacthNo, parent, "child", nodeState, originalNodeState,
// RPNi, null);
// Object result = remoteRuleServer.fireRule(parentRiskResource, "风险管控/parentRisk");
// //updateRpn(result, parent, RPNi, fromId);
//
// if (parent.getParentId() != 0)
// this.findParent(bacthNo, parent, nodeState, originalNodeState, RPNi, fromId);
// }
// }
//
// return RPNi;
// }
private RiskSourceRo transfer(String bacthNo, RiskSource riskSource, String from, String nodeState, String originalNodeState, BigDecimal rpni, List<FmeaPointInputitem> pointInputitems) { private RiskSourceRo transfer(String bacthNo, RiskSource riskSource, String from, String nodeState, String originalNodeState, BigDecimal rpni, List<FmeaPointInputitem> pointInputitems) {
...@@ -808,13 +816,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -808,13 +816,13 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public boolean processTaskData(ProtalDataRo taskData) throws Exception { public boolean processTaskData(ProtalDataRo taskData) throws Exception {
taskData.setBatchNo(UUID.randomUUID().toString()); taskData.setBatchNo(UUID.randomUUID().toString());
Object result = remoteRuleServer.fireRule(taskData, "风险管控/patrol"); //Object result = remoteRuleServer.fireRule(taskData, "风险管控/patrol");
return true; return true;
} }
@Async @Async
public boolean processProtalData(ProtalDataRo protalData) throws Exception { public void processProtalData(ProtalDataRo protalData) {
String bacthNo = UUID.randomUUID().toString(); String bacthNo = UUID.randomUUID().toString();
protalData.setBatchNo(bacthNo); protalData.setBatchNo(bacthNo);
PPoint pPoint = iPPointDao.findById(protalData.getId()); PPoint pPoint = iPPointDao.findById(protalData.getId());
...@@ -831,7 +839,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -831,7 +839,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
protalData.setUserName(""); protalData.setUserName("");
} }
} }
if (!CollectionUtils.isEmpty(protalData.getItems())) { if (!CollectionUtils.isEmpty(protalData.getItems())) {
Long pointId = protalData.getId(); Long pointId = protalData.getId();
List<Long> inputIds = Lists.newArrayList(); List<Long> inputIds = Lists.newArrayList();
...@@ -861,28 +868,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -861,28 +868,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fmeaPointInputitemMapper.updateStateByIds(0, successIds); fmeaPointInputitemMapper.updateStateByIds(0, successIds);
} }
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
fmeaIds.forEach(fmeaId -> rsDataQueue.addAbnormalMessage(fmeaId)); fmeaIds.forEach(fmeaId -> rsDataQueue.addPatrolMessage(fmeaId));
}
Object result = remoteRuleServer.fireRule(protalData, "风险管控/patrol");
//处理返回结果
List<RiskSource> riskSources = this.riskSourceMapper.queryByPoint(protalData.getId());
if ("2".equals(protalData.getNodeState()) || "3".equals(protalData.getNodeState())) {
if (!CollectionUtils.isEmpty(riskSources))
for (RiskSource source : riskSources) {
source.setStatus("ANOMALY");
this.iRiskSourceDao.save(source);
}
} }
//asymbleWithParent(bacthNo,riskSources, ProtalDataRo.class.getSimpleName(),protalData.getId(),protalData.getNodeState(),protalData.getOriginalNodeState(),protalData.getPointInputitems()); //asymbleWithParent(bacthNo,riskSources, ProtalDataRo.class.getSimpleName(),protalData.getId(),protalData.getNodeState(),protalData.getOriginalNodeState(),protalData.getPointInputitems());
return true;
} }
// @Override // @Override
...@@ -1112,26 +1100,26 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1112,26 +1100,26 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
deviceData.setMonitor(equipment.getName()); deviceData.setMonitor(equipment.getName());
deviceData.setEquimentId(String.valueOf(equipment.getId())); deviceData.setEquimentId(String.valueOf(equipment.getId()));
FireEquimentDataRo ruleData = new FireEquimentDataRo(); // FireEquimentDataRo ruleData = new FireEquimentDataRo();
ruleData.setBatchNo(batchNo); // ruleData.setBatchNo(batchNo);
ruleData.setEquimentId(String.valueOf(equipment.getId())); // ruleData.setEquimentId(String.valueOf(equipment.getId()));
ruleData.setMonitor(equipment.getName()); // ruleData.setMonitor(equipment.getName());
ruleData.setCode(deviceData.getCode()); // ruleData.setCode(deviceData.getCode());
ruleData.setFireEquimentId(fireEquipment.getId()); // ruleData.setFireEquimentId(fireEquipment.getId());
ruleData.setName(fireEquipmentPoint.getName()); // ruleData.setName(fireEquipmentPoint.getName());
ruleData.setNodeState("true".equals(deviceData.getState()) ? "1" : "0"); // ruleData.setNodeState("true".equals(deviceData.getState()) ? "1" : "0");
ruleData.setUnit(fireEquipmentPoint.getUnit()); // ruleData.setUnit(fireEquipmentPoint.getUnit());
ruleData.setValue(deviceData.getState()); // ruleData.setValue(deviceData.getState());
ruleData.setFireEqumentName(fireEquipment.getName()); // ruleData.setFireEqumentName(fireEquipment.getName());
Object result = remoteRuleServer.fireRule(ruleData, "风险管控/fireEquiment"); // Object result = remoteRuleServer.fireRule(ruleData, "风险管控/fireEquiment");
//处理返回结果 //处理返回结果
// } else { // } else {
// if (batch == null) { // if (batch == null) {
// batchNo = batch.toString(); // batchNo = batch.toString();
// } // }
List<RiskSource> riskSources = this.riskSourceMapper.queryByFireEqument(fireEquipmentPoint.getFireEquipmentId()); //List<RiskSource> riskSources = this.riskSourceMapper.queryByFireEqument(fireEquipmentPoint.getFireEquipmentId());
asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), fireEquipmentPoint.getFireEquipmentId(), deviceData.getNodeState(), null, null); //asymbleWithParent(batchNo, riskSources, FireEquimentDataRo.class.getSimpleName(), fireEquipmentPoint.getFireEquipmentId(), deviceData.getNodeState(), null, null);
if (ObjectUtils.isEmpty(fireEquipmentPointType) || "false".equals(deviceData.getState())) { if (ObjectUtils.isEmpty(fireEquipmentPointType) || "false".equals(deviceData.getState())) {
return; return;
} }
...@@ -1231,23 +1219,23 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1231,23 +1219,23 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (dict != null && dict.getDictValue().equals("alarm_type_trouble")) { if (dict != null && dict.getDictValue().equals("alarm_type_trouble")) {
notifyAlarm(fireEquipmentPoint, param); notifyAlarm(fireEquipmentPoint, param);
} }
String batchNo = UUID.randomUUID().toString(); // String batchNo = UUID.randomUUID().toString();
FireEquimentDataRo ruleData = new FireEquimentDataRo(); // FireEquimentDataRo ruleData = new FireEquimentDataRo();
ruleData.setBatchNo(batchNo); // ruleData.setBatchNo(batchNo);
ruleData.setEquimentId(String.valueOf(equipment.getId())); // ruleData.setEquimentId(String.valueOf(equipment.getId()));
ruleData.setMonitor(equipment.getName()); // ruleData.setMonitor(equipment.getName());
ruleData.setCode(data.getFireEquipmentCode()); // ruleData.setCode(data.getFireEquipmentCode());
ruleData.setFireEquimentId(Long.valueOf(data.getFireEquipmentId())); // ruleData.setFireEquimentId(Long.valueOf(data.getFireEquipmentId()));
ruleData.setName(data.getPointName()); // ruleData.setName(data.getPointName());
ruleData.setNodeState("true".equals(data.getState()) ? "1" : "0"); // ruleData.setNodeState("true".equals(data.getState()) ? "1" : "0");
ruleData.setUnit(data.getUnit()); // ruleData.setUnit(data.getUnit());
ruleData.setValue(data.getSoe() + ""); // ruleData.setValue(data.getSoe() + "");
ruleData.setFireEqumentName(data.getFireEquipmentName()); // ruleData.setFireEqumentName(data.getFireEquipmentName());
try { // try {
Object result = remoteRuleServer.fireRule(ruleData, "风险管控/fireEquiment"); // Object result = remoteRuleServer.fireRule(ruleData, "风险管控/fireEquiment");
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} }
} }
} }
...@@ -1279,7 +1267,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1279,7 +1267,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
fmeaEquipmentPointMapper.updateStateByIds(state, ids); fmeaEquipmentPointMapper.updateStateByIds(state, ids);
} }
RsDataQueue rsDataQueue = RsDataQueue.getInstance(); RsDataQueue rsDataQueue = RsDataQueue.getInstance();
fmeaIds.forEach(fmeaId -> rsDataQueue.addAbnormalMessage(fmeaId)); fmeaIds.forEach(fmeaId -> rsDataQueue.addEquipmentMessage(fmeaId));
} }
} }
...@@ -1426,7 +1414,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1426,7 +1414,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* 修改、添加导致rpn、rpni改变 * 修改、添加导致rpn、rpni改变
*/ */
@Override @Override
public void notifyFmeaFromUpdate(Long fmeaId) { public void notifyFmeaFromUpdate(Long fmeaId, String nofityType) {
Fmea fmea = fmeaMapper.getById(fmeaId); Fmea fmea = fmeaMapper.getById(fmeaId);
if (fmea == null) { if (fmea == null) {
return; return;
...@@ -1443,21 +1431,48 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1443,21 +1431,48 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} else { } else {
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue()); BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
rpn = newOidValue.multiply(sidValue).multiply(didValue); rpn = newOidValue.multiply(sidValue).multiply(didValue);
} }
List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = getBetweenLevel(rpn, levels);
String jpushTarget = null;
fmea.setRpni(rpni); fmea.setRpni(rpni);
fmea.setRpn(rpn); fmea.setRpn(rpn);
if (newLevel != null) {
fmea.setRiskLevelId(newLevel.getId());
jpushTarget = getJpushTarget(fmea, newLevel.getLevel());
}
fmeaMapper.updateRpn(fmea); fmeaMapper.updateRpn(fmea);
saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, rpni); saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, rpni);
this.notifyRiskSource(fmea.getRiskSourceId()); this.notifyRiskSource(fmea.getRiskSourceId(), nofityType, jpushTarget);
}
}
private String getJpushTarget(Fmea fmea, Integer level) {
String jpushTarget = null;
Long userId = null;
if (level.equals(1)) {
userId = fmea.getCompanyLeader();
} else if (level.equals(2)) {
userId = fmea.getDepartmentLeader();
} else if (level.equals(3)) {
userId = fmea.getGroupLeader();
} else if (level.equals(4)) {
userId = fmea.getPersonLeader();
}
if (userId != null) {
SUser user = iUserDao.findById(userId);
if (user != null) {
jpushTarget = user.getMobile();
}
} }
return jpushTarget;
} }
/** /**
* 告警或者不合格项导致fmea的rpn、new_evaluation_oid改变 * 告警或者不合格项导致fmea的rpn、new_evaluation_oid改变
*/ */
@Override @Override
public void notifyFmeaFromAbnormal(Long fmeaId) { public void notifyFmeaFromAbnormal(Long fmeaId, String notifyType) {
Fmea fmea = fmeaMapper.getById(fmeaId); Fmea fmea = fmeaMapper.getById(fmeaId);
if (fmea == null) { if (fmea == null) {
return; return;
...@@ -1473,11 +1488,18 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1473,11 +1488,18 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal sidValue = new BigDecimal(fmea.getSidValue()); BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal didValue = new BigDecimal(fmea.getDidValue()); BigDecimal didValue = new BigDecimal(fmea.getDidValue());
BigDecimal rpn = newOidValue.multiply(sidValue).multiply(didValue); BigDecimal rpn = newOidValue.multiply(sidValue).multiply(didValue);
List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = getBetweenLevel(rpn, levels);
fmea.setRpn(rpn); fmea.setRpn(rpn);
fmea.setNewEvaluationOid(oEvaluationModel.getId()); fmea.setNewEvaluationOid(oEvaluationModel.getId());
String jpushTarget = null;
if (newLevel != null) {
jpushTarget = getJpushTarget(fmea, newLevel.getLevel());
fmea.setRiskLevelId(newLevel.getId());
}
fmeaMapper.updateRpn(fmea); fmeaMapper.updateRpn(fmea);
saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, fmea.getRpni()); saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, fmea.getRpni());
this.notifyRiskSource(fmea.getRiskSourceId()); this.notifyRiskSource(fmea.getRiskSourceId(), notifyType, jpushTarget);
} }
} }
} }
...@@ -1547,11 +1569,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1547,11 +1569,12 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
* fmea的更新导致rpn、rpni的值改变 * fmea的更新导致rpn、rpni的值改变
*/ */
@Override @Override
public void notifyRiskSource(Long riskSourceId) { public void notifyRiskSource(Long riskSourceId, String notifyType, String jpushTarget) {
RiskSource riskSource = iRiskSourceDao.findById(riskSourceId); RiskSource riskSource = iRiskSourceDao.findById(riskSourceId);
if (riskSource == null) { if (riskSource == null) {
return; return;
} }
RiskLevel oldRiskLevel = iRiskLevelDao.findById(riskSource.getRiskLevelId());
List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId); List<Fmea> fmeas = fmeaMapper.listByRiskSourceId(riskSourceId);
if (CollectionUtils.isEmpty(fmeas)) { if (CollectionUtils.isEmpty(fmeas)) {
BigDecimal resetValue = new BigDecimal("0"); BigDecimal resetValue = new BigDecimal("0");
...@@ -1590,12 +1613,49 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1590,12 +1613,49 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
BigDecimal rpn = maxDidValue.multiply(maxSidValue).multiply(averageNewOidValue); BigDecimal rpn = maxDidValue.multiply(maxSidValue).multiply(averageNewOidValue);
BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue); BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue);
List<RiskLevel> levels = riskLevelDao.findAll(); List<RiskLevel> levels = riskLevelDao.findAll();
RiskLevel newLevel = getBetweenLevel(rpn, levels); RiskLevel newRiskLevel = getBetweenLevel(rpn, levels);
if (newLevel != null) { if (newRiskLevel != null) {
riskSource.setRpn(rpn); riskSource.setRpn(rpn);
riskSource.setRpni(rpni); riskSource.setRpni(rpni);
riskSource.setRiskLevelId(newLevel.getId()); riskSource.setRiskLevelId(newRiskLevel.getId());
riskSourceMapper.updateRpn(riskSource); riskSourceMapper.updateRpn(riskSource);
jpushRiskSourceMessage("风险点告警", jpushTarget);
notifyRule(riskSourceId, rpn, rpni, oldRiskLevel.getLevel(), newRiskLevel.getLevel(), notifyType);
}
}
private void jpushRiskSourceMessage(String content, String jpushTarget) {
if (StringUtils.isEmpty(jpushTarget)) {
return;
}
PushMsgParam pushMsgParam = new PushMsgParam();
pushMsgParam.setRecivers(Lists.newArrayList(jpushTarget));
pushMsgParam.setContent(content);
pushMsgParam.setSubject("风险点RPN值改变");
pushMsgParam.setType(JPushTypeEnum.ALIAS.getCode());
appMessagePushService.sendMessage(pushMsgParam);
}
private void notifyRule(Long id, BigDecimal rpnr, BigDecimal rpni, Integer oldLevel, Integer newLevel, String notifyType) {
int level = oldLevel - newLevel;
String changeType;
if (level > 0) {
changeType = "down";
} else if (level == 0) {
changeType = "no";
} else {
changeType = "up";
}
RiskSourceRuleRo riskSourceRuleRo = new RiskSourceRuleRo();
riskSourceRuleRo.setId(id);
riskSourceRuleRo.setRpnr(rpnr);
riskSourceRuleRo.setRpni(rpni);
riskSourceRuleRo.setLevelChangeType(changeType);
riskSourceRuleRo.setNotifyType(notifyType);
try {
remoteRuleServer.fireRule(riskSourceRuleRo, "风险管控/riskSource");
} catch (Exception e) {
log.error("调用规则异常", e);
} }
} }
......
package com.yeejoin.amos.fas.business.service.intfc; package com.yeejoin.amos.fas.business.service.intfc;
import java.util.HashMap; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import java.util.List;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam; import java.util.HashMap;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.dao.entity.Fmea;
import com.yeejoin.amos.op.core.common.query.DaoCriteria;
public interface IFmeaService { public interface IFmeaService {
/** /**
* 维护Fmea模型 * 维护Fmea模型
* */
* @param map void editFmea(HashMap<String, Object> map);
* @return
*/ /**
void editFmea(HashMap<String, Object> map); * 根据ID删除Fmea
*/
/** void deleteFmea(Long[] fmeaIds);
* 根据ID删除Fmea
* /**
* @param fmeaIds * 分页查询Fmea
*/ */
void deleteFmea(Long[] fmeaIds); Page<HashMap<String, Object>> queryFmeaList(CommonPageInfoParam param);
/** //
* 分页查询Fmea // void updateRpniInfo(Long riskSourceId);
*
* @param criterias /**
* @param commonPageable * 查询关联的关联对象个数
* @return */
*/
Page<HashMap<String, Object>> queryFmeaList(CommonPageInfoParam param);
void updateRpniInfo(Long riskSourceId);
/**
* 查询关联的关联对象个数
*
* @param ids
* @return count 关联对象个数
*/
int queryControlObjCount(String[] ids); int queryControlObjCount(String[] ids);
} }
...@@ -72,7 +72,7 @@ public interface IRiskSourceService { ...@@ -72,7 +72,7 @@ public interface IRiskSourceService {
boolean processTaskData(ProtalDataRo taskData) throws Exception; boolean processTaskData(ProtalDataRo taskData) throws Exception;
boolean processProtalData(ProtalDataRo protalData) throws Exception; void processProtalData(ProtalDataRo protalData) throws Exception;
RiskSourceTreeResponse queryRiskSourceDetailById(Long id); RiskSourceTreeResponse queryRiskSourceDetailById(Long id);
...@@ -107,9 +107,9 @@ public interface IRiskSourceService { ...@@ -107,9 +107,9 @@ public interface IRiskSourceService {
Integer getChildTypeByPid(Long riskSourceId); Integer getChildTypeByPid(Long riskSourceId);
void notifyFmeaFromAbnormal(Long fmeaId); void notifyFmeaFromAbnormal(Long fmeaId, String notifyType);
void notifyFmeaFromUpdate(Long fmeaId); void notifyFmeaFromUpdate(Long fmeaId, String nofityType);
void notifyRiskSource(Long riskSourceId); void notifyRiskSource(Long riskSourceId, String notifyType, String jpushTarget);
} }
...@@ -70,6 +70,13 @@ public class RiskSourceRo extends BasicsRo { ...@@ -70,6 +70,13 @@ public class RiskSourceRo extends BasicsRo {
private String riskState;//风险点状态 private String riskState;//风险点状态
private BigDecimal rg;
/**
* up、down、no
*/
private String levelChangeType;
public String getRiskState() { public String getRiskState() {
return riskState; return riskState;
......
package com.yeejoin.amos.fas.business.service.model;
import java.math.BigDecimal;
public class RiskSourceRuleRo extends BasicsRo {
/**
* patrol、equipment、update、delete
*/
private String notifyType;
private Long id;
private BigDecimal rpnr;
private BigDecimal rpni;
/**
* up、down、no
*/
private String levelChangeType;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public BigDecimal getRpnr() {
return rpnr;
}
public void setRpnr(BigDecimal rpnr) {
this.rpnr = rpnr;
}
public BigDecimal getRpni() {
return rpni;
}
public void setRpni(BigDecimal rpni) {
this.rpni = rpni;
}
public String getLevelChangeType() {
return levelChangeType;
}
public void setLevelChangeType(String levelChangeType) {
this.levelChangeType = levelChangeType;
}
public String getNotifyType() {
return notifyType;
}
public void setNotifyType(String notifyType) {
this.notifyType = notifyType;
}
}
...@@ -52,8 +52,12 @@ public class RsDataQueue { ...@@ -52,8 +52,12 @@ public class RsDataQueue {
blockingQueue.add(new FmeaMessage(fmeaId, "update")); blockingQueue.add(new FmeaMessage(fmeaId, "update"));
} }
public void addAbnormalMessage(Long fmeaId) { public void addPatrolMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, "abnormal")); blockingQueue.add(new FmeaMessage(fmeaId, "patrol"));
}
public void addEquipmentMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, "equipment"));
} }
public void addDeleteMessage(Long riskSourceId) { public void addDeleteMessage(Long riskSourceId) {
...@@ -68,12 +72,14 @@ public class RsDataQueue { ...@@ -68,12 +72,14 @@ public class RsDataQueue {
if (riskSourceService != null) { if (riskSourceService != null) {
String from = fmeaMessage.getNorifyFrom(); String from = fmeaMessage.getNorifyFrom();
Long handId = fmeaMessage.getHandId(); Long handId = fmeaMessage.getHandId();
if (from.equals("abnormal")) { if (from.equals("patrol")) {
riskSourceService.notifyFmeaFromAbnormal(handId); riskSourceService.notifyFmeaFromAbnormal(handId, from);
} else if (from.equals("equipment")) {
riskSourceService.notifyFmeaFromAbnormal(handId, from);
} else if (from.equals("update")) { } else if (from.equals("update")) {
riskSourceService.notifyFmeaFromUpdate(handId); riskSourceService.notifyFmeaFromUpdate(handId, from);
} else if (from.equals("delete")) { } else if (from.equals("delete")) {
riskSourceService.notifyRiskSource(handId); riskSourceService.notifyRiskSource(handId, from, null);
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -80,7 +80,7 @@ params.xssSecurity = false ...@@ -80,7 +80,7 @@ params.xssSecurity = false
#rule #rule
#params.remoteRuleUrl=http://172.16.3.3:8080/ #params.remoteRuleUrl=http://172.16.3.3:8080/
params.remoteRuleUrl=http://172.16.10.91:8080/ params.remoteRuleUrl=http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl=http://172.16.10.91:10600/ params.remoteWebsocketUrl=http://172.16.10.91:10600/
#redis database index #redis database index
...@@ -103,3 +103,4 @@ linux.img.path = / ...@@ -103,3 +103,4 @@ linux.img.path = /
file.uploadUrl=D:\\upload\\files\\ file.uploadUrl=D:\\upload\\files\\
#picture read #picture read
file.readUrl=http://172.16.3.89:8083/file/getFile?in= file.readUrl=http://172.16.3.89:8083/file/getFile?in=
params.isPush=true
...@@ -102,6 +102,66 @@ ...@@ -102,6 +102,66 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="xukaiqiang" id="1557134646002-8">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="risk_level_id"/>
</not>
</preConditions>
<comment>f_fmea add column risk_level_id</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `risk_level_id` bigint(20) DEFAULT NULL COMMENT '风险等级id';
</sql>
</changeSet>
<changeSet author="xukaiqiang" id="1557134646002-9">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="company_leader"/>
</not>
</preConditions>
<comment>f_fmea add column company_leader</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `company_leader` bigint(20) DEFAULT NULL COMMENT '公司负责人';
</sql>
</changeSet>
<changeSet author="xukaiqiang" id="1557134646002-10">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="department_leader"/>
</not>
</preConditions>
<comment>f_fmea add column department_leader</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `department_leader` bigint(20) DEFAULT NULL COMMENT '部门负责人';
</sql>
</changeSet>
<changeSet author="xukaiqiang" id="1557134646002-11">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="group_leader"/>
</not>
</preConditions>
<comment>f_fmea add column group_leader</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `group_leader` bigint(20) DEFAULT NULL COMMENT '班组负责人';
</sql>
</changeSet>
<changeSet author="xukaiqiang" id="1557134646002-12">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_fmea" columnName="person_leader"/>
</not>
</preConditions>
<comment>f_fmea add column person_leader</comment>
<sql>
ALTER TABLE `f_fmea` ADD COLUMN `person_leader` bigint(20) DEFAULT NULL COMMENT '个人负责人';
</sql>
</changeSet>
<changeSet author="tianbo" id="1582104676000-1"> <changeSet author="tianbo" id="1582104676000-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
......
...@@ -176,7 +176,7 @@ CREATE TABLE `f_fmea` ( ...@@ -176,7 +176,7 @@ CREATE TABLE `f_fmea` (
`create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间', `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`create_by` int(11) DEFAULT '0' COMMENT '创建者', `create_by` int(11) DEFAULT '0' COMMENT '创建者',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FEMA表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='FMEA表';
-- ---------------------------- -- ----------------------------
-- Table structure for f_preplan_picture -- Table structure for f_preplan_picture
......
...@@ -98,6 +98,10 @@ ...@@ -98,6 +98,10 @@
a.evaluation_oid as evaluationOid, a.evaluation_oid as evaluationOid,
a.evaluation_did as evaluationDid, a.evaluation_did as evaluationDid,
a.new_evaluation_oid as newEvaluationOid, a.new_evaluation_oid as newEvaluationOid,
a.company_leader as companyLeader,
a.department_leader as departmentLeader,
a.person_leader as personLeader,
a.group_leader as groupLeader,
a.rpni, a.rpni,
a.rpn, a.rpn,
(select coefficient from f_evaluation_model where id = a.evaluation_sid) as sidValue, (select coefficient from f_evaluation_model where id = a.evaluation_sid) as sidValue,
......
...@@ -102,11 +102,14 @@ ...@@ -102,11 +102,14 @@
a.fmea_id as fmeaId, a.fmea_id as fmeaId,
a.point_inputitem_id as pointInputitemId, a.point_inputitem_id as pointInputitemId,
a.state, a.state,
b.input_item_id as inputItemId b.input_item_id as inputItemId,
c.risk_source_id
from from
f_fmea_point_inputitem as a f_fmea_point_inputitem as a
left join left join
p_point_inputitem as b on a.point_inputitem_id = b.id p_point_inputitem as b on a.point_inputitem_id = b.id
left join
f_fmea as c on a.fmea_id = c.id
where where
b.point_id = #{pointId} b.point_id = #{pointId}
and and
......
...@@ -375,7 +375,7 @@ ...@@ -375,7 +375,7 @@
FROM FROM
f_risk_source rs f_risk_source rs
WHERE WHERE
EXISTS ( id in (
SELECT SELECT
pi.risk_source_id pi.risk_source_id
FROM FROM
......
...@@ -220,6 +220,11 @@ ...@@ -220,6 +220,11 @@
<artifactId>commons-jexl</artifactId> <artifactId>commons-jexl</artifactId>
<version>2.1.1</version> <version>2.1.1</version>
</dependency> </dependency>
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.10</version>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
......
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