Commit 271591d2 authored by hkl's avatar hkl

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

parent aac0e86f
...@@ -335,250 +335,250 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -335,250 +335,250 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
} }
@AutoLog(value = "导入") // @AutoLog(value = "导入")
@ApiOperation(value = "导入", notes = "导入 ") // @ApiOperation(value = "导入", notes = "导入 ")
@PostMapping(value = "/upload2") // @PostMapping(value = "/upload2")
@Transactional // @Transactional
public Result<String> uploadFile2(MultipartFile file, @ApiParam(name = "动静态几何尺寸主键id") String id) { // public Result<String> uploadFile2(MultipartFile file, @ApiParam(name = "动静态几何尺寸主键id") String id) {
try { // try {
//初始化数据模板 // //初始化数据模板
movementCourseService.lambdaUpdate() // movementCourseService.lambdaUpdate()
.eq(MovementCourse::getMovementMasterId, id) // .eq(MovementCourse::getMovementMasterId, id)
.remove(); // .remove();
movementCourseInfoService.lambdaUpdate() // movementCourseInfoService.lambdaUpdate()
.eq(MovementCourseInfo::getMovementMasterId, id) // .eq(MovementCourseInfo::getMovementMasterId, id)
.remove(); // .remove();
//
//时间校验 // //时间校验
String pat = "\\d{4}.\\d{2}.\\d{2}"; // String pat = "\\d{4}.\\d{2}.\\d{2}";
Pattern p = Pattern.compile(pat); // Pattern p = Pattern.compile(pat);
//读取第一个sheet页的数据 // //读取第一个sheet页的数据
ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0); // ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0);
//读取Excel中所有的数据,以行保存 // //读取Excel中所有的数据,以行保存
List<List<Object>> rowRecords = reader.read(); // List<List<Object>> rowRecords = reader.read();
// 获取excel的列数 // // 获取excel的列数
int column = rowRecords.get(0).size(); // int column = rowRecords.get(0).size();
//初始化列的索引 // //初始化列的索引
int skipColumnNum = 0; // int skipColumnNum = 0;
//int seq = 1; // 第一个 // //int seq = 1; // 第一个
//初始化起始里程 // //初始化起始里程
String startingAndEndingMileageStr = ""; // String startingAndEndingMileageStr = "";
//初始化终点里程 // //初始化终点里程
String endingMileageStr = ""; // String endingMileageStr = "";
//初始化曲线半径 // //初始化曲线半径
String curveRadius = ""; // String curveRadius = "";
//初始化超高 // //初始化超高
String superHigh = ""; // String superHigh = "";
//初始化加宽 // //初始化加宽
String widen = ""; // String widen = "";
//初始化顺坡率 // //初始化顺坡率
String slopeRatio = ""; // String slopeRatio = "";
//初始化长度 // //初始化长度
String longExtent = ""; // String longExtent = "";
//初始化备注 // //初始化备注
String remark = ""; // String remark = "";
//初始化起始里程表主键 // //初始化起始里程表主键
String courseId = ""; // String courseId = "";
// 如果做完了一个解析就跳过 // // 如果做完了一个解析就跳过
List<MovementCourse> movementCourses = new ArrayList<>(); // List<MovementCourse> movementCourses = new ArrayList<>();
List<MovementCourseInfo> resultList = new ArrayList<>(); // List<MovementCourseInfo> resultList = new ArrayList<>();
//初始化里程排序 // //初始化里程排序
int sort = 0; // int sort = 0;
//初始化测点 // //初始化测点
int measurePoint = 0; // int measurePoint = 0;
//初始化轨号排序 // //初始化轨号排序
int infoSort = 0; // int infoSort = 0;
for (int i = 0; i < column; i++) { // for (int i = 0; i < column; i++) {
skipColumnNum++; // skipColumnNum++;
if (ObjectUtil.isEmpty(startingAndEndingMileageStr)) { // if (ObjectUtil.isEmpty(startingAndEndingMileageStr)) {
// 1.起止里程 // // 1.起止里程
List<Object> startingAndEndingMileage = rowRecords.get(3); // List<Object> startingAndEndingMileage = rowRecords.get(3);
Object mileageObject = startingAndEndingMileage.get(i); // Object mileageObject = startingAndEndingMileage.get(i);
String mileage = mileageObject.toString(); // String mileage = mileageObject.toString();
//
//超高、加宽、顺坡率、线路全长 // //超高、加宽、顺坡率、线路全长
List<Object> courseList = rowRecords.get(4); // List<Object> courseList = rowRecords.get(4);
Object courseObject = courseList.get(i); // Object courseObject = courseList.get(i);
String courseStr = courseObject.toString(); // String courseStr = courseObject.toString();
if (mileage.contains("起止里程")) { // if (mileage.contains("起止里程")) {
//开始里程 // //开始里程
String[] start = mileage.split("-"); // String[] start = mileage.split("-");
String s = start[0]; // String s = start[0];
String k = s.substring(s.indexOf("K") + 1, s.length()).trim(); // String k = s.substring(s.indexOf("K") + 1, s.length()).trim();
//
// 按照“+”分割 // // 按照“+”分割
startingAndEndingMileageStr = k.replace("\\s", "").replaceAll(" +", "").replace("+", "").trim(); // startingAndEndingMileageStr = k.replace("\\s", "").replaceAll(" +", "").replace("+", "").trim();
//
//结束里程 // //结束里程
String s1 = start[1]; // String s1 = start[1];
String[] ks1 = s1.replaceAll("\\s*", "").replaceAll(" ", "").split(","); // String[] ks1 = s1.replaceAll("\\s*", "").replaceAll(" ", "").split(",");
String k1 = ks1[0]; // String k1 = ks1[0];
String n1 = k1.replace("+", "").replace("K", ""); // String n1 = k1.replace("+", "").replace("K", "");
endingMileageStr = n1; // endingMileageStr = n1;
//
//曲线半径 // //曲线半径
String[] n2 = s1.split("半径 "); // String[] n2 = s1.split("半径 ");
String s3 = n2[1]; // String s3 = n2[1];
curveRadius = s3.substring(0, s3.indexOf(" m")).replace("/", "").trim(); // curveRadius = s3.substring(0, s3.indexOf(" m")).replace("/", "").trim();
//
//解析超高、加宽、顺坡率、线路全长 // //解析超高、加宽、顺坡率、线路全长
String[] n3 = courseStr.split("超高"); // String[] n3 = courseStr.split("超高");
String s4 = n3[1]; // String s4 = n3[1];
superHigh = s4.substring(0, s4.indexOf("mm")).replace("/", "").trim(); // superHigh = s4.substring(0, s4.indexOf("mm")).replace("/", "").trim();
//
//加宽 // //加宽
String[] n4 = courseStr.split("加宽"); // String[] n4 = courseStr.split("加宽");
String s5 = n4[1]; // String s5 = n4[1];
widen = s5.substring(0, s5.indexOf("mm")).replace("/", "").trim(); // widen = s5.substring(0, s5.indexOf("mm")).replace("/", "").trim();
//System.out.println(skipColumnNum+"加宽="+widen+";"); // //System.out.println(skipColumnNum+"加宽="+widen+";");
//
//顺坡率 // //顺坡率
String[] n5 = courseStr.split("顺坡率"); // String[] n5 = courseStr.split("顺坡率");
String s6 = n5[1]; // String s6 = n5[1];
slopeRatio = s6.substring(0, s6.indexOf("‰")).replace("/", "").trim(); // slopeRatio = s6.substring(0, s6.indexOf("‰")).replace("/", "").trim();
//System.out.println(skipColumnNum+"顺坡率="+slopeRatio+";"); // //System.out.println(skipColumnNum+"顺坡率="+slopeRatio+";");
//
//线路全长 // //线路全长
String[] n6 = courseStr.split("线路全长:"); // String[] n6 = courseStr.split("线路全长:");
String s7 = n6[1]; // String s7 = n6[1];
longExtent = s7.substring(0, s7.indexOf("米")).replace("/", "").trim(); // longExtent = s7.substring(0, s7.indexOf("米")).replace("/", "").trim();
//System.out.println(skipColumnNum+"线路全长="+longExtent+";"); // //System.out.println(skipColumnNum+"线路全长="+longExtent+";");
//
//解析备注 // //解析备注
remark = rowRecords.get(14).get(i + 3).toString().trim(); // remark = rowRecords.get(14).get(i + 3).toString().trim();
//
MovementCourse movementCourse = new MovementCourse(); // MovementCourse movementCourse = new MovementCourse();
movementCourse.setMovementMasterId(id); // movementCourse.setMovementMasterId(id);
movementCourse.setCourseStartingMileage(new BigDecimal(startingAndEndingMileageStr)); // movementCourse.setCourseStartingMileage(new BigDecimal(startingAndEndingMileageStr));
movementCourse.setCourseEndMileage(new BigDecimal(endingMileageStr)); // movementCourse.setCourseEndMileage(new BigDecimal(endingMileageStr));
if (ObjectUtil.isNotEmpty(curveRadius)) { // if (ObjectUtil.isNotEmpty(curveRadius)) {
movementCourse.setCurveRadius(new BigDecimal(curveRadius)); // movementCourse.setCurveRadius(new BigDecimal(curveRadius));
} // }
if (ObjectUtil.isNotEmpty(superHigh)) { // if (ObjectUtil.isNotEmpty(superHigh)) {
movementCourse.setSuperHigh(new BigDecimal(superHigh)); // movementCourse.setSuperHigh(new BigDecimal(superHigh));
} // }
if (ObjectUtil.isNotEmpty(widen)) { // if (ObjectUtil.isNotEmpty(widen)) {
movementCourse.setWiden(new BigDecimal(widen)); // movementCourse.setWiden(new BigDecimal(widen));
} // }
if (ObjectUtil.isNotEmpty(slopeRatio)) { // if (ObjectUtil.isNotEmpty(slopeRatio)) {
movementCourse.setSlopeRatio(new BigDecimal(slopeRatio)); // movementCourse.setSlopeRatio(new BigDecimal(slopeRatio));
} // }
if (ObjectUtil.isNotEmpty(longExtent)) { // if (ObjectUtil.isNotEmpty(longExtent)) {
movementCourse.setLongExtent(new BigDecimal(longExtent)); // movementCourse.setLongExtent(new BigDecimal(longExtent));
} // }
sort++; // sort++;
courseId = UUIDGenerator.generate(); // courseId = UUIDGenerator.generate();
movementCourse.setId(courseId); // movementCourse.setId(courseId);
movementCourse.setDelFlag("0"); // movementCourse.setDelFlag("0");
movementCourse.setRemark(remark); // movementCourse.setRemark(remark);
movementCourse.setSort(sort); // movementCourse.setSort(sort);
movementCourses.add(movementCourse); // movementCourses.add(movementCourse);
} // }
} // }
//
//解析子集 // //解析子集
if ((skipColumnNum - 1) % 28 == 0) { // if ((skipColumnNum - 1) % 28 == 0) {
continue; // continue;
} // }
if ((skipColumnNum - 2) % 28 == 0) { // if ((skipColumnNum - 2) % 28 == 0) {
continue; // continue;
} // }
//
// 保存明细 // // 保存明细
infoSort++; // infoSort++;
measurePoint++; // measurePoint++;
MovementCourseInfo movementCourseInfo = new MovementCourseInfo(); // MovementCourseInfo movementCourseInfo = new MovementCourseInfo();
movementCourseInfo.setId(UUIDGenerator.generate()); // movementCourseInfo.setId(UUIDGenerator.generate());
movementCourseInfo.setDelFlag("0"); // movementCourseInfo.setDelFlag("0");
movementCourseInfo.setMovementMasterId(id); // movementCourseInfo.setMovementMasterId(id);
movementCourseInfo.setMovementCourseId(courseId); // movementCourseInfo.setMovementCourseId(courseId);
movementCourseInfo.setInfoSort(infoSort); // movementCourseInfo.setInfoSort(infoSort);
movementCourseInfo.setMeasurePoint(measurePoint); // movementCourseInfo.setMeasurePoint(measurePoint);
//获取轨号 // //获取轨号
List<Object> trackCodeList = rowRecords.get(6); // List<Object> trackCodeList = rowRecords.get(6);
String trackCode = trackCodeList.get(i).toString().trim(); // String trackCode = trackCodeList.get(i).toString().trim();
if (ObjectUtil.isNotEmpty(trackCode) && !("检查日期").equals(trackCode) && !("轨号").equals(trackCode)) { // if (ObjectUtil.isNotEmpty(trackCode) && !("检查日期").equals(trackCode) && !("轨号").equals(trackCode)) {
movementCourseInfo.setTrackCode(trackCode); // movementCourseInfo.setTrackCode(trackCode);
} // }
//获取轨距 // //获取轨距
List<Object> trackGaugeList = rowRecords.get(7); // List<Object> trackGaugeList = rowRecords.get(7);
String trackGauge = trackGaugeList.get(i).toString().trim(); // String trackGauge = trackGaugeList.get(i).toString().trim();
if (ObjectUtil.isNotEmpty(trackGauge) && !("轨距").equals(trackGauge) && !p.matcher(trackGauge).matches()) { // if (ObjectUtil.isNotEmpty(trackGauge) && !("轨距").equals(trackGauge) && !p.matcher(trackGauge).matches()) {
movementCourseInfo.setTrackGauge(trackGauge); // movementCourseInfo.setTrackGauge(trackGauge);
} // }
//获取水平 // //获取水平
List<Object> levelList = rowRecords.get(8); // List<Object> levelList = rowRecords.get(8);
String level = levelList.get(i).toString().trim(); // String level = levelList.get(i).toString().trim();
if (ObjectUtil.isNotEmpty(level) && !("水平").equals(level) && !p.matcher(level).matches()) { // if (ObjectUtil.isNotEmpty(level) && !("水平").equals(level) && !p.matcher(level).matches()) {
movementCourseInfo.setLevel(level); // movementCourseInfo.setLevel(level);
} // }
//获取三角坑 // //获取三角坑
List<Object> triangularPitList = rowRecords.get(9); // List<Object> triangularPitList = rowRecords.get(9);
String triangularPit = triangularPitList.get(i).toString().trim(); // String triangularPit = triangularPitList.get(i).toString().trim();
//
if (ObjectUtil.isNotEmpty(triangularPit) && !("三角坑").equals(triangularPit) && !p.matcher(triangularPit).matches()) { // if (ObjectUtil.isNotEmpty(triangularPit) && !("三角坑").equals(triangularPit) && !p.matcher(triangularPit).matches()) {
movementCourseInfo.setTriangularPit(triangularPit); // movementCourseInfo.setTriangularPit(triangularPit);
} // }
//获取方向 // //获取方向
List<Object> directionList = rowRecords.get(10); // List<Object> directionList = rowRecords.get(10);
String direction = directionList.get(i).toString().trim(); // String direction = directionList.get(i).toString().trim();
//
if (ObjectUtil.isNotEmpty(direction) && !("方向").equals(direction) && !p.matcher(direction).matches()) { // if (ObjectUtil.isNotEmpty(direction) && !("方向").equals(direction) && !p.matcher(direction).matches()) {
movementCourseInfo.setDirection(direction); // movementCourseInfo.setDirection(direction);
} // }
//获取高低 // //获取高低
List<Object> heightList = rowRecords.get(11); // List<Object> heightList = rowRecords.get(11);
String height = heightList.get(i).toString().trim(); // String height = heightList.get(i).toString().trim();
//
if (ObjectUtil.isNotEmpty(height) && !("高低").equals(height) && !p.matcher(height).matches()) { // if (ObjectUtil.isNotEmpty(height) && !("高低").equals(height) && !p.matcher(height).matches()) {
movementCourseInfo.setHeight(height); // movementCourseInfo.setHeight(height);
} // }
//获取结构 // //获取结构
List<Object> structureList = rowRecords.get(12); // List<Object> structureList = rowRecords.get(12);
String structure = structureList.get(i).toString().trim(); // String structure = structureList.get(i).toString().trim();
//
if (ObjectUtil.isNotEmpty(structure) && !("结构").equals(structure) && !p.matcher(structure).matches()) { // if (ObjectUtil.isNotEmpty(structure) && !("结构").equals(structure) && !p.matcher(structure).matches()) {
movementCourseInfo.setStructure(structure); // movementCourseInfo.setStructure(structure);
} // }
//获取整改 // //获取整改
List<Object> rectificationList = rowRecords.get(13); // List<Object> rectificationList = rowRecords.get(13);
String rectification = rectificationList.get(i).toString().trim(); // String rectification = rectificationList.get(i).toString().trim();
//
if (ObjectUtil.isNotEmpty(rectification) && !("整改").equals(rectification) && !p.matcher(rectification).matches()) { // if (ObjectUtil.isNotEmpty(rectification) && !("整改").equals(rectification) && !p.matcher(rectification).matches()) {
movementCourseInfo.setRectification(rectification); // movementCourseInfo.setRectification(rectification);
} // }
resultList.add(movementCourseInfo); // resultList.add(movementCourseInfo);
if (measurePoint % 8 == 0) { // if (measurePoint % 8 == 0) {
measurePoint = 0; // measurePoint = 0;
} // }
if ((skipColumnNum + 2) % 28 == 0) { // if ((skipColumnNum + 2) % 28 == 0) {
i = i + 4; // i = i + 4;
skipColumnNum = skipColumnNum + 4; // skipColumnNum = skipColumnNum + 4;
startingAndEndingMileageStr = ""; // startingAndEndingMileageStr = "";
endingMileageStr = ""; // endingMileageStr = "";
curveRadius = ""; // curveRadius = "";
superHigh = ""; // superHigh = "";
widen = ""; // widen = "";
slopeRatio = ""; // slopeRatio = "";
longExtent = ""; // longExtent = "";
remark = ""; // remark = "";
courseId = ""; // courseId = "";
infoSort = 0; // infoSort = 0;
} // }
} // }
if (ObjectUtil.isNotEmpty(resultList)) { // if (ObjectUtil.isNotEmpty(resultList)) {
movementCourseInfoService.saveBatch(resultList); // movementCourseInfoService.saveBatch(resultList);
} // }
if (ObjectUtil.isNotEmpty(movementCourses)) { // if (ObjectUtil.isNotEmpty(movementCourses)) {
movementCourseService.saveBatch(movementCourses); // movementCourseService.saveBatch(movementCourses);
} // }
//
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
throw new RuntimeException(e); // throw new RuntimeException(e);
} // }
return Result.ok("操作成功"); // return Result.ok("操作成功");
} // }
@AutoLog(value = "人工静态检查数据-保存曲线半径信息") @AutoLog(value = "人工静态检查数据-保存曲线半径信息")
...@@ -678,9 +678,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -678,9 +678,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0); ExcelReader reader = ExcelUtil.getReader(file.getInputStream(), 0);
//读取Excel中所有的数据,以行保存 //读取Excel中所有的数据,以行保存
List<List<Object>> rowRecords = reader.read(); List<List<Object>> rowRecords = reader.read();
//获取当前登录人信息
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String realname = user.getRealname();
//初始化测点里程 //初始化测点里程
String pointMileage = ""; String pointMileage = "";
//初始化水平加速度 //初始化水平加速度
...@@ -739,10 +736,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -739,10 +736,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
movementAdditiveInfo.setId(IdWorker.get32UUID()); movementAdditiveInfo.setId(IdWorker.get32UUID());
movementAdditiveInfo.setDelFlag("0"); movementAdditiveInfo.setDelFlag("0");
movementAdditiveInfo.setMovementMasterId(id); movementAdditiveInfo.setMovementMasterId(id);
movementAdditiveInfo.setCreateTime(new Date());
movementAdditiveInfo.setUpdateTime(new Date());
movementAdditiveInfo.setCreateBy(realname);
movementAdditiveInfo.setUpdateBy(realname);
movementAdditiveInfo.setInfoSort(sort); movementAdditiveInfo.setInfoSort(sort);
if (ObjectUtil.isNotEmpty(pointMileage)) { if (ObjectUtil.isNotEmpty(pointMileage)) {
movementAdditiveInfo.setPointMileage(new BigDecimal(pointMileage)); movementAdditiveInfo.setPointMileage(new BigDecimal(pointMileage));
......
...@@ -10,9 +10,11 @@ import org.jeecg.common.exception.JeecgBootException; ...@@ -10,9 +10,11 @@ import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.UUIDGenerator; import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.entity.MovementCourse; import org.jeecg.modules.checkData.entity.MovementCourse;
import org.jeecg.modules.checkData.entity.MovementCourseInfo; import org.jeecg.modules.checkData.entity.MovementCourseInfo;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.face.MovementRecordsMasterFace; import org.jeecg.modules.checkData.face.MovementRecordsMasterFace;
import org.jeecg.modules.checkData.service.IMovementCourseInfoService; import org.jeecg.modules.checkData.service.IMovementCourseInfoService;
import org.jeecg.modules.checkData.service.IMovementCourseService; import org.jeecg.modules.checkData.service.IMovementCourseService;
import org.jeecg.modules.checkData.service.IMovementRecordsMasterService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -34,6 +36,9 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -34,6 +36,9 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
@Resource @Resource
private IMovementCourseInfoService movementCourseInfoService; private IMovementCourseInfoService movementCourseInfoService;
@Resource
private IMovementRecordsMasterService movementRecordsMasterService;
@Override @Override
public void saveLabourCheckItem(MovementCourse record) { public void saveLabourCheckItem(MovementCourse record) {
...@@ -90,6 +95,8 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -90,6 +95,8 @@ 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);
...@@ -99,6 +106,8 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -99,6 +106,8 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace
int column = currentRowHandler.rowRecords.get(0).size(); int column = currentRowHandler.rowRecords.get(0).size();
int sort = 0; int sort = 0;
int trackCodeCount = 1; int trackCodeCount = 1;
boolean startExist = false;
boolean endExist = false;
for (int i = 0; i < column; i++) { for (int i = 0; i < column; i++) {
// 2.1 解析检查项目 获取 起止里程,曲线半径,超高,加宽,顺坡率,线路全长 // 2.1 解析检查项目 获取 起止里程,曲线半径,超高,加宽,顺坡率,线路全长
...@@ -126,6 +135,25 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -126,6 +135,25 @@ 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");
...@@ -276,6 +304,13 @@ public class MovementRecordsMasterFaceImpl implements MovementRecordsMasterFace ...@@ -276,6 +304,13 @@ 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();
......
...@@ -10,14 +10,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -10,14 +10,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.UUIDGenerator; import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem; import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem;
import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItemDetail; import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItemDetail;
import org.jeecg.modules.checkData.mapper.MovementRecordsMasterMapper;
import org.jeecg.modules.checkData.mapper.RailInspectionEquipmentItemDetailMapper; import org.jeecg.modules.checkData.mapper.RailInspectionEquipmentItemDetailMapper;
import org.jeecg.modules.checkData.mapper.RailInspectionEquipmentItemMapper; import org.jeecg.modules.checkData.mapper.RailInspectionEquipmentItemMapper;
import org.jeecg.modules.checkData.service.IRailInspectionEquipmentItemService; import org.jeecg.modules.checkData.service.IRailInspectionEquipmentItemService;
import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemDetailVO; import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemDetailVO;
import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemVO; import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -41,14 +44,21 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -41,14 +44,21 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
@Resource @Resource
private RailInspectionEquipmentItemDetailMapper railInspectionEquipmentItemDetailMapper; private RailInspectionEquipmentItemDetailMapper railInspectionEquipmentItemDetailMapper;
@Resource
private MovementRecordsMasterMapper movementRecordsMasterMapper;
@Override @Override
public List<RailInspectionEquipmentItemVO> queryList(String masterId) { public List<RailInspectionEquipmentItemVO> queryList(String masterId) {
return this.baseMapper.queryList(masterId); return this.baseMapper.queryList(masterId);
} }
@Override @Override
@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中所有的数据,以行保存
...@@ -57,15 +67,41 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -57,15 +67,41 @@ 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;
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);
String titleHeader = Convert.toStr(cols.get(13)); String titleHeader = Convert.toStr(cols.get(13));
// 检查起始里程 // 检查起始里程
BigDecimal courseStartingMileage = Convert.toBigDecimal(cols.get(3)); BigDecimal courseStartingMileage = Convert.toBigDecimal(cols.get(3));
// 检查终点里程 // 检查终点里程
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())) {
...@@ -88,24 +124,26 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -88,24 +124,26 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
item.setCurveRadius(curveRadius); item.setCurveRadius(curveRadius);
item.setSuperHigh(superHigh); item.setSuperHigh(superHigh);
item.setSlopeRatio(slopeRatio); item.setSlopeRatio(slopeRatio);
item.setRailInspectionEquipmentId(masterId);
item.setDelFlag("0");
item.setSort(sort);
items.add(item); items.add(item);
// 读取item详情
int skipRow = analysisItemDetail(i, titleHeader, item.getId(), rowRecords, itemDetails); int skipRow = readItemDetail(i, titleHeader, item.getId(), rowRecords, itemDetails);
i = i + skipRow; i = i + skipRow;
sort++;
} else { } else {
i++; i++;
} }
} }
for (int i = 0; i < items.size(); i++) { if (!startExist) {
RailInspectionEquipmentItem item = items.get(i); throw JeecgBootException.error("起点里程要和批次的起点里程一致");
item.setSort(i + 1); }
item.setDelFlag("0"); if (!endExist) {
item.setRailInspectionEquipmentId(masterId); throw JeecgBootException.error("终点里程要和批次的起点里程一致");
} }
// 项目信息-先删除,再导入 // 项目信息-先删除,再导入
this.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, masterId).remove(); this.lambdaUpdate().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, masterId).remove();
...@@ -113,17 +151,15 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -113,17 +151,15 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
queryWrapper.eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, masterId); queryWrapper.eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, masterId);
railInspectionEquipmentItemDetailMapper.delete(queryWrapper); railInspectionEquipmentItemDetailMapper.delete(queryWrapper);
railInspectionEquipmentItemDetailMapper.insertBatch(itemDetails); railInspectionEquipmentItemDetailMapper.insertBatch(itemDetails);
this.saveBatch(items); this.saveBatch(items);
} catch (IOException io) { } catch (IOException io) {
throw new JeecgBootException(io); throw new JeecgBootException(io);
} }
} }
private int analysisItemDetail(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行不解析
...@@ -183,9 +219,9 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -183,9 +219,9 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
// 解析轨向、高低及其它 1行:空白不解析 // 解析轨向、高低及其它 1行:空白不解析
// 解析临修日期及内容 1行:空白不解析 // 解析临修日期及内容 1行:空白不解析
// 如果是正线解析首轮检查负责人1行 // 如果是股道解析首轮检查负责人1行
int skipRow = 14; int skipRow = 14;
if (titleHeader.contains("正线")) { if (titleHeader.contains("股道")) {
skipRow = skipRow + 1; skipRow = skipRow + 1;
} }
...@@ -258,17 +294,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp ...@@ -258,17 +294,7 @@ public class RailInspectionEquipmentItemServiceImpl extends ServiceImpl<RailInsp
@Override @Override
public void updateRecord(RailInspectionEquipmentItem record) { public void updateRecord(RailInspectionEquipmentItem record) {
this.lambdaUpdate() this.lambdaUpdate().set(RailInspectionEquipmentItem::getRemark, record.getRemark()).set(RailInspectionEquipmentItem::getCourseStartingMileage, record.getCourseStartingMileage()).set(RailInspectionEquipmentItem::getCourseEndMileage, record.getCourseEndMileage()).set(RailInspectionEquipmentItem::getCurveRadius, record.getCurveRadius()).set(RailInspectionEquipmentItem::getLongExtent, record.getLongExtent()).set(RailInspectionEquipmentItem::getSlopeRatio, record.getSlopeRatio()).set(RailInspectionEquipmentItem::getSuperHigh, record.getSuperHigh()).set(RailInspectionEquipmentItem::getWiden, record.getWiden()).eq(RailInspectionEquipmentItem::getId, record.getId()).update();
.set(RailInspectionEquipmentItem::getRemark, record.getRemark())
.set(RailInspectionEquipmentItem::getCourseStartingMileage, record.getCourseStartingMileage())
.set(RailInspectionEquipmentItem::getCourseEndMileage, record.getCourseEndMileage())
.set(RailInspectionEquipmentItem::getCurveRadius, record.getCurveRadius())
.set(RailInspectionEquipmentItem::getLongExtent, record.getLongExtent())
.set(RailInspectionEquipmentItem::getSlopeRatio, record.getSlopeRatio())
.set(RailInspectionEquipmentItem::getSuperHigh, record.getSuperHigh())
.set(RailInspectionEquipmentItem::getWiden, record.getWiden())
.eq(RailInspectionEquipmentItem::getId, record.getId())
.update();
// this.updateById(record); // this.updateById(record);
} }
......
...@@ -1676,8 +1676,11 @@ public class AnalysisAlgorithm { ...@@ -1676,8 +1676,11 @@ public class AnalysisAlgorithm {
// 计算超限:如果为null则计算,否则和单元绑定 // 计算超限:如果为null则计算,否则和单元绑定
if (null == transfinite) { if (null == transfinite) {
transfinite = this.labourCheckTransfinite(analysisBatch, movementCourseInfo); transfinite = this.labourCheckTransfinite(analysisBatch, movementCourseInfo);
} else {
unitDevice.put("labourCheckTransfinite", transfinite); // 如果超限不为空则添加进去
if (null != transfinite) {
unitDevice.put("labourCheckTransfinite", transfinite);
}
} }
} }
......
...@@ -8,8 +8,15 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -8,8 +8,15 @@ import cn.hutool.core.util.ObjectUtil;
import org.jeecg.common.api.dto.PageSearch; import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.checkData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.entity.RecordsMasterCheck;
import org.jeecg.modules.checkData.mapper.MovementRecordsMasterMapper;
import org.jeecg.modules.checkData.service.IMovementRecordsMasterService;
import org.jeecg.modules.checkData.service.IRecordsMasterCheckService;
import org.jeecg.modules.deviceAsset.entity.*; import org.jeecg.modules.deviceAsset.entity.*;
import org.jeecg.modules.deviceAsset.service.*; import org.jeecg.modules.deviceAsset.service.*;
import org.jeecg.modules.dynamicStaticAnalysis.service.IAnalysisBatchService;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchService;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO; import org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO;
import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO; import org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap; import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
...@@ -56,7 +63,11 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub ...@@ -56,7 +63,11 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
private ISignBoardManagementService signBoardManagementService; private ISignBoardManagementService signBoardManagementService;
@Resource @Resource
private ISleeperManagementService sleeperManagementService; private ISleeperManagementService sleeperManagementService;
@Resource
private IMovementRecordsMasterService movementRecordsMasterService;
@Resource
private IRecordsMasterCheckService recordsMasterCheckService;
@AutoLog(value = "线路车站-地铁区间-分页列表查询") @AutoLog(value = "线路车站-地铁区间-分页列表查询")
@ApiOperation(value = "线路车站-地铁区间-分页列表查询", notes = "线路车站-地铁区间-分页列表查询") @ApiOperation(value = "线路车站-地铁区间-分页列表查询", notes = "线路车站-地铁区间-分页列表查询")
...@@ -132,7 +143,12 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub ...@@ -132,7 +143,12 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
Long signBoardCount = signBoardManagementService.lambdaQuery() Long signBoardCount = signBoardManagementService.lambdaQuery()
.eq(SignBoardManagement::getSectionId, id) .eq(SignBoardManagement::getSectionId, id)
.count(); .count();
Long movementRecordsCount = movementRecordsMasterService.lambdaQuery()
.eq(MovementRecordsMaster::getSubwaySectionId, id)
.count();
Long recordsMasterCount = recordsMasterCheckService.lambdaQuery()
.eq(RecordsMasterCheck::getSubwaySectionId, id)
.count();
boolean isDel = false; boolean isDel = false;
StringBuilder errorMsg = new StringBuilder("该区间下还有"); StringBuilder errorMsg = new StringBuilder("该区间下还有");
...@@ -168,6 +184,14 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub ...@@ -168,6 +184,14 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
isDel = true; isDel = true;
errorMsg.append("轨行区标示牌:" + signBoardCount + "个"); errorMsg.append("轨行区标示牌:" + signBoardCount + "个");
} }
if (movementRecordsCount != 0) {
isDel = true;
errorMsg.append("动静态几何数据关联:" + movementRecordsCount + "条");
}
if (recordsMasterCount != 0) {
isDel = true;
errorMsg.append("设备检查记录数据关联:" + recordsMasterCount + "条");
}
if (isDel) { if (isDel) {
throw JeecgBootException.error(errorMsg.toString()); throw JeecgBootException.error(errorMsg.toString());
} }
...@@ -223,6 +247,12 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub ...@@ -223,6 +247,12 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
Long signBoardCount = signBoardManagementService.lambdaQuery() Long signBoardCount = signBoardManagementService.lambdaQuery()
.eq(SignBoardManagement::getSectionId, id) .eq(SignBoardManagement::getSectionId, id)
.count(); .count();
Long movementRecordsCount = movementRecordsMasterService.lambdaQuery()
.eq(MovementRecordsMaster::getSubwaySectionId, id)
.count();
Long recordsMasterCount = recordsMasterCheckService.lambdaQuery()
.eq(RecordsMasterCheck::getSubwaySectionId, id)
.count();
boolean isDel = false; boolean isDel = false;
if (railCount != 0) { if (railCount != 0) {
isDel = true; isDel = true;
...@@ -248,6 +278,12 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub ...@@ -248,6 +278,12 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
if (signBoardCount != 0) { if (signBoardCount != 0) {
isDel = true; isDel = true;
} }
if (movementRecordsCount != 0) {
isDel = true;
}
if (recordsMasterCount != 0) {
isDel = true;
}
if (isDel) { if (isDel) {
failNum++; failNum++;
......
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