Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
d14a55f5
Commit
d14a55f5
authored
Apr 25, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(JG):气瓶导入功能开发
parent
4ef9a44c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
329 additions
and
227 deletions
+329
-227
ChargingMediumConverter.java
...boot/module/jg/api/converter/ChargingMediumConverter.java
+47
-0
EquCodeTypeConverter.java
...os/boot/module/jg/api/converter/EquCodeTypeConverter.java
+53
-0
ImportedConverter.java
.../amos/boot/module/jg/api/converter/ImportedConverter.java
+53
-0
NondestructConverter.java
...os/boot/module/jg/api/converter/NondestructConverter.java
+60
-0
VehicleCylinderConverter.java
...oot/module/jg/api/converter/VehicleCylinderConverter.java
+8
-8
EquipInfoCylinderExcelDto.java
...mos/boot/module/jg/api/dto/EquipInfoCylinderExcelDto.java
+56
-40
PressureVesselListener.java
...mos/boot/module/jg/biz/config/PressureVesselListener.java
+0
-0
YhListener.java
...om/yeejoin/amos/boot/module/jg/biz/config/YhListener.java
+0
-159
IdxBizJqEquipmentRegisterController.java
...g/biz/controller/IdxBizJqEquipmentRegisterController.java
+43
-17
IIdxBizJgRegisterInfoService.java
...t/module/jg/biz/service/IIdxBizJgRegisterInfoService.java
+1
-3
IIdxBizJgUseInfoService.java
...s/boot/module/jg/biz/service/IIdxBizJgUseInfoService.java
+2
-0
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+0
-0
IdxBizJgUseInfoServiceImpl.java
...odule/jg/biz/service/impl/IdxBizJgUseInfoServiceImpl.java
+6
-0
pressureVesselTemplate.xlsx
.../src/main/resources/templates/pressureVesselTemplate.xlsx
+0
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/ChargingMediumConverter.java
0 → 100644
View file @
d14a55f5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
converter
;
import
com.alibaba.excel.converters.Converter
;
import
com.alibaba.excel.enums.CellDataTypeEnum
;
import
com.alibaba.excel.metadata.CellData
;
import
com.alibaba.excel.metadata.GlobalConfiguration
;
import
com.alibaba.excel.metadata.property.ExcelContentProperty
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
ChargingMediumConverter
implements
Converter
<
String
>
{
private
static
final
Map
<
String
,
String
>
EXCEL_TO_JAVA_MAP
=
new
HashMap
<>();
private
static
final
Map
<
String
,
String
>
JAVA_TO_EXCEL_MAP
=
new
HashMap
<>();
static
{
EXCEL_TO_JAVA_MAP
.
put
(
"液化天然气"
,
"LIQUEFIED_NATURAL_GAS"
);
EXCEL_TO_JAVA_MAP
.
put
(
"液化石油气"
,
"LIQUEFIED_PETROLEUM_GAS"
);
EXCEL_TO_JAVA_MAP
.
put
(
"压缩天然气"
,
"COMPRESSED_NATURAL_GAS"
);
JAVA_TO_EXCEL_MAP
.
put
(
"LIQUEFIED_NATURAL_GAS"
,
"液化天然气"
);
JAVA_TO_EXCEL_MAP
.
put
(
"LIQUEFIED_PETROLEUM_GAS"
,
"液化石油气"
);
JAVA_TO_EXCEL_MAP
.
put
(
"COMPRESSED_NATURAL_GAS"
,
"压缩天然气"
);
}
@Override
public
Class
<?>
supportJavaTypeKey
()
{
return
String
.
class
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
return
CellDataTypeEnum
.
STRING
;
}
@Override
public
String
convertToJavaData
(
CellData
cellData
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
{
return
EXCEL_TO_JAVA_MAP
.
getOrDefault
(
cellData
.
getStringValue
(),
"COMPRESSED_NATURAL_GAS"
);
}
@Override
public
CellData
convertToExcelData
(
String
o
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
{
return
new
CellData
(
JAVA_TO_EXCEL_MAP
.
getOrDefault
(
o
,
"压缩天然气"
));
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/EquCodeTypeConverter.java
0 → 100644
View file @
d14a55f5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
converter
;
import
com.alibaba.excel.converters.Converter
;
import
com.alibaba.excel.enums.CellDataTypeEnum
;
import
com.alibaba.excel.metadata.CellData
;
import
com.alibaba.excel.metadata.GlobalConfiguration
;
import
com.alibaba.excel.metadata.property.ExcelContentProperty
;
public
class
EquCodeTypeConverter
implements
Converter
<
String
>
{
private
static
final
String
HAVE
=
"有"
;
private
static
final
String
NOT
=
"无"
;
@Override
public
Class
<?>
supportJavaTypeKey
()
{
// 实体类中对象属性类型
return
String
.
class
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
return
CellDataTypeEnum
.
STRING
;
}
@Override
public
String
convertToJavaData
(
CellData
cellData
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
{
// 从Cell中读取数据
String
cellValue
=
cellData
.
getStringValue
();
// 判断Excel中的值,将其转换为预期的数值
if
(
HAVE
.
equals
(
cellValue
))
{
return
"1"
;
}
else
if
(
NOT
.
equals
(
cellValue
))
{
return
"2"
;
}
return
null
;
}
@Override
public
CellData
convertToExcelData
(
String
o
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
throws
Exception
{
// 判断实体类中获取的值,转换为Excel预期的值,并封装为CellData对象
if
(
o
==
null
)
{
return
new
CellData
(
""
);
}
else
if
(
o
.
equals
(
"1"
))
{
return
new
CellData
(
HAVE
);
}
else
if
(
o
.
equals
(
"2"
))
{
return
new
CellData
(
NOT
);
}
return
new
CellData
(
""
);
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/ImportedConverter.java
0 → 100644
View file @
d14a55f5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
converter
;
import
com.alibaba.excel.converters.Converter
;
import
com.alibaba.excel.enums.CellDataTypeEnum
;
import
com.alibaba.excel.metadata.CellData
;
import
com.alibaba.excel.metadata.GlobalConfiguration
;
import
com.alibaba.excel.metadata.property.ExcelContentProperty
;
public
class
ImportedConverter
implements
Converter
<
String
>
{
private
static
final
String
WHETHER
=
"是"
;
private
static
final
String
NOT
=
"否"
;
@Override
public
Class
<?>
supportJavaTypeKey
()
{
return
String
.
class
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
// Excel中对应的CellData属性类型
return
CellDataTypeEnum
.
STRING
;
}
@Override
public
String
convertToJavaData
(
CellData
cellData
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
{
// 从Cell中读取数据
String
cellValue
=
cellData
.
getStringValue
();
// 判断Excel中的值,将其转换为预期的数值
if
(
WHETHER
.
equals
(
cellValue
))
{
return
"1"
;
}
else
if
(
NOT
.
equals
(
cellValue
))
{
return
"0"
;
}
return
null
;
}
@Override
public
CellData
convertToExcelData
(
String
o
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
throws
Exception
{
// 判断实体类中获取的值,转换为Excel预期的值,并封装为CellData对象
if
(
o
==
null
)
{
return
new
CellData
(
""
);
}
else
if
(
o
.
equals
(
"1"
))
{
return
new
CellData
(
WHETHER
);
}
else
if
(
o
.
equals
(
"0"
))
{
return
new
CellData
(
NOT
);
}
return
new
CellData
(
""
);
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/NondestructConverter.java
0 → 100644
View file @
d14a55f5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
converter
;
import
com.alibaba.excel.converters.Converter
;
import
com.alibaba.excel.enums.CellDataTypeEnum
;
import
com.alibaba.excel.metadata.CellData
;
import
com.alibaba.excel.metadata.GlobalConfiguration
;
import
com.alibaba.excel.metadata.property.ExcelContentProperty
;
public
class
NondestructConverter
implements
Converter
<
String
>
{
private
static
final
String
CI_FEN
=
"磁粉"
;
private
static
final
String
SHE_XIAN
=
"射线"
;
private
static
final
String
CHAO_SENG
=
"超声"
;
private
static
final
String
SHEN_TOU
=
"渗透"
;
@Override
public
Class
<?>
supportJavaTypeKey
()
{
// 实体类中对象属性类型
return
String
.
class
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
// Excel中对应的CellData属性类型
return
CellDataTypeEnum
.
STRING
;
}
@Override
public
String
convertToJavaData
(
CellData
cellData
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
{
// 从Cell中读取数据
String
cellValue
=
cellData
.
getStringValue
();
// 判断Excel中的值,将其转换为预期的数值
if
(
CI_FEN
.
equals
(
cellValue
))
{
return
"5988"
;
}
else
if
(
SHE_XIAN
.
equals
(
cellValue
))
{
return
"5986"
;
}
else
if
(
CHAO_SENG
.
equals
(
cellValue
))
{
return
"5987"
;
}
return
"5989"
;
}
@Override
public
CellData
convertToExcelData
(
String
o
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
throws
Exception
{
// 判断实体类中获取的值,转换为Excel预期的值,并封装为CellData对象
if
(
o
==
null
)
{
return
new
CellData
(
""
);
}
else
if
(
o
.
equals
(
"5988"
))
{
return
new
CellData
(
CI_FEN
);
}
else
if
(
o
.
equals
(
"5986"
))
{
return
new
CellData
(
SHE_XIAN
);
}
else
if
(
o
.
equals
(
"5987"
))
{
return
new
CellData
(
CHAO_SENG
);
}
return
new
CellData
(
SHEN_TOU
);
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/
Ge
nderConverter.java
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/
VehicleCyli
nderConverter.java
View file @
d14a55f5
...
...
@@ -6,10 +6,10 @@ import com.alibaba.excel.metadata.CellData;
import
com.alibaba.excel.metadata.GlobalConfiguration
;
import
com.alibaba.excel.metadata.property.ExcelContentProperty
;
public
class
Ge
nderConverter
implements
Converter
<
String
>
{
public
class
VehicleCyli
nderConverter
implements
Converter
<
String
>
{
private
static
final
String
MAN
=
"是"
;
private
static
final
String
WOMAN
=
"否"
;
private
static
final
String
WHETHER
=
"是"
;
private
static
final
String
NOT
=
"否"
;
@Override
...
...
@@ -28,11 +28,11 @@ public class GenderConverter implements Converter<String> {
public
String
convertToJavaData
(
CellData
cellData
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
{
// 从Cell中读取数据
String
gender
=
cellData
.
getStringValue
();
String
cellValue
=
cellData
.
getStringValue
();
// 判断Excel中的值,将其转换为预期的数值
if
(
MAN
.
equals
(
gender
))
{
if
(
WHETHER
.
equals
(
cellValue
))
{
return
"0"
;
}
else
if
(
WOMAN
.
equals
(
gender
))
{
}
else
if
(
NOT
.
equals
(
cellValue
))
{
return
"1"
;
}
return
null
;
...
...
@@ -44,9 +44,9 @@ public class GenderConverter implements Converter<String> {
if
(
o
==
null
)
{
return
new
CellData
(
""
);
}
else
if
(
o
.
equals
(
"0"
))
{
return
new
CellData
(
MAN
);
return
new
CellData
(
WHETHER
);
}
else
if
(
o
.
equals
(
"1"
))
{
return
new
CellData
(
WOMAN
);
return
new
CellData
(
NOT
);
}
return
new
CellData
(
""
);
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/EquipInfoCylinderExcelDto.java
View file @
d14a55f5
...
...
@@ -2,8 +2,9 @@ package com.yeejoin.amos.boot.module.jg.api.dto;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.format.DateTimeFormat
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.module.jg.api.converter.
GenderConverter
;
import
com.yeejoin.amos.boot.module.jg.api.converter.
*
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -46,14 +47,14 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
private
String
useInnerCode
;
@ApiModelProperty
(
value
=
"是否车用气瓶"
)
@ExcelProperty
(
value
=
"是否车用气瓶"
,
index
=
4
,
converter
=
Ge
nderConverter
.
class
)
@ExcelProperty
(
value
=
"是否车用气瓶"
,
index
=
4
,
converter
=
VehicleCyli
nderConverter
.
class
)
@NotBlank
(
message
=
"是否车用气瓶不能为空"
)
private
String
whetherVehicleCylinder
;
//转换
private
String
whetherVehicleCylinder
;
@ApiModelProperty
(
value
=
"有无设备代码"
)
@ExcelProperty
(
value
=
"有无设备代码"
,
index
=
5
,
converter
=
Gender
Converter
.
class
)
@ExcelProperty
(
value
=
"有无设备代码"
,
index
=
5
,
converter
=
EquCodeType
Converter
.
class
)
@NotBlank
(
message
=
"有无设备代码不能为空"
)
private
String
equCodeType
;
//转换
private
String
equCodeType
;
@ApiModelProperty
(
value
=
"设备代码"
)
@ExcelProperty
(
value
=
"设备代码"
,
index
=
6
)
...
...
@@ -86,6 +87,7 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
@ApiModelProperty
(
value
=
"设计日期"
)
@ExcelProperty
(
value
=
"设计日期"
,
index
=
12
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
designDate
;
@ApiModelProperty
(
value
=
"总图图号"
)
...
...
@@ -98,6 +100,7 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
@ApiModelProperty
(
value
=
"设计文件鉴定日期"
)
@ExcelProperty
(
value
=
"设计文件鉴定日期"
,
index
=
15
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
appraisalDate
;
//制造信息
...
...
@@ -124,126 +127,139 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
@ApiModelProperty
(
value
=
"制造日期"
)
@ExcelProperty
(
value
=
"制造日期"
,
index
=
20
)
@NotBlank
(
message
=
"制造日期不能为空"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
produceDate
;
@ApiModelProperty
(
value
=
"是否进口"
)
@ExcelProperty
(
value
=
"是否进口"
,
index
=
21
)
@ExcelProperty
(
value
=
"是否进口"
,
index
=
21
,
converter
=
ImportedConverter
.
class
)
private
String
imported
;
@ApiModelProperty
(
value
=
"制造国"
)
@ExcelProperty
(
value
=
"制造国"
,
index
=
22
)
private
String
produceCountry
;
//检验检测
@ApiModelProperty
(
value
=
"检测机构名称"
)
@ExcelProperty
(
value
=
"检测机构名称"
,
index
=
23
)
@NotBlank
(
message
=
"检测机构名称不能为空"
)
private
String
inspectOrgName
;
@ApiModelProperty
(
value
=
"检测人员名称"
)
@ExcelProperty
(
value
=
"检测人员名称"
,
index
=
24
)
@NotBlank
(
message
=
"检测人员名称不能为空"
)
private
String
inspectStaff
;
@ApiModelProperty
(
value
=
"检测日期"
)
@ExcelProperty
(
value
=
"检测日期"
,
index
=
25
)
@NotBlank
(
message
=
"检测日期不能为空"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
inspectDate
;
//技术参数
@ExcelProperty
(
value
=
"额定质量(kg)"
,
index
=
2
3
)
@ExcelProperty
(
value
=
"额定质量(kg)"
,
index
=
2
6
)
@ApiModelProperty
(
value
=
"额定质量(kg)"
)
private
String
ratedQuality
;
@ExcelProperty
(
value
=
"使用环境温度(℃)"
,
index
=
2
4
)
@ExcelProperty
(
value
=
"使用环境温度(℃)"
,
index
=
2
7
)
@ApiModelProperty
(
value
=
"使用环境温度(℃)"
)
private
String
ambientTemperature
;
@ExcelProperty
(
value
=
"单瓶容积(m3)"
,
index
=
2
5
)
@ExcelProperty
(
value
=
"单瓶容积(m3)"
,
index
=
2
8
)
@ApiModelProperty
(
value
=
"单瓶容积(m3)"
)
@NotBlank
(
message
=
"单瓶容积(m3)不能为空"
)
private
String
singleBottleVolume
;
@ExcelProperty
(
value
=
"总容积(m3)"
,
index
=
26
)
@ApiModelProperty
(
value
=
"总容积(m3)"
)
private
String
totalVolume
;
@ExcelProperty
(
value
=
"型号"
,
index
=
27
)
@ExcelProperty
(
value
=
"型号"
,
index
=
29
)
@ApiModelProperty
(
value
=
"型号"
)
private
String
modelNumber
;
@ExcelProperty
(
value
=
"数量"
,
index
=
28
)
@ApiModelProperty
(
value
=
"数量"
)
private
String
num
;
@ExcelProperty
(
value
=
"充装介质"
,
index
=
29
)
@ExcelProperty
(
value
=
"充装介质"
,
index
=
30
,
converter
=
ChargingMediumConverter
.
class
)
@ApiModelProperty
(
value
=
"充装介质"
)
@NotBlank
(
message
=
"充装介质不能为空"
)
private
String
chargingMedium
;
@ExcelProperty
(
value
=
"规格"
,
index
=
3
0
)
@ExcelProperty
(
value
=
"规格"
,
index
=
3
1
)
@ApiModelProperty
(
value
=
"规格"
)
private
String
specification
;
@ExcelProperty
(
value
=
"外径"
,
index
=
3
1
)
@ExcelProperty
(
value
=
"外径"
,
index
=
3
2
)
@ApiModelProperty
(
value
=
"外径"
)
private
String
outsideDiameter
;
@ExcelProperty
(
value
=
"壁厚"
,
index
=
3
2
)
@ExcelProperty
(
value
=
"壁厚"
,
index
=
3
3
)
@ApiModelProperty
(
value
=
"壁厚"
)
private
String
wallThickness
;
@ExcelProperty
(
value
=
"长度"
,
index
=
3
3
)
@ExcelProperty
(
value
=
"长度"
,
index
=
3
4
)
@ApiModelProperty
(
value
=
"长度"
)
private
String
length
;
@ExcelProperty
(
value
=
"公称工作压力(MPa)"
,
index
=
3
4
)
@ExcelProperty
(
value
=
"公称工作压力(MPa)"
,
index
=
3
5
)
@ApiModelProperty
(
value
=
"公称工作压力(MPa)"
)
@NotBlank
(
message
=
"公称工作压力(MPa)不能为空"
)
private
String
nominalWorkingPressure
;
@ExcelProperty
(
value
=
"材料(管路)"
,
index
=
3
5
)
@ExcelProperty
(
value
=
"材料(管路)"
,
index
=
3
6
)
@ApiModelProperty
(
value
=
"材料(管路)"
)
private
String
piping
;
@ExcelProperty
(
value
=
"无损检测方法(气瓶)"
,
index
=
3
6
)
@ExcelProperty
(
value
=
"无损检测方法(气瓶)"
,
index
=
3
7
,
converter
=
NondestructConverter
.
class
)
@ApiModelProperty
(
value
=
"无损检测方法(气瓶)"
)
private
String
qpLossless
;
//5988
@ExcelProperty
(
value
=
"材料(瓶体)"
,
index
=
3
7
)
@ExcelProperty
(
value
=
"材料(瓶体)"
,
index
=
3
8
)
@ApiModelProperty
(
value
=
"材料(瓶体)"
)
private
String
bottleBody
;
@ExcelProperty
(
value
=
"材料(端塞)"
,
index
=
3
8
)
@ExcelProperty
(
value
=
"材料(端塞)"
,
index
=
3
9
)
@ApiModelProperty
(
value
=
"材料(端塞)"
)
private
String
endPlug
;
@ExcelProperty
(
value
=
"无损检测比例(管路)(%)"
,
index
=
39
)
@ExcelProperty
(
value
=
"无损检测比例(管路)(%)"
,
index
=
40
)
@ApiModelProperty
(
value
=
"无损检测比例(管路)(%)"
)
private
String
glRatio
;
@ExcelProperty
(
value
=
"无损检测比例(气瓶)(%)"
,
index
=
4
0
)
@ExcelProperty
(
value
=
"无损检测比例(气瓶)(%)"
,
index
=
4
1
)
@ApiModelProperty
(
value
=
"无损检测比例(气瓶)(%)"
)
private
String
qpRatio
;
@ExcelProperty
(
value
=
"无损检测方法(管路)"
,
index
=
4
1
)
@ExcelProperty
(
value
=
"无损检测方法(管路)"
,
index
=
4
2
,
converter
=
NondestructConverter
.
class
)
@ApiModelProperty
(
value
=
"无损检测方法(管路)"
)
private
String
glLossless
;
@ExcelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
,
index
=
4
2
)
@ExcelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
,
index
=
4
3
)
@ApiModelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
)
private
String
qpPressure
;
@ExcelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
,
index
=
4
3
)
@ExcelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
,
index
=
4
4
)
@ApiModelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
)
private
String
glPressure
;
@ExcelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
,
index
=
4
4
)
@ExcelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
,
index
=
4
5
)
@ApiModelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
)
private
String
qpAirTightness
;
@ExcelProperty
(
value
=
"气体置换后压力(MPa)"
,
index
=
4
5
)
@ExcelProperty
(
value
=
"气体置换后压力(MPa)"
,
index
=
4
6
)
@ApiModelProperty
(
value
=
"气体置换后压力(MPa)"
)
private
String
displacementPressure
;
@ExcelProperty
(
value
=
"热处理方式"
,
index
=
4
6
)
@ExcelProperty
(
value
=
"热处理方式"
,
index
=
4
7
)
@ApiModelProperty
(
value
=
"热处理方式"
)
private
String
heatTreatmentMethod
;
@ExcelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
,
index
=
4
7
)
@ExcelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
,
index
=
4
8
)
@ApiModelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
)
private
String
glAirTightness
;
@ExcelProperty
(
value
=
"气瓶安装位置"
,
index
=
4
8
)
@ExcelProperty
(
value
=
"气瓶安装位置"
,
index
=
4
9
)
@ApiModelProperty
(
value
=
"气瓶安装位置"
)
private
String
installationPosition
;
@ExcelProperty
(
value
=
"瓶体内含氧量(%)"
,
index
=
49
)
@ExcelProperty
(
value
=
"瓶体内含氧量(%)"
,
index
=
50
)
@ApiModelProperty
(
value
=
"瓶体内含氧量(%)"
)
private
String
oxygen
;
@ExcelProperty
(
value
=
"热处理温度(℃)"
,
index
=
5
0
)
@ExcelProperty
(
value
=
"热处理温度(℃)"
,
index
=
5
1
)
@ApiModelProperty
(
value
=
"热处理温度(℃)"
)
private
String
qpHeatTreatmentTemperature
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/config/PressureVesselListener.java
0 → 100644
View file @
d14a55f5
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/config/YhListener.java
deleted
100644 → 0
View file @
4ef9a44c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
config
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.alibaba.excel.read.metadata.holder.ReadRowHolder
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Slf4j
@Data
@Component
public
class
YhListener
extends
AnalysisEventListener
<
EquipInfoCylinderExcelDto
>
{
//每次最多导入条数
private
static
final
int
BATCH_COUNT
=
2000
;
public
static
YhListener
yhListener
;
//数据集合
List
<
String
>
useInnerCodeList
=
new
ArrayList
<>();
List
<
IdxBizJgUseInfo
>
useInfoList
=
new
ArrayList
<>();
List
<
IdxBizJgRegisterInfo
>
registerInfoList
=
new
ArrayList
<>();
List
<
IdxBizJgDesignInfo
>
designInfoList
=
new
ArrayList
<>();
List
<
IdxBizJgFactoryInfo
>
factoryInfoList
=
new
ArrayList
<>();
List
<
IdxBizJgTechParamsVessel
>
paramsVesselList
=
new
ArrayList
<>();
//读取失败的Excel文件索引行数集合
List
<
String
>
failedRowIndexList
=
new
ArrayList
<>();
private
StringBuilder
result
=
new
StringBuilder
();
@PostConstruct
public
void
init
()
{
yhListener
=
this
;
}
@SneakyThrows
@Override
public
void
invoke
(
EquipInfoCylinderExcelDto
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
int
rowIndex
=
readRowHolder
.
getRowIndex
()
+
1
;
try
{
log
.
info
(
"解析第{}行数据:{}"
,
rowIndex
,
JSON
.
toJSONString
(
data
));
if
(
useInnerCodeList
.
contains
(
data
.
getUseInnerCode
()))
{
failedRowIndexList
.
add
(
String
.
format
(
"Excel第[%s]行 -> 错误的数据: [%s]"
,
rowIndex
,
"设备代码重复!"
));
}
if
(
StringUtils
.
isBlank
(
data
.
getProductName
()))
{
failedRowIndexList
.
add
(
String
.
format
(
"Excel第[%s]行 -> 错误的数据: [%s]"
,
rowIndex
,
"设备名称为空!"
));
}
if
(
StringUtils
.
isBlank
(
data
.
getBrandName
()))
{
failedRowIndexList
.
add
(
String
.
format
(
"Excel第[%s]行 -> 错误的数据: [%s]"
,
rowIndex
,
"品牌名称为空!"
));
}
if
(
failedRowIndexList
.
isEmpty
()){
this
.
dealExcelData
(
data
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"行索引数: [{}] -> 失败的Excel数据: [{}]"
,
rowIndex
,
JSON
.
toJSONString
(
data
));
failedRowIndexList
.
add
(
String
.
format
(
"Excel第[%s]行 -> 错误的数据: [%s]"
,
rowIndex
,
JSON
.
toJSONString
(
data
)));
}
}
/**
* 处理导入数据
*
* @param data excelData
*/
private
void
dealExcelData
(
EquipInfoCylinderExcelDto
data
)
{
useInnerCodeList
.
add
(
data
.
getUseInnerCode
());
Date
date
=
new
Date
();
String
record
=
UUID
.
randomUUID
().
toString
();
IdxBizJgRegisterInfo
registerInfo
=
new
IdxBizJgRegisterInfo
();
BeanUtils
.
copyProperties
(
data
,
registerInfo
);
registerInfoList
.
add
(
registerInfo
);
IdxBizJgUseInfo
useInfo
=
new
IdxBizJgUseInfo
();
BeanUtils
.
copyProperties
(
data
,
useInfo
);
//使用信息
useInfo
.
setRecord
(
record
);
useInfo
.
setRecDate
(
date
);
useInfo
.
setDataSource
(
"jg"
);
useInfo
.
setEquState
(
null
);
useInfoList
.
add
(
useInfo
);
IdxBizJgDesignInfo
designInfo
=
new
IdxBizJgDesignInfo
();
BeanUtils
.
copyProperties
(
data
,
designInfo
);
designInfoList
.
add
(
designInfo
);
IdxBizJgFactoryInfo
factoryInfo
=
new
IdxBizJgFactoryInfo
();
BeanUtils
.
copyProperties
(
data
,
factoryInfo
);
factoryInfoList
.
add
(
factoryInfo
);
IdxBizJgTechParamsVessel
paramsVessel
=
new
IdxBizJgTechParamsVessel
();
BeanUtils
.
copyProperties
(
data
,
paramsVessel
);
paramsVesselList
.
add
(
paramsVessel
);
//读取数超过2000进行一次数据写入
//防止一次读取的数据量过大做的一个限制
//因为在doAfterAllAnalysed()方法里面执行批量导入,这个方法是在读取完Excel才会执行
if
(
registerInfoList
.
size
()
>=
BATCH_COUNT
)
{
//sysUserService.insertByPoListCheck(poList);
registerInfoList
.
clear
();
//清除list中的数据
}
if
(
designInfoList
.
size
()
>=
BATCH_COUNT
)
{
//sysUserService.insertByPoListCheck(poList);
designInfoList
.
clear
();
//清除list中的数据
}
if
(
factoryInfoList
.
size
()
>=
BATCH_COUNT
)
{
//sysUserService.insertByPoListCheck(poList);
factoryInfoList
.
clear
();
//清除list中的数据
}
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
result
.
append
(
"导入完成,成功导入"
);
result
.
append
(
"条数据"
);
try
{
if
(!
useInfoList
.
isEmpty
())
{
//sysUserService.insertByPoListCheck(poList);
log
.
info
(
"所有数据解析完成!"
);
}
}
catch
(
RuntimeException
e
)
{
throw
new
RuntimeException
(
"Insert User Check Error!"
);
}
}
@Override
public
void
onException
(
Exception
exception
,
AnalysisContext
context
)
throws
Exception
{
System
.
out
.
println
(
"helloTwo"
);
throw
exception
;
}
public
String
getResult
()
{
return
result
.
toString
();
}
//获取读取失败的Excel行索引数集合
public
List
<
String
>
getFailedRows
()
{
return
failedRowIndexList
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/IdxBizJqEquipmentRegisterController.java
View file @
d14a55f5
...
...
@@ -3,21 +3,25 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.tomcat.util.http.ResponseUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -132,22 +136,44 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
return
ResponseHelper
.
buildResponse
(
idxBizJgRegisterInfoService
.
queryForUnitEquipmentPage
(
jsonObject
));
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"导入设备信息"
)
@PostMapping
(
"/import_batch"
)
public
ResponseModel
<
String
>
importByExcel
(
MultipartFile
multipartFile
,
String
equDefineCode
)
throws
Exception
{
List
<
EquipInfoCylinderExcelDto
>
excelDtoList
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
EquipInfoCylinderExcelDto
.
class
,
4
);
return
ResponseHelper
.
buildResponse
(
idxBizJgRegisterInfoService
.
importByExcel
(
excelDtoList
,
equDefineCode
));
/**
* 压力容器设备批量导入
*/
@PostMapping
(
"/importPressureVesselData"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"压力容器设备批量导入"
)
public
ResponseModel
<
String
>
importPressureVesselData
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
Map
<
String
,
Object
>
paramMap
)
{
HashMap
<
String
,
Object
>
colorMap
=
new
HashMap
<>();
colorMap
.
put
(
"EQU_LIST_CODE"
,
"2000"
);
colorMap
.
put
(
"EQU_LIST"
,
"压力容器"
);
colorMap
.
put
(
"EQU_CATEGORY"
,
"气瓶"
);
colorMap
.
put
(
"EQU_CATEGORY_CODE"
,
"2300"
);
colorMap
.
put
(
"EQU_DEFINE"
,
"特种气瓶(内装填料气瓶、纤维缠绕气瓶、低温绝热气瓶)"
);
colorMap
.
put
(
"EQU_DEFINE_CODE"
,
"23T0"
);
return
ResponseHelper
.
buildResponse
(
idxBizJgRegisterInfoService
.
importPressureVesselData
(
file
,
colorMap
));
}
/**
*
用户导入
*
压力容器设备模版下载
*/
@PostMapping
(
"/importYh"
)
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"用户导入"
)
public
ResponseModel
importYh
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"equDefineCode"
)
String
equDefineCode
)
{
return
ResponseHelper
.
buildResponse
(
idxBizJgRegisterInfoService
.
importYh
(
file
,
equDefineCode
));
@GetMapping
(
"/pressureVesselTemplate"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"压力容器设备模版下载"
)
public
void
pressureVesselTemplate
(
HttpServletResponse
response
)
throws
Exception
{
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
"压力容器设备导入模版.xlsx"
,
"UTF-8"
));
response
.
setContentType
(
"application/vnd.ms-excel"
);
Resource
resource
=
new
ClassPathResource
(
"templates/pressureVesselTemplate.xlsx"
);
try
(
OutputStream
outputStream
=
response
.
getOutputStream
();
InputStream
inputStream
=
resource
.
getInputStream
())
{
byte
[]
bytes
=
new
byte
[
1024
*
1024
];
int
len
;
while
((
len
=
inputStream
.
read
(
bytes
))
!=
-
1
)
{
outputStream
.
write
(
bytes
,
0
,
len
);
}
}
catch
(
IOException
e
)
{
throw
new
Exception
(
"系统异常"
);
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/IIdxBizJgRegisterInfoService.java
View file @
d14a55f5
...
...
@@ -34,7 +34,5 @@ public interface IIdxBizJgRegisterInfoService {
Page
<
JSONObject
>
queryForUnitEquipmentPage
(
JSONObject
jsonObject
);
String
importByExcel
(
List
<
EquipInfoCylinderExcelDto
>
excelDtoList
,
String
equDefineCode
);
Object
importYh
(
MultipartFile
file
,
String
equDefineCode
);
String
importPressureVesselData
(
MultipartFile
file
,
Map
<
String
,
Object
>
paramMap
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/IIdxBizJgUseInfoService.java
View file @
d14a55f5
...
...
@@ -18,4 +18,6 @@ public interface IIdxBizJgUseInfoService {
IdxBizJgUseInfo
getOneData
(
String
record
);
List
<
IdxBizJgUseInfo
>
getUseInfoListByEquIds
(
List
<
String
>
equIds
);
boolean
saveBatch
(
List
<
IdxBizJgUseInfo
>
useInfoList
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
View file @
d14a55f5
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/IdxBizJgUseInfoServiceImpl.java
View file @
d14a55f5
...
...
@@ -34,4 +34,9 @@ public class IdxBizJgUseInfoServiceImpl extends BaseService<IdxBizJgUseInfoDto,I
queryWrapper
.
lambda
().
in
(
IdxBizJgUseInfo:
:
getRecord
,
equIds
);
return
list
(
queryWrapper
);
}
@Override
public
boolean
saveBatch
(
List
<
IdxBizJgUseInfo
>
useInfoList
)
{
return
super
.
saveBatch
(
useInfoList
);
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/templates/pressureVesselTemplate.xlsx
0 → 100644
View file @
d14a55f5
File added
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