Commit 9234c3b2 authored by hkl's avatar hkl

feat:1.调整程序

parent 3cc309c3
...@@ -30,9 +30,11 @@ public class AsyncTask implements AsyncConfigurer { ...@@ -30,9 +30,11 @@ public class AsyncTask implements AsyncConfigurer {
public Executor getAsyncExecutor() { public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 设置核心线程数 // 设置核心线程数
executor.setCorePoolSize(10); // CPU密集型(CPU密集型也叫计算密集型,指的是运算较多,cpu占用高,读/写I/O(硬盘/内存)较少):corePoolSize = CPU核数 + 1
// IO密集型(与cpu密集型相反,系统运作,大部分的状况是CPU在等I/O (硬盘/内存) 的读/写操作,此时CPU Loading并不高。):corePoolSize = CPU核数 * 2
executor.setCorePoolSize(8);
// 设置最大线程数 // 设置最大线程数
executor.setMaxPoolSize(100); executor.setMaxPoolSize(8);
// 线程池所使用的缓冲队列 // 线程池所使用的缓冲队列
executor.setQueueCapacity(10); executor.setQueueCapacity(10);
// 等待任务在关机时完成-- 表明等待所有线程执行完 // 等待任务在关机时完成-- 表明等待所有线程执行完
......
...@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO; import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO;
import org.jeecg.modules.deviceAsset.entity.FastenerManagement; import org.jeecg.modules.deviceAsset.entity.FastenerManagement;
import org.jeecg.modules.deviceAsset.service.IFastenerManagementService; import org.jeecg.modules.deviceAsset.service.IFastenerManagementService;
...@@ -46,6 +47,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage ...@@ -46,6 +47,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody FastenerManagement fastenerManagement) { public Result<String> edit(@RequestBody FastenerManagement fastenerManagement) {
if (ObjectUtil.isEmpty(fastenerManagement.getId())) { if (ObjectUtil.isEmpty(fastenerManagement.getId())) {
fastenerManagement.setId(UUIDGenerator.generate());
this.service.save(fastenerManagement); this.service.save(fastenerManagement);
} else { } else {
this.service.updateById(fastenerManagement); this.service.updateById(fastenerManagement);
......
...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api; ...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO; import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO;
import org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO; import org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO;
import org.jeecg.modules.deviceAsset.entity.FastenerManagement; import org.jeecg.modules.deviceAsset.entity.FastenerManagement;
...@@ -50,6 +51,7 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana ...@@ -50,6 +51,7 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody SignBoardManagement signBoardManagement) { public Result<String> edit(@RequestBody SignBoardManagement signBoardManagement) {
if (ObjectUtil.isEmpty(signBoardManagement.getId())) { if (ObjectUtil.isEmpty(signBoardManagement.getId())) {
signBoardManagement.setId(UUIDGenerator.generate());
this.service.save(signBoardManagement); this.service.save(signBoardManagement);
} else { } else {
this.service.updateById(signBoardManagement); this.service.updateById(signBoardManagement);
......
...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api; ...@@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO; import org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO;
import org.jeecg.modules.deviceAsset.dto.SleeperManagementDTO; import org.jeecg.modules.deviceAsset.dto.SleeperManagementDTO;
import org.jeecg.modules.deviceAsset.entity.SignBoardManagement; import org.jeecg.modules.deviceAsset.entity.SignBoardManagement;
...@@ -51,6 +52,7 @@ public class SleeperManagementController extends JeecgController<SleeperManageme ...@@ -51,6 +52,7 @@ public class SleeperManagementController extends JeecgController<SleeperManageme
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody SleeperManagement sleeperManagement) { public Result<String> edit(@RequestBody SleeperManagement sleeperManagement) {
if (ObjectUtil.isEmpty(sleeperManagement.getId())) { if (ObjectUtil.isEmpty(sleeperManagement.getId())) {
sleeperManagement.setId(UUIDGenerator.generate());
this.service.save(sleeperManagement); this.service.save(sleeperManagement);
} else { } else {
this.service.updateById(sleeperManagement); this.service.updateById(sleeperManagement);
......
...@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiParam; ...@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiParam;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO; import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO;
import org.jeecg.modules.deviceAsset.entity.TrackBedManagement; import org.jeecg.modules.deviceAsset.entity.TrackBedManagement;
import org.jeecg.modules.deviceAsset.service.ITrackBedManagementService; import org.jeecg.modules.deviceAsset.service.ITrackBedManagementService;
...@@ -50,6 +51,7 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage ...@@ -50,6 +51,7 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<String> edit(@RequestBody TrackBedManagement trackBedManagement) { public Result<String> edit(@RequestBody TrackBedManagement trackBedManagement) {
if (ObjectUtil.isEmpty(trackBedManagement.getId())) { if (ObjectUtil.isEmpty(trackBedManagement.getId())) {
trackBedManagement.setId(UUIDGenerator.generate());
this.service.save(trackBedManagement); this.service.save(trackBedManagement);
} else { } else {
this.service.updateById(trackBedManagement); this.service.updateById(trackBedManagement);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
t_da_curve_management t1 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
LEFT JOIN t_sn_light_rail t3 ON t2.light_rail_id = t3.id LEFT JOIN t_sn_light_rail t3 ON t2.light_rail_id = t3.id
<where> WHERE t3.status = 1
<if test="dto.curveCode != null and dto.curveCode != ''"> <if test="dto.curveCode != null and dto.curveCode != ''">
AND t1.curve_code like concat('%',#{dto.curveCode},'%') AND t1.curve_code like concat('%',#{dto.curveCode},'%')
</if> </if>
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
<if test="dto.lineAliasId != null and dto.lineAliasId != ''"> <if test="dto.lineAliasId != null and dto.lineAliasId != ''">
AND t1.line_alias_id = #{dto.lineAliasId} AND t1.line_alias_id = #{dto.lineAliasId}
</if> </if>
AND t3.status = 1 order by t1.line_alias_id,t1.curve_mileage_zh
</where>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -27,58 +27,70 @@ ...@@ -27,58 +27,70 @@
</if> </if>
</select> </select>
<select id="getLineSpecialRail" resultType="java.util.Map"> <select id="getLineSpecialRail" resultType="java.util.Map">
SELECT SELECT id,
id,
unitCode, unitCode,
deviceCode,
startMileage, startMileage,
endMileage, endMileage,
type ROUND((startMileage + endMileage) / 2, 3) centerMileage,
FROM type,
( typeName
SELECT FROM (
t1.id, <!--
SELECT t1.id,
t1.unit_code unitCode, t1.unit_code unitCode,
t1.rail_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
1 type,
'钢轨' typeName
FROM t_da_rail_management t1
WHERE t1.line_alias_id = #{lineAliasId}
AND t1.light_rail_id = #{lightRailId}
UNION ALL
-->
SELECT t1.id,
t1.unit_code unitCode,
t1.curve_code deviceCode,
t1.curve_mileage_zh startMileage, t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage, t1.curve_mileage_hz endMileage,
'曲线' type 2 type,
FROM '曲线' typeName
t_da_curve_management t1 FROM t_da_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE WHERE t1.line_alias_id = #{lineAliasId}
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId} AND t2.light_rail_id = #{lightRailId}
UNION ALL UNION ALL
SELECT
t1.id, SELECT t1.id,
t1.unit_code unitCode, t1.unit_code unitCode,
t1.vertical_curve_code deviceCode,
t1.starting_mileage startMileage, t1.starting_mileage startMileage,
t1.end_mileage endMileage, t1.end_mileage endMileage,
'竖曲线' type 3 type,
FROM '竖曲线' typeName
t_da_vertical_curve_management t1 FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE WHERE t1.line_alias_id = #{lineAliasId}
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId} AND t2.light_rail_id = #{lightRailId}
UNION ALL UNION ALL
SELECT
t1.id, SELECT t1.id,
t1.unit_code unitCode, t1.unit_code unitCode,
t1.switch_code deviceCode,
t1.byroad_pre_mileage startMileage, t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage, t1.byroad_end_mileage endMileage,
'道岔' type 4 type,
FROM '道岔' typeName
t_da_switch_management t1 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_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 LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
AND t3.line_alias_id = t1.line_alias_id WHERE t1.line_alias_id = #{lineAliasId}
WHERE
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId} AND t2.light_rail_id = #{lightRailId}
) t ) t
ORDER BY ORDER BY t.startMileage
t.startMileage
</select> </select>
</mapper> </mapper>
...@@ -3,6 +3,7 @@ package org.jeecg.modules.deviceAsset.service.impl; ...@@ -3,6 +3,7 @@ package org.jeecg.modules.deviceAsset.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.CurveManagementDTO; import org.jeecg.modules.deviceAsset.dto.CurveManagementDTO;
import org.jeecg.modules.deviceAsset.entity.CurveManagement; import org.jeecg.modules.deviceAsset.entity.CurveManagement;
import org.jeecg.modules.deviceAsset.mapper.CurveManagementMapper; import org.jeecg.modules.deviceAsset.mapper.CurveManagementMapper;
...@@ -36,6 +37,7 @@ public class CurveManagementServiceImpl extends ServiceImpl<CurveManagementMappe ...@@ -36,6 +37,7 @@ public class CurveManagementServiceImpl extends ServiceImpl<CurveManagementMappe
@Override @Override
public void edit(CurveManagement curveManagement) { public void edit(CurveManagement curveManagement) {
if (ObjectUtil.isEmpty(curveManagement.getId())) { if (ObjectUtil.isEmpty(curveManagement.getId())) {
curveManagement.setId(UUIDGenerator.generate());
String utilCode = UnitCodeUtil.curveUnitCodeUtil(curveManagement.getLineAliasId()); String utilCode = UnitCodeUtil.curveUnitCodeUtil(curveManagement.getLineAliasId());
curveManagement.setUnitCode(utilCode); curveManagement.setUnitCode(utilCode);
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.util.UUIDGenerator; import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.config.AsyncTask;
import org.jeecg.modules.deviceAsset.dto.RailManagementDTO; import org.jeecg.modules.deviceAsset.dto.RailManagementDTO;
import org.jeecg.modules.deviceAsset.entity.RailManagement; import org.jeecg.modules.deviceAsset.entity.RailManagement;
import org.jeecg.modules.deviceAsset.mapper.RailManagementMapper; import org.jeecg.modules.deviceAsset.mapper.RailManagementMapper;
...@@ -46,6 +47,9 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -46,6 +47,9 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Resource @Resource
private SubwaySectionMapper subwaySectionMapper; private SubwaySectionMapper subwaySectionMapper;
@Resource
private AsyncTask asyncTask;
@Override @Override
public Page<RailManagementVO> queryPageList(Page<RailManagementVO> pageData, RailManagementDTO dto) { public Page<RailManagementVO> queryPageList(Page<RailManagementVO> pageData, RailManagementDTO dto) {
return this.baseMapper.queryPageList(pageData, dto); return this.baseMapper.queryPageList(pageData, dto);
...@@ -70,7 +74,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -70,7 +74,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override @Override
public void intelligentGeneration(String lightRailId) { public void intelligentGeneration(String lightRailId) {
// 1.删除整条线的 // 1.删除整条线的
this.lambdaUpdate().eq(RailManagement::getLightRailId,lightRailId).remove(); this.lambdaUpdate().eq(RailManagement::getLightRailId, lightRailId).remove();
// 2.查询当前车站的上下行里程 // 2.查询当前车站的上下行里程
...@@ -119,7 +123,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -119,7 +123,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList.addAll(downRailList); allRailList.addAll(downRailList);
// 异步执行保存
asyncTask.getAsyncExecutor().execute(() -> {
this.saveBatch(allRailList); this.saveBatch(allRailList);
});
} }
/** /**
...@@ -185,7 +193,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -185,7 +193,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
* @param lineAliasId * @param lineAliasId
*/ */
private void generationCore(LightRail lightRail, List<RailManagement> allRailList, String lineAliasId) { private void generationCore(LightRail lightRail, List<RailManagement> allRailList, String lineAliasId) {
List<Map<String, Object>> lineSpecialRailList = this.getLineSpecialRail(lightRail.getId(),lineAliasId); List<Map<String, Object>> lineSpecialRailList = this.getLineSpecialRail(lightRail.getId(), lineAliasId);
BigDecimal lineStartMileage = BigDecimal.ZERO; BigDecimal lineStartMileage = BigDecimal.ZERO;
BigDecimal endMileage = lightRail.getUpLineMileage(); BigDecimal endMileage = lightRail.getUpLineMileage();
...@@ -269,6 +277,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper, ...@@ -269,6 +277,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override @Override
public List<Map<String, Object>> getLineSpecialRail(String lightRailId, String lineAliasId) { public List<Map<String, Object>> getLineSpecialRail(String lightRailId, String lineAliasId) {
return this.baseMapper.getLineSpecialRail(lightRailId,lineAliasId); return this.baseMapper.getLineSpecialRail(lightRailId, lineAliasId);
} }
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.dto.PageSearch; import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.SwitchManagementQueryDTO; import org.jeecg.modules.deviceAsset.dto.SwitchManagementQueryDTO;
import org.jeecg.modules.deviceAsset.entity.SwitchManagement; import org.jeecg.modules.deviceAsset.entity.SwitchManagement;
import org.jeecg.modules.deviceAsset.mapper.SwitchManagementMapper; import org.jeecg.modules.deviceAsset.mapper.SwitchManagementMapper;
...@@ -35,6 +36,7 @@ public class SwitchManagementServiceImpl extends ServiceImpl<SwitchManagementMap ...@@ -35,6 +36,7 @@ public class SwitchManagementServiceImpl extends ServiceImpl<SwitchManagementMap
@Override @Override
public void edit(SwitchManagement switchManagement) { public void edit(SwitchManagement switchManagement) {
if (ObjectUtil.isEmpty(switchManagement.getId())) { if (ObjectUtil.isEmpty(switchManagement.getId())) {
switchManagement.setId(UUIDGenerator.generate());
String utilCode = UnitCodeUtil.switchUnitCodeUtil(switchManagement.getLineAliasId()); String utilCode = UnitCodeUtil.switchUnitCodeUtil(switchManagement.getLineAliasId());
switchManagement.setUnitCode(utilCode); switchManagement.setUnitCode(utilCode);
this.save(switchManagement); this.save(switchManagement);
......
...@@ -2,6 +2,7 @@ package org.jeecg.modules.deviceAsset.service.impl; ...@@ -2,6 +2,7 @@ package org.jeecg.modules.deviceAsset.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.VerticalCurveManagementDTO; import org.jeecg.modules.deviceAsset.dto.VerticalCurveManagementDTO;
import org.jeecg.modules.deviceAsset.entity.VerticalCurveManagement; import org.jeecg.modules.deviceAsset.entity.VerticalCurveManagement;
import org.jeecg.modules.deviceAsset.mapper.VerticalCurveManagementMapper; import org.jeecg.modules.deviceAsset.mapper.VerticalCurveManagementMapper;
...@@ -30,6 +31,7 @@ public class VerticalCurveManagementServiceImpl extends ServiceImpl<VerticalCurv ...@@ -30,6 +31,7 @@ public class VerticalCurveManagementServiceImpl extends ServiceImpl<VerticalCurv
@Override @Override
public void edit(VerticalCurveManagement verticalCurveManagement) { public void edit(VerticalCurveManagement verticalCurveManagement) {
if (ObjectUtil.isEmpty(verticalCurveManagement.getId())) { if (ObjectUtil.isEmpty(verticalCurveManagement.getId())) {
verticalCurveManagement.setId(UUIDGenerator.generate());
String utilCode = UnitCodeUtil.verticalCurveUnitCodeUtil(verticalCurveManagement.getLineAliasId()); String utilCode = UnitCodeUtil.verticalCurveUnitCodeUtil(verticalCurveManagement.getLineAliasId());
verticalCurveManagement.setUnitCode(utilCode); verticalCurveManagement.setUnitCode(utilCode);
this.save(verticalCurveManagement); this.save(verticalCurveManagement);
......
...@@ -133,7 +133,6 @@ public class AnalysisBatchUnitDevice implements Serializable { ...@@ -133,7 +133,6 @@ public class AnalysisBatchUnitDevice implements Serializable {
@TableField("add_device_check_score") @TableField("add_device_check_score")
private BigDecimal addDeviceCheckScore; private BigDecimal addDeviceCheckScore;
@ApiModelProperty("备注") @ApiModelProperty("备注")
@TableField("remark") @TableField("remark")
private String remark; private String remark;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
deviceCode, deviceCode,
startMileage, startMileage,
endMileage, endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
type, type,
typeName typeName
FROM (SELECT t1.id, FROM (SELECT t1.id,
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
2 type, 2 type,
'曲线' typeName '曲线' typeName
FROM t_da_curve_management t1 FROM t_da_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId} WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId} AND t2.light_rail_id = #{lightRailId}
...@@ -45,10 +46,12 @@ ...@@ -45,10 +46,12 @@
3 type, 3 type,
'竖曲线' typeName '竖曲线' typeName
FROM t_da_vertical_curve_management t1 FROM t_da_vertical_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id LEFT JOIN t_sn_subway_section t2 ON t1.section_id = t2.id
WHERE t1.line_alias_id = #{lineAliasId} WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId} AND t2.light_rail_id = #{lightRailId}
UNION ALL UNION ALL
SELECT t1.id, SELECT t1.id,
t1.unit_code unitCode, t1.unit_code unitCode,
t1.switch_code deviceCode, t1.switch_code deviceCode,
...@@ -58,10 +61,10 @@ ...@@ -58,10 +61,10 @@
'道岔' typeName '道岔' typeName
FROM t_da_switch_management t1 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_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 LEFT JOIN t_sn_subway_section t3 ON t2.section_id = t3.id AND t3.line_alias_id = t1.line_alias_id
AND t3.line_alias_id = t1.line_alias_id
WHERE t1.line_alias_id = #{lineAliasId} WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}) t AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY t.startMileage ORDER BY t.startMileage
</select> </select>
</mapper> </mapper>
...@@ -62,17 +62,18 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe ...@@ -62,17 +62,18 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
return Result.OK("操作成功"); return Result.OK("操作成功");
} }
@AutoLog(value = "维修作业管理-作业计划批次管理-超限页面新增")
@ApiOperation(value = "维修作业管理-作业计划批次管理-超限页面新增", notes = "维修作业管理-作业计划批次管理-超限页面新增")
@PostMapping(value = "/batchSaveRecord")
public Result<String> batchSaveRecord(@RequestBody AnalysisBatchSaveDTO dto) {
@AutoLog(value = "维修作业管理-作业计划批次管理-维修作业管理页面更新") this.service.batchSaveRecord(dto);
@ApiOperation(value = "维修作业管理-作业计划批次管理-维修作业管理页面更新", notes = "维修作业管理-作业计划批次管理-维修作业管理页面更新")
@PostMapping(value = "/updateRecord")
public Result<String> updateRecord(@RequestBody WorkBatchSaveOrUpdateDTO dto) {
this.service.updateRecord(dto);
return Result.OK("操作成功"); return Result.OK("操作成功");
} }
@AutoLog(value = "维修作业管理-作业计划批次管理-通过id删除") @AutoLog(value = "维修作业管理-作业计划批次管理-通过id删除")
@ApiOperation(value = "维修作业管理-作业计划批次管理-通过id删除", notes = "维修作业管理-作业计划批次管理-通过id删除") @ApiOperation(value = "维修作业管理-作业计划批次管理-通过id删除", notes = "维修作业管理-作业计划批次管理-通过id删除")
@GetMapping(value = "/deleteRecord") @GetMapping(value = "/deleteRecord")
...@@ -83,25 +84,11 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe ...@@ -83,25 +84,11 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
@AutoLog(value = "维修作业管理-作业计划批次管理-获取里程单元设备") @AutoLog(value = "维修作业管理-作业计划批次管理-获取里程单元设备")
@ApiOperation(value = "维修作业管理-作业计划批次管理-获取里程单元设备", notes = "维修作业管理-作业计划批次管理-获取里程单元设备") @ApiOperation(value = "维修作业管理-作业计划批次管理-获取里程单元设备", notes = "维修作业管理-作业计划批次管理-获取里程单元设备")
@GetMapping(value = "/getUnitDeviceList") @PostMapping(value = "/getUnitDeviceList")
public Result<List<Map<String, Object>>> getUnitDeviceList(@RequestBody UnitDeviceDTO dto) { public Result<List<Map<String, Object>>> getUnitDeviceList(@RequestBody UnitDeviceDTO dto) {
List<Map<String, Object>> records = this.service.getUnitDeviceList(dto); List<Map<String, Object>> records = this.service.getUnitDeviceList(dto);
return Result.OK(records); return Result.OK(records);
} }
@AutoLog(value = "维修作业管理-作业计划批次管理-维修作业管理页面详情新增")
@ApiOperation(value = "维修作业管理-作业计划批次管理-维修作业管理页面新增", notes = "维修作业管理-作业计划批次管理-维修作业管理页面新增")
@PostMapping(value = "/saveDetailRecord")
public Result<String> saveDetailRecord(@RequestBody WorkBatchDetailDTO dto) {
this.service.saveDetailRecord(dto);
return Result.OK("操作成功");
}
} }
package org.jeecg.modules.maintenanceWork.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
* 维修作业管理-作业计划批次管理表
* </p>
*
* @author hkl
* @since 2023-08-09
*/
@Data
@ApiModel(value = "PageSaveOrUpdateDTO对象", description = "维修作业管理-页面来源保存或更新dto")
public class AnalysisBatchSaveDTO {
private static final long serialVersionUID = 1L;
private String id;
@ApiModelProperty("作业计划批次号")
private String workBatchCode;
@ApiModelProperty("所属线路id")
private String lightRailId;
@ApiModelProperty("所属线路名称")
private String lightRailName;
@ApiModelProperty("所属线别id")
private String lineAliasId;
@ApiModelProperty("所属线别名称")
private String lineAliasName;
@ApiModelProperty("作业起始里程")
private BigDecimal workStartingMileage;
@ApiModelProperty("作业终点里程")
private BigDecimal workEndMileage;
@ApiModelProperty("作业终止时间")
private Date workStartTime;
@ApiModelProperty("作业终止时间")
private Date workEndTime;
@ApiModelProperty("作业班组")
private String team;
@ApiModelProperty("作业状态 0-未作业 1-已作业")
private Integer workStatus;
@ApiModelProperty("来源 1-一键全部派工 2-一键失格派工")
private Integer saveType;
@ApiModelProperty("分析批次id")
private String analysisBatchId;
}
...@@ -9,12 +9,18 @@ import java.math.BigDecimal; ...@@ -9,12 +9,18 @@ import java.math.BigDecimal;
@Data @Data
@ApiModel(value = "UnitDeviceDTO对象", description = "fsf1") @ApiModel(value = "UnitDeviceDTO对象", description = "fsf1")
public class UnitDeviceDTO { public class UnitDeviceDTO {
@ApiModelProperty("作业计划批次号") @ApiModelProperty("车站id")
private String lightRailId; private String lightRailId;
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("线别id")
private String lineAliasId; private String lineAliasId;
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("开始里程")
private BigDecimal startMileage; private BigDecimal startMileage;
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("结束里程")
private BigDecimal endMileage; private BigDecimal endMileage;
@ApiModelProperty("设备类型 1-钢轨 2-曲线 3-竖曲线 4-道岔")
private String type;
} }
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* <p> * <p>
...@@ -58,4 +59,7 @@ public class WorkBatchSaveOrUpdateDTO { ...@@ -58,4 +59,7 @@ public class WorkBatchSaveOrUpdateDTO {
@ApiModelProperty("作业状态 0-未作业 1-已作业") @ApiModelProperty("作业状态 0-未作业 1-已作业")
private Integer workStatus; private Integer workStatus;
@ApiModelProperty("单元设备列表")
private List<DispatchDTO> unitDeviceList;
} }
...@@ -23,13 +23,13 @@ public interface IWorkBatchService extends IService<WorkBatch> { ...@@ -23,13 +23,13 @@ public interface IWorkBatchService extends IService<WorkBatch> {
void saveRecord(WorkBatchSaveOrUpdateDTO dto); void saveRecord(WorkBatchSaveOrUpdateDTO dto);
void updateRecord(WorkBatchSaveOrUpdateDTO dto);
void deleteRecord(String id); void deleteRecord(String id);
void transfiniteSaveRecord(WorkBatchTransfiniteSaveDTO dto); void transfiniteSaveRecord(WorkBatchTransfiniteSaveDTO dto);
void saveDetailRecord(WorkBatchDetailDTO dto);
List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto); List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto);
void batchSaveRecord(AnalysisBatchSaveDTO dto);
} }
...@@ -2,11 +2,14 @@ package org.jeecg.modules.maintenanceWork.service.impl; ...@@ -2,11 +2,14 @@ package org.jeecg.modules.maintenanceWork.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.util.UUIDGenerator; 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.AnalysisAlgorithmMapper;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceMapper;
import org.jeecg.modules.maintenanceWork.dto.*; import org.jeecg.modules.maintenanceWork.dto.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch; import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail; import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
...@@ -40,6 +43,9 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -40,6 +43,9 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Resource @Resource
private AnalysisAlgorithmMapper analysisAlgorithmMapper; private AnalysisAlgorithmMapper analysisAlgorithmMapper;
@Resource
private AnalysisBatchUnitDeviceMapper analysisBatchUnitDeviceMapper;
@Override @Override
public Page<WorkBatchVO> listRecord(Page<WorkBatchVO> pageData, WorkBatchDTO dto) { public Page<WorkBatchVO> listRecord(Page<WorkBatchVO> pageData, WorkBatchDTO dto) {
return this.baseMapper.listRecord(pageData, dto); return this.baseMapper.listRecord(pageData, dto);
...@@ -47,15 +53,40 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -47,15 +53,40 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Override @Override
public void saveRecord(WorkBatchSaveOrUpdateDTO dto) { public void saveRecord(WorkBatchSaveOrUpdateDTO dto) {
// 保存主信息
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class); WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
if (ObjectUtil.isEmpty(dto.getId())) {
workBatch.setId(UUIDGenerator.generate()); workBatch.setId(UUIDGenerator.generate());
this.save(workBatch); workBatch.setWorkStatus(9);
} }
@Override this.saveOrUpdate(workBatch);
public void updateRecord(WorkBatchSaveOrUpdateDTO dto) {
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
this.updateById(workBatch); // 保证明细信息
// 先删除
LambdaQueryWrapper<WorkBatchDetail> delWrapper = Wrappers.lambdaQuery();
delWrapper.eq(WorkBatchDetail::getWorkBatchId, dto.getId());
workBatchDetailMapper.delete(delWrapper);
List<DispatchDTO> transfiniteList = dto.getUnitDeviceList();
for (DispatchDTO dispatchDTO : transfiniteList) {
WorkBatchDetail workBatchDetail = new WorkBatchDetail();
workBatchDetail.setId(UUIDGenerator.generate());
workBatchDetail.setWorkBatchId(dto.getId());
workBatchDetail.setWorkBatchCode(dto.getWorkBatchCode());
workBatchDetail.setUnitId(dispatchDTO.getUnitId());
workBatchDetail.setUnitCode(dispatchDTO.getUnitCode());
workBatchDetail.setUnitType(dispatchDTO.getUnitType());
workBatchDetail.setUnitTypeName(dispatchDTO.getUnitTypeName());
workBatchDetail.setUnitDeviceCode(dispatchDTO.getUnitDeviceCode());
workBatchDetail.setUnitEndMileage(dispatchDTO.getUnitStartingMileage());
workBatchDetail.setUnitEndMileage(dispatchDTO.getUnitEndMileage());
workBatchDetail.setUnitCenterMileage(dispatchDTO.getUnitCenterMileage());
workBatchDetail.setUnitScore(dispatchDTO.getUnitScore());
workBatchDetail.setUnitScoreLevel(dispatchDTO.getUnitScoreLevel());
workBatchDetail.setUnitScoreLevelStr(dispatchDTO.getUnitScoreLevelStr());
workBatchDetailMapper.insert(workBatchDetail);
}
} }
@Override @Override
...@@ -99,43 +130,13 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -99,43 +130,13 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
} }
@Override
public void saveDetailRecord(WorkBatchDetailDTO dto) {
// 先删除
LambdaQueryWrapper<WorkBatchDetail> delWrapper = Wrappers.lambdaQuery();
delWrapper.eq(WorkBatchDetail::getWorkBatchId, dto.getWorkBatchId());
workBatchDetailMapper.delete(delWrapper);
List<DispatchDTO> transfiniteList = dto.getUnitDeviceList();
for (DispatchDTO dispatchDTO : transfiniteList) {
WorkBatchDetail workBatchDetail = new WorkBatchDetail();
workBatchDetail.setId(UUIDGenerator.generate());
workBatchDetail.setWorkBatchId(dto.getWorkBatchId());
workBatchDetail.setWorkBatchCode(dto.getWorkBatchCode());
workBatchDetail.setUnitId(dispatchDTO.getUnitId());
workBatchDetail.setUnitCode(dispatchDTO.getUnitCode());
workBatchDetail.setUnitType(dispatchDTO.getUnitType());
workBatchDetail.setUnitTypeName(dispatchDTO.getUnitTypeName());
workBatchDetail.setUnitDeviceCode(dispatchDTO.getUnitDeviceCode());
workBatchDetail.setUnitEndMileage(dispatchDTO.getUnitStartingMileage());
workBatchDetail.setUnitEndMileage(dispatchDTO.getUnitEndMileage());
workBatchDetail.setUnitCenterMileage(dispatchDTO.getUnitCenterMileage());
workBatchDetail.setUnitScore(dispatchDTO.getUnitScore());
workBatchDetail.setUnitScoreLevel(dispatchDTO.getUnitScoreLevel());
workBatchDetail.setUnitScoreLevelStr(dispatchDTO.getUnitScoreLevelStr());
workBatchDetailMapper.insert(workBatchDetail);
}
}
@Override @Override
public List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto) { public List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto) {
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
List<Map<String, Object>> unitDeviceList = analysisAlgorithmMapper.getUnitDevice(dto.getLightRailId(), dto.getLineAliasId()); List<Map<String, Object>> unitDeviceList = analysisAlgorithmMapper.getUnitDevice(dto.getLightRailId(), dto.getLineAliasId());
for (Map<String, Object> unitDevice : unitDeviceList) { for (Map<String, Object> unitDevice : unitDeviceList) {
BigDecimal startMileage = Convert.toBigDecimal(unitDevice.get("startMileage")); BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
BigDecimal endMileage = Convert.toBigDecimal(unitDevice.get("endMileage"));
BigDecimal centerMileage = startMileage.add(endMileage).divide(new BigDecimal("2"), 3, RoundingMode.HALF_UP);
if (dto.getStartMileage().compareTo(centerMileage) <= 0 && dto.getEndMileage().compareTo(centerMileage) > 0) { if (dto.getStartMileage().compareTo(centerMileage) <= 0 && dto.getEndMileage().compareTo(centerMileage) > 0) {
resultList.add(unitDevice); resultList.add(unitDevice);
} }
...@@ -143,4 +144,39 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch ...@@ -143,4 +144,39 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
return resultList; return resultList;
} }
@Override
public void batchSaveRecord(AnalysisBatchSaveDTO dto) {
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
workBatch.setId(UUIDGenerator.generate());
workBatch.setWorkStatus(9); // 9-已作业
workBatch.setSource(2); // 超限页面
this.save(workBatch);
// 2.查询
LambdaQueryWrapper<AnalysisBatchUnitDevice> unitDeviceWrapper = Wrappers.lambdaQuery();
if (dto.getSaveType() == 2) {
unitDeviceWrapper.eq(AnalysisBatchUnitDevice::getUnitScoreLevel, 3);
}
List<AnalysisBatchUnitDevice> unitDevices = analysisBatchUnitDeviceMapper.selectList(unitDeviceWrapper);
for (AnalysisBatchUnitDevice unitDevice : unitDevices) {
WorkBatchDetail workBatchDetail = new WorkBatchDetail();
workBatchDetail.setId(UUIDGenerator.generate());
workBatchDetail.setWorkBatchId(workBatch.getId());
workBatchDetail.setWorkBatchCode(workBatch.getWorkBatchCode());
workBatchDetail.setUnitId(unitDevice.getUnitId());
workBatchDetail.setUnitCode(unitDevice.getUnitCode());
workBatchDetail.setUnitType(unitDevice.getUnitType());
workBatchDetail.setUnitTypeName(unitDevice.getUnitTypeName());
workBatchDetail.setUnitDeviceCode(unitDevice.getUnitDeviceCode());
workBatchDetail.setUnitEndMileage(unitDevice.getUnitStartingMileage());
workBatchDetail.setUnitEndMileage(unitDevice.getUnitEndMileage());
workBatchDetail.setUnitCenterMileage(unitDevice.getUnitCenterMileage());
workBatchDetail.setUnitScore(unitDevice.getUnitScore());
workBatchDetail.setUnitScoreLevel(unitDevice.getUnitScoreLevel());
workBatchDetail.setUnitScoreLevelStr(unitDevice.getUnitScoreLevelStr());
workBatchDetailMapper.insert(workBatchDetail);
}
}
} }
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