Commit d37e24df authored by maoying's avatar maoying

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

parents 231cc85d cc82472f
......@@ -213,7 +213,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;
......
......@@ -115,32 +115,41 @@ public class PlanVisual3dController extends BaseController {
* @return 资源设备 or 数据项
*/
@Authorization(ingore = true)
@GetMapping(value = "resource/common")
@GetMapping(value = "common/dataBind")
@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();
//1.查询数据类型
if (!StringUtil.isNotEmpty(type)) {
return CommonResponseUtil.success(planVisual3dService.getResourceTypeList());
}
if(StringUtil.isNotEmpty(type) && !StringUtil.isNotEmpty(id)){
//2.查询类型对应数据
if (StringUtil.isNotEmpty(type) && !StringUtil.isNotEmpty(id)) {
return planVisual3dService.getResourceListByType(type);
}
if(StringUtil.isNotEmpty(type) && StringUtil.isNotEmpty(id)){
//3.查询绑定项数据
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
*/
@Authorization(ingore = true)
@ApiOperation(value = "资源类型查询",notes = "资源类型查询")
@GetMapping(value ="resource/type/list")
public CommonResponse getResourceList(){
return CommonResponseUtil.success(planVisual3dService.getResourceTypeList());
@ApiOperation(value = "预案应用树", notes = "预案应用树")
@GetMapping(value = "/plan/textPlanTree/{appId}")
public CommonResponse getPlanTree(@PathVariable("appId") String appId) {
return CommonResponseUtil.success(planVisual3dService.getTextPlanBySubjectId(appId));
}
@ApiOperation(value = "删除预案文件", notes = "删除预案文件")
@DeleteMapping(value = "/plan/textPlan/{id}")
public CommonResponse deleteTextPlanFile(@PathVariable("id") Long id) {
try {
planVisual3dService.deleteTextPlanFile(id);
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
}
}
......@@ -53,6 +53,17 @@ public class TopographyController {
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);
return CommonResponseUtil.success(results);
}
/**
* 保存拓扑图
*
......@@ -61,7 +72,9 @@ 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");
synchronized (TopographyController.class) {
String appId = topographyParam.getString("appId") != null ? topographyParam.getString("appId") : null;
String type = topographyParam.getString("type");
//节点
JSONArray nodes = topographyParam.getJSONArray("nodeData");
......@@ -106,6 +119,7 @@ public class TopographyController {
lineService.saveLines(lineData);
//节点详情
JSONObject nodeDetailJson = topographyParam.getJSONObject("nodeDetail");
if(nodeDetailJson != null) {
TopographyNodeDetail nodeDetail = JSON.parseObject(JSON.toJSONString(nodeDetailJson), TopographyNodeDetail.class);
......@@ -119,11 +133,13 @@ public class TopographyController {
//返回保存后的数据
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);
}
}
@ApiOperation(value = "根据nodeid查询节点详情", notes = "根据nodeid查询节点详情")
@GetMapping(value = "/detail/{nodeid}")
......
......@@ -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);
}
......@@ -17,4 +17,6 @@ public interface ITopographyLineDao extends BaseDao<TopographyLine, Long> {
@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);
}
......@@ -25,4 +25,9 @@ public interface ITopographyNodeDao extends BaseDao<TopographyNode, Long> {
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);
}
......@@ -17,6 +17,9 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{
@Override
public List<TopographyLine> getLinesByAppIdAndType(String appId,String type) {
if(appId == null) {
return topographyLineDao.findByType(type);
}
return topographyLineDao.findByAppIdAndType(appId,type);
}
......@@ -33,5 +36,10 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{
}
}
@Override
public List<TopographyLine> getLinesByType(String type) {
return topographyLineDao.findByType(type);
}
}
......@@ -28,6 +28,9 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
@Override
public List<TopographyNode> getNodesByAppIdAndType(String appId,String type) {
if(appId == null) {
return nodeDao.findByType(type);
}
return nodeDao.findByAppIdAndType(appId,type);
}
......@@ -78,7 +81,16 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
@Override
public int queryMaxKeyByAppIdAndType(String appId,String type) {
return nodeDao.queryMaxKeyByAppIdAndType(appId,type);
Integer maxKey;
if(null == appId) {
maxKey = nodeDao.queryMaxKeyByType(type);
}else {
maxKey = nodeDao.queryMaxKeyByAppIdAndType(appId,type);
}
if(maxKey == null) {
maxKey = 0;
}
return maxKey;
}
@Override
......@@ -86,5 +98,10 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
return nodeDao.findById(id);
}
@Override
public List<TopographyNode> getNodesByType(String type) {
return nodeDao.findByType(type);
}
}
......@@ -92,8 +92,12 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List<TreeSubjectVo> childrenVos = Lists.newArrayList();
List<Object> res = (List<Object>) response.getDataList();
res.forEach(r -> {
TreeSubjectVo subjectVo = new TreeSubjectVo();
LinkedHashMap<String, Object> map1 = (LinkedHashMap<String, Object>) r;
Integer state = (Integer) map1.get("publishState");
if(state == 0) {//过滤 未发布状态
return;
}
TreeSubjectVo subjectVo = new TreeSubjectVo();
subjectVo.setType("listNode");
subjectVo.setParentId((String) map.get("id"));
subjectVo.setId((String) map1.get("id"));
......@@ -105,7 +109,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
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.setPublishState(state);
subjectVo.setBelongTreeId((String) map1.get("belongTreeId"));
subjectVo.setScenes(map1.get("scenes") == null ? "" : (String) map1.get("scenes"));
......@@ -187,11 +191,35 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
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.delete(id);
}
}
......@@ -36,4 +36,8 @@ public interface IPlanVisual3dService {
List<Map<String,Object>> getResourceById(String type,Long id);
List<Map<String,Object>> getResourceTypeList();
List<TreeSubjectVo> getTextPlanBySubjectId(String appId);
void deleteTextPlanFile(Long id);
}
......@@ -12,4 +12,6 @@ public interface ITopographyLineService {
public void deleteLine(String id);
public List<TopographyLine> getLinesByType(String type);
}
......@@ -23,4 +23,6 @@ public interface ITopographyNodeService {
public TopographyNode queryById(String id);
public List<TopographyNode> getNodesByType(String type);
}
......@@ -314,4 +314,59 @@
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1586742391611-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="f_text_plan"/>
</not>
</preConditions>
<comment>create f_text_plan</comment>
<sql>
CREATE TABLE `f_text_plan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`app_id` varchar(255) NOT NULL COMMENT '预案id',
`text_name` varchar(255) NOT NULL DEFAULT '' COMMENT '文本预案名称',
`file_path` varchar(255) NOT NULL COMMENT '预案路径',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`create_date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COMMENT='文本预案';
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1586742391611-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_topography_line" columnName="from_port"/>
</not>
</preConditions>
<comment>f_topography_line add column from_port</comment>
<sql>
ALTER TABLE `f_topography_line` ADD COLUMN `from_port` varchar(32) DEFAULT NULL;
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1586742391611-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="f_topography_line" columnName="to_port"/>
</not>
</preConditions>
<comment>f_topography_line add column to_port</comment>
<sql>
ALTER TABLE `f_topography_line` ADD COLUMN `to_port` varchar(32) DEFAULT NULL;
</sql>
</changeSet>
<changeSet author="shanqiyun" id="1586742391611-4">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_topography_node_detail " columnName="nodeid"/>
</preConditions>
<comment>"f_topography_node_detail " change column nodeid</comment>
<sql>
ALTER TABLE `f_topography_node_detail`
MODIFY COLUMN `nodeid` varchar(36) DEFAULT NULL;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -5,7 +5,11 @@
<!--查询-->
<select id="getResourceListByType" resultType="java.util.HashMap">
SELECT
rs.id as `key` ,rs.name as label,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'">
......
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