Commit f14bbfff authored by hkl's avatar hkl

feat:1.提交树

parent 8fe6203a
package org.jeecg.modules.checkData.dynamicStaticGeometricData.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -13,7 +14,6 @@ import org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspect
import org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItemVO;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.service.IRailInspectionEquipmentItemDetailService;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.service.IRailInspectionEquipmentItemService;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.service.impl.RailInspectionEquipmentItemServiceImpl;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -30,7 +30,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("/checkData/dynamicStaticGeometricData/railInspectionEquipmentItem")
@ApiOperation("检查数据-动静态几何尺寸数据-轨检仪静态检查数据-检查项目")
@Api("检查数据-动静态几何尺寸数据-轨检仪静态检查数据-检查项目")
public class RailInspectionEquipmentItemController extends JeecgController<RailInspectionEquipmentItem, IRailInspectionEquipmentItemService> {
@Resource
......@@ -115,5 +115,4 @@ public class RailInspectionEquipmentItemController extends JeecgController<RailI
return Result.ok("操作成功");
}
}
......@@ -142,6 +142,13 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
int measurePoint = 1;
int sort = 1;
for (int i = 2; i < 32; i++) {
if (measurePoint % 8 == 0) {
measurePoint = 1;
i = i + 2;
continue;
} else {
measurePoint++;
}
RailInspectionEquipmentItemDetail itemDetail = new RailInspectionEquipmentItemDetail();
itemDetail.setId(UUIDGenerator.generate());
itemDetail.setRailInspectionEquipmentItemId(itemId);
......@@ -162,12 +169,8 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
itemDetail.setOther(other);
// 测点
itemDetail.setMeasurePoint(measurePoint - 1);
if (measurePoint % 10 == 0) {
measurePoint = 1;
} else {
measurePoint++;
}
itemDetail.setMeasurePoint(measurePoint);
itemDetail.setInfoSort(sort++);
itemDetails.add(itemDetail);
}
......
......@@ -4,7 +4,6 @@ package org.jeecg.modules.checkData.equipmentCheckData.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -15,9 +14,9 @@ import io.swagger.annotations.*;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItem;
import org.jeecg.modules.checkData.equipmentCheckData.dto.MovementAdditiveInfoDTO;
import org.jeecg.modules.checkData.equipmentCheckData.dto.MovementRecordsMasterDTO;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementAdditiveInfo;
......@@ -38,13 +37,13 @@ import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
import org.jeecg.modules.utils.BeanCopyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.web.multipart.MultipartFile;
import javax.transaction.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......
......@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
......@@ -131,9 +132,18 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@AutoLog(value = "线路车站-轻轨线路-获取区间车站映射")
@ApiOperation(value = "线路车站-线别管理-获取区间车站映射", notes = "线路车站-线别管理-获取区间车站映射")
@ApiOperation(value = "线路车站-轻轨线路-获取区间车站映射", notes = "线路车站-轻轨线路-获取区间车站映射")
@GetMapping(value = "/getSectionStation")
public Result<List<SectionStationMapVO>> getSectionStation() {
return Result.OK(this.service.getSectionStation());
}
@AutoLog(value = "线路车站-轻轨线路-获取线路下面所有的(区间-站点)树")
@ApiOperation(value = "线路车站-轻轨线路-获取线路下面所有的(区间-站点)树", notes = "线路车站-轻轨线路-获取线路下面所有的(区间-站点)树")
@GetMapping(value = "/getTree")
public Result<List<SectionStationNode>> getTree() {
return Result.OK(this.service.getTree());
}
}
......@@ -6,6 +6,7 @@ import org.jeecg.modules.subwayNetwork.entity.LightRail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import java.util.List;
......@@ -18,4 +19,7 @@ public interface LightRailMapper extends BaseMapper<LightRail> {
IPage<LightRailQueryVO> queryPageList(IPage<LightRailQueryVO> page, LightRailQueryDTO query);
List<SectionStationMapVO> getSectionStation();
List<SectionStationNode> getTreeLightRailList();
}
......@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.SubwaySection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO;
import java.util.List;
/**
* @Description: 线路车站-地铁区间
* @Author: jeecg-boot
......@@ -15,4 +18,6 @@ import org.jeecg.modules.subwayNetwork.vo.SubwaySectionVO;
public interface SubwaySectionMapper extends BaseMapper<SubwaySection> {
IPage<SubwaySectionVO> queryPageList(IPage<SubwaySectionVO> page, SubwaySectionQueryDTO query);
List<SectionStationNode> getTreeSubwaySectionList();
}
......@@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.jeecg.modules.subwayNetwork.vo.TrainStationVO;
import java.util.List;
/**
* @Description: 线路车站-地铁站
* @Author: jeecg-boot
......@@ -17,4 +20,5 @@ public interface TrainStationMapper extends BaseMapper<TrainStation> {
IPage<TrainStationVO> queryPageList(IPage<LightRailQueryVO> page, TrainStationQueryDTO query);
List<SectionStationNode> getTreeTrainStationList();
}
......@@ -42,5 +42,33 @@
t_sn_section_station_map
</select>
<select id="getTreeLightRailList" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationNode">
SELECT
id,
rail_line_name label,
'1' level,
'0' parent,
'' lineAliasId,
'0' startMileage,
TRUNCATE ( up_line_mileage / 2, 3 ) centerMileage,
up_line_mileage endMileage,
true isLeaf
FROM
t_sn_light_rail
<!-- UNION ALL
SELECT
concat(id,'-2') id,
rail_line_name label,
'1' LEVEL,
'0' parent,
'2' lineAliasId,
'0' startMileage,
TRUNCATE ( down_line_mileage / 2, 3 ) centerMileage,
down_line_mileage endMileage,
false isLeaf
FROM
t_sn_light_rail
-->
</select>
</mapper>
\ No newline at end of file
......@@ -30,4 +30,19 @@
</if>
</where>
</select>
<select id="getTreeSubwaySectionList" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationNode">
SELECT
id,
section_name label,
'2' level,
light_rail_id parent,
line_alias_id,
light_rail_id,
section_starting_mileage startMileage,
TRUNCATE ( (section_end_mileage+section_starting_mileage) / 2, 3 ) centerMileage,
section_end_mileage endMileage,
true isLeaf
FROM
t_sn_subway_section
</select>
</mapper>
\ No newline at end of file
......@@ -31,4 +31,18 @@
</if>
</where>
</select>
<select id="getTreeTrainStationList" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationNode">
SELECT
concat(t1.id,'-',t2.section_id) id,
t1.station_name label,
'3' level,
t2.section_id parent,
t1.line_alias_id,
t1.starting_mileage startMileage,
t1.center_mileage centerMileage,
t1.end_mileage endMileage,
true isLeaf
FROM
t_sn_train_station t1 LEFT JOIN t_sn_section_station_map t2 ON t1.id = t2.station_id
</select>
</mapper>
\ No newline at end of file
......@@ -7,6 +7,7 @@ import org.jeecg.modules.subwayNetwork.entity.LightRail;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import java.util.List;
import java.util.Map;
......@@ -29,5 +30,5 @@ public interface ILightRailService extends IService<LightRail> {
List<SectionStationMapVO> getSectionStation();
List<Map<String,Object>> getTree();
List<SectionStationNode> getTree();
}
......@@ -8,14 +8,16 @@ import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.mapper.LightRailMapper;
import org.jeecg.modules.subwayNetwork.mapper.SubwaySectionMapper;
import org.jeecg.modules.subwayNetwork.mapper.TrainStationMapper;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -29,7 +31,7 @@ public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail
private SubwaySectionMapper subwaySectionMapper;
@Resource
private ITrainStationService trainStationService;
private TrainStationMapper trainStationMapper;
@Override
public IPage<LightRailQueryVO> queryPageList(PageSearch<LightRailQueryDTO> dto) {
......@@ -45,9 +47,57 @@ public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail
}
@Override
public List<Map<String, Object>> getTree() {
// 1.查询所有线路
public List<SectionStationNode> getTree() {
// 1. 查询数据
// 1.1 查询所有线路,按上下行查询
List<SectionStationNode> lightRailList = this.baseMapper.getTreeLightRailList();
return null;
// 1.2 查询所有区间
List<SectionStationNode> subwaySectionList = subwaySectionMapper.getTreeSubwaySectionList();
// 1.3 查询所有车站
List<SectionStationNode> trainStation = trainStationMapper.getTreeTrainStationList();
// 2.组装数据
// 2.1 组装 车站-区间&组装一个区间map
Map<String, SectionStationNode> subwaySectionMap = new HashMap<>();
for (SectionStationNode sectionStationNode : subwaySectionList) {
// 2.1.1 组装区间map
subwaySectionMap.put(sectionStationNode.getId(), sectionStationNode);
// 2.1.2 组装车站-区间
for (SectionStationNode lightRail : lightRailList) {
if (sectionStationNode.getParent().equals(lightRail.getId())) {
List<SectionStationNode> children = lightRail.getChildren();
if (children == null) {
children = new ArrayList<>();
lightRail.setChildren(children);
lightRail.setIsLeaf(false);
}
children.add(sectionStationNode);
}
}
}
// 2.1 组装区间-车站数据
for (SectionStationNode node : trainStation) {
SectionStationNode sectionStationNode = subwaySectionMap.get(node.getParent());
// 这个车站属于这个区间就添加进去,说明不是叶子节点
if (sectionStationNode != null) {
List<SectionStationNode> children = sectionStationNode.getChildren();
if (children == null) {
children = new ArrayList<>();
sectionStationNode.setChildren(children);
sectionStationNode.setIsLeaf(false);
}
children.add(node);
}
}
return lightRailList;
}
}
package org.jeecg.modules.subwayNetwork.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel(value = "SectionStationNode", description = "区间-站节点")
public class SectionStationNode {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "标签")
private String label;
@ApiModelProperty(value = "等级")
private String level;
@ApiModelProperty(value = "父节点")
private String parent;
@ApiModelProperty(value = "线别id")
private String lineAliasId;
@ApiModelProperty(value = "起始里程")
private BigDecimal startMileage;
@ApiModelProperty(value = "中心里程")
private BigDecimal centerMileage;
@ApiModelProperty(value = "结束里程")
private BigDecimal endMileage;
@ApiModelProperty(value = "是否是叶子节点")
private Boolean isLeaf;
@ApiModelProperty(value = "孩子节点")
private List<SectionStationNode> children;
}
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