Commit 8aacdef2 authored by hkl's avatar hkl

feat:1.修改bug

parent 4cf9ebaa
......@@ -41,10 +41,12 @@
<artifactId>jeewx-api</artifactId>
</dependency>
<!-- 积木报表 -->
<!--
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
</dependency>
-->
<!-- hutool -->
<dependency>
<groupId>cn.hutool</groupId>
......
......@@ -26,7 +26,7 @@ public class TurnoutUseCheck implements Serializable {
private static final long serialVersionUID = 1L;
@TableField("id")
// @TableField("id")
private String id;
@ApiModelProperty("创建人")
......
......@@ -7,8 +7,10 @@ import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.checkData.vo.MovementAdditiveInfoVO;
import org.jeecg.modules.checkData.vo.MovementRecordsMasterVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
......@@ -36,4 +38,7 @@ public interface MovementRecordsMasterMapper extends BaseMapper<MovementRecordsM
* @return
*/
Page<MovementAdditiveInfoVO> queryPageAdditiveInfoList(Page<MovementAdditiveInfoVO> pageData, MovementAdditiveInfoDTO dto);
List<ToDoDetailVO> getTodoList(String currentUserId);
}
package org.jeecg.modules.checkData.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.checkData.dto.RecordsMasterCheckDTO;
import org.jeecg.modules.checkData.entity.RecordsMasterCheck;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.checkData.vo.RecordsMasterCheckVO;
import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO;
import org.jeecg.modules.deviceAsset.vo.TrackBedManagementVO;
/**
* <p>
......@@ -24,4 +22,5 @@ public interface RecordsMasterCheckMapper extends BaseMapper<RecordsMasterCheck>
* @return
*/
Page<RecordsMasterCheckVO> queryPageList(Page<RecordsMasterCheckVO> pageData, RecordsMasterCheckDTO dto);
}
......@@ -46,4 +46,20 @@
order by t1.info_sort asc
</where>
</select>
<select id="getTodoList" resultType="org.jeecg.modules.homePage.vo.ToDoDetailVO">
SELECT
t1.id,
t1.ek_code batchCode,
t1.check_time,
'1' toDoType,
t1.type checkType
FROM
t_djt_movement_records_master t1
WHERE
del_flag = '0'
AND NOT EXISTS ( SELECT 1 FROM t_dsa_analysis_batch_check_data_map WHERE ek_id = t1.id)
<if test="currentUserId != null and currentUserId != ''">
AND t1.create_by = #{currentUserId}
</if>
</select>
</mapper>
......@@ -7,6 +7,9 @@ import org.jeecg.modules.checkData.dto.MovementRecordsMasterDTO;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.vo.MovementAdditiveInfoVO;
import org.jeecg.modules.checkData.vo.MovementRecordsMasterVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import java.util.List;
/**
* <p>
......@@ -35,4 +38,10 @@ public interface IMovementRecordsMasterService extends IService<MovementRecordsM
*/
Page<MovementAdditiveInfoVO> queryPageAdditiveInfoList(Page<MovementAdditiveInfoVO> pageData, MovementAdditiveInfoDTO dto);
/**
* 获取代办列表
* @param currentUserId
* @return
*/
List<ToDoDetailVO> getTodoList(String currentUserId);
}
......@@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.checkData.vo.RecordsMasterCheckVO;
import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO;
import org.jeecg.modules.deviceAsset.vo.TrackBedManagementVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import java.util.List;
/**
* <p>
......@@ -24,4 +27,6 @@ public interface IRecordsMasterCheckService extends IService<RecordsMasterCheck>
* @return
*/
Page<RecordsMasterCheckVO> queryPageList(Page<RecordsMasterCheckVO> pageData, RecordsMasterCheckDTO dto);
}
......@@ -9,9 +9,11 @@ import org.jeecg.modules.checkData.service.IMovementRecordsMasterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.checkData.vo.MovementAdditiveInfoVO;
import org.jeecg.modules.checkData.vo.MovementRecordsMasterVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
......@@ -46,4 +48,9 @@ public class MovementRecordsMasterServiceImpl extends ServiceImpl<MovementRecord
public Page<MovementAdditiveInfoVO> queryPageAdditiveInfoList(Page<MovementAdditiveInfoVO> pageData, MovementAdditiveInfoDTO dto) {
return this.baseMapper.queryPageAdditiveInfoList(pageData, dto);
}
@Override
public List<ToDoDetailVO> getTodoList(String currentUserId) {
return this.baseMapper.getTodoList(currentUserId);
}
}
......@@ -7,8 +7,11 @@ import org.jeecg.modules.checkData.mapper.RecordsMasterCheckMapper;
import org.jeecg.modules.checkData.service.IRecordsMasterCheckService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.checkData.vo.RecordsMasterCheckVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 设备检查记录主表 服务实现类
......
......@@ -7,6 +7,7 @@ import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatch;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO;
import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import java.util.List;
......@@ -25,4 +26,6 @@ public interface AnalysisBatchMapper extends BaseMapper<AnalysisBatch> {
Page<AnalysisBatchQueryVO> listRecord(Page<AnalysisBatchQueryVO> pageData, AnalysisBatchQueryDTO dto);
List<CheckBatchVO> listRecordDetail(List<String> analysisBatchIds);
List<ToDoDetailVO> getTodoList(String currentUserId);
}
......@@ -100,4 +100,26 @@
#{item}
</foreach>
</select>
<select id="getTodoList" resultType="org.jeecg.modules.homePage.vo.ToDoDetailVO">
SELECT
t3.id,
t3.analysis_type,
t3.analysis_batch_code batch_code,
'2' toDoType
FROM
t_dsa_analysis_batch t3
WHERE
NOT EXISTS (
SELECT
1
FROM
t_mw_work_batch_detail t1
INNER JOIN t_dsa_analysis_batch_unit_device t2 ON t1.analysis_batch_unit_device_id = t2.id
WHERE
t2.analysis_batch_id = t3.id
)
<if test="currentUserId != null and currentUserId != ''">
AND t3.create_by = #{currentUserId}
</if>
</select>
</mapper>
......@@ -25,7 +25,7 @@
t1.unit_score_level,
t1.unit_score_level_str,
t1.remark,
( SELECT COUNT( 1 ) FROM t_dsa_analysis_batch_unit_device_transfinite WHERE analysis_batch_unit_device_id = t1.id LIMIT 1 ) AS is_work,
( SELECT COUNT( 1 ) FROM t_dsa_analysis_batch_unit_device_transfinite WHERE analysis_batch_unit_device_id = t1.id AND is_work = 1 LIMIT 1 ) AS is_work,
( SELECT COUNT( 1 ) FROM t_dsa_analysis_batch_unit_device_transfinite WHERE analysis_batch_unit_device_id = t1.id LIMIT 1 ) AS is_transfinite,
( SELECT COUNT( 1 ) FROM t_mw_work_batch_detail WHERE analysis_batch_unit_device_id = t1.id LIMIT 1 ) AS work_status
FROM
......
......@@ -8,6 +8,7 @@ import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatch;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO;
import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import java.util.List;
......@@ -32,4 +33,6 @@ public interface IAnalysisBatchService extends IService<AnalysisBatch> {
void deleteRecord(String id);
List<CheckBatchVO> listRecordDetail(List<String> analysisBatchIds);
List<ToDoDetailVO> getTodoList(String currentUserId);
}
......@@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.dynamicStaticAnalysis.util.StrUtil;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchQueryVO;
import org.jeecg.modules.dynamicStaticAnalysis.vo.CheckBatchVO;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.jeecg.modules.utils.BeanCopyUtil;
import org.springframework.stereotype.Service;
......@@ -163,5 +164,10 @@ public class AnalysisBatchServiceImpl extends ServiceImpl<AnalysisBatchMapper, A
return this.baseMapper.listRecordDetail(analysisBatchIds);
}
@Override
public List<ToDoDetailVO> getTodoList(String currentUserId) {
return this.baseMapper.getTodoList(currentUserId);
}
}
......@@ -44,9 +44,15 @@ public class AnalysisBatchUnitDeviceServiceImpl extends ServiceImpl<AnalysisBatc
if (ObjectUtil.isNotEmpty(page.getRecords())) {
List<String> analysisBatchUnitDeviceIds = page.getRecords().stream().map(AnalysisBatchUnitDeviceVO::getId).collect(Collectors.toList());
List<AnalysisBatchUnitDeviceTransfiniteVO> transfiniteList = transfiniteMapper.getTransfiniteListByIds(analysisBatchUnitDeviceIds);
Map<String, List<AnalysisBatchUnitDeviceTransfiniteVO>> map = transfiniteList.stream().collect(Collectors.groupingBy(AnalysisBatchUnitDeviceTransfiniteVO::getAnalysisBatchUnitDeviceId));
page.getRecords().forEach(record -> record.setTransfiniteList(map.get(record.getId())));
List<AnalysisBatchUnitDeviceTransfiniteVO> transfiniteListAll = transfiniteMapper.getTransfiniteListByIds(analysisBatchUnitDeviceIds);
Map<String, List<AnalysisBatchUnitDeviceTransfiniteVO>> map = transfiniteListAll.stream().collect(Collectors.groupingBy(AnalysisBatchUnitDeviceTransfiniteVO::getAnalysisBatchUnitDeviceId));
page.getRecords().forEach(record -> {
List<AnalysisBatchUnitDeviceTransfiniteVO> transfiniteList = map.get(record.getId());
if (transfiniteList == null) {
transfiniteList = new ArrayList<>();
}
record.setTransfiniteList(transfiniteList);
});
}
......
package org.jeecg.modules.homePage.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.homePage.face.HomePageFace;
import org.jeecg.modules.homePage.vo.ToDoVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 首页 前端控制器
* </p>
*
* @author hkl
* @since 2023-09-25 16:45:26
*/
@RestController
@RequestMapping("/homePage")
@Api(tags = "首页")
public class HomePageController {
@Resource
private HomePageFace homePageFace;
@AutoLog(value = "首页-获取线路下面所有的(区间-站点)树")
@ApiOperation(value = "首页-获取线路下面所有的(区间-站点)树", notes = "首页-获取线路下面所有的(区间-站点)树")
@GetMapping(value = "/getTree")
public Result<List<SectionStationNode>> getTree() {
return Result.OK(homePageFace.getTree());
}
@AutoLog(value = "首页-代办列表")
@ApiOperation(value = "首页-代办列表", notes = "首页-代办列表")
@GetMapping(value = "/todoList")
public Result<ToDoVO> todoList() {
ToDoVO x = homePageFace.todoList();
return Result.OK(x);
}
}
package org.jeecg.modules.homePage.face;
import org.jeecg.modules.homePage.vo.ToDoVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import java.util.List;
public interface HomePageFace {
/**
* 获取树
*
* @return
*/
List<SectionStationNode> getTree();
/**
* 代办列表
*
* @return
*/
ToDoVO todoList();
}
package org.jeecg.modules.homePage.face.impl;
import org.jeecg.modules.checkData.service.IMovementRecordsMasterService;
import org.jeecg.modules.dynamicStaticAnalysis.service.IAnalysisBatchService;
import org.jeecg.modules.homePage.face.HomePageFace;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.jeecg.modules.homePage.vo.ToDoVO;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchService;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class HomePageFaceImpl implements HomePageFace {
@Resource
private ILightRailService lightRailService;
@Resource
private IMovementRecordsMasterService movementRecordsMasterService;
@Resource
private IAnalysisBatchService analysisBatchService;
@Resource
private IWorkBatchService workBatchService;
@Override
public List<SectionStationNode> getTree() {
return lightRailService.getTree();
}
@Override
public ToDoVO todoList() {
String currentUserId = null;
ToDoVO vo = new ToDoVO();
// 1.查询检查未使用的检查批次
List<ToDoDetailVO> checkBatchList = movementRecordsMasterService.getTodoList(currentUserId);
vo.setCheckBatchList(checkBatchList);
// 2.查询未派工的分析批次
List<ToDoDetailVO> analysisBatchList = analysisBatchService.getTodoList(currentUserId);
vo.setAnalysisBatchList(analysisBatchList);
// 3.查询作业状态未完成的维修派工批次
List<ToDoDetailVO> workBatchList = workBatchService.getTodoList(currentUserId);
vo.setWorkBatchList(workBatchList);
return vo;
}
}
package org.jeecg.modules.homePage.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "ToDoDetailVO对象", description = "首页-代表列表vo详情")
public class ToDoDetailVO {
@ApiModelProperty("id")
private String id;
@ApiModelProperty("批次号")
private String batchCode;
@ApiModelProperty("类型:1-检查批次 2-分析批次 3-维修工单批次")
private String toDoType;
@ApiModelProperty("检查数据类型 1-人工静态检查 2-轨检仪静态检查 3-轨检车检查 4-添乘仪检查")
private Integer checkType;
@ApiModelProperty("分析类型 1-均值分析 2-峰值分析")
private Integer analysisType;
@ApiModelProperty("来源 1-页面添加 2-超限派工添加")
private Integer workType;
}
package org.jeecg.modules.homePage.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "ToDoVO对象", description = "首页-代办列表")
public class ToDoVO {
@ApiModelProperty("检查批次列表")
private List<ToDoDetailVO> checkBatchList;
@ApiModelProperty("分析批次列表")
private List<ToDoDetailVO> analysisBatchList;
@ApiModelProperty("派工批次列表")
private List<ToDoDetailVO> workBatchList;
}
......@@ -61,4 +61,9 @@ public class AnalysisBatchSaveDTO {
@ApiModelProperty("分析批次id")
private String analysisBatchId;
@Data
public static class form {
}
}
package org.jeecg.modules.maintenanceWork.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.jeecg.modules.maintenanceWork.dto.UnitDeviceDTO;
import org.jeecg.modules.maintenanceWork.dto.WorkBatchDTO;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
......@@ -11,6 +12,7 @@ import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO;
import org.jeecg.modules.unitDevice.vo.CaseReportCheckDataVO;
import org.jeecg.modules.unitDevice.vo.CaseReportWorkBatchVO;
import java.util.List;
import java.util.Map;
/**
......@@ -28,4 +30,6 @@ public interface WorkBatchMapper extends BaseMapper<WorkBatch> {
Page<Map<String, Object>> getUnitDevicePage(Page<Map<String, Object>> pageData, UnitDeviceDTO dto);
Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto);
List<ToDoDetailVO> getTodoList(String currentUserId);
}
......@@ -137,4 +137,17 @@
LEFT JOIN t_mw_work_batch t2 ON t1.work_batch_id = t2.id AND t2.del_flag = '0'
ORDER BY t2.create_time
</select>
<select id="getTodoList" resultType="org.jeecg.modules.homePage.vo.ToDoDetailVO">
SELECT
t1.id,
t1.work_batch_code batch_code,
'3' toDoType,
t1.source workType
FROM
t_mw_work_batch t1
WHERE work_status = 0
<if test="currentUserId != null and currentUserId != ''">
AND t1.create_by = #{currentUserId}
</if>
</select>
</mapper>
package org.jeecg.modules.maintenanceWork.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.jeecg.modules.maintenanceWork.dto.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -10,6 +11,7 @@ import org.jeecg.modules.unitDevice.dto.CaseReportWorkBatchDTO;
import org.jeecg.modules.unitDevice.vo.CaseReportCheckDataVO;
import org.jeecg.modules.unitDevice.vo.CaseReportWorkBatchVO;
import java.util.List;
import java.util.Map;
/**
......@@ -37,4 +39,6 @@ public interface IWorkBatchService extends IService<WorkBatch> {
void batchSaveRecord(AnalysisBatchSaveDTO dto);
Page<CaseReportWorkBatchVO> caseReportWorkBatch(Page<CaseReportWorkBatchVO> pageData, CaseReportWorkBatchDTO dto);
List<ToDoDetailVO> getTodoList(String currentUserId);
}
......@@ -10,6 +10,7 @@ import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatchUnitDevice;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceMapper;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceTransfiniteMapper;
import org.jeecg.modules.homePage.vo.ToDoDetailVO;
import org.jeecg.modules.maintenanceWork.dto.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
......@@ -189,5 +190,10 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
return this.baseMapper.caseReportWorkBatch(pageData, dto);
}
@Override
public List<ToDoDetailVO> getTodoList(String currentUserId) {
return this.baseMapper.getTodoList(currentUserId);
}
}
package org.jeecg.modules.subwayNetwork.controller;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.shiro.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import java.util.*;
/**
* @Description: 线路车站-轻轨线路
......
......@@ -37,8 +37,8 @@
<select id="getTreeSubwaySectionList" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationNode">
SELECT t.id,
t.section_name label,
'2' level,
t.light_rail_id parent,
'3' level,
concat(t.light_rail_id, '-', t.line_alias_id) parent,
t.line_alias_id,
t3.line_alias_code,
t.light_rail_id,
......@@ -50,5 +50,6 @@
LEFT JOIN t_sn_light_rail t2 ON t.light_rail_id = t2.id
LEFT JOIN t_sn_line_alias t3 ON t.line_alias_id = t3.id
WHERE t2.status = 1
ORDER BY startMileage, line_alias_id
</select>
</mapper>
\ No newline at end of file
......@@ -35,10 +35,10 @@
</select>
<select id="getTreeTrainStationList" resultType="org.jeecg.modules.subwayNetwork.vo.SectionStationNode">
SELECT
concat(t1.id,'-',t2.section_id) id,
concat(t2.section_id,'-',t1.id) id,
t1.station_name label,
'3' level,
t2.section_id parent,
concat(t1.light_rail_id,'-',t1.line_alias_id) parent,
t1.line_alias_id,
t4.line_alias_code,
t1.starting_mileage startMileage,
......@@ -50,5 +50,6 @@
LEFT JOIN t_sn_light_rail t3 on t1.light_rail_id = t3.id and t2.light_rail_id = t3.id
LEFT JOIN t_sn_line_alias t4 ON t1.line_alias_id = t4.id
WHERE t3.status = 1
ORDER BY startMileage,line_alias_id
</select>
</mapper>
\ No newline at end of file
package org.jeecg.modules.subwayNetwork.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.mapper.LightRailMapper;
import org.jeecg.modules.subwayNetwork.mapper.LineAliasMapper;
import org.jeecg.modules.subwayNetwork.mapper.SubwaySectionMapper;
import org.jeecg.modules.subwayNetwork.mapper.TrainStationMapper;
import org.jeecg.modules.subwayNetwork.service.ILightRailService;
......@@ -16,10 +19,12 @@ import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description: 线路车站-线别管理
......@@ -33,6 +38,9 @@ public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail
@Resource
private TrainStationMapper trainStationMapper;
@Resource
private LineAliasMapper lineAliasMapper;
@Override
public IPage<LightRailQueryVO> queryPageList(PageSearch<LightRailQueryDTO> dto) {
IPage<LightRailQueryVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
......@@ -46,8 +54,7 @@ public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail
return this.baseMapper.getSectionStation();
}
@Override
public List<SectionStationNode> getTree() {
public List<SectionStationNode> getTree2() {
// 1. 查询数据
// 1.1 查询所有线路,按上下行查询
List<SectionStationNode> lightRailList = this.baseMapper.getTreeLightRailList();
......@@ -98,6 +105,108 @@ public class LightRailServiceImpl extends ServiceImpl<LightRailMapper, LightRail
}
return lightRailList;
}
/**
* 首页的树结构请修改为“线路->线别->车站、区间”这种树型结构
* <p>
* 车站1、车站1~车站2区间、车站2
*
* @return
*/
@Override
public List<SectionStationNode> getTree() {
// 1. 查询数据
// 1.1 查询所有线路,按上下行查询
List<SectionStationNode> lightRailList = this.baseMapper.getTreeLightRailList();
// 1.2 查询上下行
List<LineAlias> lineAliasRecords = lineAliasMapper.selectList(Wrappers.emptyWrapper());
// 1.3 查询所有区间
List<SectionStationNode> subwaySectionList = subwaySectionMapper.getTreeSubwaySectionList();
// 1.4 查询所有车站
List<SectionStationNode> trainStationList = trainStationMapper.getTreeTrainStationList();
// 2. 组装数据
List<SectionStationNode> lineAliasList = new ArrayList();
// 2.1 组装线路->线别数据
for (SectionStationNode lightRailNode : lightRailList) {
List<SectionStationNode> childrens = new ArrayList<>();
for (LineAlias lineAliasRecord : lineAliasRecords) {
SectionStationNode children = new SectionStationNode();
children.setId(lightRailNode.getId() + "-" + lineAliasRecord.getId());
children.setLevel("2");
children.setIsLeaf(true);
children.setLabel(lineAliasRecord.getLineAliasName());
children.setParent(lightRailNode.getId());
children.setLineAliasId(lineAliasRecord.getId());
children.setLineAliasCode(lineAliasRecord.getLineAliasCode());
children.setStartMileage(BigDecimal.ZERO);
children.setEndMileage(BigDecimal.ZERO);
if (lineAliasRecord.getId().equals("1") || lineAliasRecord.getId().equals("2")) { // 上下行线单独处理
children.setStartMileage(lightRailNode.getStartMileage());
children.setCenterMileage(lightRailNode.getCenterMileage());
children.setEndMileage(lightRailNode.getEndMileage());
}
childrens.add(children);
lineAliasList.add(children);
}
lightRailNode.setIsLeaf(false);
lightRailNode.setChildren(childrens);
}
// 2.2
// 2.2.1 组装车站,区间【车站1、车站1~车站2区间、车站2】
Map<String, SectionStationNode> subwaySectionMap = subwaySectionList.stream().collect(Collectors.toMap(SectionStationNode::getId, value -> value));
Map<String, List<SectionStationNode>> subwayAndtrainStationSectionMap = new HashMap<>();
Map<String, SectionStationNode> useMap = new HashMap<>();
for (SectionStationNode trainStation : trainStationList) {
// ① 判断车站,区间list否存在,不存在新增一个
List<SectionStationNode> subwayAndtrainStationNodeList = subwayAndtrainStationSectionMap.get(trainStation.getParent());
if (subwayAndtrainStationNodeList == null) {
subwayAndtrainStationNodeList = new ArrayList<>();
subwayAndtrainStationSectionMap.put(trainStation.getParent(), subwayAndtrainStationNodeList);
}
subwayAndtrainStationNodeList.add(trainStation);
// ② 紧接着去看看区间有没有,如果有则里面跟在车站后面
String subwayId = trainStation.getId().split("-")[0]; // 区间id
SectionStationNode sectionStationNode = subwaySectionMap.get(subwayId);
SectionStationNode isUse = useMap.get(subwayId); // 这个map的作用是,一个线路下面的区间保证只能使用一次
// 如果区间存在,并且没有被使用
if (sectionStationNode != null) {
if (isUse == null) {
// 将区间添加到车站后面
subwayAndtrainStationNodeList.add(sectionStationNode);
// 标记被使用
useMap.put(subwayId, sectionStationNode);
} else {
// 如果被使用了,则要移除当前车站,避免重复,最后一个车站不用移除
// 车站-区间list去重,例如【站点1;站点1-站点2区间;站点2;站点2;站点2-站点3区间;站点3】去掉中间的重复的站点2
// 如果是最后一个车站则不用去重
subwayAndtrainStationNodeList.remove(trainStation);
}
}
}
// 2.2.2 组装线别数据->车站,区间【车站1、车站1~车站2区间、车站2】
for (SectionStationNode lineAliasNode : lineAliasList) {
List<SectionStationNode> childrens = subwayAndtrainStationSectionMap.get(lineAliasNode.getId());
if (null != childrens) {
lineAliasNode.setChildren(childrens);
lineAliasNode.setIsLeaf(false);
}
}
return lightRailList;
}
}
......@@ -2,4 +2,4 @@ spring:
application:
name: jeecg-system
profiles:
active: hkl
active: dev
......@@ -243,6 +243,7 @@
</exclusions>
</dependency>
<!-- 积木报表-->
<!--
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
......@@ -254,6 +255,7 @@
</exclusion>
</exclusions>
</dependency>
-->
</dependencies>
</dependencyManagement>
......
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