Commit e4af6fbc authored by suhuiguang's avatar suhuiguang

Merge branch 'develop' into dev_upgrade

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/PlanVisual3dController.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/FireEquipPointServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/FmeaServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ITopographyNodeServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IRiskSourceService.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/client/invoke/RsDataQueue.java # YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-1.0.2.xml
parents e28ff62a 5a275471
package com.yeejoin.amos.fas.common.enums;
/**
* rpn变化类型枚举
*/
public enum RpnChangeLogTypeEum {
/**
* 类型枚举
*/
upper("上升",0),
down("下降",1),
unChange("未发生变化",2);
private String name;
private int code;
RpnChangeLogTypeEum(String name,int code){
this.name = name;
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
package com.yeejoin.amos.fas.common.enums;
/**
* @author DELL
*/
public enum TriggerRpnChangeTypeEum {
/**
* 触发类型枚举
*/
patrol("巡检","patrol"),
equipment("设备告警","equipment"),
fmeaUpdate("危险因素评价","fmeaUpdate"),
fmeaDelete("危险因素删除","fmeaDelete"),
riskDelete("风险点删除","riskDelete");
private String name;
private String code;
TriggerRpnChangeTypeEum(String name,String code){
this.name = name;
this.code = code;
}
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;
}
}
......@@ -47,6 +47,8 @@ public class RiskLevel extends BasicEntity {
@Column(name = "down_limit")
private BigDecimal downLimit;
private Integer manageLevel;
private String remark;
private String severity;
......@@ -125,4 +127,12 @@ public class RiskLevel extends BasicEntity {
public void setDownLimit(BigDecimal downLimit) {
this.downLimit = downLimit;
}
public Integer getManageLevel() {
return manageLevel;
}
public void setManageLevel(Integer manageLevel) {
this.manageLevel = manageLevel;
}
}
\ No newline at end of file
......@@ -67,6 +67,12 @@ public class TopographyLine extends BusinessEntity{
@Column(name = "to_port", columnDefinition = "varchar(32) COMMENT '终点'")
private String toPort;
@Column(name = "type", columnDefinition = "varchar(32) COMMENT '1 领导架构 | 2 任务流程'")
private String type;
@Column(name = "category", columnDefinition = "varchar(32) COMMENT '类别'")
private String category;
public String getId() {
return id;
}
......@@ -127,6 +133,18 @@ public class TopographyLine extends BusinessEntity{
public void setToPort(String toPort) {
this.toPort = toPort;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
}
......@@ -74,6 +74,9 @@ public class TopographyNode extends BusinessEntity{
@Column(name = "source_id", columnDefinition = "varchar(32) COMMENT '资源id'")
private String sourceId;
@Column(name = "type", columnDefinition = "varchar(32) COMMENT '1 领导架构 | 2 任务流程'")
private String type;
public String getId() {
return id;
}
......@@ -140,4 +143,10 @@ public class TopographyNode extends BusinessEntity{
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.yeejoin.amos.fas.business.bo;
import java.math.BigDecimal;
/**
* @author DELL
*/
public class RpnCalculationBo {
/**
* rpn
*/
BigDecimal rpn;
/**
* rpni
*/
BigDecimal rpni;
/**
* 长度
*/
long size;
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public BigDecimal getRpn() {
return rpn;
}
public void setRpn(BigDecimal rpn) {
this.rpn = rpn;
}
public BigDecimal getRpni() {
return rpni;
}
public void setRpni(BigDecimal rpni) {
this.rpni = rpni;
}
public boolean isEmpty(){
return size <= 0;
}
}
......@@ -210,7 +210,7 @@ public class FileController extends BaseController {
return new CommonResponse(SUCCESS, "访问的文件不存在!", "查询成功");
}
if (fileName.endsWith(".doc") || fileName.endsWith(".docx")) {
String htmlFileName = fileName.substring(0, fileName.indexOf(".")) + ".html";
String htmlFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".html";
File htmlFile = new File(htmlFileName);
String data = WordConverterUtils.wordToHtmlString(fileName, readUrl);
Map<String, Object> processData = null;
......
......@@ -7,28 +7,15 @@ import com.yeejoin.amos.fas.dao.entity.TextPlan;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.List;
import java.util.Map;
......@@ -38,14 +25,14 @@ import java.util.Map;
public class PlanVisual3dController extends BaseController {
private final Logger log = LoggerFactory.getLogger(PlanVisual3dController.class);
// 上传路径
@Value("${file.uploadUrl}")
private String fileUploadDir;
@Autowired
private IPlanVisual3dService planVisual3dService;
@Autowired
HttpServletResponse response;
@Autowired
......@@ -62,50 +49,50 @@ public class PlanVisual3dController extends BaseController {
public CommonResponse getTextPlanById(@PathVariable(value = "id") Long id) {
return CommonResponseUtil.success(planVisual3dService.getTextPlanInfoById(id));
}
//@Authorization(ingore = true)
@RequestMapping(value = "/plan/text/downloadFile/{id}", method = RequestMethod.GET)
public HttpServletResponse download(@PathVariable("id") Long id) {
TextPlan testPlan = planVisual3dService.getTextPlanInfoById(id);
if(testPlan != null) {
String path = testPlan.getFilePath();
if( path != null && !"".equals(path)) {
try {
// path是指欲下载的文件的路径。
File file = new File(fileUploadDir + path);
if(file.exists()) {
// 取得文件名。
String filename = file.getName();
// 取得文件的后缀名。
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
TextPlan testPlan = planVisual3dService.getTextPlanInfoById(id);
if (testPlan != null) {
String path = testPlan.getFilePath();
if (path != null && !"".equals(path)) {
try {
// path是指欲下载的文件的路径。
File file = new File(fileUploadDir + path);
if (file.exists()) {
// 取得文件名。
String filename = file.getName();
// 取得文件的后缀名。
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(fileUploadDir + path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
// response.reset();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
response.setContentType("application/x-download");
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
toClient.write(buffer);
toClient.flush();
toClient.close();
}else {
response.setStatus(404);
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}else {
response.setStatus(404);
}
return response;
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename=" + new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
response.setContentType("application/x-download");
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
toClient.write(buffer);
toClient.flush();
toClient.close();
} else {
response.setStatus(404);
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
} else {
response.setStatus(404);
}
return response;
}
/**
......
......@@ -42,11 +42,22 @@ public class TopographyController {
@Autowired
private ITopographyLineService lineService;
@ApiOperation(value = "根据appID查询节点及线", notes = "根据appID查询节点及线")
@GetMapping(value = "/{appId}")
public CommonResponse getTextPlanById(@PathVariable(value = "appId") String appId) {
List<TopographyNode> nodes = nodeService.getNodesByAppId(appId);
List<TopographyLine> links = lineService.getLinksByAppId(appId);
@ApiOperation(value = "根据appId查询节点及线", notes = "根据appID查询节点及线")
@GetMapping(value = "/query/{type}/{appId}")
public CommonResponse getTextPlanByIdAndType(@PathVariable(value = "appId") String appId,@PathVariable(value = "type") String type) {
List<TopographyNode> nodes = nodeService.getNodesByAppIdAndType(appId,type);
List<TopographyLine> links = lineService.getLinesByAppIdAndType(appId,type);
Map<String,Object> results = new HashMap<>();
results.put("nodeData", nodes);
results.put("linkData", links);
return CommonResponseUtil.success(results);
}
@ApiOperation(value = "根据type查询节点及线", notes = "根据type查询节点及线")
@GetMapping(value = "/query/{type}")
public CommonResponse getTextPlanByType(@PathVariable(value = "type") String type) {
List<TopographyNode> nodes = nodeService.getNodesByType(type);
List<TopographyLine> links = lineService.getLinesByType(type);
Map<String,Object> results = new HashMap<>();
results.put("nodeData", nodes);
results.put("linkData", links);
......@@ -61,58 +72,73 @@ public class TopographyController {
@PostMapping(value = "/updateTopo", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "保存拓扑图", notes = "保存拓扑图")
public CommonResponse savedonghuanNodes(@ApiParam(value = "", required = false) @RequestBody JSONObject topographyParam) {
String appId = topographyParam.getString("appId");
//节点
JSONArray nodes = topographyParam.getJSONArray("nodeData");
List<TopographyNode> nodeData = JSON.parseArray(JSON.toJSONString(nodes), TopographyNode.class);
HashMap<String, String> convertKeyMap = new HashMap<>();
int curSize = nodeService.queryMaxKeyByAppId(appId);
for(TopographyNode e:nodeData){
if(Integer.valueOf(e.getKey()) < 0) {
curSize = curSize + 1 ;
String newKey = String.format("%05d", curSize);
convertKeyMap.put(e.getKey(), newKey);
e.setKey(newKey);
e.setAppId(appId);
e.setGroup("");
}
};
//线
JSONArray links = topographyParam.getJSONArray("linkData");
List<TopographyLine> lineData = JSON.parseArray(JSON.toJSONString(links), TopographyLine.class);
lineData.forEach(l -> {
if(Integer.parseInt(l.getFrom()) < 0) {
l.setFrom(convertKeyMap.get(l.getFrom()));
}
if(Integer.parseInt(l.getTo()) < 0) {
l.setTo(convertKeyMap.get(l.getTo()));
}
if(l.getAppId() == null) {
l.setAppId(appId);
}
});
nodeService.saveNodes(nodeData);
lineService.saveLines(lineData);
//节点详情
JSONObject nodeDetailJson = topographyParam.getJSONObject("nodeDetail");
if(nodeDetailJson != null) {
TopographyNodeDetail nodeDetail = JSON.parseObject(JSON.toJSONString(nodeDetailJson), TopographyNodeDetail.class);
String nodekey = nodeDetail.getNodekey();
if(nodekey != null && Integer.parseInt(nodekey) < 0) {
TopographyNode node = nodeService.queryByKeyAndAppId(convertKeyMap.get(nodekey),appId);
nodeDetail.setNodeid(node.getId());
}
nodeService.saveNodeDetail(nodeDetail);
synchronized (TopographyController.class) {
String appId = topographyParam.getString("appId") != null ? topographyParam.getString("appId") : null;
String type = topographyParam.getString("type");
//节点
JSONArray nodes = topographyParam.getJSONArray("nodeData");
List<TopographyNode> nodeData = JSON.parseArray(JSON.toJSONString(nodes), TopographyNode.class);
HashMap<String, String> convertKeyMap = new HashMap<>();
int curSize = nodeService.queryMaxKeyByAppIdAndType(appId,type);
for(TopographyNode e:nodeData){
if(Integer.valueOf(e.getKey()) < 0) {
curSize = curSize + 1 ;
String newKey = String.format("%05d", curSize);
convertKeyMap.put(e.getKey(), newKey);
e.setKey(newKey);
e.setType(type);
e.setAppId(appId);
if(e.getGroup() == null) {
e.setGroup("");
}else if(Integer.valueOf(e.getGroup()) < 0){//修改新节点组
e.setGroup(convertKeyMap.get(e.getGroup()));
}
}
};
//线
JSONArray links = topographyParam.getJSONArray("linkData");
List<TopographyLine> lineData = JSON.parseArray(JSON.toJSONString(links), TopographyLine.class);
lineData.forEach(l -> {//修改新增节点之间线的连接
if(Integer.parseInt(l.getFrom()) < 0) {
l.setFrom(convertKeyMap.get(l.getFrom()));
}
if(Integer.parseInt(l.getTo()) < 0) {
l.setTo(convertKeyMap.get(l.getTo()));
}
if(l.getCategory() == null) {
l.setCategory("");
}
if(l.getAppId() == null) {
l.setAppId(appId);
l.setType(type);
}
});
nodeService.saveNodes(nodeData);
lineService.saveLines(lineData);
//节点详情
JSONObject nodeDetailJson = topographyParam.getJSONObject("nodeDetail");
if(nodeDetailJson != null) {
TopographyNodeDetail nodeDetail = JSON.parseObject(JSON.toJSONString(nodeDetailJson), TopographyNodeDetail.class);
String nodekey = nodeDetail.getNodekey();
if(nodekey != null && Integer.parseInt(nodekey) < 0) {
TopographyNode node = nodeService.queryByKeyAndAppIdAndType(convertKeyMap.get(nodekey),appId,type);
nodeDetail.setNodeid(node.getId());
}
nodeService.saveNodeDetail(nodeDetail);
}
//返回保存后的数据
List<TopographyNode> newNodes = nodeService.getNodesByAppIdAndType(appId,type);
List<TopographyLine> newLinks = lineService.getLinesByAppIdAndType(appId,type);
Map<String,Object> results = new HashMap<>();
results.put("nodeData", newNodes);
results.put("linkData", newLinks);
return CommonResponseUtil.success(results);
}
List<TopographyNode> newNodes = nodeService.getNodesByAppId(appId);
List<TopographyLine> newLinks = lineService.getLinksByAppId(appId);
Map<String,Object> results = new HashMap<>();
results.put("nodeData", newNodes);
results.put("linkData", newLinks);
return CommonResponseUtil.success(results);
}
@ApiOperation(value = "根据nodeid查询节点详情", notes = "根据nodeid查询节点详情")
......@@ -143,7 +169,8 @@ public class TopographyController {
if("Link".equals(type)) {
lineService.deleteLine(id);
}else {
nodeService.deleteNode(id);
TopographyNode node = nodeService.queryById(id);
nodeService.deleteNode(node);
}
return CommonResponseUtil.success();
}
......
......@@ -36,5 +36,7 @@ public interface FmeaMapper extends BaseMapper {
List<Fmea> listByRiskSourceId(Long riskSourceId);
List<Fmea> listByRiskSourceIds(@Param("ids") List<Long> ids);
void updateRpn(Fmea fmea);
}
......@@ -6,7 +6,7 @@ import java.util.List;
import java.util.Map;
public interface PlanVisual3dMapper extends BaseMapper {
List<HashMap<String,String>> getResourceListByType(@Param("type") String type);
List<HashMap<String,Object>> getResourceListByType(@Param("type") String type);
Map<String, Object> queryOneByTypeAndId(@Param("type") String type, @Param("id") Long id);
}
......@@ -12,5 +12,7 @@ public interface IFireEquipmentPointDao extends BaseDao<FireEquipmentPoint, Long
Optional<FireEquipmentPoint> findById(Long id);
FireEquipmentPoint findOneByCode(String pointCode);
int countByCode(String code);
}
......@@ -30,7 +30,7 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> {
/**
* 根据ID删除fmea对象
*
* @param riskSourceId
* @param fmeaIds
*/
@Modifying
@Transactional
......@@ -45,4 +45,7 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> {
@Query(value = "SELECT count(1) FROM `f_fmea_equipment_point` WHERE fmea_id in ?1", nativeQuery = true)
int countAssociatedEquipPointByIds(String[] ids);
@Query(value = "select * from `f_fmea` where id in ?1",nativeQuery = true)
List<Fmea> findAllByRiskSourceIds(List<Long> ids);
}
......@@ -10,11 +10,13 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine;
@Repository("iTopographyLineDao")
public interface ITopographyLineDao extends BaseDao<TopographyLine, Long> {
List<TopographyLine> findByAppId(String appId);
List<TopographyLine> findByAppIdAndType(String appId,String type);
TopographyLine findById(String id);
@Query(value = "select * from f_topography_line " + " where `from` = (?1) or `to` = (?1)",nativeQuery = true)
List<TopographyLine> findByKey(String key);
List<TopographyLine> findByType(String type);
}
......@@ -11,16 +11,23 @@ import com.yeejoin.amos.fas.dao.entity.TopographyNode;
@Repository("iTopographyNodeDao")
public interface ITopographyNodeDao extends BaseDao<TopographyNode, Long> {
List<TopographyNode> findByAppId(String appId);
List<TopographyNode> findByAppIdAndType(String appId,String type);
@Query(value = "select * from f_topography_node " + " where id in (?1)",nativeQuery = true)
List<TopographyNode> findAllByIds(@Param("ids") List<String> ids);
TopographyNode findById(String id);
TopographyNode findByKeyAndAppId(String nodekey, String appId);
TopographyNode findByKeyAndAppIdAndType(String nodekey, String appId,String type);
@Query(value = "select max(`key`) from f_topography_node where app_id = (?1)",nativeQuery = true)
Integer queryMaxKeyByAppId(String appId);
@Query(value = "select max(`key`) from f_topography_node where app_id = (?1) and type = (?2)",nativeQuery = true)
Integer queryMaxKeyByAppIdAndType(String appId,String type);
List<TopographyNode> findByGroupAndAppIdAndType(String key, String appId, String type);
List<TopographyNode> findByType(String type);
@Query(value = "select max(`key`) from f_topography_node where type = (?1)",nativeQuery = true)
Integer queryMaxKeyByType(String type);
}
......@@ -29,6 +29,8 @@ public class FireEquipmentPointEntity extends FireEquipmentPointExtend {
private String orgCode;
private Long alarmType;
private String alarmTypeName;
private String fireEquipmentCode;
......@@ -135,4 +137,12 @@ public class FireEquipmentPointEntity extends FireEquipmentPointExtend {
public void setFireEquipmentCode(String fireEquipmentCode) {
this.fireEquipmentCode = fireEquipmentCode;
}
public String getAlarmTypeName() {
return alarmTypeName;
}
public void setAlarmTypeName(String alarmTypeName) {
this.alarmTypeName = alarmTypeName;
}
}
......@@ -29,7 +29,7 @@ public class FireEquipmentPointParam {
@Excel(name = "单位", orderNum = "7", width = 12)
private String unit;
@Excel(name = "告警类型", replace = {"火灾告警_1", "电源开关_2", "换流变_6", "液位_3", "流量_4", "容量_5"}, orderNum = "8")
@Excel(name = "告警类型", replace = {"火灾告警_1", "电源开关_2", "换流变_6", "液位_3", "流量_4", "容量_5", "故障告警_7"}, orderNum = "8")
private Long alarmType;
public Long getId() {
......
......@@ -67,10 +67,7 @@ public class FmeaServiceImpl implements IFmeaService {
fmeas.forEach(fmea -> {
String userId = paramMap.get("user_id") == null ? "0" : paramMap.get("user_id").toString();
fmea.setCreateBy(userId);
// RiskSource riskSource = iRiskSourceDao.findById(fmea.getRiskSourceId());
// fmea.setRiskSource(riskSource);
iFmeaDao.save(fmea);
//updateRpniInfo(fmea.getRiskSourceId());
});
}
......@@ -235,8 +232,9 @@ public class FmeaServiceImpl implements IFmeaService {
if(anomalyLevel1.isPresent()){
anomalyLevel =anomalyLevel1.get();
}
if (anomalyLevel != null && anomalyLevel.getLevel() > maxLevel)
if (anomalyLevel != null && anomalyLevel.getLevel() > maxLevel){
maxLevel = anomalyLevel.getLevel();
}
}
return maxLevel;
}
......@@ -245,36 +243,14 @@ public class FmeaServiceImpl implements IFmeaService {
private List<RiskSource> findAnomalyRiskSource(Long riskSourceId) {
List<RiskSource> returnList = new ArrayList<>();
List<RiskSource> childs = iRiskSourceDao.findByParentId(riskSourceId);
if (CollectionUtils.isEmpty(childs))
if (CollectionUtils.isEmpty(childs)){
return returnList;
}
for (RiskSource child : childs) {
/*if("ANOMALY".equals(child.getStatus()))
{
returnList.add(child);
}*/
returnList.add(child);
returnList.addAll(this.findAnomalyRiskSource(child.getId()));
}
return returnList;
}
private BigDecimal updateRpn(Object result, RiskSource riskSource, BigDecimal RPNi) {
/*"RPNr": 16,
"RPNi": -14*/
Map map = (Map) result;
RPNi = new BigDecimal(Double.parseDouble(String.valueOf(map.get("RPNi"))));
if (RPNi != null) {
riskSource.setRpni(RPNi);
this.iRiskSourceDao.save(riskSource);
}
return RPNi;
}
}
......@@ -16,8 +16,11 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{
private ITopographyLineDao topographyLineDao;
@Override
public List<TopographyLine> getLinksByAppId(String appId) {
return topographyLineDao.findByAppId(appId);
public List<TopographyLine> getLinesByAppIdAndType(String appId,String type) {
if(appId == null) {
return topographyLineDao.findByType(type);
}
return topographyLineDao.findByAppIdAndType(appId,type);
}
@Override
......@@ -32,6 +35,11 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{
topographyLineDao.delete(line);
}
}
@Override
public List<TopographyLine> getLinesByType(String type) {
return topographyLineDao.findByType(type);
}
}
......@@ -26,8 +26,11 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
private ITopographyLineDao lineDao;
@Override
public List<TopographyNode> getNodesByAppId(String appId) {
return nodeDao.findByAppId(appId);
public List<TopographyNode> getNodesByAppIdAndType(String appId,String type) {
if(appId == null) {
return nodeDao.findByType(type);
}
return nodeDao.findByAppIdAndType(appId,type);
}
@Override
......@@ -53,8 +56,8 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
}
@Override
public void deleteNode(String id) {
TopographyNode node = nodeDao.findById(id);
public void deleteNode(TopographyNode node) {
// TopographyNode node = nodeDao.findById(id);
if(node != null) {
String key = node.getKey();
nodeDao.delete(node);
......@@ -62,17 +65,41 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
if(lines != null && lines.size() > 0) {
lineDao.deleteAll(lines);
}
if(node.getIsGroup() != null && node.getIsGroup()) {
List<TopographyNode> childNodes = nodeDao.findByGroupAndAppIdAndType(node.getKey(),node.getAppId(),node.getType());
childNodes.forEach(c -> deleteNode(c));
}
return;
}
}
@Override
public TopographyNode queryByKeyAndAppIdAndType(String nodekey, String appId,String type) {
return nodeDao.findByKeyAndAppIdAndType(nodekey,appId,type);
}
@Override
public int queryMaxKeyByAppIdAndType(String appId,String type) {
Integer maxKey;
if(null == appId) {
maxKey = nodeDao.queryMaxKeyByType(type);
}else {
maxKey = nodeDao.queryMaxKeyByAppIdAndType(appId,type);
}
if(maxKey == null) {
maxKey = 0;
}
return maxKey;
}
@Override
public TopographyNode queryByKeyAndAppId(String nodekey, String appId) {
return nodeDao.findByKeyAndAppId(nodekey,appId);
public TopographyNode queryById(String id) {
return nodeDao.findById(id);
}
@Override
public int queryMaxKeyByAppId(String appId) {
return nodeDao.queryMaxKeyByAppId(appId);
public List<TopographyNode> getNodesByType(String type) {
return nodeDao.findByType(type);
}
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant;
import com.yeejoin.amos.fas.business.dao.mapper.DictMapper;
import com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
......@@ -34,6 +35,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
IDictService dictService;
@Autowired
private DictMapper dictMapper;
@Override
public List<TreeSubjectVo> getPlanTree() {
......@@ -75,9 +79,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
for (Object obj : list) {
TreeSubjectVo treeItem = new TreeSubjectVo();
LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) obj;
treeItem.setId((Integer) map.get("id"));
treeItem.setId((String) map.get("id"));
treeItem.setTreeName((String) map.get("treeName"));
treeItem.setParentId((Integer) map.get("parentId"));
treeItem.setParentId((String) map.get("parentId"));
treeItem.setMaxSubjectNumber((Integer) map.get("maxSubjectNumber"));
treeItem.setType("treeNode");
......@@ -92,30 +96,34 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List<TreeSubjectVo> childrenVos = Lists.newArrayList();
List<Object> res = (List<Object>) response.getDataList();
res.forEach(r -> {
LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r;
Integer state = (Integer) map1.get("publishState");
if(state == 0) {//过滤 未发布状态
return;
}
TreeSubjectVo subjectVo = new TreeSubjectVo();
LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r;
subjectVo.setType("listNode");
subjectVo.setParentId((Integer) map.get("id"));
subjectVo.setId((Integer) map1.get("id"));
subjectVo.setDelete(map1.get("isDelete") == null ? false : (Boolean) map1.get("isDelete"));
subjectVo.setCreateTime((Long) map1.get("createTime"));
subjectVo.setParentId((String) map.get("id"));
subjectVo.setId((String) map1.get("id"));
subjectVo.setDelete(map1.get("isDelete") == null || (Integer) map1.get("isDelete") == 0 ? false : true);
subjectVo.setCreateTime((String) map1.get("createTime"));
subjectVo.setCreator(map1.get("creator") == null ? 0 : (Integer) map1.get("creator"));
subjectVo.setSubjectName((String) map1.get("subjectName"));
subjectVo.setTreeName((String) map1.get("subjectName"));
subjectVo.setSubjectDetail((String) map1.get("subjectDetail"));
subjectVo.setSubjectType((String) map1.get("subjectType"));
subjectVo.setSubjectTypeName((String) map1.get("subjectTypeName"));
subjectVo.setPublishState((Integer) map1.get("publishState"));
subjectVo.setBelongTreeId((Integer) map1.get("belongTreeId"));
subjectVo.setPublishState(state);
subjectVo.setBelongTreeId((String) map1.get("belongTreeId"));
subjectVo.setScenes(map1.get("scenes") == null ? "" : (String) map1.get("scenes"));
//关联文字预案
List<TextPlan> textPlans = iTextPlanDao.findByAppId(String.valueOf(subjectVo.getId()));
textPlans.forEach(t -> {
TreeSubjectVo textTreeSubjectVo = new TreeSubjectVo();
textTreeSubjectVo.setParentId(Integer.valueOf(t.getAppId()));
textTreeSubjectVo.setParentId(String.valueOf(t.getAppId()));
textTreeSubjectVo.setTreeName(t.getTextName());
textTreeSubjectVo.setId((int) t.getId());
textTreeSubjectVo.setId(String.valueOf(t.getId()));
textTreeSubjectVo.setType("textNode");
subjectVo.getChildren().add(textTreeSubjectVo);
});
......@@ -178,5 +186,44 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return list;
}
@Override
public List<Map<String, Object>> getResourceTypeList() {
Dict dict = new Dict();
dict.setDictCode(FasConstant.PLAN_SOURCE_TYPE);
List<Dict> dictList = dictMapper.getDictList(dict);
List<Map<String, Object>> list = new ArrayList<>();
list = dictList.stream().map(e->{
Map<String, Object> newMap = new HashMap<String, Object>();
newMap.put("key",e.getDictValue());
newMap.put("value",e.getDictValue());//前端级联Cascader使用
newMap.put("isLeaf",false);////前端级联Cascader使用
newMap.put("dataType","type");
newMap.put("label",e.getDictName());
return newMap;
}).collect(Collectors.toList());
return list;
}
@Override
public List<TreeSubjectVo> getTextPlanBySubjectId(String appId) {
//关联文字预案
List<TreeSubjectVo> subjectVos = new ArrayList<>();
List<TextPlan> textPlans = iTextPlanDao.findByAppId(appId);
textPlans.forEach(t -> {
TreeSubjectVo textTreeSubjectVo = new TreeSubjectVo();
textTreeSubjectVo.setParentId(String.valueOf(t.getAppId()));
textTreeSubjectVo.setTreeName(t.getTextName());
textTreeSubjectVo.setId(String.valueOf(t.getId()));
textTreeSubjectVo.setType("textNode");
subjectVos.add(textTreeSubjectVo);
});
return subjectVos;
}
@Override
public void deleteTextPlanFile(Long id) {
iTextPlanDao.deleteById(id);
}
}
......@@ -4,7 +4,6 @@ import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.TextPlan;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -35,4 +34,10 @@ public interface IPlanVisual3dService {
CommonResponse getResourceListByType(String type);
List<Map<String,Object>> getResourceById(String type,Long id);
List<Map<String,Object>> getResourceTypeList();
List<TreeSubjectVo> getTextPlanBySubjectId(String appId);
void deleteTextPlanFile(Long id);
}
package com.yeejoin.amos.fas.business.service.intfc;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.data.domain.Page;
import com.yeejoin.amos.fas.business.bo.BindRegionBo;
import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
......@@ -19,6 +13,12 @@ import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint;
import com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import org.springframework.data.domain.Page;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public interface IRiskSourceService {
......@@ -86,8 +86,6 @@ public interface IRiskSourceService {
Map earlyWarning(Long riskSourceId);
// BigDecimal updateRiskSourceRpni(Long riskSourceId) throws Exception;
List<HashMap<String, Object>> queryRiskAreaRpn();
String processFireEqumtData(AlarmParam deviceData) throws Exception;
......@@ -114,8 +112,6 @@ public interface IRiskSourceService {
void notifyFmeaFromUpdate(String toke,String product,String appKey,Long fmeaId, String nofityType);
void notifyRiskSource(Long riskSourceId, String notifyType, String jpushTarget);
/**
* 按照机构重新区域树
* @param orgCode 机构
......@@ -137,4 +133,9 @@ public interface IRiskSourceService {
*/
void batchSaveRegionUe4(List<BindRegionBo> regionBoList);
void notifyRiskSource(Long fmeaId, Long riskSourceId, String notifyType, Set<String> jpushTargets);
void notifyFmeaFromDelete(Long handId, String from);
void notifyRiskSourceDelete(Long handId);
}
......@@ -6,10 +6,12 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine;
public interface ITopographyLineService {
public List<TopographyLine> getLinksByAppId(String appId);
public List<TopographyLine> getLinesByAppIdAndType(String appId,String type);
public void saveLines(List<TopographyLine> lineData);
public void deleteLine(String id);
public List<TopographyLine> getLinesByType(String type);
}
......@@ -2,13 +2,12 @@ package com.yeejoin.amos.fas.business.service.intfc;
import java.util.List;
import com.yeejoin.amos.fas.dao.entity.TopographyLine;
import com.yeejoin.amos.fas.dao.entity.TopographyNode;
import com.yeejoin.amos.fas.dao.entity.TopographyNodeDetail;
public interface ITopographyNodeService {
public List<TopographyNode> getNodesByAppId(String appId);
public List<TopographyNode> getNodesByAppIdAndType(String appId,String type);
public void saveNodes(List<TopographyNode> nodeData);
......@@ -16,10 +15,14 @@ public interface ITopographyNodeService {
public TopographyNodeDetail saveNodeDetail(TopographyNodeDetail nodeDetail);
public void deleteNode(String id);
public void deleteNode(TopographyNode node);
public TopographyNode queryByKeyAndAppId(String nodekey, String appId);
public TopographyNode queryByKeyAndAppIdAndType(String nodekey, String appId,String type);
public int queryMaxKeyByAppId(String appId);
public int queryMaxKeyByAppIdAndType(String appId,String type);
public TopographyNode queryById(String id);
public List<TopographyNode> getNodesByType(String type);
}
package com.yeejoin.amos.fas.business.util;
import com.yeejoin.amos.fas.business.bo.RpnCalculationBo;
import com.yeejoin.amos.fas.common.enums.RpnChangeLogTypeEum;
import com.yeejoin.amos.fas.dao.entity.Fmea;
import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint;
import com.yeejoin.amos.fas.dao.entity.FmeaPointInputitem;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List;
/**
* @author DELL
*/
public class RpnUtils {
/**
* 计算风险值
* @param fmeas
* @return RpnCalculationBo
*/
public static RpnCalculationBo calRpnAndRpni(List<Fmea> fmeas){
BigDecimal maxSidValue = new BigDecimal("0");
BigDecimal maxDidValue = new BigDecimal("0");
BigDecimal totalOidValue = new BigDecimal("0");
BigDecimal totalNewOidValue = new BigDecimal("0");
long count = 0L;
for (Fmea fmea : fmeas) {
if (fmea.getEvaluationDid() != null && fmea.getEvaluationSid() != null && fmea.getEvaluationOid() != null && fmea.getNewEvaluationOid() != null) {
BigDecimal didValue = new BigDecimal(fmea.getDidValue());
BigDecimal sidValue = new BigDecimal(fmea.getSidValue());
BigDecimal oidValue = new BigDecimal(fmea.getOidValue());
BigDecimal newOidValue = new BigDecimal(fmea.getNewOidValue());
if (didValue.compareTo(maxDidValue) == 1) {
maxDidValue = didValue;
}
if (sidValue.compareTo(maxSidValue) == 1) {
maxSidValue = sidValue;
}
totalOidValue = totalOidValue.add(oidValue);
totalNewOidValue = totalNewOidValue.add(newOidValue);
count++;
}
}
RpnCalculationBo rpnValue = new RpnCalculationBo();
rpnValue.setSize(count);
if (count == 0) {
return rpnValue;
}
BigDecimal averageOidValue = totalOidValue.divide(BigDecimal.valueOf(count),2,BigDecimal.ROUND_HALF_UP);
BigDecimal averageNewOidValue = totalNewOidValue.divide(BigDecimal.valueOf(count),2,BigDecimal.ROUND_HALF_UP);
BigDecimal rpn = maxDidValue.multiply(maxSidValue).multiply(averageNewOidValue).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal rpni = maxDidValue.multiply(maxSidValue).multiply(averageOidValue).setScale(2,BigDecimal.ROUND_HALF_UP);
rpnValue.setRpn(rpn);
rpnValue.setRpni(rpni);
return rpnValue;
}
/**
* 计算最大故障率
* @param equipmentPoints
* @param pointInputitems
* @return
*/
public static Double getMaxRate(List<FmeaEquipmentPoint> equipmentPoints, List<FmeaPointInputitem> pointInputitems) {
Double pointInputitemRate = null;
if (!CollectionUtils.isEmpty(pointInputitems)) {
int totalPointInputitem = pointInputitems.size();
int pointInputitemUnNormal = 0;
for (FmeaPointInputitem pointInputitem : pointInputitems) {
if (pointInputitem.getState() == 1) {
pointInputitemUnNormal++;
}
}
pointInputitemRate = pointInputitemUnNormal * 1.0 / totalPointInputitem;
}
Double equipmentPointRate = null;
if (!CollectionUtils.isEmpty(equipmentPoints)) {
int totalEquipmentPoint = equipmentPoints.size();
int equipmentPointUnNormal = 0;
for (FmeaEquipmentPoint equipmentPoint : equipmentPoints) {
if (equipmentPoint.getState() == 1) {
equipmentPointUnNormal++;
}
}
equipmentPointRate = equipmentPointUnNormal * 1.0 / totalEquipmentPoint;
}
if (equipmentPointRate == null) {
if (pointInputitemRate == null) {
return null;
} else {
return pointInputitemRate;
}
} else {
if (pointInputitemRate == null) {
return equipmentPointRate;
} else {
if (pointInputitemRate < equipmentPointRate) {
return equipmentPointRate;
} else {
return pointInputitemRate;
}
}
}
}
/**
* 获得风险等级
* @param rpni
* @param levels
* @return
*/
public static RiskLevel getBetweenLevel(BigDecimal rpni, List<RiskLevel> levels) {
if (CollectionUtils.isEmpty(levels)) {
return null;
}
for (RiskLevel level : levels) {
int downResult = level.getDownLimit().compareTo(rpni);
int topResult = level.getTopLimit().compareTo(rpni);
if (downResult == -1 && topResult != -1) {
return level;
}
}
return null;
}
/**
* 获取风险变化类型
* @param rpn
* @param rpni
* @return
*/
public static int getChangeType(BigDecimal rpn, BigDecimal rpni) {
if(rpn.subtract(rpni).doubleValue() > 0){
return RpnChangeLogTypeEum.upper.getCode();
} else if(rpn.subtract(rpni).doubleValue() < 0){
return RpnChangeLogTypeEum.down.getCode();
} else {
return RpnChangeLogTypeEum.unChange.getCode();
}
}
}
......@@ -5,11 +5,11 @@ import java.util.List;
public class TreeSubjectVo {
private Integer id;
private String id;
private String treeName;
private Integer parentId;
private String parentId;
private Integer maxSubjectNumber;
......@@ -17,7 +17,7 @@ public class TreeSubjectVo {
private List<TreeSubjectVo> children = new ArrayList<>();
private Long createTime;
private String createTime;
private Integer creator;
......@@ -33,17 +33,17 @@ public class TreeSubjectVo {
private int publishState;
private int belongTreeId;
private String belongTreeId;
private String scenes;
List<TreeSubjectVo> subjectChildren = new ArrayList<>();
public Integer getId() {
public String getId() {
return id;
}
public void setId(Integer id) {
public void setId(String id) {
this.id = id;
}
......@@ -55,11 +55,11 @@ public class TreeSubjectVo {
this.treeName = treeName;
}
public Integer getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}
......@@ -79,11 +79,11 @@ public class TreeSubjectVo {
this.children = children;
}
public Long getCreateTime() {
public String getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
......@@ -143,11 +143,11 @@ public class TreeSubjectVo {
this.publishState = publishState;
}
public int getBelongTreeId() {
public String getBelongTreeId() {
return belongTreeId;
}
public void setBelongTreeId(int belongTreeId) {
public void setBelongTreeId(String belongTreeId) {
this.belongTreeId = belongTreeId;
}
......
......@@ -5,9 +5,8 @@ import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.util.CacheFactory;
import com.yeejoin.amos.fas.business.util.CacheMap;
import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.common.enums.TriggerRpnChangeTypeEum;
import com.yeejoin.amos.fas.context.IotContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,14 +26,19 @@ public class RsDataQueue {
private IRiskSourceService riskSourceService;
private volatile static RsDataQueue instance = null;
private static final String TOKE = "TOKE";
@Autowired
private RemoteSecurityService remoteSecurityService;
private RsDataQueue() {
riskSourceService = (IRiskSourceService) IotContext.getInstance().getBean(IRiskSourceService.class);
}
//获取RsDataQueue 的实例
/**
* 获取RsDataQueue 的实例
*
* @return 获RsDataQueue
*/
public static RsDataQueue getInstance() {
//先检查实例是否存在,如果不存在才进入下面的同步块
if (instance == null) {
......@@ -59,55 +63,65 @@ public class RsDataQueue {
}
public void addUpdateMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, "update"));
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.fmeaUpdate.getCode()));
}
public void addPatrolMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, "patrol"));
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.patrol.getCode()));
}
public void addEquipmentMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, "equipment"));
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.equipment.getCode()));
}
public void addDeleteMessage(Long riskSourceId) {
blockingQueue.add(new FmeaMessage(riskSourceId, "delete"));
blockingQueue.add(new FmeaMessage(riskSourceId, TriggerRpnChangeTypeEum.fmeaDelete.getCode()));
}
Runnable task_runnable = new Runnable() {
public void addRiskSourcePointDeleteMessage(Long parentId) {
blockingQueue.add(new FmeaMessage(parentId, TriggerRpnChangeTypeEum.riskDelete.getCode()));
}
private Runnable task_runnable = new Runnable() {
@Override
public void run() {
while (true) {
try {
FmeaMessage fmeaMessage = blockingQueue.take();
if (riskSourceService != null) {
//获取缓存
CacheMap cacheMap= CacheFactory.newChacheMap();
Toke toke= cacheMap.getValue(TOKE);
if(toke==null){
toke= remoteSecurityService.come();
Long times= (long) (20*24*60*60);
cacheMap.setex(TOKE, toke, times);
//获取缓存
CacheMap cacheMap = CacheFactory.newChacheMap();
Toke toke = cacheMap.getValue(TOKE);
if (toke == null) {
toke = remoteSecurityService.come();
Long times = (long) (20 * 24 * 60 * 60);
cacheMap.setex(TOKE, toke, times);
}
String from = fmeaMessage.getNorifyFrom();
Long handId = fmeaMessage.getHandId();
if (from.equals("patrol")) {
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(),toke.getProduct(),toke.getAppKey(),handId, from);
} else if (from.equals("equipment")) {
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(),toke.getProduct(),toke.getAppKey(),handId, from);
} else if (from.equals("update")) {
riskSourceService.notifyFmeaFromUpdate(toke.getToke(),toke.getProduct(),toke.getAppKey(),handId, from);
} else if (from.equals("delete")) {
riskSourceService.notifyRiskSource(handId, from, null);
if (from.equals(TriggerRpnChangeTypeEum.patrol.getCode())) {
//巡检不合格通知
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from);
} else if (from.equals(TriggerRpnChangeTypeEum.equipment.getCode())) {
//设备告警
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from);
} else if (from.equals(TriggerRpnChangeTypeEum.fmeaUpdate.getCode())) {
//危险因素评价修改通知
riskSourceService.notifyFmeaFromUpdate(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from);
} else if (from.equals(TriggerRpnChangeTypeEum.fmeaDelete.getCode())) {
//危险因素删除通知
riskSourceService.notifyFmeaFromDelete(handId, from);
} else if (from.equals(TriggerRpnChangeTypeEum.riskDelete.getCode())) {
//风险点删除通知
riskSourceService.notifyRiskSourceDelete(handId);
}
}
} catch (Exception e) {
LoggerFactory.getLogger(this.getClass()).error(e.getMessage());
e.printStackTrace();
}
}
}
};
}
};
}
......@@ -182,8 +182,6 @@
<column name="type"/>
</createIndex>
</changeSet>
<changeSet author="shanqiyun" id="1588067351000-1">
<preConditions onFail="MARK_RAN">
<not>
......@@ -195,7 +193,6 @@
alter table f_risk_source add column `route_path` varchar(2000) DEFAULT NULL COMMENT '路径坐标' after `position3d`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1588140925893-1">
<preConditions onFail="MARK_RAN">
<not>
......@@ -207,4 +204,14 @@
alter table `f_safety_index_change_log` add column `create_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1588990926789-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_risk_level " columnName="manage_level"/>
</preConditions>
<comment>f_risk_level add column manage_level 管控级别</comment>
<sql>
ALTER TABLE `f_risk_level`
add COLUMN `manage_level` tinyint(4) DEFAULT NULL COMMENT '管控级别';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -5,7 +5,11 @@
<!--查询-->
<select id="getResourceListByType" resultType="java.util.HashMap">
SELECT
rs.id,rs.name,rs.code
rs.id as `key` ,
rs.id AS `value`,
rs.name as label,
rs.code ,
'id' as dataType
from
<choose>
<when test="type=='fireCar'">
......
......@@ -132,12 +132,14 @@
a.unit,
a.org_code as orgCode,
a.alarm_type as alarmType,
fd.dict_name as alarmTypeName,
b.name as fireEquipmentName,
b.code as fireEquipmentCode
from
f_fire_equipment_point as a
left join
f_fire_equipment as b on a.fire_equipment_id = b.id
left join f_dict fd on fd.id = a.alarm_type
<where>
<if test="searchValue!=null and searchValue.trim() != ''">
and (a.name like concat('%',#{searchValue},'%') or a.code like concat('%',#{searchValue},'%'))
......
......@@ -154,4 +154,27 @@
</set>
where id = #{id}
</update>
<select id="listByRiskSourceIds" resultType="com.yeejoin.amos.fas.dao.entity.Fmea">
select
a.id,
a.risk_source_id as riskSourceId,
a.risk_factors_id as riskFactorsId,
a.evaluation_sid as evaluationSid,
a.evaluation_oid as evaluationOid,
a.evaluation_did as evaluationDid,
a.new_evaluation_oid as newEvaluationOid,
a.rpni,
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_oid) as oidValue,
(select coefficient from f_evaluation_model where id = a.evaluation_did) as didValue,
(select coefficient from f_evaluation_model where id = a.new_evaluation_oid) as newOidValue
from
f_fmea as a
where
a.risk_source_id in
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -119,7 +119,8 @@
null data_level,
fe.`code` data_code,
(select GROUP_CONCAT(cast(eq.`name` as char(50)) SEPARATOR ',') from f_equipment_fire_equipment fre join f_equipment eq on fre.equipment_id = eq.id where fre.fire_equipment_id = fe.id) protect_obj_name,
null route_name
null route_name,
0 frequency
from f_fire_equipment fe
where
<choose>
......@@ -249,7 +250,8 @@
null data_level,
e.`code` data_code,
null protect_obj_name,
null route_name
null route_name,
0 frequency
from f_equipment e
where
<choose>
......@@ -346,7 +348,8 @@
null data_level,
fc.car_num data_code,
null protect_obj_name,
null route_name
null route_name,
0 frequency
from f_fire_car fc
where
......@@ -445,7 +448,8 @@
null data_level,
fs.`code` data_code,
null protect_obj_name,
null route_name
null route_name ,
0 frequency
from f_fire_station fs
where
<choose>
......@@ -544,7 +548,8 @@
null data_level,
wr.`code` data_code,
null protect_obj_name,
null route_name
null route_name ,
0 frequency
from f_water_resource wr
where
<choose>
......
......@@ -207,7 +207,7 @@
</dependencyManagement>
<repositories>
<repositories>
<repository>
<id>public</id>
<name>Public Repositories</name>
......@@ -218,7 +218,16 @@
<name>maven-public</name>
<url>http://172.16.1.6:8081/nexus/content/repositories/maven-public/</url>
</repository>
<repository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://repo.typroject.org:8081/repository/maven-public/</url>
</repository>
<repository>
<id>maven-snapshot</id>
<name>maven-snapshot</name>
<url>http://repo.typroject.org:8081/repository/maven-snapshots/</url>
</repository>
</repositories>
<pluginRepositories>
......
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