Commit 9234c3b2 authored by hkl's avatar hkl

feat:1.调整程序

parent 3cc309c3
......@@ -30,9 +30,11 @@ public class AsyncTask implements AsyncConfigurer {
public Executor getAsyncExecutor() {
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);
// 等待任务在关机时完成-- 表明等待所有线程执行完
......
......@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiOperation;
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.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO;
import org.jeecg.modules.deviceAsset.entity.FastenerManagement;
import org.jeecg.modules.deviceAsset.service.IFastenerManagementService;
......@@ -46,6 +47,7 @@ public class FastenerManagementController extends JeecgController<FastenerManage
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody FastenerManagement fastenerManagement) {
if (ObjectUtil.isEmpty(fastenerManagement.getId())) {
fastenerManagement.setId(UUIDGenerator.generate());
this.service.save(fastenerManagement);
} else {
this.service.updateById(fastenerManagement);
......
......@@ -8,6 +8,7 @@ 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.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.FastenerManagementDTO;
import org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO;
import org.jeecg.modules.deviceAsset.entity.FastenerManagement;
......@@ -50,6 +51,7 @@ public class SignBoardManagementController extends JeecgController<SignBoardMana
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody SignBoardManagement signBoardManagement) {
if (ObjectUtil.isEmpty(signBoardManagement.getId())) {
signBoardManagement.setId(UUIDGenerator.generate());
this.service.save(signBoardManagement);
} else {
this.service.updateById(signBoardManagement);
......
......@@ -8,6 +8,7 @@ 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.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.SignBoardManagementDTO;
import org.jeecg.modules.deviceAsset.dto.SleeperManagementDTO;
import org.jeecg.modules.deviceAsset.entity.SignBoardManagement;
......@@ -51,6 +52,7 @@ public class SleeperManagementController extends JeecgController<SleeperManageme
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody SleeperManagement sleeperManagement) {
if (ObjectUtil.isEmpty(sleeperManagement.getId())) {
sleeperManagement.setId(UUIDGenerator.generate());
this.service.save(sleeperManagement);
} else {
this.service.updateById(sleeperManagement);
......
......@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiParam;
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.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.TrackBedManagementDTO;
import org.jeecg.modules.deviceAsset.entity.TrackBedManagement;
import org.jeecg.modules.deviceAsset.service.ITrackBedManagementService;
......@@ -50,6 +51,7 @@ public class TrackBedManagementController extends JeecgController<TrackBedManage
@PostMapping(value = "/edit")
public Result<String> edit(@RequestBody TrackBedManagement trackBedManagement) {
if (ObjectUtil.isEmpty(trackBedManagement.getId())) {
trackBedManagement.setId(UUIDGenerator.generate());
this.service.save(trackBedManagement);
} else {
this.service.updateById(trackBedManagement);
......
......@@ -5,29 +5,28 @@
<select id="queryPageList" resultType="org.jeecg.modules.deviceAsset.vo.CurveManagementQueryVO">
SELECT
t1.*,
t2.light_rail_name,
t2.light_rail_id,
t2.section_name,
(SELECT line_alias_name FROM t_sn_line_alias WHERE id = t1.line_alias_id limit 1) line_alias_name
t1.*,
t2.light_rail_name,
t2.light_rail_id,
t2.section_name,
(SELECT line_alias_name FROM t_sn_line_alias WHERE id = t1.line_alias_id limit 1) line_alias_name
FROM
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_light_rail t3 ON t2.light_rail_id = t3.id
<where>
<if test="dto.curveCode != null and dto.curveCode != ''">
AND t1.curve_code like concat('%',#{dto.curveCode},'%')
</if>
<if test="dto.sectionId != null and dto.sectionId != ''">
AND t1.section_id = #{dto.sectionId}
</if>
<if test="dto.lightRailId != null and dto.lightRailId != ''">
AND t2.light_rail_id = #{dto.lightRailId}
</if>
<if test="dto.lineAliasId != null and dto.lineAliasId != ''">
AND t1.line_alias_id = #{dto.lineAliasId}
</if>
AND t3.status = 1
</where>
WHERE t3.status = 1
<if test="dto.curveCode != null and dto.curveCode != ''">
AND t1.curve_code like concat('%',#{dto.curveCode},'%')
</if>
<if test="dto.sectionId != null and dto.sectionId != ''">
AND t1.section_id = #{dto.sectionId}
</if>
<if test="dto.lightRailId != null and dto.lightRailId != ''">
AND t2.light_rail_id = #{dto.lightRailId}
</if>
<if test="dto.lineAliasId != null and dto.lineAliasId != ''">
AND t1.line_alias_id = #{dto.lineAliasId}
</if>
order by t1.line_alias_id,t1.curve_mileage_zh
</select>
</mapper>
\ No newline at end of file
......@@ -27,58 +27,70 @@
</if>
</select>
<select id="getLineSpecialRail" resultType="java.util.Map">
SELECT
id,
unitCode,
startMileage,
endMileage,
type
FROM
(
SELECT
t1.id,
t1.unit_code unitCode,
t1.curve_mileage_zh startMileage,
t1.curve_mileage_hz endMileage,
'曲线' type
FROM
t_da_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id
WHERE
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
SELECT id,
unitCode,
deviceCode,
startMileage,
endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
type,
typeName
FROM (
<!--
SELECT t1.id,
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_hz endMileage,
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 = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.vertical_curve_code deviceCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
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 = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
SELECT
t1.id,
t1.unit_code unitCode,
t1.starting_mileage startMileage,
t1.end_mileage endMileage,
'竖曲线' type
FROM
t_da_vertical_curve_management t1
LEFT JOIN t_sn_train_station t2 ON t1.section_id = t1.id
WHERE
t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
UNION ALL
SELECT
t1.id,
t1.unit_code unitCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
'道岔' type
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 = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY
t.startMileage
SELECT t1.id,
t1.unit_code unitCode,
t1.switch_code deviceCode,
t1.byroad_pre_mileage startMileage,
t1.byroad_end_mileage endMileage,
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 = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY t.startMileage
</select>
</mapper>
......@@ -3,6 +3,7 @@ package org.jeecg.modules.deviceAsset.service.impl;
import cn.hutool.core.util.ObjectUtil;
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.deviceAsset.dto.CurveManagementDTO;
import org.jeecg.modules.deviceAsset.entity.CurveManagement;
import org.jeecg.modules.deviceAsset.mapper.CurveManagementMapper;
......@@ -36,6 +37,7 @@ public class CurveManagementServiceImpl extends ServiceImpl<CurveManagementMappe
@Override
public void edit(CurveManagement curveManagement) {
if (ObjectUtil.isEmpty(curveManagement.getId())) {
curveManagement.setId(UUIDGenerator.generate());
String utilCode = UnitCodeUtil.curveUnitCodeUtil(curveManagement.getLineAliasId());
curveManagement.setUnitCode(utilCode);
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.config.AsyncTask;
import org.jeecg.modules.deviceAsset.dto.RailManagementDTO;
import org.jeecg.modules.deviceAsset.entity.RailManagement;
import org.jeecg.modules.deviceAsset.mapper.RailManagementMapper;
......@@ -46,6 +47,9 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Resource
private SubwaySectionMapper subwaySectionMapper;
@Resource
private AsyncTask asyncTask;
@Override
public Page<RailManagementVO> queryPageList(Page<RailManagementVO> pageData, RailManagementDTO dto) {
return this.baseMapper.queryPageList(pageData, dto);
......@@ -70,7 +74,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override
public void intelligentGeneration(String lightRailId) {
// 1.删除整条线的
this.lambdaUpdate().eq(RailManagement::getLightRailId,lightRailId).remove();
this.lambdaUpdate().eq(RailManagement::getLightRailId, lightRailId).remove();
// 2.查询当前车站的上下行里程
......@@ -119,7 +123,11 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
allRailList.addAll(downRailList);
this.saveBatch(allRailList);
// 异步执行保存
asyncTask.getAsyncExecutor().execute(() -> {
this.saveBatch(allRailList);
});
}
/**
......@@ -185,7 +193,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
* @param 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 endMileage = lightRail.getUpLineMileage();
......@@ -269,6 +277,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
@Override
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;
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.common.util.UUIDGenerator;
import org.jeecg.modules.deviceAsset.dto.SwitchManagementQueryDTO;
import org.jeecg.modules.deviceAsset.entity.SwitchManagement;
import org.jeecg.modules.deviceAsset.mapper.SwitchManagementMapper;
......@@ -35,6 +36,7 @@ public class SwitchManagementServiceImpl extends ServiceImpl<SwitchManagementMap
@Override
public void edit(SwitchManagement switchManagement) {
if (ObjectUtil.isEmpty(switchManagement.getId())) {
switchManagement.setId(UUIDGenerator.generate());
String utilCode = UnitCodeUtil.switchUnitCodeUtil(switchManagement.getLineAliasId());
switchManagement.setUnitCode(utilCode);
this.save(switchManagement);
......
......@@ -2,6 +2,7 @@ package org.jeecg.modules.deviceAsset.service.impl;
import cn.hutool.core.util.ObjectUtil;
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.entity.VerticalCurveManagement;
import org.jeecg.modules.deviceAsset.mapper.VerticalCurveManagementMapper;
......@@ -30,6 +31,7 @@ public class VerticalCurveManagementServiceImpl extends ServiceImpl<VerticalCurv
@Override
public void edit(VerticalCurveManagement verticalCurveManagement) {
if (ObjectUtil.isEmpty(verticalCurveManagement.getId())) {
verticalCurveManagement.setId(UUIDGenerator.generate());
String utilCode = UnitCodeUtil.verticalCurveUnitCodeUtil(verticalCurveManagement.getLineAliasId());
verticalCurveManagement.setUnitCode(utilCode);
this.save(verticalCurveManagement);
......
......@@ -133,7 +133,6 @@ public class AnalysisBatchUnitDevice implements Serializable {
@TableField("add_device_check_score")
private BigDecimal addDeviceCheckScore;
@ApiModelProperty("备注")
@TableField("remark")
private String remark;
......
......@@ -8,6 +8,7 @@
deviceCode,
startMileage,
endMileage,
ROUND((startMileage + endMileage) / 2, 3) centerMileage,
type,
typeName
FROM (SELECT t1.id,
......@@ -31,7 +32,7 @@
2 type,
'曲线' typeName
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}
AND t2.light_rail_id = #{lightRailId}
......@@ -45,10 +46,12 @@
3 type,
'竖曲线' typeName
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}
AND t2.light_rail_id = #{lightRailId}
UNION ALL
SELECT t1.id,
t1.unit_code unitCode,
t1.switch_code deviceCode,
......@@ -57,11 +60,11 @@
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
AND t2.light_rail_id = #{lightRailId}
) t
ORDER BY t.startMileage
</select>
</mapper>
......@@ -62,17 +62,18 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
return Result.OK("操作成功");
}
@AutoLog(value = "维修作业管理-作业计划批次管理-超限页面新增")
@ApiOperation(value = "维修作业管理-作业计划批次管理-超限页面新增", notes = "维修作业管理-作业计划批次管理-超限页面新增")
@PostMapping(value = "/batchSaveRecord")
public Result<String> batchSaveRecord(@RequestBody AnalysisBatchSaveDTO dto) {
@AutoLog(value = "维修作业管理-作业计划批次管理-维修作业管理页面更新")
@ApiOperation(value = "维修作业管理-作业计划批次管理-维修作业管理页面更新", notes = "维修作业管理-作业计划批次管理-维修作业管理页面更新")
@PostMapping(value = "/updateRecord")
public Result<String> updateRecord(@RequestBody WorkBatchSaveOrUpdateDTO dto) {
this.service.batchSaveRecord(dto);
this.service.updateRecord(dto);
return Result.OK("操作成功");
}
@AutoLog(value = "维修作业管理-作业计划批次管理-通过id删除")
@ApiOperation(value = "维修作业管理-作业计划批次管理-通过id删除", notes = "维修作业管理-作业计划批次管理-通过id删除")
@GetMapping(value = "/deleteRecord")
......@@ -83,25 +84,11 @@ public class WorkBatchController extends JeecgController<WorkBatch, IWorkBatchSe
@AutoLog(value = "维修作业管理-作业计划批次管理-获取里程单元设备")
@ApiOperation(value = "维修作业管理-作业计划批次管理-获取里程单元设备", notes = "维修作业管理-作业计划批次管理-获取里程单元设备")
@GetMapping(value = "/getUnitDeviceList")
@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);
}
@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;
@Data
@ApiModel(value = "UnitDeviceDTO对象", description = "fsf1")
public class UnitDeviceDTO {
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("车站id")
private String lightRailId;
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("线别id")
private String lineAliasId;
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("开始里程")
private BigDecimal startMileage;
@ApiModelProperty("作业计划批次号")
@ApiModelProperty("结束里程")
private BigDecimal endMileage;
@ApiModelProperty("设备类型 1-钢轨 2-曲线 3-竖曲线 4-道岔")
private String type;
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -58,4 +59,7 @@ public class WorkBatchSaveOrUpdateDTO {
@ApiModelProperty("作业状态 0-未作业 1-已作业")
private Integer workStatus;
@ApiModelProperty("单元设备列表")
private List<DispatchDTO> unitDeviceList;
}
......@@ -23,13 +23,13 @@ public interface IWorkBatchService extends IService<WorkBatch> {
void saveRecord(WorkBatchSaveOrUpdateDTO dto);
void updateRecord(WorkBatchSaveOrUpdateDTO dto);
void deleteRecord(String id);
void transfiniteSaveRecord(WorkBatchTransfiniteSaveDTO dto);
void saveDetailRecord(WorkBatchDetailDTO dto);
List<Map<String, Object>> getUnitDeviceList(UnitDeviceDTO dto);
void batchSaveRecord(AnalysisBatchSaveDTO dto);
}
......@@ -2,11 +2,14 @@ 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 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;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
......@@ -40,6 +43,9 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Resource
private AnalysisAlgorithmMapper analysisAlgorithmMapper;
@Resource
private AnalysisBatchUnitDeviceMapper analysisBatchUnitDeviceMapper;
@Override
public Page<WorkBatchVO> listRecord(Page<WorkBatchVO> pageData, WorkBatchDTO dto) {
return this.baseMapper.listRecord(pageData, dto);
......@@ -47,15 +53,40 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Override
public void saveRecord(WorkBatchSaveOrUpdateDTO dto) {
// 保存主信息
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
workBatch.setId(UUIDGenerator.generate());
this.save(workBatch);
}
if (ObjectUtil.isEmpty(dto.getId())) {
workBatch.setId(UUIDGenerator.generate());
workBatch.setWorkStatus(9);
}
@Override
public void updateRecord(WorkBatchSaveOrUpdateDTO dto) {
WorkBatch workBatch = BeanUtil.copyProperties(dto, WorkBatch.class);
this.updateById(workBatch);
this.saveOrUpdate(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
......@@ -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
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 startMileage = Convert.toBigDecimal(unitDevice.get("startMileage"));
BigDecimal endMileage = Convert.toBigDecimal(unitDevice.get("endMileage"));
BigDecimal centerMileage = startMileage.add(endMileage).divide(new BigDecimal("2"), 3, RoundingMode.HALF_UP);
BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
if (dto.getStartMileage().compareTo(centerMileage) <= 0 && dto.getEndMileage().compareTo(centerMileage) > 0) {
resultList.add(unitDevice);
}
......@@ -143,4 +144,39 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
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