Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZTGK
hzsomms
Commits
c5a6a405
Commit
c5a6a405
authored
Jul 14, 2023
by
shizhilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入核心提交 --shizhilong
parent
5c4f5aa8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
252 additions
and
20 deletions
+252
-20
MovementRecordsMasterController.java
...CheckData/controller/MovementRecordsMasterController.java
+249
-17
MovementCourseInfoDTO.java
...eckData/equipmentCheckData/dto/MovementCourseInfoDTO.java
+1
-1
MovementCourseInfo.java
...eckData/equipmentCheckData/entity/MovementCourseInfo.java
+1
-1
MovementCourseInfoVO.java
...checkData/equipmentCheckData/vo/MovementCourseInfoVO.java
+1
-1
No files found.
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/controller/MovementRecordsMasterController.java
View file @
c5a6a405
...
...
@@ -7,13 +7,16 @@ import cn.hutool.poi.excel.ExcelUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.shiro.SecurityUtils
;
import
org.jeecg.common.api.vo.Result
;
import
org.jeecg.common.aspect.annotation.AutoLog
;
import
org.jeecg.common.system.vo.LoginUser
;
import
org.jeecg.modules.checkData.equipmentCheckData.dto.MovementRecordsMasterDTO
;
import
org.jeecg.modules.checkData.equipmentCheckData.entity.MovementCourse
;
import
org.jeecg.modules.checkData.equipmentCheckData.entity.MovementCourseInfo
;
...
...
@@ -33,12 +36,13 @@ import org.springframework.web.bind.annotation.*;
import
org.jeecg.common.system.base.controller.JeecgController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.transaction.Transactional
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.
util.ArrayList
;
import
java.util.
Date
;
import
java.util.
List
;
import
java.util.
Set
;
import
java.
math.BigDecimal
;
import
java.util.
*
;
import
java.util.
regex.Matcher
;
import
java.util.
regex.Pattern
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -180,10 +184,10 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
if
(
bean
.
getSectionEndMileage
()
!=
null
)
{
result
.
setEndMileage
(
bean
.
getSectionEndMileage
());
}
if
(
ObjectUtil
.
isNotEmpty
(
bean
.
getSectionName
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
bean
.
getSectionName
()))
{
result
.
setSubwaySectionName
(
bean
.
getSectionName
());
}
if
(
ObjectUtil
.
isNotEmpty
(
bean
.
getLightRailName
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
bean
.
getLightRailName
()))
{
result
.
setLightRailName
(
bean
.
getLightRailName
());
}
}
...
...
@@ -247,23 +251,251 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
@AutoLog
(
value
=
"导入"
)
@ApiOperation
(
value
=
"导入"
,
notes
=
"导入 "
)
@PostMapping
(
value
=
"/upload"
)
@ResponseBody
public
Result
<
String
>
uploadFile
(
MultipartFile
file
,
@RequestParam
(
name
=
"动静态几何尺寸主键id"
)
String
id
)
{
try
{
@Transactional
public
Result
<
String
>
uploadFile
(
MultipartFile
file
,
@ApiParam
(
name
=
"动静态几何尺寸主键id"
)
String
id
)
{
try
{
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
>>
readAll
=
reader
.
read
();
for
(
List
<
Object
>
list
:
readAll
){
System
.
out
.
println
(
list
.
toString
());
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
=
""
;
//获取当前登录人信息
LoginUser
user
=
(
LoginUser
)
SecurityUtils
.
getSubject
().
getPrincipal
();
String
realname
=
user
.
getRealname
();
// 如果做完了一个解析就跳过
MovementCourse
movementCourse
=
new
MovementCourse
();
List
<
MovementCourseInfo
>
resultList
=
new
ArrayList
<>();
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
.
indexOf
(
"起止里程"
)
!=
-
1
)
{
//开始里程
String
[]
start
=
mileage
.
split
(
"-"
);
String
s
=
start
[
0
];
String
[]
n0
=
s
.
split
(
"\\+"
);
startingAndEndingMileageStr
=
n0
[
1
].
trim
();
//System.out.println(skipColumnNum+"开始里程="+startMileage);
//结束里程
String
s1
=
start
[
1
];
String
[]
n1
=
s1
.
split
(
"\\+"
);
String
s2
=
n1
[
1
];
endingMileageStr
=
s2
.
substring
(
0
,
s2
.
indexOf
(
" "
)).
trim
();
//System.out.println(skipColumnNum+"结束里程="+endMileage);
//曲线半径
String
[]
n2
=
s2
.
split
(
"半径 "
);
String
s3
=
n2
[
1
];
curveRadius
=
s3
.
substring
(
0
,
s3
.
indexOf
(
" m"
)).
replace
(
"/"
,
""
).
trim
();
//System.out.println(skipColumnNum+"曲线半径="+bj+";");
//解析超高、加宽、顺坡率、线路全长
String
[]
n3
=
courseStr
.
split
(
"超高"
);
String
s4
=
n3
[
1
];
superHigh
=
s4
.
substring
(
0
,
s4
.
indexOf
(
"mm"
)).
replace
(
"/"
,
""
).
trim
();
//System.out.println(skipColumnNum+"超高="+superHigh+";");
//加宽
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
.
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
));
}
courseId
=
IdWorker
.
get32UUID
();
movementCourse
.
setId
(
courseId
);
movementCourse
.
setDelFlag
(
"0"
);
movementCourse
.
setCreateTime
(
new
Date
());
movementCourse
.
setUpdateTime
(
new
Date
());
movementCourse
.
setCreateBy
(
realname
);
movementCourse
.
setUpdateBy
(
realname
);
movementCourse
.
setRemark
(
remark
);
movementCourseService
.
save
(
movementCourse
);
}
}
catch
(
Exception
e
){
e
.
getMessage
();
}
//解析子集
if
((
skipColumnNum
-
1
)%
28
==
0
){
continue
;
}
if
((
skipColumnNum
-
2
)%
28
==
0
){
continue
;
}
if
(
ObjectUtil
.
isNotEmpty
(
courseId
))
{
MovementCourseInfo
movementCourseInfo
=
new
MovementCourseInfo
();
movementCourseInfo
.
setId
(
IdWorker
.
get32UUID
());
movementCourseInfo
.
setDelFlag
(
"0"
);
movementCourseInfo
.
setMovementMasterId
(
id
);
movementCourseInfo
.
setMovementCourseId
(
courseId
);
movementCourseInfo
.
setCreateTime
(
new
Date
());
movementCourseInfo
.
setUpdateTime
(
new
Date
());
movementCourseInfo
.
setCreateBy
(
realname
);
movementCourseInfo
.
setUpdateBy
(
realname
);
//获取轨号
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
((
skipColumnNum
+
2
)
%
28
==
0
)
{
i
=
i
+
4
;
skipColumnNum
=
skipColumnNum
+
4
;
startingAndEndingMileageStr
=
""
;
endingMileageStr
=
""
;
curveRadius
=
""
;
superHigh
=
""
;
widen
=
""
;
slopeRatio
=
""
;
longExtent
=
""
;
remark
=
""
;
courseId
=
""
;
movementCourse
=
new
MovementCourse
();
}
}
if
(
resultList
!=
null
&&
resultList
.
size
()
>
0
)
{
movementCourseInfoService
.
saveBatch
(
resultList
);
}
}
catch
(
Exception
e
)
{
e
.
getMessage
();
}
return
Result
.
ok
(
"操作成功"
);
}
public
static
void
main
(
String
[]
args
)
{
String
aa
=
"2022.11.07"
;
String
pat
=
"\\d{4}.\\d{2}.\\d{2}"
;
Pattern
p
=
Pattern
.
compile
(
pat
);
if
(
p
.
matcher
(
aa
).
matches
()){
System
.
out
.
println
(
"1111"
);
}
else
{
System
.
out
.
println
(
"2222"
);
}
}
/**
* 校验参数
*
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/dto/MovementCourseInfoDTO.java
View file @
c5a6a405
...
...
@@ -39,7 +39,7 @@ public class MovementCourseInfoDTO {
private
String
movementMasterId
;
@ApiModelProperty
(
"动静态几何尺寸对应得里程信息主键-》外键"
)
private
BigDecimal
movementCourseId
;
private
String
movementCourseId
;
@ApiModelProperty
(
"轨号"
)
private
String
trackCode
;
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/entity/MovementCourseInfo.java
View file @
c5a6a405
...
...
@@ -60,7 +60,7 @@ public class MovementCourseInfo implements Serializable {
@ApiModelProperty
(
"动静态几何尺寸对应得里程信息主键-》外键"
)
@TableField
(
"movement_course_id"
)
private
BigDecimal
movementCourseId
;
private
String
movementCourseId
;
@ApiModelProperty
(
"轨号"
)
@TableField
(
"track_code"
)
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/checkData/equipmentCheckData/vo/MovementCourseInfoVO.java
View file @
c5a6a405
...
...
@@ -45,7 +45,7 @@ public class MovementCourseInfoVO {
private
String
movementMasterId
;
@ApiModelProperty
(
"动静态几何尺寸对应得里程信息主键-》外键"
)
private
BigDecimal
movementCourseId
;
private
String
movementCourseId
;
@ApiModelProperty
(
"轨号"
)
private
String
trackCode
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment