Commit 18d38095 authored by shizhilong's avatar shizhilong

导入公里总结报告 -shizhilong

parent fbabc476
......@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.*;
import lombok.Cleanup;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
......@@ -19,14 +20,8 @@ import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.checkData.equipmentCheckData.dto.MovementAdditiveInfoDTO;
import org.jeecg.modules.checkData.equipmentCheckData.dto.MovementRecordsMasterDTO;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementAdditiveInfo;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementCourse;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementCourseInfo;
import org.jeecg.modules.checkData.equipmentCheckData.entity.MovementRecordsMaster;
import org.jeecg.modules.checkData.equipmentCheckData.service.IMovementAdditiveInfoService;
import org.jeecg.modules.checkData.equipmentCheckData.service.IMovementCourseInfoService;
import org.jeecg.modules.checkData.equipmentCheckData.service.IMovementCourseService;
import org.jeecg.modules.checkData.equipmentCheckData.service.IMovementRecordsMasterService;
import org.jeecg.modules.checkData.equipmentCheckData.entity.*;
import org.jeecg.modules.checkData.equipmentCheckData.service.*;
import org.jeecg.modules.checkData.equipmentCheckData.vo.*;
import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.LineAlias;
......@@ -35,15 +30,15 @@ import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.jeecg.modules.subwayNetwork.service.ISubwaySectionService;
import org.jeecg.modules.utils.BeanCopyUtil;
import org.jeecg.modules.utils.ExcelAnalysisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.transaction.Transactional;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
......@@ -71,6 +66,22 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
private IMovementAdditiveInfoService movementAdditiveInfoService;
@Autowired
private ILightRailService lightRailService;
@Autowired
private IMovementDiferenceManagerService movementDiferenceManagerService;
@Autowired
private IMovementOverReportService movementOverReportService;
@Autowired
private IMovementSectionReportService movementSectionReportService;
@Autowired
private IMovementSummaryReportService movementSummaryReportService;
@Autowired
private IMovementTqiKilometerReportService movementTqiKilometerReportService;
@Autowired
private IMovementTqiKilometerStandardManagerService movementTqiKilometerStandardManagerService;
@Autowired
private IMovementTqiReportService movementTqiReportService;
@Autowired
private IMovementTqiStandardManagerService movementTqiStandardManagerService;
//**********************************人工静态检查******************************
......@@ -192,8 +203,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
// }
// return Result.OK(resultList);
// }
@AutoLog(value = "根据动静态几何尺寸数据id和对应的里程相关信息id查询其详情")
@ApiOperation(value = "根据动静态几何尺寸数据id和对应的里程相关信息id查询其详情", notes = "根据动静态几何尺寸数据id和对应的里程相关信息id查询其详情")
@GetMapping(value = "/getInfoById")
......@@ -231,6 +240,7 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
}
return Result.OK(resultList);
}
@AutoLog(value = "动静态几何尺寸主数据新增或者编辑")
@ApiOperation(value = "动静态几何尺寸主数据新增或者编辑", notes = "动静态几何尺寸主数据新增或者编辑")
@PostMapping(value = "/saveOrUpdate")
......@@ -264,14 +274,8 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
if ("1".equals(type)) {
//人工静态检查相关
//删除里程详情
// LambdaUpdateWrapper<MovementCourseInfo> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
// lambdaUpdateWrapper.set(MovementCourseInfo::getDelFlag, "1");
// lambdaUpdateWrapper.eq(MovementCourseInfo::getMovementMasterId, id);
movementCourseInfoService.lambdaUpdate().eq(MovementCourseInfo::getMovementMasterId, id).remove();
//删除里程相关
// LambdaUpdateWrapper<MovementCourse> updateWrapper = Wrappers.lambdaUpdate();
// updateWrapper.set(MovementCourse::getDelFlag, "1");
// updateWrapper.eq(MovementCourse::getMovementMasterId, id);
movementCourseService.lambdaUpdate().eq(MovementCourse::getMovementMasterId, id).remove();
} else if ("4".equals(type)) {
//删除添乘仪详情
......@@ -279,12 +283,26 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
updateQuery.set(MovementAdditiveInfo::getDelFlag, "1");
updateQuery.eq(MovementAdditiveInfo::getMovementMasterId, id);
movementAdditiveInfoService.update(updateQuery);
} else if ("3".equals(type)) {
//删除轨检车-》轨道动态几何尺寸容许值差管理值
movementDiferenceManagerService.lambdaUpdate().eq(MovementDiferenceManager::getMovementMasterId, id).remove();
//删除轨检车-》超限记录报告
movementOverReportService.lambdaUpdate().eq(MovementOverReport::getMovementMasterId, id).remove();
//删除轨检车-》区段总结报告
movementSectionReportService.lambdaUpdate().eq(MovementSectionReport::getMovementMasterId, id).remove();
//删除轨检车-》公里总结报告表
movementSummaryReportService.lambdaUpdate().eq(MovementSummaryReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里总结报告
movementTqiKilometerReportService.lambdaUpdate().eq(MovementTqiKilometerReport::getMovementMasterId, id).remove();
//删除轨检车-》TQI公里状态评定标准
movementTqiKilometerStandardManagerService.lambdaUpdate().eq(MovementTqiKilometerStandardManager::getMovementMasterId, id).remove();
//删除轨检车-》TQI总结报告
movementTqiReportService.lambdaUpdate().eq(MovementTqiReport::getMovementMasterId, id).remove();
//删除轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
movementTqiStandardManagerService.lambdaUpdate().eq(MovementTqiStandardManager::getMovementMasterId, id).remove();
}
//删除动静态几何尺寸数据
LambdaUpdateWrapper<MovementRecordsMaster> update = Wrappers.lambdaUpdate();
update.set(MovementRecordsMaster::getDelFlag, "1");
update.eq(MovementRecordsMaster::getId, id);
this.service.update(update);
this.service.lambdaUpdate().eq(MovementRecordsMaster::getId, id).remove();
return Result.OK("删除成功!");
}
......@@ -361,7 +379,7 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
String[] start = mileage.split("-");
String s = start[0];
String k = s.substring(s.indexOf("K") + 1, s.length()).trim();
startingAndEndingMileageStr = k.replace("+","").trim();
startingAndEndingMileageStr = k.replace("+", "").trim();
//结束里程
String s1 = start[1];
......@@ -369,7 +387,7 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
String k1 = ks1[1];
String[] n1 = k1.split("\\+");
String s2 = n1[1];
endingMileageStr = n1[0]+s2.substring(0, s2.indexOf(" ")).trim();
endingMileageStr = n1[0] + s2.substring(0, s2.indexOf(" ")).trim();
//曲线半径
String[] n2 = s1.split("半径 ");
......@@ -754,6 +772,517 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
return Result.ok("操作成功");
}
/*************************************轨检车相关接口******************************************
/**
* 轨检车详情查询
*
* @param id 动静态几何尺寸数据id
* @param type 查询类型
* @return
*/
@AutoLog(value = "轨检车详情查询")
@ApiOperation(value = "轨检车详情查询", notes = "轨检车详情查询")
@GetMapping(value = "/getTrackInfo")
public Result<Map<String, Object>> getTrackInfo(@ApiParam(name = "动静态几何尺寸数据id") String id, @ApiParam(name = "查询类型") String type) {
Map<String, Object> map = new HashMap<>();
if ("1".equals(type)) {
//轨检车-》轨道动态几何尺寸容许值差管理值
List<MovementDiferenceManager> list = movementDiferenceManagerService.lambdaQuery()
.eq(MovementDiferenceManager::getMovementMasterId, id)
.eq(MovementDiferenceManager::getDelFlag, "0")
.orderByAsc(MovementDiferenceManager::getSort)
.list();
map.put("movementDiference", list);
} else if ("2".equals(type)) {
//轨检车-》超限记录报告
List<MovementOverReport> list = movementOverReportService.lambdaQuery()
.eq(MovementOverReport::getMovementMasterId, id)
.eq(MovementOverReport::getDelFlag, "0")
.orderByAsc(MovementOverReport::getSort)
.list();
map.put("movementOverReport", list);
} else if ("3".equals(type)) {
//轨检车-》区段总结报告
List<MovementSectionReport> list = movementSectionReportService.lambdaQuery()
.eq(MovementSectionReport::getMovementMasterId, id)
.eq(MovementSectionReport::getDelFlag, "0")
.orderByAsc(MovementSectionReport::getSort)
.list();
map.put("movementSectionReport", list);
} else if ("4".equals(type)) {
//轨检车-》公里总结报告表
List<MovementSummaryReport> list = movementSummaryReportService.lambdaQuery()
.eq(MovementSummaryReport::getMovementMasterId, id)
.eq(MovementSummaryReport::getDelFlag, "0")
.orderByAsc(MovementSummaryReport::getSort)
.list();
map.put("movementSummaryReport", list);
} else if ("5".equals(type)) {
//轨检车-》TQI公里总结报告
List<MovementTqiKilometerReport> list = movementTqiKilometerReportService.lambdaQuery()
.eq(MovementTqiKilometerReport::getMovementMasterId, id)
.eq(MovementTqiKilometerReport::getDelFlag, "0")
.orderByAsc(MovementTqiKilometerReport::getSort)
.list();
map.put("movementTqiKilometerReport", list);
} else if ("6".equals(type)) {
//轨检车-》TQI公里状态评定标准
List<MovementTqiKilometerStandardManager> list = movementTqiKilometerStandardManagerService.lambdaQuery()
.eq(MovementTqiKilometerStandardManager::getMovementMasterId, id)
.eq(MovementTqiKilometerStandardManager::getDelFlag, "0")
.orderByAsc(MovementTqiKilometerStandardManager::getSort)
.list();
map.put("movementTqiKilometerStandardManager", list);
} else if ("7".equals(type)) {
//轨检车-》TQI总结报告
List<MovementTqiReport> list = movementTqiReportService.lambdaQuery()
.eq(MovementTqiReport::getMovementMasterId, id)
.eq(MovementTqiReport::getDelFlag, "0")
.orderByAsc(MovementTqiReport::getSort)
.list();
map.put("movementTqiReport", list);
} else {
//轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
List<MovementTqiStandardManager> list = movementTqiStandardManagerService.lambdaQuery()
.eq(MovementTqiStandardManager::getMovementMasterId, id)
.eq(MovementTqiStandardManager::getDelFlag, "0")
.orderByAsc(MovementTqiStandardManager::getSort)
.list();
map.put("movementTqiStandardManager", list);
}
return Result.OK(map);
}
@AutoLog(value = "轨检车导入")
@ApiOperation(value = "轨检车导入", notes = "轨检车导入")
@PostMapping(value = "/trackUpload")
@Transactional
public Result<String> trackUploadFile(MultipartFile file, @ApiParam(name = "动静态几何尺寸主键id") String id) throws Exception {
try {
//初始化数据模板
boolean state = this.initData(id);
if (state == false) {
return Result.error("初始化数据失败");
}
InputStream in = file.getInputStream();
//读取Excel中的数据
List<List<Object>> rowRecords = ExcelAnalysisUtils.getListByExcel(in);
//获取当前登录人信息
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String realname = user.getRealname();
//初始化导入顺序
int sort = 0;
//公里总结报告表占用行数
//int dataOne = 0;
//初始化公里总结报告集合
List<MovementSummaryReport> movementSummaryReportList = new ArrayList<>();
for (int i = 0; i < rowRecords.size(); i++) {
List<Object> list = rowRecords.get(i);
boolean state1 = list.contains("公里总结报告表");
if (state1 == true) {
String data = list.get(0).toString().trim();
if ("公里总结报告表".equals(data)) {
//处理公里总结报告表解析封装逻辑
int dataOne = this.uploadMovementSummaryReport(movementSummaryReportList, i, sort, realname, rowRecords, id);
i= i + dataOne;
System.out.println(i);
break;
} else {
continue;
}
} else {
continue;
}
}
//维护公里总结报告表
if (movementSummaryReportList != null && movementSummaryReportList.size() > 0) {
movementSummaryReportService.saveBatch(movementSummaryReportList);
}
//释放资源
in.close();
} catch (Exception e) {
e.getMessage();
}
return Result.ok("操作成功");
}
//************************************公共方法封装******************************************************
/**
* @param movementSummaryReportList 最终的公里总结报告集合
* @param i 当前行坐标
* @param sort 顺序
* @param realname 当前登录人姓名
* @param rowRecords 总行列数据集合
* @param id 主表id
*/
public int uploadMovementSummaryReport(List<MovementSummaryReport> movementSummaryReportList, int i, int sort, String realname, List<List<Object>> rowRecords, String id) {
int dataOne = 0;
for (int j = i + 4; j < rowRecords.size(); j++) {
List<Object> list1 = rowRecords.get(j);
dataOne++;
if (list1 == null || list1.size() <= 0) {
dataOne = dataOne+4;
return dataOne;
}
// boolean state2 = list1.contains("打印时间");
// if (state2 == true) {
// break;
// }
sort++;
//初始化公里总结报告表
MovementSummaryReport model = new MovementSummaryReport();
model.setId(IdWorker.get32UUID());
model.setDelFlag("0");
model.setMovementMasterId(id);
model.setCreateTime(new Date());
model.setUpdateTime(new Date());
model.setCreateBy(realname);
model.setUpdateBy(realname);
model.setSort(sort);
//公里
String kilometer = "";
kilometer = rowRecords.get(j).get(0).toString().trim();
if (ObjectUtil.isNotEmpty(kilometer)) {
model.setKilometer(kilometer);
}
//长度
String longitude = "";
longitude = rowRecords.get(j).get(2).toString().trim();
if (ObjectUtil.isNotEmpty(longitude)) {
model.setLongitude(longitude);
}
//左高低1
String leftHighLowOne = "";
leftHighLowOne = rowRecords.get(j).get(5).toString().trim();
if (ObjectUtil.isNotEmpty(leftHighLowOne)) {
model.setLeftHighLowOne(leftHighLowOne);
}
//左高低2
String leftHighLowTwo = "";
leftHighLowTwo = rowRecords.get(j).get(6).toString().trim();
if (ObjectUtil.isNotEmpty(leftHighLowTwo)) {
model.setLeftHighLowTwo(leftHighLowTwo);
}
//左高低3
String leftHighLowThree = "";
leftHighLowThree = rowRecords.get(j).get(8).toString().trim();
if (ObjectUtil.isNotEmpty(leftHighLowThree)) {
model.setLeftHighLowThree(leftHighLowThree);
}
//左高低4
String leftHighLowFour = "";
leftHighLowFour = rowRecords.get(j).get(12).toString().trim();
if (ObjectUtil.isNotEmpty(leftHighLowFour)) {
model.setLeftHighLowFour(leftHighLowFour);
}
//右高低1
String rightHighLowOne = "";
rightHighLowOne = rowRecords.get(j).get(15).toString().trim();
if (ObjectUtil.isNotEmpty(rightHighLowOne)) {
model.setRightHighLowOne(rightHighLowOne);
}
//右高低2
String rightHighLowTwo = "";
rightHighLowTwo = rowRecords.get(j).get(17).toString().trim();
if (ObjectUtil.isNotEmpty(rightHighLowTwo)) {
model.setRightHighLowTwo(rightHighLowTwo);
}
//右高低3
String rightHighLowThree = "";
rightHighLowThree = rowRecords.get(j).get(20).toString().trim();
if (ObjectUtil.isNotEmpty(rightHighLowThree)) {
model.setRightHighLowThree(rightHighLowThree);
}
//右高低4
String rightHighLowFour = "";
rightHighLowFour = rowRecords.get(j).get(22).toString().trim();
if (ObjectUtil.isNotEmpty(rightHighLowFour)) {
model.setRightHighLowFour(rightHighLowFour);
}
//左轨向1
String leftTrackOne = "";
leftTrackOne = rowRecords.get(j).get(24).toString().trim();
if (ObjectUtil.isNotEmpty(leftTrackOne)) {
model.setLeftTrackOne(leftTrackOne);
}
//左轨向2
String leftTrackTwo = "";
leftTrackTwo = rowRecords.get(j).get(26).toString().trim();
if (ObjectUtil.isNotEmpty(leftTrackTwo)) {
model.setLeftTrackTwo(leftTrackTwo);
}
//左轨向3
String leftTrackThree = "";
leftTrackThree = rowRecords.get(j).get(29).toString().trim();
if (ObjectUtil.isNotEmpty(leftTrackThree)) {
model.setLeftTrackThree(leftTrackThree);
}
//左轨向4
String leftTrackFour = "";
leftTrackFour = rowRecords.get(j).get(31).toString().trim();
if (ObjectUtil.isNotEmpty(leftTrackFour)) {
model.setLeftTrackFour(leftTrackFour);
}
//右轨向1
String rightTrackOne = "";
rightTrackOne = rowRecords.get(j).get(33).toString().trim();
if (ObjectUtil.isNotEmpty(rightTrackOne)) {
model.setRightTrackOne(rightTrackOne);
}
//右轨向2
String rigTrackTwo = "";
rigTrackTwo = rowRecords.get(j).get(34).toString().trim();
if (ObjectUtil.isNotEmpty(rigTrackTwo)) {
model.setRightTrackTwo(rigTrackTwo);
}
//右轨向3
String rigTrackThree = "";
rigTrackThree = rowRecords.get(j).get(37).toString().trim();
if (ObjectUtil.isNotEmpty(rigTrackThree)) {
model.setRightTrackThree(rigTrackThree);
}
//右轨向4
String rightTrackFour = "";
rightTrackFour = rowRecords.get(j).get(38).toString().trim();
if (ObjectUtil.isNotEmpty(rightTrackFour)) {
model.setRightTrackFour(rightTrackFour);
}
//轨距1
String trackGaugeOne = "";
trackGaugeOne = rowRecords.get(j).get(40).toString().trim();
if (ObjectUtil.isNotEmpty(trackGaugeOne)) {
model.setTrackGaugeOne(trackGaugeOne);
}
//轨距2
String trackGaugeTwo = "";
trackGaugeTwo = rowRecords.get(j).get(43).toString().trim();
if (ObjectUtil.isNotEmpty(trackGaugeTwo)) {
model.setTrackGaugeTwo(trackGaugeTwo);
}
//轨距3
String trackGaugeThree = "";
trackGaugeThree = rowRecords.get(j).get(48).toString().trim();
if (ObjectUtil.isNotEmpty(trackGaugeThree)) {
model.setTrackGaugeThree(trackGaugeThree);
}
//轨距4
String trackGaugeFour = "";
trackGaugeFour = rowRecords.get(j).get(50).toString().trim();
if (ObjectUtil.isNotEmpty(trackGaugeFour)) {
model.setTrackGaugeFour(trackGaugeFour);
}
//水平1
String levelOne = "";
levelOne = rowRecords.get(j).get(51).toString().trim();
if (ObjectUtil.isNotEmpty(levelOne)) {
model.setLevelOne(levelOne);
}
//水平2
String levelTwo = "";
levelTwo = rowRecords.get(j).get(54).toString().trim();
if (ObjectUtil.isNotEmpty(levelTwo)) {
model.setLevelTwo(levelTwo);
}
//水平3
String levelThree = "";
levelThree = rowRecords.get(j).get(61).toString().trim();
if (ObjectUtil.isNotEmpty(levelThree)) {
model.setLevelThree(levelThree);
}
//水平4
String levelFour = "";
levelFour = rowRecords.get(j).get(64).toString().trim();
if (ObjectUtil.isNotEmpty(levelFour)) {
model.setLevelFour(levelFour);
}
//三角坑1
String triangularPitOne = "";
triangularPitOne = rowRecords.get(j).get(66).toString().trim();
if (ObjectUtil.isNotEmpty(triangularPitOne)) {
model.setTriangularPitOne(triangularPitOne);
}
//三角坑2
String triangularPitTwo = "";
triangularPitTwo = rowRecords.get(j).get(68).toString().trim();
if (ObjectUtil.isNotEmpty(triangularPitTwo)) {
model.setTriangularPitTwo(triangularPitTwo);
}
//三角坑3
String triangularPitThree = "";
triangularPitThree = rowRecords.get(j).get(73).toString().trim();
if (ObjectUtil.isNotEmpty(triangularPitThree)) {
model.setTriangularPitThree(triangularPitThree);
}
//三角坑4
String triangularPitFour = "";
triangularPitFour = rowRecords.get(j).get(76).toString().trim();
if (ObjectUtil.isNotEmpty(triangularPitFour)) {
model.setTriangularPitFour(triangularPitFour);
}
//曲率1
String curvatureOne = "";
curvatureOne = rowRecords.get(j).get(77).toString().trim();
if (ObjectUtil.isNotEmpty(curvatureOne)) {
model.setCurvatureOne(curvatureOne);
}
//曲率2
String curvatureTwo = "";
curvatureTwo = rowRecords.get(j).get(79).toString().trim();
if (ObjectUtil.isNotEmpty(curvatureTwo)) {
model.setCurvatureTwo(curvatureTwo);
}
//曲率3
String curvatureThree = "";
curvatureThree = rowRecords.get(j).get(82).toString().trim();
if (ObjectUtil.isNotEmpty(curvatureThree)) {
model.setCurvatureThree(curvatureThree);
}
//曲率4
String curvatureFour = "";
curvatureFour = rowRecords.get(j).get(83).toString().trim();
if (ObjectUtil.isNotEmpty(curvatureFour)) {
model.setCurvatureFour(curvatureFour);
}
//垂向加速度1
String droopVelocityOne = "";
droopVelocityOne = rowRecords.get(j).get(85).toString().trim();
if (ObjectUtil.isNotEmpty(droopVelocityOne)) {
model.setDroopVelocityOne(droopVelocityOne);
}
//垂向加速度2
String droopVelocityTwo = "";
droopVelocityTwo = rowRecords.get(j).get(88).toString().trim();
if (ObjectUtil.isNotEmpty(droopVelocityTwo)) {
model.setDroopVelocityTwo(droopVelocityTwo);
}
//垂向加速度3
String droopVelocityThree = "";
droopVelocityThree = rowRecords.get(j).get(91).toString().trim();
if (ObjectUtil.isNotEmpty(droopVelocityThree)) {
model.setDroopVelocityThree(droopVelocityThree);
}
//垂向加速度4
String droopVelocityFour = "";
droopVelocityFour = rowRecords.get(j).get(93).toString().trim();
if (ObjectUtil.isNotEmpty(droopVelocityFour)) {
model.setDroopVelocityFour(droopVelocityFour);
}
//横向加速度1
String acrossVelocityOne = "";
acrossVelocityOne = rowRecords.get(j).get(94).toString().trim();
if (ObjectUtil.isNotEmpty(acrossVelocityOne)) {
model.setAcrossVelocityOne(acrossVelocityOne);
}
//横向加速度2
String acrossVelocityTwo = "";
acrossVelocityTwo = rowRecords.get(j).get(97).toString().trim();
if (ObjectUtil.isNotEmpty(acrossVelocityTwo)) {
model.setAcrossVelocityTwo(acrossVelocityTwo);
}
//横向加速度3
String acrossVelocityThree = "";
acrossVelocityThree = rowRecords.get(j).get(99).toString().trim();
if (ObjectUtil.isNotEmpty(acrossVelocityThree)) {
model.setAcrossVelocityThree(acrossVelocityThree);
}
//横向加速度4
String acrossVelocityFour = "";
acrossVelocityFour = rowRecords.get(j).get(101).toString().trim();
if (ObjectUtil.isNotEmpty(acrossVelocityFour)) {
model.setAcrossVelocityFour(acrossVelocityFour);
}
//曲率变化率1
String curvatureChangeOne = "";
curvatureChangeOne = rowRecords.get(j).get(104).toString().trim();
if (ObjectUtil.isNotEmpty(curvatureChangeOne)) {
model.setCurvatureChangeOne(curvatureChangeOne);
}
//曲率变化率2
String curvatureChangeTwo = "";
curvatureChangeTwo = rowRecords.get(j).get(108).toString().trim();
if (ObjectUtil.isNotEmpty(curvatureChangeTwo)) {
model.setCurvatureChangeTwo(curvatureChangeTwo);
}
//轨距变化率1
String trackGaugeChangeOne = "";
trackGaugeChangeOne = rowRecords.get(j).get(111).toString().trim();
if (ObjectUtil.isNotEmpty(trackGaugeChangeOne)) {
model.setTrackGaugeChangeOne(trackGaugeChangeOne);
}
//轨距变化率2
String trackGaugeChangeTwo = "";
trackGaugeChangeTwo = rowRecords.get(j).get(115).toString().trim();
if (ObjectUtil.isNotEmpty(trackGaugeChangeTwo)) {
model.setTrackGaugeChangeTwo(trackGaugeChangeTwo);
}
//公里扣分
String kilometerDeduct = "";
kilometerDeduct = rowRecords.get(j).get(119).toString().trim();
if (ObjectUtil.isNotEmpty(kilometerDeduct)) {
model.setKilometerDeduct(kilometerDeduct);
}
//评定
String evaluate = "";
evaluate = rowRecords.get(j).get(123).toString().trim();
if (ObjectUtil.isNotEmpty(evaluate)) {
model.setEvaluate(evaluate);
}
//速度 (km/h)
String speed = "";
speed = rowRecords.get(j).get(127).toString().trim();
if (ObjectUtil.isNotEmpty(speed)) {
model.setSpeed(speed);
}
movementSummaryReportList.add(model);
}
dataOne = dataOne+4;
return dataOne;
}
/**
* 导入初始化轨检车数据
*
* @param id
* @return
*/
private boolean initData(String id) {
//轨检车-》轨道动态几何尺寸容许值差管理值
QueryWrapper<MovementDiferenceManager> movementDiferenceManagerRemove = new QueryWrapper<>();
movementDiferenceManagerRemove.eq("movement_master_id", id);
movementDiferenceManagerService.remove(movementDiferenceManagerRemove);
//轨检车-》超限记录报告
QueryWrapper<MovementOverReport> movementOverReportRemove = new QueryWrapper<>();
movementOverReportRemove.eq("movement_master_id", id);
movementOverReportService.remove(movementOverReportRemove);
//轨检车-》区段总结报告
QueryWrapper<MovementSectionReport> movementSectionReportRemove = new QueryWrapper<>();
movementSectionReportRemove.eq("movement_master_id", id);
movementSectionReportService.remove(movementSectionReportRemove);
//轨检车-》区段总结报告
QueryWrapper<MovementSummaryReport> movementSummaryReportRemove = new QueryWrapper<>();
movementSummaryReportRemove.eq("movement_master_id", id);
movementSummaryReportService.remove(movementSummaryReportRemove);
//轨检车-》TQI公里总结报告
QueryWrapper<MovementTqiKilometerReport> movementTqiKilometerReportRemove = new QueryWrapper<>();
movementTqiKilometerReportRemove.eq("movement_master_id", id);
movementTqiKilometerReportService.remove(movementTqiKilometerReportRemove);
//轨检车-》TQI公里状态评定标准
QueryWrapper<MovementTqiKilometerStandardManager> movementTqiKilometerStandardManagerRemove = new QueryWrapper<>();
movementTqiKilometerStandardManagerRemove.eq("movement_master_id", id);
movementTqiKilometerStandardManagerService.remove(movementTqiKilometerStandardManagerRemove);
//轨检车-》TQI总结报告
QueryWrapper<MovementTqiReport> movementTqiReportRemove = new QueryWrapper<>();
movementTqiReportRemove.eq("movement_master_id", id);
movementTqiReportService.remove(movementTqiReportRemove);
//轨检车-》200m区段轨道不平顺质量指数TQI管理标准(单位:mm)
QueryWrapper<MovementTqiStandardManager> movementTqiStandardManagerRemove = new QueryWrapper<>();
movementTqiStandardManagerRemove.eq("movement_master_id", id);
movementTqiStandardManagerService.remove(movementTqiStandardManagerRemove);
return true;
}
/**
* 校验参数
*
......
package org.jeecg.modules.utils;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* @author admin
*/
public class ExcelAnalysisUtils {
/**
* @Description:获取IO流中的数据,组装成List<List<Object>>对象
*/
public static List<List<Object>> getListByExcel(InputStream in) throws Exception {
List<List<Object>> list;
//创建Excel工作薄
Workbook work = new XSSFWorkbook(in);
Sheet sheet; //页数
Row row; //行数
Cell cell; //列数
list = new ArrayList<>();
//遍历Excel中所有的sheet
for (int i = 0; i < work.getNumberOfSheets(); i++) {
sheet = work.getSheetAt(i);
if (sheet == null) {
continue;
}
//遍历当前sheet中的所有行
for (int j = sheet.getFirstRowNum(); j <= sheet.getLastRowNum(); j++) {
row = sheet.getRow(j);
if (row == null) {
continue;
}
//遍历所有的列
List<Object> li = new ArrayList<>();
for (int y = row.getFirstCellNum(); y < row.getLastCellNum(); y++) {
cell = row.getCell(y);
li.add(getValue(cell));
}
list.add(li);
}
}
return list;
}
/**
* 对表格中数值进行格式化 解决excel类型问题,获得数值
*/
public static String getValue(Cell cell) {
String value = "";
if(null == cell) {
return value;
}
switch(cell.getCellType()) {
//数值型
case NUMERIC:
if(DateUtil.isCellDateFormatted(cell)) {
//如果是date类型则 ,获取该cell的date值
Date date = DateUtil.getJavaDate(cell.getNumericCellValue());
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
value = format.format(date);
}
else {// 纯数字
BigDecimal big = BigDecimal.valueOf(cell.getNumericCellValue());
String s = "0";
value = big.toString();
//解决1234.0 去掉后面的.0
if(null != value && !"".equals(value.trim())) {
String[] item = value.split("[.]");
if(1 < item.length && s.equals(item[1])) {
value = item[0];
}
}
}
break;
//字符串类型
case STRING:
value = cell.getStringCellValue();
break;
// 公式类型
case FORMULA:
//读公式计算值
value = String.valueOf(cell.getNumericCellValue());
String nan = "NaN";
if(nan.equals(value)) {// 如果获取的数据值为非法值,则转换为获取字符串
value = cell.getStringCellValue();
}
break;
// 布尔类型
case BOOLEAN:
value = " " + cell.getBooleanCellValue();
break;
default:
value = cell.getStringCellValue();
}
String ss = "null";
if(ss.endsWith(value.trim())) {
value = "";
}
return value;
}
}
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