Commit ba572248 authored by shizhilong's avatar shizhilong

导入 TQI公里总结报告表 TQI总结报告表 超限记录报告 -shizhilong

parent 18d38095
...@@ -39,6 +39,7 @@ import javax.transaction.Transactional; ...@@ -39,6 +39,7 @@ import javax.transaction.Transactional;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -872,32 +873,64 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -872,32 +873,64 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
String realname = user.getRealname(); String realname = user.getRealname();
//初始化导入顺序 //初始化导入顺序
int sort = 0; int sort = 0;
//公里总结报告表占用行数
//int dataOne = 0;
//初始化公里总结报告集合 //初始化公里总结报告集合
List<MovementSummaryReport> movementSummaryReportList = new ArrayList<>(); List<MovementSummaryReport> movementSummaryReportList = new ArrayList<>();
//初始化TQI公里总结报告集合
List<MovementTqiKilometerReport> movementTqiKilometerReportList = new ArrayList<>();
//初始化TQI总结报告表集合
List<MovementTqiReport> movementTqiReportList = new ArrayList<>();
//初始化超限记录报告集合
List<MovementOverReport> movementOverReportList = new ArrayList<>();
for (int i = 0; i < rowRecords.size(); i++) { for (int i = 0; i < rowRecords.size(); i++) {
List<Object> list = rowRecords.get(i); List<Object> list = rowRecords.get(i);
boolean state1 = list.contains("公里总结报告表"); if (list == null || list.size() <= 0) {
if (state1 == true) { continue;
String data = list.get(0).toString().trim(); }
if ("公里总结报告表".equals(data)) { String str = list.get(0).toString().trim();
if (str.equals("")) {
continue;
}
if (str.equals("四级缺陷记录报告表")|| str.equals("三级缺陷记录报告表") || str.equals("二级缺陷记录报告表") || str.equals("一级缺陷记录报告表")) {
//处理超限记录报告解析封装逻辑
int dataOne = this.uploadMovementOverReport(movementOverReportList, i, sort, realname, rowRecords, id);
i = i + dataOne;
}else if (str.equals("TQI总结报告表")) {
//处理TQI总结报告表解析封装逻辑
int dataOne = this.uploadMovementTqiReport(movementTqiReportList, i, sort, realname, rowRecords, id);
i = i + dataOne;
} else if (str.equals("TQI公里总结报告表")) {
//处理TQI公里总结报告表解析封装逻辑
int dataOne = this.uploadMovementTqiKilometerReport(movementTqiKilometerReportList, i, sort, realname, rowRecords, id);
i = i + dataOne;
} else if (str.equals("公里总结报告表")) {
//处理公里总结报告表解析封装逻辑 //处理公里总结报告表解析封装逻辑
int dataOne = this.uploadMovementSummaryReport(movementSummaryReportList, i, sort, realname, rowRecords, id); int dataOne = this.uploadMovementSummaryReport(movementSummaryReportList, i, sort, realname, rowRecords, id);
i= i + dataOne; i = i + dataOne;
System.out.println(i);
break;
} else { } else {
if (i != rowRecords.size() - 1) {
continue; continue;
}
} else { } else {
continue; //释放资源
in.close();
}
} }
} }
//维护公里总结报告表 //维护公里总结报告表
if (movementSummaryReportList != null && movementSummaryReportList.size() > 0) { if (movementSummaryReportList != null && movementSummaryReportList.size() > 0) {
movementSummaryReportService.saveBatch(movementSummaryReportList); movementSummaryReportService.saveBatch(movementSummaryReportList);
} }
//维护TQI公里总结报告表
if (movementTqiKilometerReportList != null && movementTqiKilometerReportList.size() > 0) {
movementTqiKilometerReportService.saveBatch(movementTqiKilometerReportList);
}
//维护TQI总结报告表
if (movementTqiReportList != null && movementTqiReportList.size() > 0) {
movementTqiReportService.saveBatch(movementTqiReportList);
}
//维护超限记录报告
if (movementOverReportList != null && movementOverReportList.size() > 0) {
movementOverReportService.saveBatch(movementOverReportList);
}
//释放资源 //释放资源
in.close(); in.close();
} catch (Exception e) { } catch (Exception e) {
...@@ -909,27 +942,354 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -909,27 +942,354 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
//************************************公共方法封装****************************************************** //************************************公共方法封装******************************************************
/** /**
* @param movementSummaryReportList 最终的公里总结报告集合 * @param movementOverReportList 最终的超限总结报告集合
* @param i 当前行坐标 * @param i 当前行坐标
* @param sort 顺序 * @param sort 顺序
* @param realname 当前登录人姓名 * @param realname 当前登录人姓名
* @param rowRecords 总行列数据集合 * @param rowRecords 总行列数据集合
* @param id 主表id * @param id 主表id
*/ */
public int uploadMovementSummaryReport(List<MovementSummaryReport> movementSummaryReportList, int i, int sort, String realname, List<List<Object>> rowRecords, String id) { public int uploadMovementOverReport(List<MovementOverReport> movementOverReportList, int i, int sort, String realname, List<List<Object>> rowRecords, String id) {
String regEx = "[^0-9]";
Pattern p = Pattern.compile(regEx);
int dataOne = 0; int dataOne = 0;
for (int j = i + 4; j < rowRecords.size(); j++) { for (int j = i + 4; j < rowRecords.size(); j++) {
List<Object> list1 = rowRecords.get(j); List<Object> list1 = rowRecords.get(j);
if (list1 == null || list1.size() <= 0) {
return dataOne;
}
String str = list1.get(0).toString().trim();
if (str.equals("")) {
return dataOne;
}
dataOne++; dataOne++;
sort++;
//初始化公里总结报告表
MovementOverReport model = new MovementOverReport();
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 code = "";
code = rowRecords.get(j).get(0).toString().trim();
if (ObjectUtil.isNotEmpty(code)) {
model.setXuhao(code);
}
//里程(m)
String mileage = "";
String data = rowRecords.get(j).get(4).toString().trim();
if (ObjectUtil.isNotEmpty(data)) {
Matcher m = p.matcher(data);
mileage = m.replaceAll("").trim();
model.setMileage(new BigDecimal(mileage));
}
//区间名称
String sectionName = "";
sectionName = rowRecords.get(j).get(14).toString().trim();
if (ObjectUtil.isNotEmpty(sectionName)) {
model.setSectionName(sectionName);
}
//超限类型
String overrunType = "";
overrunType = rowRecords.get(j).get(32).toString().trim();
if (ObjectUtil.isNotEmpty(overrunType)) {
model.setOverrunType(overrunType);
}
//超限等级
String overrunLevel = "";
overrunLevel = rowRecords.get(j).get(42).toString().trim();
if (ObjectUtil.isNotEmpty(overrunLevel)) {
model.setOverrunLevel(overrunLevel);
}
//长度
String longitude = "";
longitude = rowRecords.get(j).get(53).toString().trim();
if (ObjectUtil.isNotEmpty(longitude)) {
model.setLongitude(longitude);
}
//峰值(mm或g)
String peakValue = "";
peakValue = rowRecords.get(j).get(66).toString().trim();
if (ObjectUtil.isNotEmpty(peakValue)) {
model.setPeakValue(peakValue);
}
//管理数据差
String dataDifference = "";
dataDifference = rowRecords.get(j).get(77).toString().trim();
if (ObjectUtil.isNotEmpty(dataDifference)) {
model.setDataDifference(dataDifference);
}
//线性
String xianxing = "";
xianxing = rowRecords.get(j).get(86).toString().trim();
if (ObjectUtil.isNotEmpty(xianxing)) {
model.setXianxing(xianxing);
}
//检测标准
String standard = "";
standard = rowRecords.get(j).get(98).toString().trim();
if (ObjectUtil.isNotEmpty(standard)) {
model.setStandard(standard);
}
//速度(km/h)
String spend = "";
spend = rowRecords.get(j).get(109).toString().trim();
if (ObjectUtil.isNotEmpty(spend)) {
model.setSpend(spend);
}
//备注
String remark = "";
remark = rowRecords.get(j).get(124).toString().trim();
if (ObjectUtil.isNotEmpty(remark)) {
model.setRemark(remark);
}
movementOverReportList.add(model);
}
return dataOne;
}
/**
* @param movementTqiReportList 最终的TQI总结报告集合
* @param i 当前行坐标
* @param sort 顺序
* @param realname 当前登录人姓名
* @param rowRecords 总行列数据集合
* @param id 主表id
*/
public int uploadMovementTqiReport(List<MovementTqiReport> movementTqiReportList, int i, int sort, String realname, List<List<Object>> rowRecords, String id) {
String regEx = "[^0-9]";
Pattern p = Pattern.compile(regEx);
int dataOne = 0;
for (int j = i + 5; j < rowRecords.size(); j++) {
List<Object> list1 = rowRecords.get(j);
if (list1 == null || list1.size() <= 0) { if (list1 == null || list1.size() <= 0) {
dataOne = dataOne+4;
return dataOne; return dataOne;
} }
// boolean state2 = list1.contains("打印时间"); String str = list1.get(0).toString().trim();
// if (state2 == true) { if (str.equals("")) {
// break; return dataOne;
// } }
dataOne++;
sort++;
//初始化公里总结报告表
MovementTqiReport model = new MovementTqiReport();
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);
//开始里程(m)
String startMileage = "";
//终点里程(m)
String endMileage = "";
String mileage = rowRecords.get(j).get(0).toString().trim();
if (ObjectUtil.isNotEmpty(mileage)) {
//使用符号进行分割
String[] s1 = mileage.split("->");
String start = s1[0];
Matcher m = p.matcher(start);
startMileage = m.replaceAll("").trim();
model.setStartMileage(new BigDecimal(startMileage));
String end = s1[1];
Matcher m1 = p.matcher(end);
endMileage = m1.replaceAll("").trim();
model.setEndMileage(new BigDecimal(endMileage));
}
//区间名称
String sectionName = "";
sectionName = rowRecords.get(j).get(11).toString().trim();
if (ObjectUtil.isNotEmpty(sectionName)) {
model.setSectionName(sectionName);
}
//高低左
String highLowLeft = "";
highLowLeft = rowRecords.get(j).get(30).toString().trim();
if (ObjectUtil.isNotEmpty(highLowLeft)) {
model.setHighLowLeft(highLowLeft);
}
//高低右
String highLowRight = "";
highLowRight = rowRecords.get(j).get(35).toString().trim();
if (ObjectUtil.isNotEmpty(highLowRight)) {
model.setHighLowRight(highLowRight);
}
//轨向左
String trackLeft = "";
trackLeft = rowRecords.get(j).get(44).toString().trim();
if (ObjectUtil.isNotEmpty(trackLeft)) {
model.setTrackLeft(trackLeft);
}
//轨向右
String trackRight = "";
trackRight = rowRecords.get(j).get(52).toString().trim();
if (ObjectUtil.isNotEmpty(trackRight)) {
model.setTrackRight(trackRight);
}
//水平(mm)
String level = "";
level = rowRecords.get(j).get(65).toString().trim();
if (ObjectUtil.isNotEmpty(level)) {
model.setLevel(level);
}
//轨距(mm)
String trackGauge = "";
trackGauge = rowRecords.get(j).get(75).toString().trim();
if (ObjectUtil.isNotEmpty(trackGauge)) {
model.setTrackGauge(trackGauge);
}
//三角坑(mm)
String triangularPit = "";
triangularPit = rowRecords.get(j).get(81).toString().trim();
if (ObjectUtil.isNotEmpty(triangularPit)) {
model.setTriangularPit(triangularPit);
}
//TQI数值
String tqiComeUpon = "";
tqiComeUpon = rowRecords.get(j).get(87).toString().trim();
if (ObjectUtil.isNotEmpty(tqiComeUpon)) {
model.setTqiComeUpon(tqiComeUpon);
}
//TQI超标
String tqiAboveStandard = "";
tqiAboveStandard = rowRecords.get(j).get(95).toString().trim();
if (ObjectUtil.isNotEmpty(tqiAboveStandard)) {
model.setTqiAboveStandard(tqiAboveStandard);
}
//扣分
String deduct = "";
deduct = rowRecords.get(j).get(103).toString().trim();
if (ObjectUtil.isNotEmpty(deduct)) {
model.setDeduct(deduct);
}
//检测标准
String standard = "";
standard = rowRecords.get(j).get(112).toString().trim();
if (ObjectUtil.isNotEmpty(standard)) {
model.setStandard(standard);
}
//速度(km/h)
String spend = "";
spend = rowRecords.get(j).get(125).toString().trim();
if (ObjectUtil.isNotEmpty(spend)) {
model.setSpend(spend);
}
movementTqiReportList.add(model);
}
return dataOne;
}
/**
* @param movementTqiKilometerReportList 最终的TQI公里总结报告集合
* @param i 当前行坐标
* @param sort 顺序
* @param realname 当前登录人姓名
* @param rowRecords 总行列数据集合
* @param id 主表id
*/
public int uploadMovementTqiKilometerReport(List<MovementTqiKilometerReport> movementTqiKilometerReportList, int i, int sort, String realname, List<List<Object>> rowRecords, String id) {
int dataOne = 0;
for (int j = i + 5; j < rowRecords.size(); j++) {
List<Object> list1 = rowRecords.get(j);
if (list1 == null || list1.size() <= 0) {
return dataOne;
}
String str = list1.get(0).toString().trim();
if (str.equals("")) {
return dataOne;
}
dataOne++;
sort++;
//初始化公里总结报告表
MovementTqiKilometerReport model = new MovementTqiKilometerReport();
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 standard = "";
standard = rowRecords.get(j).get(10).toString().trim();
if (ObjectUtil.isNotEmpty(standard)) {
model.setStandard(standard);
}
//未超标
String notAboveStandard = "";
notAboveStandard = rowRecords.get(j).get(25).toString().trim();
if (ObjectUtil.isNotEmpty(notAboveStandard)) {
model.setNotAboveStandard(notAboveStandard);
}
//超标
String aboveStandard = "";
aboveStandard = rowRecords.get(j).get(39).toString().trim();
if (ObjectUtil.isNotEmpty(aboveStandard)) {
model.setAboveStandard(aboveStandard);
}
//超标10
String aboveStandardTen = "";
aboveStandardTen = rowRecords.get(j).get(62).toString().trim();
if (ObjectUtil.isNotEmpty(aboveStandardTen)) {
model.setAboveStandardTen(aboveStandardTen);
}
//超标20
String aboveStandardTwenty = "";
aboveStandardTwenty = rowRecords.get(j).get(80).toString().trim();
if (ObjectUtil.isNotEmpty(aboveStandardTwenty)) {
model.setAboveStandardTwenty(aboveStandardTwenty);
}
//T值
String comeUpon = "";
comeUpon = rowRecords.get(j).get(95).toString().trim();
if (ObjectUtil.isNotEmpty(comeUpon)) {
model.setComeUpon(comeUpon);
}
//评价
String rate = "";
rate = rowRecords.get(j).get(114).toString().trim();
if (ObjectUtil.isNotEmpty(rate)) {
model.setRate(rate);
}
movementTqiKilometerReportList.add(model);
}
return dataOne;
}
/**
* @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);
if (list1 == null || list1.size() <= 0) {
return dataOne;
}
String str = list1.get(0).toString().trim();
if (str.equals("")) {
return dataOne;
}
dataOne++;
sort++; sort++;
//初始化公里总结报告表 //初始化公里总结报告表
MovementSummaryReport model = new MovementSummaryReport(); MovementSummaryReport model = new MovementSummaryReport();
...@@ -1237,7 +1597,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -1237,7 +1597,6 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
} }
movementSummaryReportList.add(model); movementSummaryReportList.add(model);
} }
dataOne = dataOne+4;
return dataOne; return dataOne;
} }
......
...@@ -45,7 +45,7 @@ public class MovementOverReportDTO { ...@@ -45,7 +45,7 @@ public class MovementOverReportDTO {
private String movementMasterId; private String movementMasterId;
@ApiModelProperty("序号") @ApiModelProperty("序号")
private String code; private String xuhao;
@ApiModelProperty("里程(m)") @ApiModelProperty("里程(m)")
private BigDecimal mileage; private BigDecimal mileage;
...@@ -69,7 +69,7 @@ public class MovementOverReportDTO { ...@@ -69,7 +69,7 @@ public class MovementOverReportDTO {
private String dataDifference; private String dataDifference;
@ApiModelProperty("线性") @ApiModelProperty("线性")
private String linear; private String xianxing;
@ApiModelProperty("检测标准") @ApiModelProperty("检测标准")
private String standard; private String standard;
......
...@@ -59,8 +59,8 @@ public class MovementOverReport implements Serializable { ...@@ -59,8 +59,8 @@ public class MovementOverReport implements Serializable {
private String movementMasterId; private String movementMasterId;
@ApiModelProperty("序号") @ApiModelProperty("序号")
@TableField("code") @TableField("xuhao")
private String code; private String xuhao;
@ApiModelProperty("里程(m)") @ApiModelProperty("里程(m)")
@TableField("mileage") @TableField("mileage")
...@@ -91,8 +91,8 @@ public class MovementOverReport implements Serializable { ...@@ -91,8 +91,8 @@ public class MovementOverReport implements Serializable {
private String dataDifference; private String dataDifference;
@ApiModelProperty("线性") @ApiModelProperty("线性")
@TableField("linear") @TableField("xianxing")
private String linear; private String xianxing;
@ApiModelProperty("检测标准") @ApiModelProperty("检测标准")
@TableField("standard") @TableField("standard")
......
...@@ -45,7 +45,7 @@ public class MovementOverReportVO { ...@@ -45,7 +45,7 @@ public class MovementOverReportVO {
private String movementMasterId; private String movementMasterId;
@ApiModelProperty("序号") @ApiModelProperty("序号")
private String code; private String xuhao;
@ApiModelProperty("里程(m)") @ApiModelProperty("里程(m)")
private BigDecimal mileage; private BigDecimal mileage;
...@@ -69,7 +69,7 @@ public class MovementOverReportVO { ...@@ -69,7 +69,7 @@ public class MovementOverReportVO {
private String dataDifference; private String dataDifference;
@ApiModelProperty("线性") @ApiModelProperty("线性")
private String linear; private String xianxing;
@ApiModelProperty("检测标准") @ApiModelProperty("检测标准")
private String standard; private String standard;
......
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