Commit 6c121853 authored by hkl's avatar hkl

feat: 1.轨检仪器bug修改

parent 6ca0da31
......@@ -51,11 +51,11 @@ public class RailInspectionEquipmentItem implements Serializable {
@TableField("rail_inspection_equipment_id")
private String railInspectionEquipmentId;
@ApiModelProperty("检查起始里程(m)")
@ApiModelProperty("检查起始里程(km)")
@TableField("course_starting_mileage")
private BigDecimal courseStartingMileage;
@ApiModelProperty("检查终点里程(m)")
@ApiModelProperty("检查终点里程(km)")
@TableField("course_end_mileage")
private BigDecimal courseEndMileage;
......
......@@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
......@@ -93,6 +94,8 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
int skipRow = analysisItemDetail(i, titleHeader, item.getId(), rowRecords, itemDetails);
i = i + skipRow;
} else {
i++;
}
}
......@@ -127,9 +130,12 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
private int analysisItemDetail(int rows, String titleHeader, String itemId, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) {
// 解析检查项目:3行:跳过2行不解析
// 解析检查项目:1行:跳过2行不解析
List<Object> checkItems = rowRecords.get(rows + 2);
// 解析规矩轨距:1行
// 解析测点:1行
List<Object> measurePoints = rowRecords.get(rows + 3);
// 解析轨距:1行
List<Object> trackGauges = rowRecords.get(rows + 4);
// 解析水平 :1行
List<Object> levels = rowRecords.get(rows + 5);
......@@ -139,37 +145,36 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
List<Object> others = rowRecords.get(rows + 7);
int measurePoint = 1;
int sort = 1;
for (int i = 2; i < 32; i++) {
if (measurePoint % 8 == 0) {
measurePoint = 1;
i = i + 2;
// 测点:测点8和9不保留
Integer measurePoint = Convert.toInt(measurePoints.get(i));
if (measurePoint == 8 || measurePoint == 9) {
continue;
} else {
measurePoint++;
}
RailInspectionEquipmentItemDetail itemDetail = new RailInspectionEquipmentItemDetail();
itemDetail.setId(UUIDGenerator.generate());
itemDetail.setRailInspectionEquipmentItemId(itemId);
// 检查项目
String checkItem = checkItems.get(i).toString();
itemDetail.setCheckItem(checkItem);
//轨距
// 轨距
String trackGauge = trackGauges.get(i).toString();
itemDetail.setTrackGauge(trackGauge);
//水平
// 水平
String level = levels.get(i).toString();
itemDetail.setLevel(level);
//三角坑
// 三角坑
String triangularPit = triangularPits.get(i).toString();
itemDetail.setTriangularPit(triangularPit);
//解析轨向、高低及其它
String other = others.get(i).toString();
itemDetail.setOther(other);
// 测点
itemDetail.setMeasurePoint(measurePoint);
// 测点值向后偏移一个
itemDetail.setMeasurePoint(measurePoint + 1);
itemDetail.setInfoSort(sort++);
itemDetails.add(itemDetail);
......@@ -200,6 +205,11 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
@Override
public void saveRecord(RailInspectionEquipmentItem record) {
// 中心里程 = (开始里程+结束里程) / 2
BigDecimal startMileage = record.getCourseStartingMileage();
BigDecimal endMileage = record.getCourseEndMileage();
BigDecimal avgMileage = endMileage.subtract(startMileage).divide(new BigDecimal("2"), 3, RoundingMode.HALF_UP);
// 保存item表
record.setId(UUIDGenerator.generate());
......@@ -208,23 +218,28 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
// 初始化明细表
String checkItem = "检查项目:";
List<RailInspectionEquipmentItemDetail> itemDetails = new ArrayList<>();
int measurePoint = 1;
int measurePoint = 0;
int sort = 1;
for (int i = 2; i < 32; i++) {
if (measurePoint % 8 == 0) {
measurePoint = 1;
i = i + 2;
continue;
} else {
if (measurePoint == 8) {
measurePoint++;
continue;
}
if (measurePoint == 9) {
measurePoint = 0;
startMileage = startMileage.add(avgMileage);
continue;
}
measurePoint++;
RailInspectionEquipmentItemDetail itemDetail = new RailInspectionEquipmentItemDetail();
itemDetail.setId(UUIDGenerator.generate());
itemDetail.setRailInspectionEquipmentId(record.getRailInspectionEquipmentId());
itemDetail.setRailInspectionEquipmentItemId(record.getId());
// 检查项目
itemDetail.setCheckItem("");
itemDetail.setCheckItem(checkItem + startMileage.add(avgMileage));
//轨距
itemDetail.setTrackGauge("");
//水平
......@@ -235,12 +250,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
itemDetail.setOther("");
// 测点
itemDetail.setMeasurePoint(measurePoint - 1);
if (measurePoint % 10 == 0) {
measurePoint = 1;
} else {
measurePoint++;
}
itemDetail.setMeasurePoint(measurePoint);
itemDetail.setInfoSort(sort++);
itemDetails.add(itemDetail);
}
......
package org.jeecg.modules.dynamicStaticAnalysis.mapper;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
......@@ -19,5 +20,8 @@ public interface AnalysisAlgorithmMapper {
* @param lightRailId 线路id
* @param lineAliasId 线别id
*/
List<Map<String,Object>> getUnitDevice(String lightRailId, String lineAliasId);
List<Map<String, Object>> getUnitDevice(String lightRailId,
String lineAliasId,
BigDecimal startMileage,
BigDecimal endMileage);
}
......@@ -69,6 +69,14 @@
WHERE t1.line_alias_id = #{lineAliasId}
AND t2.light_rail_id = #{lightRailId}
) t
<where>
<if test="startMileage != null">
AND t.centerMileage >= #{startMileage}
</if>
<if test="endMileage != null">
AND t.centerMileage <![CDATA[ <= ]]> #{endMileage}
</if>
</where>
ORDER BY t.startMileage
</select>
</mapper>
......@@ -18,7 +18,7 @@
t1.unit_device_code,
t1.unit_type,
t1.unit_type_name,
t1.unit_starting_mileage,
t1.unit_start_mileage unit_starting_mileage,
t1.unit_center_mileage,
t1.unit_end_mileage,
t1.unit_score,
......
package org.jeecg.modules.dynamicStaticAnalysis.util;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -30,4 +31,27 @@ public class StrUtil {
return speedLevel;
}
/**
* 提取文字成数字并去掉末尾多余的0
*
* @param text
* @return
*/
public static BigDecimal extractTextToNumber(String text) {
String regex = "(-\\|+)?\\d+(\\.\\d+)?";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
BigDecimal result = null;
while (matcher.find()) {
String group = matcher.group();
if (null != group && !group.isEmpty()) {
result = new BigDecimal(group);
break;
}
}
return result;
}
}
......@@ -99,12 +99,15 @@
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>
<where>
<if test="dto.startMileage != null">
AND t.centerMileage >= #{dto.startMileage}
</if>
<if test="dto.endMileage != null">
AND t.centerMileage <![CDATA[ <= ]]> #{dto.endMileage}
</if>
</where>
ORDER BY t.startMileage
</select>
</mapper>
......@@ -9,6 +9,8 @@ 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.AnalysisBatchUnitDeviceMapper;
import org.jeecg.modules.dynamicStaticAnalysis.mapper.AnalysisBatchUnitDeviceTransfiniteMapper;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchUnitDeviceTransfiniteVO;
import org.jeecg.modules.maintenanceWork.dto.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatch;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
......@@ -39,6 +41,8 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Resource
private AnalysisBatchUnitDeviceMapper analysisBatchUnitDeviceMapper;
@Resource
private AnalysisBatchUnitDeviceTransfiniteMapper transfiniteMapper;
@Override
public Page<WorkBatchVO> listRecord(Page<WorkBatchVO> pageData, WorkBatchDTO dto) {
......@@ -46,6 +50,10 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
for (WorkBatchVO record : pageRecords.getRecords()) {
List<WorkBatchDetailVO> detailList = workBatchDetailMapper.queryListByWorkBatchId(record.getId());
// for (WorkBatchDetailVO workBatchDetailVO : detailList) {
// List<AnalysisBatchUnitDeviceTransfiniteVO> transfiniteList = transfiniteMapper.getTransfiniteList(record.getId());
// workBatchDetailVO.setTransfiniteList(transfiniteList);
// }
record.setDetailList(detailList);
}
......
......@@ -6,13 +6,16 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.jeecg.modules.dynamicStaticAnalysis.vo.AnalysisBatchUnitDeviceTransfiniteVO;
/**
* <p>
......@@ -68,4 +71,8 @@ public class WorkBatchDetailVO {
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("超限")
private List<AnalysisBatchUnitDeviceTransfiniteVO> transfiniteList = new ArrayList<>();
}
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