Commit 2a2816f0 authored by hkl's avatar hkl

feat:1.人工检查数据导入bug

parent 271591d2
...@@ -74,10 +74,6 @@ ...@@ -74,10 +74,6 @@
<properties> <properties>
<package.environment>hkl</package.environment> <package.environment>hkl</package.environment>
</properties> </properties>
<!-- 是否默认 true表示默认-->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile> </profile>
<!-- 测试环境 --> <!-- 测试环境 -->
...@@ -86,6 +82,10 @@ ...@@ -86,6 +82,10 @@
<properties> <properties>
<package.environment>test</package.environment> <package.environment>test</package.environment>
</properties> </properties>
<!-- 是否默认 true表示默认-->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile> </profile>
<!-- 压测环境--> <!-- 压测环境-->
......
...@@ -334,253 +334,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -334,253 +334,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
return Result.OK("操作成功"); return Result.OK("操作成功");
} }
// @AutoLog(value = "导入")
// @ApiOperation(value = "导入", notes = "导入 ")
// @PostMapping(value = "/upload2")
// @Transactional
// public Result<String> uploadFile2(MultipartFile file, @ApiParam(name = "动静态几何尺寸主键id") String id) {
// try {
// //初始化数据模板
// movementCourseService.lambdaUpdate()
// .eq(MovementCourse::getMovementMasterId, id)
// .remove();
// movementCourseInfoService.lambdaUpdate()
// .eq(MovementCourseInfo::getMovementMasterId, id)
// .remove();
//
// //时间校验
// String pat = "\\d{4}.\\d{2}.\\d{2}";
// Pattern p = Pattern.compile(pat);
// //读取第一个sheet页的数据
// ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0);
// //读取Excel中所有的数据,以行保存
// List<List<Object>> rowRecords = reader.read();
// // 获取excel的列数
// int column = rowRecords.get(0).size();
// //初始化列的索引
// int skipColumnNum = 0;
// //int seq = 1; // 第一个
// //初始化起始里程
// String startingAndEndingMileageStr = "";
// //初始化终点里程
// String endingMileageStr = "";
// //初始化曲线半径
// String curveRadius = "";
// //初始化超高
// String superHigh = "";
// //初始化加宽
// String widen = "";
// //初始化顺坡率
// String slopeRatio = "";
// //初始化长度
// String longExtent = "";
// //初始化备注
// String remark = "";
// //初始化起始里程表主键
// String courseId = "";
// // 如果做完了一个解析就跳过
// List<MovementCourse> movementCourses = new ArrayList<>();
// List<MovementCourseInfo> resultList = new ArrayList<>();
// //初始化里程排序
// int sort = 0;
// //初始化测点
// int measurePoint = 0;
// //初始化轨号排序
// int infoSort = 0;
// for (int i = 0; i < column; i++) {
// skipColumnNum++;
// if (ObjectUtil.isEmpty(startingAndEndingMileageStr)) {
// // 1.起止里程
// List<Object> startingAndEndingMileage = rowRecords.get(3);
// Object mileageObject = startingAndEndingMileage.get(i);
// String mileage = mileageObject.toString();
//
// //超高、加宽、顺坡率、线路全长
// List<Object> courseList = rowRecords.get(4);
// Object courseObject = courseList.get(i);
// String courseStr = courseObject.toString();
// if (mileage.contains("起止里程")) {
// //开始里程
// String[] start = mileage.split("-");
// String s = start[0];
// String k = s.substring(s.indexOf("K") + 1, s.length()).trim();
//
// // 按照“+”分割
// startingAndEndingMileageStr = k.replace("\\s", "").replaceAll(" +", "").replace("+", "").trim();
//
// //结束里程
// String s1 = start[1];
// String[] ks1 = s1.replaceAll("\\s*", "").replaceAll(" ", "").split(",");
// String k1 = ks1[0];
// String n1 = k1.replace("+", "").replace("K", "");
// endingMileageStr = n1;
//
// //曲线半径
// String[] n2 = s1.split("半径 ");
// String s3 = n2[1];
// curveRadius = s3.substring(0, s3.indexOf(" m")).replace("/", "").trim();
//
// //解析超高、加宽、顺坡率、线路全长
// String[] n3 = courseStr.split("超高");
// String s4 = n3[1];
// superHigh = s4.substring(0, s4.indexOf("mm")).replace("/", "").trim();
//
// //加宽
// String[] n4 = courseStr.split("加宽");
// String s5 = n4[1];
// widen = s5.substring(0, s5.indexOf("mm")).replace("/", "").trim();
// //System.out.println(skipColumnNum+"加宽="+widen+";");
//
// //顺坡率
// String[] n5 = courseStr.split("顺坡率");
// String s6 = n5[1];
// slopeRatio = s6.substring(0, s6.indexOf("‰")).replace("/", "").trim();
// //System.out.println(skipColumnNum+"顺坡率="+slopeRatio+";");
//
// //线路全长
// String[] n6 = courseStr.split("线路全长:");
// String s7 = n6[1];
// longExtent = s7.substring(0, s7.indexOf("米")).replace("/", "").trim();
// //System.out.println(skipColumnNum+"线路全长="+longExtent+";");
//
// //解析备注
// remark = rowRecords.get(14).get(i + 3).toString().trim();
//
// MovementCourse movementCourse = new MovementCourse();
// movementCourse.setMovementMasterId(id);
// movementCourse.setCourseStartingMileage(new BigDecimal(startingAndEndingMileageStr));
// movementCourse.setCourseEndMileage(new BigDecimal(endingMileageStr));
// if (ObjectUtil.isNotEmpty(curveRadius)) {
// movementCourse.setCurveRadius(new BigDecimal(curveRadius));
// }
// if (ObjectUtil.isNotEmpty(superHigh)) {
// movementCourse.setSuperHigh(new BigDecimal(superHigh));
// }
// if (ObjectUtil.isNotEmpty(widen)) {
// movementCourse.setWiden(new BigDecimal(widen));
// }
// if (ObjectUtil.isNotEmpty(slopeRatio)) {
// movementCourse.setSlopeRatio(new BigDecimal(slopeRatio));
// }
// if (ObjectUtil.isNotEmpty(longExtent)) {
// movementCourse.setLongExtent(new BigDecimal(longExtent));
// }
// sort++;
// courseId = UUIDGenerator.generate();
// movementCourse.setId(courseId);
// movementCourse.setDelFlag("0");
// movementCourse.setRemark(remark);
// movementCourse.setSort(sort);
// movementCourses.add(movementCourse);
// }
// }
//
// //解析子集
// if ((skipColumnNum - 1) % 28 == 0) {
// continue;
// }
// if ((skipColumnNum - 2) % 28 == 0) {
// continue;
// }
//
// // 保存明细
// infoSort++;
// measurePoint++;
// MovementCourseInfo movementCourseInfo = new MovementCourseInfo();
// movementCourseInfo.setId(UUIDGenerator.generate());
// movementCourseInfo.setDelFlag("0");
// movementCourseInfo.setMovementMasterId(id);
// movementCourseInfo.setMovementCourseId(courseId);
// movementCourseInfo.setInfoSort(infoSort);
// movementCourseInfo.setMeasurePoint(measurePoint);
// //获取轨号
// List<Object> trackCodeList = rowRecords.get(6);
// String trackCode = trackCodeList.get(i).toString().trim();
// if (ObjectUtil.isNotEmpty(trackCode) && !("检查日期").equals(trackCode) && !("轨号").equals(trackCode)) {
// movementCourseInfo.setTrackCode(trackCode);
// }
// //获取轨距
// List<Object> trackGaugeList = rowRecords.get(7);
// String trackGauge = trackGaugeList.get(i).toString().trim();
// if (ObjectUtil.isNotEmpty(trackGauge) && !("轨距").equals(trackGauge) && !p.matcher(trackGauge).matches()) {
// movementCourseInfo.setTrackGauge(trackGauge);
// }
// //获取水平
// List<Object> levelList = rowRecords.get(8);
// String level = levelList.get(i).toString().trim();
// if (ObjectUtil.isNotEmpty(level) && !("水平").equals(level) && !p.matcher(level).matches()) {
// movementCourseInfo.setLevel(level);
// }
// //获取三角坑
// List<Object> triangularPitList = rowRecords.get(9);
// String triangularPit = triangularPitList.get(i).toString().trim();
//
// if (ObjectUtil.isNotEmpty(triangularPit) && !("三角坑").equals(triangularPit) && !p.matcher(triangularPit).matches()) {
// movementCourseInfo.setTriangularPit(triangularPit);
// }
// //获取方向
// List<Object> directionList = rowRecords.get(10);
// String direction = directionList.get(i).toString().trim();
//
// if (ObjectUtil.isNotEmpty(direction) && !("方向").equals(direction) && !p.matcher(direction).matches()) {
// movementCourseInfo.setDirection(direction);
// }
// //获取高低
// List<Object> heightList = rowRecords.get(11);
// String height = heightList.get(i).toString().trim();
//
// if (ObjectUtil.isNotEmpty(height) && !("高低").equals(height) && !p.matcher(height).matches()) {
// movementCourseInfo.setHeight(height);
// }
// //获取结构
// List<Object> structureList = rowRecords.get(12);
// String structure = structureList.get(i).toString().trim();
//
// if (ObjectUtil.isNotEmpty(structure) && !("结构").equals(structure) && !p.matcher(structure).matches()) {
// movementCourseInfo.setStructure(structure);
// }
// //获取整改
// List<Object> rectificationList = rowRecords.get(13);
// String rectification = rectificationList.get(i).toString().trim();
//
// if (ObjectUtil.isNotEmpty(rectification) && !("整改").equals(rectification) && !p.matcher(rectification).matches()) {
// movementCourseInfo.setRectification(rectification);
// }
// resultList.add(movementCourseInfo);
// if (measurePoint % 8 == 0) {
// measurePoint = 0;
// }
// if ((skipColumnNum + 2) % 28 == 0) {
// i = i + 4;
// skipColumnNum = skipColumnNum + 4;
// startingAndEndingMileageStr = "";
// endingMileageStr = "";
// curveRadius = "";
// superHigh = "";
// widen = "";
// slopeRatio = "";
// longExtent = "";
// remark = "";
// courseId = "";
// infoSort = 0;
// }
// }
// if (ObjectUtil.isNotEmpty(resultList)) {
// movementCourseInfoService.saveBatch(resultList);
// }
// if (ObjectUtil.isNotEmpty(movementCourses)) {
// movementCourseService.saveBatch(movementCourses);
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException(e);
// }
// return Result.ok("操作成功");
// }
@AutoLog(value = "人工静态检查数据-保存曲线半径信息") @AutoLog(value = "人工静态检查数据-保存曲线半径信息")
@ApiOperation(value = "人工静态检查数据-保存曲线半径信息", notes = "人工静态检查数据-保存曲线半径信息") @ApiOperation(value = "人工静态检查数据-保存曲线半径信息", notes = "人工静态检查数据-保存曲线半径信息")
@PostMapping(value = "/saveAdditive") @PostMapping(value = "/saveAdditive")
......
...@@ -95,8 +95,6 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -95,8 +95,6 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
List<MovementCourse> movementCourseList = new ArrayList<>(); List<MovementCourse> movementCourseList = new ArrayList<>();
List<MovementCourseInfo> movementCourseInfoList = new ArrayList<>(); List<MovementCourseInfo> movementCourseInfoList = new ArrayList<>();
MovementRecordsMaster recordsMaster = this.movementRecordsMasterService.getById(id);
// 1.excel导入List<List<Object>> 中 // 1.excel导入List<List<Object>> 中
CurrentRowHandler currentRowHandler = new CurrentRowHandler(); CurrentRowHandler currentRowHandler = new CurrentRowHandler();
ExcelUtil.readBySax(inputStream, 0, currentRowHandler); ExcelUtil.readBySax(inputStream, 0, currentRowHandler);
...@@ -135,25 +133,6 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -135,25 +133,6 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
BigDecimal startMileage = Convert.toBigDecimal(startMileageStr); BigDecimal startMileage = Convert.toBigDecimal(startMileageStr);
BigDecimal endMileage = Convert.toBigDecimal(endMileageStr); BigDecimal endMileage = Convert.toBigDecimal(endMileageStr);
if (startMileage.compareTo(endMileage) >= 0) {
throw JeecgBootException.error("开始里程不能大于等于结束里程");
}
if (startMileage.compareTo(recordsMaster.getStartingMileage()) < 0) {
throw JeecgBootException.error("开始里程小于当前批次开始里程");
} else if (startMileage.compareTo(recordsMaster.getStartingMileage()) == 0) {
startExist = true;
}
// 如果结束里程 < 外面的主表的结束里程
if (endMileage.compareTo(recordsMaster.getEndMileage()) > 0) {
throw JeecgBootException.error("结束里程大于当前批次结束里程");
} else if (endMileage.compareTo(recordsMaster.getEndMileage()) == 0) {
endExist = true;
}
// ② 获取曲线半径,可能为空,‘/’ 视为空 // ② 获取曲线半径,可能为空,‘/’ 视为空
startIndex = startingAndRowDataStr.indexOf("曲线半径"); startIndex = startingAndRowDataStr.indexOf("曲线半径");
endIndex = startingAndRowDataStr.indexOf("m"); endIndex = startingAndRowDataStr.indexOf("m");
...@@ -304,13 +283,6 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -304,13 +283,6 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
} }
} }
if (!startExist) {
throw JeecgBootException.error("起点里程要和批次的起点里程一致");
}
if (!endExist) {
throw JeecgBootException.error("终点里程要和批次的终点里程一致");
}
// 保存之前先删除 // 保存之前先删除
movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove(); movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove();
movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove(); movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove();
......
...@@ -57,8 +57,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -57,8 +57,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void uploadFile(String masterId, MultipartFile file) { public void uploadFile(String masterId, MultipartFile file) {
try { try {
MovementRecordsMaster recordsMaster = movementRecordsMasterMapper.selectById(masterId);
//读取第一个sheet页的数据 //读取第一个sheet页的数据
ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0); ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0);
//读取Excel中所有的数据,以行保存 //读取Excel中所有的数据,以行保存
...@@ -67,8 +65,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -67,8 +65,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
List<RailInspectionEquipmentItem> items = new ArrayList<>(); List<RailInspectionEquipmentItem> items = new ArrayList<>();
List<RailInspectionEquipmentItemDetail> itemDetails = new ArrayList<>(); List<RailInspectionEquipmentItemDetail> itemDetails = new ArrayList<>();
boolean startExist = false;
boolean endExist = false;
int sort = 1; int sort = 1;
for (int i = 0; i < rowRecords.size(); ) { for (int i = 0; i < rowRecords.size(); ) {
List<Object> cols = rowRecords.get(i); List<Object> cols = rowRecords.get(i);
...@@ -81,27 +77,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -81,27 +77,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
BigDecimal courseEndMileage = Convert.toBigDecimal(cols.get(6)); BigDecimal courseEndMileage = Convert.toBigDecimal(cols.get(6));
if ((ObjectUtil.isNotEmpty(titleHeader) && titleHeader.contains("股道")) && (ObjectUtil.isNotEmpty(courseStartingMileage) && ObjectUtil.isNotEmpty(courseEndMileage))) { if ((ObjectUtil.isNotEmpty(titleHeader) && titleHeader.contains("股道")) && (ObjectUtil.isNotEmpty(courseStartingMileage) && ObjectUtil.isNotEmpty(courseEndMileage))) {
// 如果开始里程 > 外面的主表的开始程则报错
BigDecimal currentStartMileage = courseStartingMileage.multiply(new BigDecimal(1000));
BigDecimal currentEntMileage = courseEndMileage.multiply(new BigDecimal(1000));
if (currentStartMileage.compareTo(currentEntMileage) >= 0) {
throw JeecgBootException.error("开始里程不能大于等于结束里程");
}
if (currentStartMileage.compareTo(recordsMaster.getStartingMileage()) < 0) {
throw JeecgBootException.error("开始里程小于当前批次开始里程");
} else if (currentStartMileage.compareTo(recordsMaster.getStartingMileage()) == 0) {
startExist = true;
}
// 如果结束里程 < 外面的主表的结束里程
if (currentEntMileage.compareTo(recordsMaster.getEndMileage()) > 0) {
throw JeecgBootException.error("结束里程大于当前批次结束里程");
} else if (currentEntMileage.compareTo(recordsMaster.getEndMileage()) == 0) {
endExist = true;
}
// 曲线半径 // 曲线半径
BigDecimal curveRadius = null; BigDecimal curveRadius = null;
if (ObjectUtil.isNotEmpty(cols.get(18).toString().trim())) { if (ObjectUtil.isNotEmpty(cols.get(18).toString().trim())) {
...@@ -138,13 +113,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -138,13 +113,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
} }
} }
if (!startExist) {
throw JeecgBootException.error("起点里程要和批次的起点里程一致");
}
if (!endExist) {
throw JeecgBootException.error("终点里程要和批次的起点里程一致");
}
// 项目信息-先删除,再导入 // 项目信息-先删除,再导入
this.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, masterId).remove(); this.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, masterId).remove();
LambdaQueryWrapper<RailInspectionEquipmentItemDetail> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<RailInspectionEquipmentItemDetail> queryWrapper = new LambdaQueryWrapper<>();
...@@ -160,8 +128,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -160,8 +128,6 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
} }
private int readItemDetail(int rows, String titleHeader, String itemId, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) { private int readItemDetail(int rows, String titleHeader, String itemId, List<List<Object>> rowRecords, List<RailInspectionEquipmentItemDetail> itemDetails) {
// 解析检查项目:1行:跳过2行不解析 // 解析检查项目:1行:跳过2行不解析
List<Object> checkItems = rowRecords.get(rows + 2); List<Object> checkItems = rowRecords.get(rows + 2);
// 解析测点:1行 // 解析测点:1行
......
...@@ -1274,8 +1274,9 @@ public class AnalysisAlgorithm { ...@@ -1274,8 +1274,9 @@ public class AnalysisAlgorithm {
movementCourseInfo.setCurrentStartMileage(currentStartMileage); movementCourseInfo.setCurrentStartMileage(currentStartMileage);
movementCourseInfo.setCurrentEndEndMileage(currentEndEndMileage); movementCourseInfo.setCurrentEndEndMileage(currentEndEndMileage);
transfinite = this.railDeviceCheckTransfinite(analysisBatch, movementCourseInfo); transfinite = this.railDeviceCheckTransfinite(analysisBatch, movementCourseInfo);
} else { if (transfinite != null) {
unitDevice.put("railDeviceTransfinite", transfinite); unitDevice.put("railDeviceTransfinite", transfinite);
}
} }
} }
......
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