水运项目基础功能开发
This commit is contained in:
parent
a8756ba9fa
commit
3eeb9cd5d5
|
|
@ -59,11 +59,6 @@
|
|||
<artifactId>bonus-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 基础管理模块-->
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-basic</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@
|
|||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.13.5</version> <!-- JDK8 最稳定推荐版本 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
|
|
@ -58,6 +63,19 @@
|
|||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>bonus-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>water-design-const</artifactId>
|
||||
<version>3.8.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
@ -86,7 +104,7 @@
|
|||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>8</source><target>8</target></configuration></plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
|
|
|||
|
|
@ -115,14 +115,15 @@ public class CommonController
|
|||
|
||||
// 5. 调用工具类
|
||||
String layersInfo = DxfClient.getLayersInfo(fullLocalPath);
|
||||
System.err.println(layersInfo);
|
||||
List<CadData> cadData = dxfParser.parseAndSave(layersInfo);
|
||||
projectService.insertCadData(cadData);
|
||||
System.err.println(cadData);
|
||||
//projectService.insertCadData(cadData);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
ajax.put("cadData", cadData);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.waterdesign.controller.water;
|
|||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.waterdesign.domain.*;
|
||||
import com.bonus.waterdesign.service.ModelService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
|
@ -25,11 +26,10 @@ public class ModelController extends BaseController {
|
|||
/**
|
||||
* 获取模型列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('model:list')")
|
||||
// @PreAuthorize("@ss.hasPermi('model:list')")7
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProjectVo model)
|
||||
{
|
||||
startPage();
|
||||
List<ProjectTree> list = modelService.list(model);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
@ -37,18 +37,27 @@ public class ModelController extends BaseController {
|
|||
/**
|
||||
* 新增模型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('model:addModel')")
|
||||
@PostMapping("/addModel")
|
||||
public AjaxResult addModel(@RequestBody Model model)
|
||||
{
|
||||
return toAjax(modelService.addModel(model));
|
||||
return toAjax(modelService.addModel(model));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody PeojectNodes node) {
|
||||
return toAjax(modelService.add(node));
|
||||
}
|
||||
@PostMapping("/openView")
|
||||
public AjaxResult openView(@RequestBody PeojectNodes node) {
|
||||
//获取所有的节点信息
|
||||
List<CadData> list =modelService.openView(node);
|
||||
//返回list信息给前台
|
||||
return AjaxResult.success(list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.time.LocalDateTime;
|
|||
@Data
|
||||
public class CadData {
|
||||
private Long id;
|
||||
private String type;
|
||||
private String layerName;
|
||||
private String entityType;
|
||||
private Integer color;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.waterdesign.domain;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/7/10
|
||||
|
|
@ -12,12 +14,12 @@ public class Model {
|
|||
/**
|
||||
* 主键
|
||||
*/
|
||||
private int id;
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* 工程id
|
||||
*/
|
||||
private int projectId;
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 模型名称
|
||||
|
|
@ -75,4 +77,6 @@ public class Model {
|
|||
*/
|
||||
private String createTime;
|
||||
|
||||
private List<CadData> selectedEntities;// 只接收勾选的图元
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,7 @@ public class ProjectTree {
|
|||
private String projectId;
|
||||
private String proName;
|
||||
private String modelUrl;
|
||||
private String levelName;
|
||||
private String nodeCount;
|
||||
private List<ProjectVo> children = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.waterdesign.mapper;
|
||||
|
||||
import com.bonus.waterdesign.domain.CadData;
|
||||
import com.bonus.waterdesign.domain.Model;
|
||||
import com.bonus.waterdesign.domain.PeojectNodes;
|
||||
import com.bonus.waterdesign.domain.ProjectVo;
|
||||
|
|
@ -16,4 +17,6 @@ public interface ModelMapper {
|
|||
int deleteById(String id);
|
||||
|
||||
boolean update(PeojectNodes node);
|
||||
|
||||
List<CadData> openView(PeojectNodes node);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.bonus.waterdesign.service;
|
||||
|
||||
import com.bonus.waterdesign.domain.Model;
|
||||
import com.bonus.waterdesign.domain.PeojectNodes;
|
||||
import com.bonus.waterdesign.domain.ProjectTree;
|
||||
import com.bonus.waterdesign.domain.ProjectVo;
|
||||
import com.bonus.waterdesign.domain.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -17,4 +14,6 @@ public interface ModelService {
|
|||
boolean delete(String id);
|
||||
|
||||
boolean update(PeojectNodes node);
|
||||
|
||||
List<CadData> openView(PeojectNodes node);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.waterdesign.service.impl;
|
|||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.waterdesign.domain.*;
|
||||
import com.bonus.waterdesign.mapper.ModelMapper;
|
||||
import com.bonus.waterdesign.mapper.ProjectMapper;
|
||||
import com.bonus.waterdesign.service.ModelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -23,6 +24,9 @@ public class ModelServiceImpl implements ModelService {
|
|||
@Resource
|
||||
private ModelMapper modelMapper;
|
||||
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Override
|
||||
public List<ProjectTree> list(ProjectVo model) {
|
||||
List<ProjectVo> list = modelMapper.list(model);
|
||||
|
|
@ -53,7 +57,9 @@ public class ModelServiceImpl implements ModelService {
|
|||
String projectId = vo.getProjectId();
|
||||
if (!projectMap.containsKey(projectId)) {
|
||||
ProjectTree project = new ProjectTree();
|
||||
project.setNodeCount(vo.getNodeCount()+"");
|
||||
project.setProjectId(projectId);
|
||||
project.setLevelName(vo.getLevelName());
|
||||
project.setModelUrl(vo.getModelUrl());
|
||||
project.setProName(vo.getProName());
|
||||
project.setChildren(new ArrayList<>());
|
||||
|
|
@ -97,7 +103,17 @@ public class ModelServiceImpl implements ModelService {
|
|||
|
||||
@Override
|
||||
public int addModel(Model model) {
|
||||
return modelMapper.addModel(model);
|
||||
//项目ID和文件保存 对应起来
|
||||
int i = modelMapper.addModel(model);
|
||||
if (i > 0) {
|
||||
List<CadData> cadDataList = model.getSelectedEntities();
|
||||
if (cadDataList != null && !cadDataList.isEmpty()) {
|
||||
for (CadData data : cadDataList) {
|
||||
projectMapper.insertCadData(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i ;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -116,4 +132,9 @@ public class ModelServiceImpl implements ModelService {
|
|||
public boolean update(PeojectNodes node) {
|
||||
return modelMapper.update(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CadData> openView(PeojectNodes node) {
|
||||
return modelMapper.openView(node);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.waterdesign.mapper.ModelMapper">
|
||||
<insert id="addModel" useGeneratedKeys="true" keyProperty="id">
|
||||
<insert id="addModel" >
|
||||
insert into tb_model(
|
||||
<if test="projectId != null and projectId != 0">project_id,</if>
|
||||
<if test="projectId != null ">project_id,</if>
|
||||
<if test="modelName != null and modelName != ''">model_name,</if>
|
||||
<if test="modelUrl != null and modelUrl != ''">model_url,</if>
|
||||
<if test="fileName != null and fileName != ''">file_name,</if>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<if test="createBy != null and createBy != ''">create_user,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="projectId != null and projectId != 0">#{projectId},</if>
|
||||
<if test="projectId != null ">#{projectId},</if>
|
||||
<if test="modelName != null and modelName != ''">#{modelName},</if>
|
||||
<if test="modelUrl != null and modelUrl != ''">#{modelUrl},</if>
|
||||
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
||||
|
|
@ -69,6 +69,7 @@
|
|||
<id property="projectId" column="project_id" />
|
||||
<result property="id" column="id" />
|
||||
<result property="proName" column="pro_name"/>
|
||||
<result property="proName" column="pro_name"/>
|
||||
<result property="proType" column="pro_type"/>
|
||||
<result property="unitName" column="unit_name"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
|
|
@ -78,7 +79,7 @@
|
|||
<result property="parentId" column="parent_id"/>
|
||||
<result property="nodelevel" column="node_level"/>
|
||||
<result property="nodeCountDetail" column="node_count_detail"/>
|
||||
<result property="nodeCount" column="nodeCount"/>
|
||||
<result property="nodeCount" column="node_count"/>
|
||||
<result property="nodeName" column="node_name"/>
|
||||
<result property="nodeId" column="node_id"/>
|
||||
<result property="modelUrl" column="model_url"/>
|
||||
|
|
@ -107,8 +108,7 @@
|
|||
p.id AS project_id,
|
||||
p.pro_name,
|
||||
p.level,
|
||||
|
||||
-- 节点统计(子查询)
|
||||
c.config_name,
|
||||
(
|
||||
SELECT COUNT(*)
|
||||
FROM sys_level_node n
|
||||
|
|
@ -125,8 +125,6 @@
|
|||
FROM tb_project p
|
||||
LEFT JOIN sys_level_config c ON p.level = c.config_id
|
||||
LEFT JOIN project_node n ON p.id = n.project_id AND n.del_flag = '0'
|
||||
|
||||
-- 关联最新模型(假设通过 version 或 id 判断)
|
||||
LEFT JOIN (
|
||||
SELECT t1.*
|
||||
FROM tb_model t1
|
||||
|
|
@ -135,11 +133,31 @@
|
|||
FROM tb_model
|
||||
GROUP BY project_id
|
||||
) t2 ON t1.project_id = t2.project_id AND t1.id = t2.max_id
|
||||
) m ON m.project_id = p.id
|
||||
) m ON m.project_id = n.id
|
||||
|
||||
WHERE p.del_flag = '0'
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="openView" resultType="com.bonus.waterdesign.domain.CadData">
|
||||
SELECT
|
||||
id,
|
||||
layer_name AS layerName,
|
||||
entity_type AS entityType,
|
||||
color,
|
||||
lineweight,
|
||||
thickness,
|
||||
transparency,
|
||||
start_point AS startPoint,
|
||||
end_point AS endPoint,
|
||||
center_point AS centerPoint,
|
||||
radius,
|
||||
points,
|
||||
geometry
|
||||
FROM
|
||||
cad_data
|
||||
WHERE
|
||||
project_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue