Commit 1f79342d authored by hkl's avatar hkl

feat:1.调整程序bug

parent 9234c3b2
......@@ -32,7 +32,7 @@
deviceCode,
startMileage,
endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
centerMileage,
type,
typeName
FROM (
......@@ -42,8 +42,9 @@
t1.rail_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
ROUND((t1.starting_mileage + t1.end_mileage) / 2, 3) centerMileage,
1 type,
'钢轨' typeName
'钢轨' typeName
FROM t_da_rail_management t1
WHERE t1.line_alias_id = #{lineAliasId}
AND t1.light_rail_id = #{lightRailId}
......@@ -55,8 +56,9 @@
t1.curve_code deviceCode,
t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage,
ROUND((t1.curve_mileage_zh + t1.curve_mileage_hz) / 2, 3) centerMileage,
2 type,
'曲线' typeName
'曲线' typeName
FROM t_da_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId}
......@@ -69,8 +71,9 @@
t1.vertical_curve_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
ROUND((t1.starting_mileage + t1.end_mileage) / 2, 3) centerMileage,
3 type,
'竖曲线' typeName
'竖曲线' typeName
FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId}
......@@ -83,8 +86,9 @@
t1.switch_code deviceCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
ROUND((t1.byroad_pre_mileage + t1.byroad_end_mileage) / 2, 3) centerMileage,
4 type,
'道岔' typeName
'道岔' typeName
FROM t_da_switch_management t1
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
......
......@@ -8,7 +8,7 @@
deviceCode,
startMileage,
endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
centerMileage,
type,
typeName
FROM (SELECT t1.id,
......@@ -16,6 +16,7 @@
t1.rail_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
ROUND((t1.starting_mileage + t1.end_mileage) / 2, 3) centerMileage,
1 type,
'钢轨' typeName
FROM t_da_rail_management t1
......@@ -29,10 +30,11 @@
t1.curve_code deviceCode,
t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage,
ROUND((t1.curve_mileage_zh + t1.curve_mileage_hz) / 2, 3) centerMileage,
2 type,
'曲线' typeName
FROM t_da_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
......@@ -43,10 +45,11 @@
t1.vertical_curve_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
ROUND((t1.starting_mileage + t1.end_mileage) / 2, 3) centerMileage,
3 type,
'竖曲线' typeName
FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
......@@ -57,14 +60,15 @@
t1.switch_code deviceCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
ROUND((t1.byroad_pre_mileage + t1.byroad_end_mileage) / 2, 3) centerMileage,
4 type,
'道岔' typeName
FROM t_da_switch_management t1
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
) t
) t
ORDER BY t.startMileage
</select>
</mapper>
......@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*;
import org.jeecg.common.system.base.controller.JeecgController;
import java.util.List;
import java.util.Map;
/**
......@@ -85,9 +84,10 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
@AutoLog(value = "维修作业管理-作业计划批次管理-获取里程单元设备")
@ApiOperation(value = "维修作业管理-作业计划批次管理-获取里程单元设备", notes = "维修作业管理-作业计划批次管理-获取里程单元设备")
@PostMapping(value = "/getUnitDeviceList")
public Result<List<Map<String, Object>>> getUnitDeviceList(@RequestBody UnitDeviceDTO dto) {
List<Map<String, Object>> records = this.service.getUnitDeviceList(dto);
return Result.OK(records);
public Result<Page<Map<String, Object>>> getUnitDevicePage(@RequestBody UnitDeviceDTO dto) {
Page<Map<String, Object>> pageData = new Page<>(dto.getPageNo(), dto.getPageSize());
pageData = this.service.getUnitDevicePage(pageData, dto);
return Result.OK(pageData);
}
......
......@@ -3,12 +3,19 @@ package org.jeecg.modules.maintenanceWork.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
@Data
@ApiModel(value = "UnitDeviceDTO对象", description = "fsf1")
public class UnitDeviceDTO {
@ApiModelProperty("车站id")
private Integer pageNo;
@ApiModelProperty("车站id")
private Integer pageSize;
@ApiModelProperty("车站id")
private String lightRailId;
......
......@@ -60,6 +60,6 @@ public class WorkBatchSaveOrUpdateDTO {
@ApiModelProperty("作业状态 0-未作业 1-已作业")
private Integer workStatus;
@ApiModelProperty("单元设备列表")
private List<DispatchDTO> unitDeviceList;
@ApiModelProperty("详情列表【就是】")
private List<DispatchDTO> detailList;
}
......@@ -55,5 +55,5 @@ public class WorkBatchTransfiniteSaveDTO {
private String team;
@ApiModelProperty("派工列表")
private List<DispatchDTO> dispatchList;
private List<DispatchDTO> detailList;
}
......@@ -2,6 +2,9 @@ package org.jeecg.modules.maintenanceWork.mapper;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailVO;
import java.util.List;
/**
* <p>
......@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface WorkBatchDetailMapper extends BaseMapper<WorkBatchDetail> {
List<WorkBatchDetailVO> queryListByWorkBatchId(String workBatchId);
}
package org.jeecg.modules.maintenanceWork.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.maintenanceWork.dto.UnitDeviceDTO;
import org.jeecg.modules.maintenanceWork.dto.WorkBatchDTO;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import java.util.Map;
/**
* <p>
* 维修作业管理-作业计划批次管理表 Mapper 接口
......@@ -17,4 +20,6 @@ import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
public interface WorkBatchMapper extends BaseMapper<WorkBatch> {
Page<WorkBatchVO> listRecord(Page<WorkBatchVO> pageData, WorkBatchDTO dto);
Page<Map<String, Object>> getUnitDevicePage(Page<Map<String, Object>> pageData, UnitDeviceDTO dto);
}
......@@ -2,4 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.maintenanceWork.mapper.WorkBatchDetailMapper">
<select id="queryListByWorkBatchId" resultType="org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailVO">
SELECT t1.id,
t1.work_batch_id,
t1.work_batch_code,
t1.analysis_batch_unit_device_id,
t1.unit_id,
t1.unit_code,
t1.unit_type,
t1.unit_type_name,
t1.unit_device_code,
t1.unit_starting_mileage,
t1.unit_center_mileage,
t1.unit_end_mileage,
t1.unit_score_level,
t1.unit_score_level_str,
t1.unit_score,
t1.remark
FROM t_mw_work_batch_detail t1
WHERE t1.work_batch_id = #{workBatchId}
</select>
</mapper>
......@@ -31,4 +31,80 @@
AND t2.work_batch_code like concat('%',#{dto.workBatchCode},'%')
</if>
</select>
<select id="getUnitDevicePage" resultType="java.util.Map">
SELECT id,
unitCode,
deviceCode,
startMileage,
endMileage,
centerMileage,
type,
typeName
FROM (SELECT t1.id,
t1.unit_code unitCode,
t1.rail_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
ROUND((t1.starting_mileage + t1.end_mileage) / 2, 3) centerMileage,
1 type,
'钢轨' typeName
FROM t_da_rail_management t1
WHERE t1.line_alias_id = #{dto.lineAliasId}
AND t1.light_rail_id = #{dto.lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.curve_code deviceCode,
t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage,
ROUND((t1.curve_mileage_zh + t1.curve_mileage_hz) / 2, 3) centerMileage,
2 type,
'曲线' typeName
FROM t_da_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{dto.lineAliasId}
AND t2.light_rail_id = #{dto.lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.vertical_curve_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
ROUND((t1.starting_mileage + t1.end_mileage) / 2, 3) centerMileage,
3 type,
'竖曲线' typeName
FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{dto.lineAliasId}
AND t2.light_rail_id = #{dto.lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.switch_code deviceCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
ROUND((t1.byroad_pre_mileage + t1.byroad_end_mileage) / 2, 3) centerMileage,
4 type,
'道岔' typeName
FROM t_da_switch_management t1
LEFT JOIN t_sn_section_station_map t2 ON t1.section_station_map_id = t2.id
LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
WHERE t1.line_alias_id = #{dto.lineAliasId}
AND t2.light_rail_id = #{dto.lightRailId}
) t
<if test="dto.startMileage != null">
AND t.centerMileage >= #{dto.startMileage}
</if>
<if test="dto.endMileage != null">
AND t.centerMileage <![CDATA[ <= ]]> #{dto.endMileage}
</if>
ORDER BY t.startMileage
</select>
</mapper>
......@@ -6,7 +6,6 @@ import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import java.util.List;
import java.util.Map;
/**
......@@ -29,7 +28,7 @@ public interface IWorkBatchService extends IService<WorkBatch> {
void transfiniteSaveRecord(WorkBatchTransfiniteSaveDTO dto);
List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto);
Page<Map<String, Object>> getUnitDevicePage(Page<Map<String, Object>> pageData, UnitDeviceDTO dto);
void batchSaveRecord(AnalysisBatchSaveDTO dto);
}
package org.jeecg.modules.maintenanceWork.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.util.UUIDGenerator;
import org.jeecg.modules.dynamicStaticAnalysis.entity.AnalysisBatchUnitDevice;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisAlgorithmMapper;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceMapper;
import org.jeecg.modules.maintenanceWork.dto.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
......@@ -16,14 +15,11 @@ import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
import org.jeecg.modules.maintenanceWork.mapper.WorkBatchDetailMapper;
import org.jeecg.modules.maintenanceWork.mapper.WorkBatchMapper;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchDetailVO;
import org.jeecg.modules.maintenanceWork.vo.WorkBatchVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -40,17 +36,23 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Resource
private WorkBatchDetailMapper workBatchDetailMapper;
@Resource
private AnalysisAlgorithmMapper analysisAlgorithmMapper;
@Resource
private AnalysisBatchUnitDeviceMapper analysisBatchUnitDeviceMapper;
@Override
public Page<WorkBatchVO> listRecord(Page<WorkBatchVO> pageData, WorkBatchDTO dto) {
return this.baseMapper.listRecord(pageData, dto);
Page<WorkBatchVO> pageRecords = this.baseMapper.listRecord(pageData, dto);
for (WorkBatchVO record : pageRecords.getRecords()) {
List<WorkBatchDetailVO> detailList = workBatchDetailMapper.queryListByWorkBatchId(record.getId());
record.setDetailList(detailList);
}
return pageRecords;
}
@Override
public void saveRecord(WorkBatchSaveOrUpdateDTO dto) {
// 保存主信息
......@@ -68,7 +70,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
LambdaQueryWrapper<WorkBatchDetail> delWrapper = Wrappers.lambdaQuery();
delWrapper.eq(WorkBatchDetail::getWorkBatchId, dto.getId());
workBatchDetailMapper.delete(delWrapper);
List<DispatchDTO> transfiniteList = dto.getUnitDeviceList();
List<DispatchDTO> transfiniteList = dto.getDetailList();
for (DispatchDTO dispatchDTO : transfiniteList) {
WorkBatchDetail workBatchDetail = new WorkBatchDetail();
workBatchDetail.setId(UUIDGenerator.generate());
......@@ -107,7 +109,7 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
workBatch.setSource(2); // 超限页面
this.save(workBatch);
List<DispatchDTO> transfiniteList = dto.getDispatchList();
List<DispatchDTO> transfiniteList = dto.getDetailList();
for (DispatchDTO transfiniteDTO : transfiniteList) {
WorkBatchDetail workBatchDetail = new WorkBatchDetail();
workBatchDetail.setId(UUIDGenerator.generate());
......@@ -131,17 +133,10 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Override
public List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto) {
List<Map<String, Object>> resultList = new ArrayList<>();
List<Map<String, Object>> unitDeviceList = analysisAlgorithmMapper.getUnitDevice(dto.getLightRailId(), dto.getLineAliasId());
for (Map<String, Object> unitDevice : unitDeviceList) {
BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
if (dto.getStartMileage().compareTo(centerMileage) <= 0 && dto.getEndMileage().compareTo(centerMileage) > 0) {
resultList.add(unitDevice);
}
}
return resultList;
public Page<Map<String, Object>> getUnitDevicePage(Page<Map<String, Object>> pageData, UnitDeviceDTO dto) {
return this.baseMapper.getUnitDevicePage(pageData, dto);
}
@Override
......
......@@ -23,10 +23,8 @@ import lombok.Setter;
* @since 2023-08-09
*/
@Data
@ApiModel(value = "WorkBatchDetail对象", description = "维修作业管理-作业计划批次管理明细表")
@ApiModel(value = "WorkBatchDetailVO对象", description = "维修作业管理-作业计划批次管理明细表")
public class WorkBatchDetailVO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
......
......@@ -7,6 +7,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -72,5 +73,7 @@ public class WorkBatchVO {
@ApiModelProperty("是否删除 0-未删除 1-已删除")
private String delFlag;
@ApiModelProperty("详情List")
private List<WorkBatchDetailVO> detailList;
}
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