Commit 1a1a91d2 authored by maoying's avatar maoying

Merge branch 'develop' of 172.16.10.76:station/YeeAmosFireAutoSysRoot into dev

parents 1b38131f a8f43ef4
...@@ -68,6 +68,12 @@ public class TopographyLine extends BusinessEntity{ ...@@ -68,6 +68,12 @@ public class TopographyLine extends BusinessEntity{
@Column(name = "to_port", columnDefinition = "varchar(32) COMMENT '终点'") @Column(name = "to_port", columnDefinition = "varchar(32) COMMENT '终点'")
private String toPort; 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() { public String getId() {
return id; return id;
} }
...@@ -128,6 +134,18 @@ public class TopographyLine extends BusinessEntity{ ...@@ -128,6 +134,18 @@ public class TopographyLine extends BusinessEntity{
public void setToPort(String toPort) { public void setToPort(String toPort) {
this.toPort = 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;
}
} }
...@@ -75,6 +75,9 @@ public class TopographyNode extends BusinessEntity{ ...@@ -75,6 +75,9 @@ public class TopographyNode extends BusinessEntity{
@Column(name = "source_id", columnDefinition = "varchar(32) COMMENT '资源id'") @Column(name = "source_id", columnDefinition = "varchar(32) COMMENT '资源id'")
private String sourceId; private String sourceId;
@Column(name = "type", columnDefinition = "varchar(32) COMMENT '1 领导架构 | 2 任务流程'")
private String type;
public String getId() { public String getId() {
return id; return id;
} }
...@@ -141,4 +144,10 @@ public class TopographyNode extends BusinessEntity{ ...@@ -141,4 +144,10 @@ public class TopographyNode extends BusinessEntity{
public void setSourceId(String sourceId) { public void setSourceId(String sourceId) {
this.sourceId = sourceId; this.sourceId = sourceId;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
} }
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService; import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import com.yeejoin.amos.fas.core.util.StringUtil;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
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;
...@@ -24,11 +25,7 @@ import org.slf4j.Logger; ...@@ -24,11 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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 java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -109,29 +106,41 @@ public class PlanVisual3dController extends BaseController { ...@@ -109,29 +106,41 @@ public class PlanVisual3dController extends BaseController {
return response; return response;
} }
/** /**
* 资源设备信息查询 * 资源设备查询、数据项查询
*
* @param type or type && id
* @return 资源设备 or 数据项
*/ */
@ApiOperation(httpMethod = "GET", value = "资源查询", notes = "资源查询")
@Authorization(ingore = true) @Authorization(ingore = true)
@GetMapping(value = "/resource/{type}/list") @GetMapping(value = "resource/common")
public CommonResponse getResourceList(@ApiParam(value = "资源类型", required = true) @PathVariable String type) { @ApiOperation(value = "设备、数据项查询", notes = "按照资源类型type查询设备,按照资源类型type和设备id查询数据项")
public CommonResponse getResourceCommon(
@ApiParam(value = "资源类型") @RequestParam(required = false) String type,
@ApiParam(value = "主键id") @RequestParam(required = false) Long id) {
if(!StringUtil.isNotEmpty(type)){
return CommonResponseUtil.success();
}
if(StringUtil.isNotEmpty(type) && !StringUtil.isNotEmpty(id)){
return planVisual3dService.getResourceListByType(type); return planVisual3dService.getResourceListByType(type);
} }
if(StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(id)){
List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id);
return CommonResponseUtil.success(list);
}
return CommonResponseUtil.success();
}
/** /**
* 资源设备数据项查询 * 资源类型查询
* * @return list
* @param id
* @return
*/ */
@Authorization(ingore = true) @Authorization(ingore = true)
@GetMapping(value = "/{type}/detail/{id}") @ApiOperation(value = "资源类型查询",notes = "资源类型查询")
@ApiOperation(value = "数据项查询", notes = "按照分类及id查询数据项") @GetMapping(value ="resource/type/list")
public CommonResponse getResourceDetail( public CommonResponse getResourceList(){
@ApiParam(value = "资源类型", required = true) @PathVariable String type, return CommonResponseUtil.success(planVisual3dService.getResourceTypeList());
@ApiParam(value = "主键id", required = true) @PathVariable Long id) {
List<Map<String, Object>> list = planVisual3dService.getResourceById(type, id);
return CommonResponseUtil.success(list);
} }
} }
...@@ -42,11 +42,11 @@ public class TopographyController { ...@@ -42,11 +42,11 @@ public class TopographyController {
@Autowired @Autowired
private ITopographyLineService lineService; private ITopographyLineService lineService;
@ApiOperation(value = "根据appID查询节点及线", notes = "根据appID查询节点及线") @ApiOperation(value = "根据appId查询节点及线", notes = "根据appID查询节点及线")
@GetMapping(value = "/{appId}") @GetMapping(value = "/query/{type}/{appId}")
public CommonResponse getTextPlanById(@PathVariable(value = "appId") String appId) { public CommonResponse getTextPlanByIdAndType(@PathVariable(value = "appId") String appId,@PathVariable(value = "type") String type) {
List<TopographyNode> nodes = nodeService.getNodesByAppId(appId); List<TopographyNode> nodes = nodeService.getNodesByAppIdAndType(appId,type);
List<TopographyLine> links = lineService.getLinksByAppId(appId); List<TopographyLine> links = lineService.getLinesByAppIdAndType(appId,type);
Map<String,Object> results = new HashMap<>(); Map<String,Object> results = new HashMap<>();
results.put("nodeData", nodes); results.put("nodeData", nodes);
results.put("linkData", links); results.put("linkData", links);
...@@ -62,33 +62,43 @@ public class TopographyController { ...@@ -62,33 +62,43 @@ public class TopographyController {
@ApiOperation(value = "保存拓扑图", notes = "保存拓扑图") @ApiOperation(value = "保存拓扑图", notes = "保存拓扑图")
public CommonResponse savedonghuanNodes(@ApiParam(value = "", required = false) @RequestBody JSONObject topographyParam) { public CommonResponse savedonghuanNodes(@ApiParam(value = "", required = false) @RequestBody JSONObject topographyParam) {
String appId = topographyParam.getString("appId"); String appId = topographyParam.getString("appId");
String type = topographyParam.getString("type");
//节点 //节点
JSONArray nodes = topographyParam.getJSONArray("nodeData"); JSONArray nodes = topographyParam.getJSONArray("nodeData");
List<TopographyNode> nodeData = JSON.parseArray(JSON.toJSONString(nodes), TopographyNode.class); List<TopographyNode> nodeData = JSON.parseArray(JSON.toJSONString(nodes), TopographyNode.class);
HashMap<String, String> convertKeyMap = new HashMap<>(); HashMap<String, String> convertKeyMap = new HashMap<>();
int curSize = nodeService.queryMaxKeyByAppId(appId); int curSize = nodeService.queryMaxKeyByAppIdAndType(appId,type);
for(TopographyNode e:nodeData){ for(TopographyNode e:nodeData){
if(Integer.valueOf(e.getKey()) < 0) { if(Integer.valueOf(e.getKey()) < 0) {
curSize = curSize + 1 ; curSize = curSize + 1 ;
String newKey = String.format("%05d", curSize); String newKey = String.format("%05d", curSize);
convertKeyMap.put(e.getKey(), newKey); convertKeyMap.put(e.getKey(), newKey);
e.setKey(newKey); e.setKey(newKey);
e.setType(type);
e.setAppId(appId); e.setAppId(appId);
if(e.getGroup() == null) {
e.setGroup(""); e.setGroup("");
}else if(Integer.valueOf(e.getGroup()) < 0){//修改新节点组
e.setGroup(convertKeyMap.get(e.getGroup()));
}
} }
}; };
//线 //线
JSONArray links = topographyParam.getJSONArray("linkData"); JSONArray links = topographyParam.getJSONArray("linkData");
List<TopographyLine> lineData = JSON.parseArray(JSON.toJSONString(links), TopographyLine.class); List<TopographyLine> lineData = JSON.parseArray(JSON.toJSONString(links), TopographyLine.class);
lineData.forEach(l -> { lineData.forEach(l -> {//修改新增节点之间线的连接
if(Integer.parseInt(l.getFrom()) < 0) { if(Integer.parseInt(l.getFrom()) < 0) {
l.setFrom(convertKeyMap.get(l.getFrom())); l.setFrom(convertKeyMap.get(l.getFrom()));
} }
if(Integer.parseInt(l.getTo()) < 0) { if(Integer.parseInt(l.getTo()) < 0) {
l.setTo(convertKeyMap.get(l.getTo())); l.setTo(convertKeyMap.get(l.getTo()));
} }
if(l.getCategory() == null) {
l.setCategory("");
}
if(l.getAppId() == null) { if(l.getAppId() == null) {
l.setAppId(appId); l.setAppId(appId);
l.setType(type);
} }
}); });
...@@ -101,14 +111,14 @@ public class TopographyController { ...@@ -101,14 +111,14 @@ public class TopographyController {
TopographyNodeDetail nodeDetail = JSON.parseObject(JSON.toJSONString(nodeDetailJson), TopographyNodeDetail.class); TopographyNodeDetail nodeDetail = JSON.parseObject(JSON.toJSONString(nodeDetailJson), TopographyNodeDetail.class);
String nodekey = nodeDetail.getNodekey(); String nodekey = nodeDetail.getNodekey();
if(nodekey != null && Integer.parseInt(nodekey) < 0) { if(nodekey != null && Integer.parseInt(nodekey) < 0) {
TopographyNode node = nodeService.queryByKeyAndAppId(convertKeyMap.get(nodekey),appId); TopographyNode node = nodeService.queryByKeyAndAppIdAndType(convertKeyMap.get(nodekey),appId,type);
nodeDetail.setNodeid(node.getId()); nodeDetail.setNodeid(node.getId());
} }
nodeService.saveNodeDetail(nodeDetail); nodeService.saveNodeDetail(nodeDetail);
} }
//返回保存后的数据
List<TopographyNode> newNodes = nodeService.getNodesByAppId(appId); List<TopographyNode> newNodes = nodeService.getNodesByAppIdAndType(appId,type);
List<TopographyLine> newLinks = lineService.getLinksByAppId(appId); List<TopographyLine> newLinks = lineService.getLinesByAppIdAndType(appId,type);
Map<String,Object> results = new HashMap<>(); Map<String,Object> results = new HashMap<>();
results.put("nodeData", newNodes); results.put("nodeData", newNodes);
results.put("linkData", newLinks); results.put("linkData", newLinks);
...@@ -143,7 +153,8 @@ public class TopographyController { ...@@ -143,7 +153,8 @@ public class TopographyController {
if("Link".equals(type)) { if("Link".equals(type)) {
lineService.deleteLine(id); lineService.deleteLine(id);
}else { }else {
nodeService.deleteNode(id); TopographyNode node = nodeService.queryById(id);
nodeService.deleteNode(node);
} }
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
......
...@@ -10,7 +10,7 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine; ...@@ -10,7 +10,7 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine;
@Repository("iTopographyLineDao") @Repository("iTopographyLineDao")
public interface ITopographyLineDao extends BaseDao<TopographyLine, Long> { public interface ITopographyLineDao extends BaseDao<TopographyLine, Long> {
List<TopographyLine> findByAppId(String appId); List<TopographyLine> findByAppIdAndType(String appId,String type);
TopographyLine findById(String id); TopographyLine findById(String id);
......
...@@ -11,16 +11,18 @@ import com.yeejoin.amos.fas.dao.entity.TopographyNode; ...@@ -11,16 +11,18 @@ import com.yeejoin.amos.fas.dao.entity.TopographyNode;
@Repository("iTopographyNodeDao") @Repository("iTopographyNodeDao")
public interface ITopographyNodeDao extends BaseDao<TopographyNode, Long> { 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) @Query(value = "select * from f_topography_node " + " where id in (?1)",nativeQuery = true)
List<TopographyNode> findAllByIds(@Param("ids") List<String> ids); List<TopographyNode> findAllByIds(@Param("ids") List<String> ids);
TopographyNode findById(String id); 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) @Query(value = "select max(`key`) from f_topography_node where app_id = (?1) and type = (?2)",nativeQuery = true)
Integer queryMaxKeyByAppId(String appId); Integer queryMaxKeyByAppIdAndType(String appId,String type);
List<TopographyNode> findByGroupAndAppIdAndType(String key, String appId, String type);
} }
...@@ -16,8 +16,8 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{ ...@@ -16,8 +16,8 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{
private ITopographyLineDao topographyLineDao; private ITopographyLineDao topographyLineDao;
@Override @Override
public List<TopographyLine> getLinksByAppId(String appId) { public List<TopographyLine> getLinesByAppIdAndType(String appId,String type) {
return topographyLineDao.findByAppId(appId); return topographyLineDao.findByAppIdAndType(appId,type);
} }
@Override @Override
......
...@@ -27,20 +27,13 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{ ...@@ -27,20 +27,13 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
private ITopographyLineDao lineDao; private ITopographyLineDao lineDao;
@Override @Override
public List<TopographyNode> getNodesByAppId(String appId) { public List<TopographyNode> getNodesByAppIdAndType(String appId,String type) {
return nodeDao.findByAppId(appId); return nodeDao.findByAppIdAndType(appId,type);
} }
@Override @Override
public void saveNodes(List<TopographyNode> nodeData) { public void saveNodes(List<TopographyNode> nodeData) {
// List<TopographyNode> list = topographyNodeDao.findAllByIds(nodeData.stream().map(n->n.getId()).collect(Collectors.toList()));
// for (TopographyNode topographyNode : list) {
// TopographyNode node = nodeData.stream().filter(n->topographyNode.getId().equals(n.getId())).findFirst().get();
// topographyNode.setLoc(node.getLoc());
// }
// topographyNodeDao.save(list);
nodeDao.save(nodeData); nodeDao.save(nodeData);
} }
@Override @Override
...@@ -61,8 +54,8 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{ ...@@ -61,8 +54,8 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
} }
@Override @Override
public void deleteNode(String id) { public void deleteNode(TopographyNode node) {
TopographyNode node = nodeDao.findById(id); // TopographyNode node = nodeDao.findById(id);
if(node != null) { if(node != null) {
String key = node.getKey(); String key = node.getKey();
nodeDao.delete(node); nodeDao.delete(node);
...@@ -70,17 +63,27 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{ ...@@ -70,17 +63,27 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
if(lines != null && lines.size() > 0) { if(lines != null && lines.size() > 0) {
lineDao.delete(lines); lineDao.delete(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 @Override
public TopographyNode queryByKeyAndAppId(String nodekey, String appId) { public int queryMaxKeyByAppIdAndType(String appId,String type) {
return nodeDao.findByKeyAndAppId(nodekey,appId); return nodeDao.queryMaxKeyByAppIdAndType(appId,type);
} }
@Override @Override
public int queryMaxKeyByAppId(String appId) { public TopographyNode queryById(String id) {
return nodeDao.queryMaxKeyByAppId(appId); return nodeDao.findById(id);
} }
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.service.impl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.fas.business.constants.FasConstant; 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.mapper.PlanVisual3dMapper;
import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao; import com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao;
import com.yeejoin.amos.fas.business.feign.IMaasVisualServer; import com.yeejoin.amos.fas.business.feign.IMaasVisualServer;
...@@ -34,6 +35,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -34,6 +35,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired @Autowired
IDictService dictService; IDictService dictService;
@Autowired
private DictMapper dictMapper;
@Override @Override
public List<TreeSubjectVo> getPlanTree() { public List<TreeSubjectVo> getPlanTree() {
...@@ -71,9 +75,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -71,9 +75,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
for (Object obj : list) { for (Object obj : list) {
TreeSubjectVo treeItem = new TreeSubjectVo(); TreeSubjectVo treeItem = new TreeSubjectVo();
LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) obj; 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.setTreeName((String) map.get("treeName"));
treeItem.setParentId((Integer) map.get("parentId")); treeItem.setParentId((String) map.get("parentId"));
treeItem.setMaxSubjectNumber((Integer) map.get("maxSubjectNumber")); treeItem.setMaxSubjectNumber((Integer) map.get("maxSubjectNumber"));
treeItem.setType("treeNode"); treeItem.setType("treeNode");
...@@ -91,10 +95,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -91,10 +95,10 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
TreeSubjectVo subjectVo = new TreeSubjectVo(); TreeSubjectVo subjectVo = new TreeSubjectVo();
LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r; LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r;
subjectVo.setType("listNode"); subjectVo.setType("listNode");
subjectVo.setParentId((Integer) map.get("id")); subjectVo.setParentId((String) map.get("id"));
subjectVo.setId((Integer) map1.get("id")); subjectVo.setId((String) map1.get("id"));
subjectVo.setDelete(map1.get("isDelete") == null ? false : (Boolean) map1.get("isDelete")); subjectVo.setDelete(map1.get("isDelete") == null || (Integer) map1.get("isDelete") == 0 ? false : true);
subjectVo.setCreateTime((Long) map1.get("createTime")); subjectVo.setCreateTime((String) map1.get("createTime"));
subjectVo.setCreator(map1.get("creator") == null ? 0 : (Integer) map1.get("creator")); subjectVo.setCreator(map1.get("creator") == null ? 0 : (Integer) map1.get("creator"));
subjectVo.setSubjectName((String) map1.get("subjectName")); subjectVo.setSubjectName((String) map1.get("subjectName"));
subjectVo.setTreeName((String) map1.get("subjectName")); subjectVo.setTreeName((String) map1.get("subjectName"));
...@@ -102,16 +106,16 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -102,16 +106,16 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
subjectVo.setSubjectType((String) map1.get("subjectType")); subjectVo.setSubjectType((String) map1.get("subjectType"));
subjectVo.setSubjectTypeName((String) map1.get("subjectTypeName")); subjectVo.setSubjectTypeName((String) map1.get("subjectTypeName"));
subjectVo.setPublishState((Integer) map1.get("publishState")); subjectVo.setPublishState((Integer) map1.get("publishState"));
subjectVo.setBelongTreeId((Integer) map1.get("belongTreeId")); subjectVo.setBelongTreeId((String) map1.get("belongTreeId"));
subjectVo.setScenes(map1.get("scenes") == null ? "" : (String) map1.get("scenes")); subjectVo.setScenes(map1.get("scenes") == null ? "" : (String) map1.get("scenes"));
//关联文字预案 //关联文字预案
List<TextPlan> textPlans = iTextPlanDao.findByAppId(String.valueOf(subjectVo.getId())); List<TextPlan> textPlans = iTextPlanDao.findByAppId(String.valueOf(subjectVo.getId()));
textPlans.forEach(t -> { textPlans.forEach(t -> {
TreeSubjectVo textTreeSubjectVo = new TreeSubjectVo(); TreeSubjectVo textTreeSubjectVo = new TreeSubjectVo();
textTreeSubjectVo.setParentId(Integer.valueOf(t.getAppId())); textTreeSubjectVo.setParentId(String.valueOf(t.getAppId()));
textTreeSubjectVo.setTreeName(t.getTextName()); textTreeSubjectVo.setTreeName(t.getTextName());
textTreeSubjectVo.setId((int) t.getId()); textTreeSubjectVo.setId(String.valueOf(t.getId()));
textTreeSubjectVo.setType("textNode"); textTreeSubjectVo.setType("textNode");
subjectVo.getChildren().add(textTreeSubjectVo); subjectVo.getChildren().add(textTreeSubjectVo);
}); });
...@@ -174,5 +178,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService { ...@@ -174,5 +178,20 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
return list; 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("label",e.getDictName());
return newMap;
}).collect(Collectors.toList());
return list;
}
} }
...@@ -1258,6 +1258,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1258,6 +1258,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
equipCommunicationDao.save(list); equipCommunicationDao.save(list);
} }
/**
* 设备告警触发fema的sod值
*/
private void notifyAlarm(FireEquipmentPoint fireEquipmentPoint, AlarmParam param) { private void notifyAlarm(FireEquipmentPoint fireEquipmentPoint, AlarmParam param) {
List<FmeaEquipmentPoint> fmeaEquipmentPoints = fmeaEquipmentPointMapper.listByEquipmentPointId(fireEquipmentPoint.getId()); List<FmeaEquipmentPoint> fmeaEquipmentPoints = fmeaEquipmentPointMapper.listByEquipmentPointId(fireEquipmentPoint.getId());
Set<Long> fmeaIds = Sets.newHashSet(); Set<Long> fmeaIds = Sets.newHashSet();
...@@ -1490,6 +1493,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1490,6 +1493,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if (fmea.getEvaluationOid() != null && fmea.getEvaluationSid() != null && fmea.getEvaluationDid() != null) { if (fmea.getEvaluationOid() != null && fmea.getEvaluationSid() != null && fmea.getEvaluationDid() != null) {
List<FmeaEquipmentPoint> equipmentPoints = fmeaEquipmentPointMapper.listFmeaByFmeaId(fmeaId); List<FmeaEquipmentPoint> equipmentPoints = fmeaEquipmentPointMapper.listFmeaByFmeaId(fmeaId);
List<FmeaPointInputitem> pointInputitems = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId); List<FmeaPointInputitem> pointInputitems = fmeaPointInputitemMapper.listFmeaByFmeaId(fmeaId);
//根据设备和巡检数据获取高的故障率
Double maxRate = getMaxRate(equipmentPoints, pointInputitems); Double maxRate = getMaxRate(equipmentPoints, pointInputitems);
if (maxRate != null) { if (maxRate != null) {
List<EvaluationModel> oModels = iEvaluationModelDao.findAllByType("O"); List<EvaluationModel> oModels = iEvaluationModelDao.findAllByType("O");
...@@ -1510,6 +1514,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1510,6 +1514,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
fmeaMapper.updateRpn(fmea); fmeaMapper.updateRpn(fmea);
saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, fmea.getRpni()); saveRpnLog(fmea.getRiskSourceId(), fmeaId, rpn, fmea.getRpni());
//影响风险点的sod值
this.notifyRiskSource(fmea.getRiskSourceId(), notifyType, jpushTarget); this.notifyRiskSource(fmea.getRiskSourceId(), notifyType, jpushTarget);
} }
} }
...@@ -1631,11 +1636,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1631,11 +1636,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource.setRpni(rpni); riskSource.setRpni(rpni);
riskSource.setRiskLevelId(newRiskLevel.getId()); riskSource.setRiskLevelId(newRiskLevel.getId());
riskSourceMapper.updateRpn(riskSource); riskSourceMapper.updateRpn(riskSource);
//极光推送给手机客户端
jpushRiskSourceMessage("风险点告警", jpushTarget); jpushRiskSourceMessage("风险点告警", jpushTarget);
//规则告警
notifyRule(riskSourceId, rpn, rpni, oldRiskLevel.getLevel(), newRiskLevel.getLevel(), notifyType); notifyRule(riskSourceId, rpn, rpni, oldRiskLevel.getLevel(), newRiskLevel.getLevel(), notifyType);
} }
} }
/**
* 极光推送
*/
private void jpushRiskSourceMessage(String content, String jpushTarget) { private void jpushRiskSourceMessage(String content, String jpushTarget) {
if (StringUtils.isEmpty(jpushTarget)) { if (StringUtils.isEmpty(jpushTarget)) {
return; return;
...@@ -1648,6 +1658,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1648,6 +1658,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
appMessagePushService.sendMessage(pushMsgParam); appMessagePushService.sendMessage(pushMsgParam);
} }
/**
* 规则告警
*/
private void notifyRule(Long id, BigDecimal rpnr, BigDecimal rpni, Integer oldLevel, Integer newLevel, String notifyType) { private void notifyRule(Long id, BigDecimal rpnr, BigDecimal rpni, Integer oldLevel, Integer newLevel, String notifyType) {
int level = oldLevel - newLevel; int level = oldLevel - newLevel;
String changeType; String changeType;
......
...@@ -4,7 +4,6 @@ import com.yeejoin.amos.fas.business.vo.TreeSubjectVo; ...@@ -4,7 +4,6 @@ import com.yeejoin.amos.fas.business.vo.TreeSubjectVo;
import com.yeejoin.amos.fas.dao.entity.TextPlan; import com.yeejoin.amos.fas.dao.entity.TextPlan;
import com.yeejoin.amos.op.core.common.response.CommonResponse; import com.yeejoin.amos.op.core.common.response.CommonResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,4 +34,6 @@ public interface IPlanVisual3dService { ...@@ -35,4 +34,6 @@ public interface IPlanVisual3dService {
CommonResponse getResourceListByType(String type); CommonResponse getResourceListByType(String type);
List<Map<String,Object>> getResourceById(String type,Long id); List<Map<String,Object>> getResourceById(String type,Long id);
List<Map<String,Object>> getResourceTypeList();
} }
...@@ -6,7 +6,7 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine; ...@@ -6,7 +6,7 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine;
public interface ITopographyLineService { 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 saveLines(List<TopographyLine> lineData);
......
...@@ -2,13 +2,12 @@ package com.yeejoin.amos.fas.business.service.intfc; ...@@ -2,13 +2,12 @@ package com.yeejoin.amos.fas.business.service.intfc;
import java.util.List; 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.TopographyNode;
import com.yeejoin.amos.fas.dao.entity.TopographyNodeDetail; import com.yeejoin.amos.fas.dao.entity.TopographyNodeDetail;
public interface ITopographyNodeService { public interface ITopographyNodeService {
public List<TopographyNode> getNodesByAppId(String appId); public List<TopographyNode> getNodesByAppIdAndType(String appId,String type);
public void saveNodes(List<TopographyNode> nodeData); public void saveNodes(List<TopographyNode> nodeData);
...@@ -16,10 +15,12 @@ public interface ITopographyNodeService { ...@@ -16,10 +15,12 @@ public interface ITopographyNodeService {
public TopographyNodeDetail saveNodeDetail(TopographyNodeDetail nodeDetail); 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);
} }
...@@ -5,11 +5,11 @@ import java.util.List; ...@@ -5,11 +5,11 @@ import java.util.List;
public class TreeSubjectVo { public class TreeSubjectVo {
private Integer id; private String id;
private String treeName; private String treeName;
private Integer parentId; private String parentId;
private Integer maxSubjectNumber; private Integer maxSubjectNumber;
...@@ -17,7 +17,7 @@ public class TreeSubjectVo { ...@@ -17,7 +17,7 @@ public class TreeSubjectVo {
private List<TreeSubjectVo> children = new ArrayList<>(); private List<TreeSubjectVo> children = new ArrayList<>();
private Long createTime; private String createTime;
private Integer creator; private Integer creator;
...@@ -33,17 +33,17 @@ public class TreeSubjectVo { ...@@ -33,17 +33,17 @@ public class TreeSubjectVo {
private int publishState; private int publishState;
private int belongTreeId; private String belongTreeId;
private String scenes; private String scenes;
List<TreeSubjectVo> subjectChildren = new ArrayList<>(); List<TreeSubjectVo> subjectChildren = new ArrayList<>();
public Integer getId() { public String getId() {
return id; return id;
} }
public void setId(Integer id) { public void setId(String id) {
this.id = id; this.id = id;
} }
...@@ -55,11 +55,11 @@ public class TreeSubjectVo { ...@@ -55,11 +55,11 @@ public class TreeSubjectVo {
this.treeName = treeName; this.treeName = treeName;
} }
public Integer getParentId() { public String getParentId() {
return parentId; return parentId;
} }
public void setParentId(Integer parentId) { public void setParentId(String parentId) {
this.parentId = parentId; this.parentId = parentId;
} }
...@@ -79,11 +79,11 @@ public class TreeSubjectVo { ...@@ -79,11 +79,11 @@ public class TreeSubjectVo {
this.children = children; this.children = children;
} }
public Long getCreateTime() { public String getCreateTime() {
return createTime; return createTime;
} }
public void setCreateTime(Long createTime) { public void setCreateTime(String createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
...@@ -143,11 +143,11 @@ public class TreeSubjectVo { ...@@ -143,11 +143,11 @@ public class TreeSubjectVo {
this.publishState = publishState; this.publishState = publishState;
} }
public int getBelongTreeId() { public String getBelongTreeId() {
return belongTreeId; return belongTreeId;
} }
public void setBelongTreeId(int belongTreeId) { public void setBelongTreeId(String belongTreeId) {
this.belongTreeId = belongTreeId; this.belongTreeId = belongTreeId;
} }
......
...@@ -73,12 +73,16 @@ public class RsDataQueue { ...@@ -73,12 +73,16 @@ public class RsDataQueue {
String from = fmeaMessage.getNorifyFrom(); String from = fmeaMessage.getNorifyFrom();
Long handId = fmeaMessage.getHandId(); Long handId = fmeaMessage.getHandId();
if (from.equals("patrol")) { if (from.equals("patrol")) {
//巡检不合格通知
riskSourceService.notifyFmeaFromAbnormal(handId, from); riskSourceService.notifyFmeaFromAbnormal(handId, from);
} else if (from.equals("equipment")) { } else if (from.equals("equipment")) {
//设备告警
riskSourceService.notifyFmeaFromAbnormal(handId, from); riskSourceService.notifyFmeaFromAbnormal(handId, from);
} else if (from.equals("update")) { } else if (from.equals("update")) {
//修改通知
riskSourceService.notifyFmeaFromUpdate(handId, from); riskSourceService.notifyFmeaFromUpdate(handId, from);
} else if (from.equals("delete")) { } else if (from.equals("delete")) {
//删除通知
riskSourceService.notifyRiskSource(handId, from, null); riskSourceService.notifyRiskSource(handId, from, null);
} }
} }
......
...@@ -278,4 +278,40 @@ ...@@ -278,4 +278,40 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="shanqiyun" id="1583983706412-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_topography_node" columnName="type"/>
</not>
</preConditions>
<comment>f_topography_node add column type</comment>
<sql>
ALTER TABLE `f_topography_node` ADD COLUMN `type` varchar(32) DEFAULT NULL COMMENT '1 领导架构 | 2 任务流程';
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1583983706412-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_topography_line" columnName="type"/>
</not>
</preConditions>
<comment>f_topography_line add column type</comment>
<sql>
ALTER TABLE `f_topography_line` ADD COLUMN `type` varchar(32) DEFAULT NULL COMMENT '1 领导架构 | 2 任务流程';
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1583983706412-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_topography_line" columnName="category"/>
</not>
</preConditions>
<comment>f_topography_line add column category</comment>
<sql>
ALTER TABLE `f_topography_line` ADD COLUMN `category` varchar(32) DEFAULT '' COMMENT '类别';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<!--查询--> <!--查询-->
<select id="getResourceListByType" resultType="java.util.HashMap"> <select id="getResourceListByType" resultType="java.util.HashMap">
SELECT SELECT
rs.id,rs.name,rs.code rs.id as `key` ,rs.name as label,rs.code
from from
<choose> <choose>
<when test="type=='fireCar'"> <when test="type=='fireCar'">
......
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