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
22fe4a13
Commit
22fe4a13
authored
Apr 26, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_tzs_register' of…
Merge branch 'develop_tzs_register' of
http://36.40.66.175:5000/moa/amos-boot-biz
into develop_tzs_register
parents
517f3745
01bec276
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
952 additions
and
4 deletions
+952
-4
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
+54
-0
EquipInfoCylinderExcelDto.java
...mos/boot/module/jg/api/dto/EquipInfoCylinderExcelDto.java
+265
-0
PressureVesselListener.java
...mos/boot/module/jg/biz/config/PressureVesselListener.java
+297
-0
IdxBizJqEquipmentRegisterController.java
...g/biz/controller/IdxBizJqEquipmentRegisterController.java
+50
-1
ICommonService.java
...ejoin/amos/boot/module/jg/biz/service/ICommonService.java
+2
-0
IIdxBizJgRegisterInfoService.java
...t/module/jg/biz/service/IIdxBizJgRegisterInfoService.java
+3
-1
IIdxBizJgUseInfoService.java
...s/boot/module/jg/biz/service/IIdxBizJgUseInfoService.java
+2
-0
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+5
-0
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+55
-2
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 @
22fe4a13
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 @
22fe4a13
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 @
22fe4a13
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 @
22fe4a13
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/VehicleCylinderConverter.java
0 → 100644
View file @
22fe4a13
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
VehicleCylinderConverter
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
"0"
;
}
else
if
(
NOT
.
equals
(
cellValue
))
{
return
"1"
;
}
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
(
"0"
))
{
return
new
CellData
(
WHETHER
);
}
else
if
(
o
.
equals
(
"1"
))
{
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/dto/EquipInfoCylinderExcelDto.java
0 → 100644
View file @
22fe4a13
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.*
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.Size
;
/**
* @author LiuLin
* @date 2021-06-18.
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"设备信息-气瓶"
,
description
=
"设备信息-气瓶"
)
public
class
EquipInfoCylinderExcelDto
extends
BaseDto
{
@ExcelIgnore
private
static
final
long
serialVersionUID
=
1L
;
//基本信息
@ApiModelProperty
(
value
=
"设备名称"
)
@ExcelProperty
(
value
=
"设备名称"
,
index
=
0
)
@NotBlank
(
message
=
"设备名称不能为空"
)
private
String
productName
;
@ApiModelProperty
(
value
=
"品牌名称"
)
@ExcelProperty
(
value
=
"品牌名称"
,
index
=
1
)
@NotBlank
(
message
=
"品牌名称不能为空"
)
@Size
(
min
=
0
,
max
=
100
,
message
=
"品牌名称不能超过100个字符"
)
private
String
brandName
;
@ApiModelProperty
(
value
=
"设备型号"
)
@ExcelProperty
(
value
=
"设备型号"
,
index
=
2
)
@NotBlank
(
message
=
"设备型号不能为空"
)
private
String
equType
;
@ApiModelProperty
(
value
=
"单位内部编号"
)
@ExcelProperty
(
value
=
"单位内部编号"
,
index
=
3
)
@NotBlank
(
message
=
"单位内部编号不能为空"
)
private
String
useInnerCode
;
@ApiModelProperty
(
value
=
"是否车用气瓶"
)
@ExcelProperty
(
value
=
"是否车用气瓶"
,
index
=
4
,
converter
=
VehicleCylinderConverter
.
class
)
@NotBlank
(
message
=
"是否车用气瓶不能为空"
)
private
String
whetherVehicleCylinder
;
@ApiModelProperty
(
value
=
"有无设备代码"
)
@ExcelProperty
(
value
=
"有无设备代码"
,
index
=
5
,
converter
=
EquCodeTypeConverter
.
class
)
@NotBlank
(
message
=
"有无设备代码不能为空"
)
private
String
equCodeType
;
@ApiModelProperty
(
value
=
"设备代码"
)
@ExcelProperty
(
value
=
"设备代码"
,
index
=
6
)
private
String
equCode
;
//判断是否必填和位数
@ApiModelProperty
(
value
=
"设备总价值(万元)"
)
@ExcelProperty
(
value
=
"设备总价值(万元)"
,
index
=
7
)
@NotBlank
(
message
=
"设备总价值(万元)不能为空"
)
private
String
equPrice
;
//设计信息
@ApiModelProperty
(
value
=
"设计单位统一社会信用代码"
)
@ExcelProperty
(
value
=
"设计单位统一社会信用代码"
,
index
=
8
)
@NotBlank
(
message
=
"设计单位统一社会信用代码不能为空"
)
private
String
designUnitCreditCode
;
@ApiModelProperty
(
value
=
"设计单位名称"
)
@ExcelProperty
(
value
=
"设计单位名称"
,
index
=
9
)
@NotBlank
(
message
=
"设计单位名称不能为空"
)
private
String
designUnitName
;
@ApiModelProperty
(
value
=
"设计许可编号"
)
@ExcelProperty
(
value
=
"设计许可编号"
,
index
=
10
)
private
String
designLicenseNum
;
@ApiModelProperty
(
value
=
"设计使用年限(年)"
)
@ExcelProperty
(
value
=
"设计使用年限(年)"
,
index
=
11
)
private
String
designUseDate
;
@ApiModelProperty
(
value
=
"设计日期"
)
@ExcelProperty
(
value
=
"设计日期"
,
index
=
12
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
designDate
;
@ApiModelProperty
(
value
=
"总图图号"
)
@ExcelProperty
(
value
=
"总图图号"
,
index
=
13
)
private
String
drawingDo
;
@ApiModelProperty
(
value
=
"设计文件鉴定单位"
)
@ExcelProperty
(
value
=
"设计文件鉴定单位"
,
index
=
14
)
private
String
appraisalUnit
;
@ApiModelProperty
(
value
=
"设计文件鉴定日期"
)
@ExcelProperty
(
value
=
"设计文件鉴定日期"
,
index
=
15
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
appraisalDate
;
//制造信息
@ApiModelProperty
(
value
=
"制造单位统一社会信用代码"
)
@ExcelProperty
(
value
=
"制造单位统一社会信用代码"
,
index
=
16
)
@NotBlank
(
message
=
"制造单位统一社会信用代码不能为空"
)
private
String
produceUnitCreditCode
;
@ApiModelProperty
(
value
=
"制造单位名称"
)
@ExcelProperty
(
value
=
"制造单位名称"
,
index
=
17
)
@NotBlank
(
message
=
"制造单位名称不能为空"
)
private
String
produceUnitName
;
@ApiModelProperty
(
value
=
"制造许可编号"
)
@ExcelProperty
(
value
=
"制造许可编号"
,
index
=
18
)
@NotBlank
(
message
=
"制造许可编号不能为空"
)
private
String
produceLicenseNum
;
@ApiModelProperty
(
value
=
"出厂编号/产品编码"
)
@ExcelProperty
(
value
=
"出厂编号/产品编码"
,
index
=
19
)
@NotBlank
(
message
=
"出厂编号/产品编码不能为空"
)
private
String
factoryNum
;
@ApiModelProperty
(
value
=
"制造日期"
)
@ExcelProperty
(
value
=
"制造日期"
,
index
=
20
)
@NotBlank
(
message
=
"制造日期不能为空"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
produceDate
;
@ApiModelProperty
(
value
=
"是否进口"
)
@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
=
26
)
@ApiModelProperty
(
value
=
"额定质量(kg)"
)
private
String
ratedQuality
;
@ExcelProperty
(
value
=
"使用环境温度(℃)"
,
index
=
27
)
@ApiModelProperty
(
value
=
"使用环境温度(℃)"
)
private
String
ambientTemperature
;
@ExcelProperty
(
value
=
"单瓶容积(m3)"
,
index
=
28
)
@ApiModelProperty
(
value
=
"单瓶容积(m3)"
)
@NotBlank
(
message
=
"单瓶容积(m3)不能为空"
)
private
String
singleBottleVolume
;
@ExcelProperty
(
value
=
"型号"
,
index
=
29
)
@ApiModelProperty
(
value
=
"型号"
)
private
String
modelNumber
;
@ExcelProperty
(
value
=
"充装介质"
,
index
=
30
,
converter
=
ChargingMediumConverter
.
class
)
@ApiModelProperty
(
value
=
"充装介质"
)
@NotBlank
(
message
=
"充装介质不能为空"
)
private
String
chargingMedium
;
@ExcelProperty
(
value
=
"规格"
,
index
=
31
)
@ApiModelProperty
(
value
=
"规格"
)
private
String
specification
;
@ExcelProperty
(
value
=
"外径"
,
index
=
32
)
@ApiModelProperty
(
value
=
"外径"
)
private
String
outsideDiameter
;
@ExcelProperty
(
value
=
"壁厚"
,
index
=
33
)
@ApiModelProperty
(
value
=
"壁厚"
)
private
String
wallThickness
;
@ExcelProperty
(
value
=
"长度"
,
index
=
34
)
@ApiModelProperty
(
value
=
"长度"
)
private
String
length
;
@ExcelProperty
(
value
=
"公称工作压力(MPa)"
,
index
=
35
)
@ApiModelProperty
(
value
=
"公称工作压力(MPa)"
)
@NotBlank
(
message
=
"公称工作压力(MPa)不能为空"
)
private
String
nominalWorkingPressure
;
@ExcelProperty
(
value
=
"材料(管路)"
,
index
=
36
)
@ApiModelProperty
(
value
=
"材料(管路)"
)
private
String
piping
;
@ExcelProperty
(
value
=
"无损检测方法(气瓶)"
,
index
=
37
,
converter
=
NondestructConverter
.
class
)
@ApiModelProperty
(
value
=
"无损检测方法(气瓶)"
)
private
String
qpLossless
;
//5988
@ExcelProperty
(
value
=
"材料(瓶体)"
,
index
=
38
)
@ApiModelProperty
(
value
=
"材料(瓶体)"
)
private
String
bottleBody
;
@ExcelProperty
(
value
=
"材料(端塞)"
,
index
=
39
)
@ApiModelProperty
(
value
=
"材料(端塞)"
)
private
String
endPlug
;
@ExcelProperty
(
value
=
"无损检测比例(管路)(%)"
,
index
=
40
)
@ApiModelProperty
(
value
=
"无损检测比例(管路)(%)"
)
private
String
glRatio
;
@ExcelProperty
(
value
=
"无损检测比例(气瓶)(%)"
,
index
=
41
)
@ApiModelProperty
(
value
=
"无损检测比例(气瓶)(%)"
)
private
String
qpRatio
;
@ExcelProperty
(
value
=
"无损检测方法(管路)"
,
index
=
42
,
converter
=
NondestructConverter
.
class
)
@ApiModelProperty
(
value
=
"无损检测方法(管路)"
)
private
String
glLossless
;
@ExcelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
,
index
=
43
)
@ApiModelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
)
private
String
qpPressure
;
@ExcelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
,
index
=
44
)
@ApiModelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
)
private
String
glPressure
;
@ExcelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
,
index
=
45
)
@ApiModelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
)
private
String
qpAirTightness
;
@ExcelProperty
(
value
=
"气体置换后压力(MPa)"
,
index
=
46
)
@ApiModelProperty
(
value
=
"气体置换后压力(MPa)"
)
private
String
displacementPressure
;
@ExcelProperty
(
value
=
"热处理方式"
,
index
=
47
)
@ApiModelProperty
(
value
=
"热处理方式"
)
private
String
heatTreatmentMethod
;
@ExcelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
,
index
=
48
)
@ApiModelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
)
private
String
glAirTightness
;
@ExcelProperty
(
value
=
"气瓶安装位置"
,
index
=
49
)
@ApiModelProperty
(
value
=
"气瓶安装位置"
)
private
String
installationPosition
;
@ExcelProperty
(
value
=
"瓶体内含氧量(%)"
,
index
=
50
)
@ApiModelProperty
(
value
=
"瓶体内含氧量(%)"
)
private
String
oxygen
;
@ExcelProperty
(
value
=
"热处理温度(℃)"
,
index
=
51
)
@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 @
22fe4a13
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
config
;
import
cn.hutool.core.date.DateUtil
;
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.*
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
@Slf4j
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Component
public
class
PressureVesselListener
extends
AnalysisEventListener
<
EquipInfoCylinderExcelDto
>
{
private
static
final
int
BATCH_COUNT
=
1000
;
//数据集合
List
<
String
>
useInnerCodeList
=
new
ArrayList
<>();
//单位内部编号集合
List
<
String
>
equCodeList
=
new
ArrayList
<>();
//设备代码集合
List
<
String
>
records
=
new
ArrayList
<>();
//设备代码集合
List
<
String
>
factoryNumList
=
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
<>();
List
<
IdxBizJgInspectionDetectionInfo
>
inspectionDetectionInfoList
=
new
ArrayList
<>();
List
<
ESEquipmentCategoryDto
>
esEquipmentCategoryList
=
new
ArrayList
<>();
private
StringBuilder
result
=
new
StringBuilder
();
private
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
private
IIdxBizJgUseInfoService
idxBizJgUseInfoService
;
private
IdxBizJgDesignInfoServiceImpl
idxBizJgDesignInfoService
;
private
IdxBizJgFactoryInfoServiceImpl
idxBizJgFactoryInfoService
;
private
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
private
IdxBizJgTechParamsVesselServiceImpl
idxBizJgTechParamsVesselService
;
private
IdxBizJgInspectionDetectionInfoServiceImpl
idxBizJgInspectionDetectionInfoService
;
private
ICommonService
commonService
;
private
RegistrationInfoMapper
tzsJgRegistrationInfoMapper
;
private
ESEquipmentCategory
esEquipmentCategory
;
private
CategoryOtherInfoMapper
categoryOtherInfoMapper
;
private
SuperviseInfoMapper
superviseInfoMapper
;
private
Map
<
String
,
Object
>
paramMap
;
private
CompanyBo
company
;
@Override
public
void
invoke
(
EquipInfoCylinderExcelDto
data
,
AnalysisContext
context
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
int
rowIndex
=
readRowHolder
.
getRowIndex
()
+
1
;
try
{
log
.
info
(
"解析第{}行数据:{}"
,
rowIndex
,
JSON
.
toJSONString
(
data
));
// 检查各字段是否为空,如果为空则追加错误信息
checkNotBlank
(
data
.
getProductName
(),
"设备名称不能为空"
);
checkNotBlank
(
data
.
getBrandName
(),
"品牌名称不能为空"
);
checkNotBlank
(
data
.
getEquType
(),
"设备型号不能为空"
);
checkNotBlank
(
data
.
getUseInnerCode
(),
"单位内部编号不能为空"
);
if
(
useInnerCodeList
.
contains
(
data
.
getUseInnerCode
()))
{
result
.
append
(
"单位内部编号不能重复;"
);
}
checkNotBlank
(
data
.
getWhetherVehicleCylinder
(),
"是否车用气瓶不能为空"
);
checkNotBlank
(
data
.
getEquCodeType
(),
"是否有设备代码不能为空"
);
checkNotBlank
(
data
.
getEquCode
(),
"设备代码不能为空"
);
if
(
"1"
.
equals
(
data
.
getEquCodeType
())
&&
equCodeList
.
contains
(
data
.
getEquCode
()))
{
result
.
append
(
"设备代码不能重复;"
);
}
this
.
checkEquCodeUniqueness
(
data
.
getEquCode
());
checkNotBlank
(
data
.
getDesignUnitCreditCode
(),
"设计单位统一社会信用代码不能为空"
);
checkNotBlank
(
data
.
getDesignUnitName
(),
"设计单位名称不能为空"
);
Optional
.
ofNullable
(
data
.
getDesignDate
()).
ifPresent
(
v
->
checkDateFormatCorrect
(
v
,
"设计日期格式不正确"
));
Optional
.
ofNullable
(
data
.
getAppraisalDate
()).
ifPresent
(
v
->
checkDateFormatCorrect
(
v
,
"设计文件鉴定日期格式不正确"
));
checkNotBlank
(
data
.
getProduceUnitCreditCode
(),
"制造单位统一社会信用代码不能为空"
);
checkNotBlank
(
data
.
getProduceUnitName
(),
"制造单位名称不能为空"
);
checkNotBlank
(
data
.
getProduceLicenseNum
(),
"制造许可编号不能为空"
);
checkNotBlank
(
data
.
getFactoryNum
(),
"出厂编号/产品编码不能为空"
);
if
(
"0"
.
equals
(
data
.
getWhetherVehicleCylinder
())
&&
factoryNumList
.
contains
(
data
.
getFactoryNum
()))
result
.
append
(
"出厂编号/产品编码不能重复;"
);
checkFactoryNumUniqueness
(
data
.
getFactoryNum
(),
null
);
checkNotBlank
(
data
.
getProduceDate
(),
"制造日期不能为空"
);
checkDateFormatCorrect
(
data
.
getProduceDate
(),
"制造日期格式不正确"
);
checkNotBlank
(
data
.
getInspectOrgName
(),
"检测机构名称不能为空"
);
checkNotBlank
(
data
.
getInspectStaff
(),
"检测人员名称不能为空"
);
checkNotBlank
(
data
.
getInspectDate
(),
"检测日期不能为空"
);
checkDateFormatCorrect
(
data
.
getInspectDate
(),
"检测日期格式不正确"
);
checkNotBlank
(
data
.
getSingleBottleVolume
(),
"单瓶容积不能为空"
);
checkNotBlank
(
data
.
getChargingMedium
(),
"充装介质不能为空"
);
checkNotBlank
(
data
.
getNominalWorkingPressure
(),
"公称工作压力不能为空"
);
// 如果存在错误信息,则抛出 BadRequest 异常
if
(
result
.
length
()
>
0
)
{
result
.
insert
(
0
,
"Excel第["
+
rowIndex
+
"]行 -> "
);
throw
new
BadRequest
(
result
.
toString
());
}
this
.
dealExcelData
(
data
);
}
catch
(
Exception
e
)
{
log
.
error
(
String
.
format
(
"行索引数: [%s] -> 失败的 Excel 数据: [%s]"
,
rowIndex
,
JSON
.
toJSONString
(
data
)),
e
);
throw
e
;
}
}
private
void
checkEquCodeUniqueness
(
String
equCode
)
{
// 根据设备代码检查唯一性
LambdaQueryWrapper
<
RegistrationInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
RegistrationInfo:
:
getEquCode
,
equCode
);
Integer
count
=
tzsJgRegistrationInfoMapper
.
selectCount
(
wrapper
);
if
(
count
>
0
)
{
result
.
append
(
"设备代码系统中已存在"
);
}
}
// 检查上传Excel中的日期格式是否正确
private
void
checkDateFormatCorrect
(
String
date
,
String
errorMessage
)
{
if
(!
date
.
matches
(
"\\d{4}-\\d{2}-\\d{2}"
))
{
result
.
append
(
errorMessage
).
append
(
";"
);
}
}
// 检查字段是否为空,如果为空则追加错误信息到result
private
void
checkNotBlank
(
String
value
,
String
errorMessage
)
{
if
(
StringUtils
.
isBlank
(
value
))
{
result
.
append
(
errorMessage
).
append
(
";"
);
}
}
private
void
checkFactoryNumUniqueness
(
String
factoryNum
,
String
sequenceNbr
)
{
// 车用气瓶业务里面的 出厂编号/产品编码 校验唯一性(产品编号在车用气瓶范围内全局唯一)
if
(
commonService
.
checkFactoryNumUniquenessForVehicleCylinder
(
factoryNum
,
sequenceNbr
)
>
0
)
{
result
.
append
(
"出厂编号/产品编码系统中已存在!"
);
}
}
/**
* 处理导入数据
*
* @param data excelData
*/
private
void
dealExcelData
(
EquipInfoCylinderExcelDto
data
)
{
useInnerCodeList
.
add
(
data
.
getUseInnerCode
());
equCodeList
.
add
(
data
.
getEquCode
());
factoryNumList
.
add
(
"0"
.
equals
(
data
.
getWhetherVehicleCylinder
())
?
data
.
getFactoryNum
()
:
null
);
Date
date
=
new
Date
();
String
record
=
UUID
.
randomUUID
().
toString
();
records
.
add
(
record
);
//使用信息
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
);
designInfo
.
setRecord
(
record
);
designInfo
.
setRecDate
(
date
);
designInfo
.
setDesignDate
(
DateUtil
.
parse
(
data
.
getDesignDate
(),
"yyyy-MM-dd"
));
designInfoList
.
add
(
designInfo
);
//制造信息
IdxBizJgFactoryInfo
factoryInfo
=
new
IdxBizJgFactoryInfo
();
BeanUtils
.
copyProperties
(
data
,
factoryInfo
);
factoryInfo
.
setRecord
(
record
);
factoryInfo
.
setRecDate
(
date
);
factoryInfo
.
setProduceDate
(
DateUtil
.
parse
(
data
.
getProduceDate
(),
"yyyy-MM-dd"
));
factoryInfo
.
setImported
(
Optional
.
ofNullable
(
data
.
getImported
()).
orElse
(
"0"
));
factoryInfoList
.
add
(
factoryInfo
);
//注册登记
IdxBizJgRegisterInfo
registerInfo
=
new
IdxBizJgRegisterInfo
();
BeanUtils
.
copyProperties
(
data
,
registerInfo
);
registerInfo
.
setRecord
(
record
);
registerInfo
.
setRecDate
(
date
);
registerInfo
.
setEquCategory
((
String
)
paramMap
.
get
(
"EQU_CATEGORY_CODE"
));
registerInfo
.
setEquDefine
((
String
)
paramMap
.
get
(
"EQU_DEFINE_CODE"
));
registerInfo
.
setEquList
((
String
)
paramMap
.
get
(
"EQU_LIST_CODE"
));
registerInfo
.
setRegisterState
(
idxBizJgRegisterInfoService
.
getRegCode
());
registerInfoList
.
add
(
registerInfo
);
//检验检测
IdxBizJgInspectionDetectionInfo
inspectionDetectionInfo
=
new
IdxBizJgInspectionDetectionInfo
();
BeanUtils
.
copyProperties
(
data
,
inspectionDetectionInfo
);
List
<
Map
<
String
,
Object
>>
InspectOrgList
=
commonService
.
getUnitListByType
(
"inspection"
,
""
);
inspectionDetectionInfo
.
setInspectOrgCode
(
findUseCode
(
InspectOrgList
,
data
.
getInspectOrgName
()));
inspectionDetectionInfo
.
setRecord
(
record
);
inspectionDetectionInfo
.
setRecDate
(
date
);
inspectionDetectionInfo
.
setInspectType
(
"ZZJDJY"
);
inspectionDetectionInfo
.
setInspectConclusion
(
"6040"
);
//默认合格
inspectionDetectionInfo
.
setInspectDate
(
DateUtil
.
parse
(
data
.
getInspectDate
(),
"yyyy-MM-dd"
));
inspectionDetectionInfo
.
setNextInspectDate
(
Date
.
from
(
LocalDate
.
parse
(
data
.
getInspectDate
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
))
.
plusYears
(
3
)
.
atStartOfDay
(
ZoneId
.
systemDefault
())
.
toInstant
()));
inspectionDetectionInfoList
.
add
(
inspectionDetectionInfo
);
//技术参数
IdxBizJgTechParamsVessel
paramsVessel
=
new
IdxBizJgTechParamsVessel
();
BeanUtils
.
copyProperties
(
data
,
paramsVessel
);
paramsVessel
.
setRecord
(
record
);
paramsVessel
.
setRecDate
(
date
);
paramsVesselList
.
add
(
paramsVessel
);
ESEquipmentCategoryDto
dto
=
JSON
.
parseObject
(
toJSONString
(
data
),
ESEquipmentCategoryDto
.
class
);
// 使用单位信息
dto
.
setDATA_SOURCE
(
useInfo
.
getDataSource
());
dto
.
setNEXT_INSPECT_DATE
(
inspectionDetectionInfo
.
getNextInspectDate
()
+
""
);
dto
.
setREC_DATE
(
System
.
currentTimeMillis
());
dto
.
setSEQUENCE_NBR
(
record
);
dto
.
setFACTORY_NUM
(
factoryInfo
.
getFactoryNum
());
dto
.
setUSE_INNER_CODE
(
useInfo
.
getUseInnerCode
());
dto
.
setEQU_CATEGORY
((
String
)
paramMap
.
get
(
"EQU_CATEGORY"
));
dto
.
setEQU_CATEGORY_CODE
((
String
)
paramMap
.
get
(
"EQU_CATEGORY_CODE"
));
dto
.
setEQU_LIST
((
String
)
paramMap
.
get
(
"EQU_LIST"
));
dto
.
setEQU_LIST_CODE
((
String
)
paramMap
.
get
(
"EQU_LIST_CODE"
));
dto
.
setEQU_DEFINE
((
String
)
paramMap
.
get
(
"EQU_DEFINE"
));
dto
.
setEQU_DEFINE_CODE
((
String
)
paramMap
.
get
(
"EQU_DEFINE_CODE"
));
dto
.
setUSE_UNIT_CREDIT_CODE
(
company
.
getCompanyCode
());
dto
.
setUSE_UNIT_NAME
(
company
.
getCompanyName
());
esEquipmentCategoryList
.
add
(
dto
);
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
context
)
{
if
(
paramsVesselList
.
size
()
>
BATCH_COUNT
)
{
throw
new
BadRequest
(
result
.
append
(
"单次导入限制1000条"
)
+
""
);
}
if
(!
useInfoList
.
isEmpty
())
{
idxBizJgUseInfoService
.
saveBatch
(
useInfoList
);
}
if
(!
designInfoList
.
isEmpty
())
{
idxBizJgDesignInfoService
.
saveBatch
(
designInfoList
);
}
if
(!
registerInfoList
.
isEmpty
())
{
idxBizJgRegisterInfoService
.
saveBatch
(
registerInfoList
);
}
if
(!
factoryInfoList
.
isEmpty
())
{
idxBizJgFactoryInfoService
.
saveBatch
(
factoryInfoList
);
}
if
(!
paramsVesselList
.
isEmpty
())
{
idxBizJgTechParamsVesselService
.
saveBatch
(
paramsVesselList
);
}
if
(!
inspectionDetectionInfoList
.
isEmpty
())
{
idxBizJgInspectionDetectionInfoService
.
saveBatch
(
inspectionDetectionInfoList
);
}
if
(!
esEquipmentCategoryList
.
isEmpty
())
{
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryList
);
}
result
.
append
(
"导入完成,成功导入"
);
result
.
append
(
useInfoList
.
size
());
result
.
append
(
"条数据"
);
log
.
info
(
"所有数据解析完成!"
);
}
@Override
public
void
onException
(
Exception
exception
,
AnalysisContext
context
)
throws
Exception
{
if
(!
esEquipmentCategoryList
.
isEmpty
())
{
superviseInfoMapper
.
deleteDataAll
(
records
);
esEquipmentCategory
.
deleteAll
(
esEquipmentCategoryList
);
}
throw
exception
;
}
public
String
getResult
()
{
return
result
.
toString
();
}
public
String
findUseCode
(
List
<
Map
<
String
,
Object
>>
unitList
,
String
inspectOrgName
)
{
Optional
<
Map
<
String
,
Object
>>
optional
=
unitList
.
stream
()
.
filter
(
map
->
map
.
containsKey
(
"useUnit"
)
&&
map
.
get
(
"useUnit"
).
equals
(
inspectOrgName
))
.
findFirst
();
return
optional
.
map
(
map
->
(
String
)
map
.
get
(
"useCode"
)).
orElse
(
null
);
}
}
\ 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 @
22fe4a13
...
...
@@ -8,12 +8,20 @@ import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
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
;
...
...
@@ -136,4 +144,45 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
JSONObject
jsonObject
=
new
JSONObject
(
queryMap
);
return
ResponseHelper
.
buildResponse
(
idxBizJgRegisterInfoService
.
queryEquipCanUsedByVesselPage
(
jsonObject
));
}
/**
* 压力容器设备批量导入
*/
@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
));
}
/**
* 压力容器设备模版下载
*/
@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/ICommonService.java
View file @
22fe4a13
...
...
@@ -184,4 +184,6 @@ public interface ICommonService {
* @return CompanyBo
*/
CompanyBo
getOneCompany
(
String
companyCode
);
Integer
checkFactoryNumUniquenessForVehicleCylinder
(
String
factoryNum
,
String
sequenceNbr
);
}
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 @
22fe4a13
...
...
@@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -35,4 +35,6 @@ public interface IIdxBizJgRegisterInfoService {
Page
<
JSONObject
>
queryForUnitEquipmentPage
(
JSONObject
jsonObject
);
Page
<
JSONObject
>
queryEquipCanUsedByVesselPage
(
JSONObject
jsonObject
);
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 @
22fe4a13
...
...
@@ -19,4 +19,6 @@ public interface IIdxBizJgUseInfoService extends IService<IdxBizJgUseInfo> {
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/CommonServiceImpl.java
View file @
22fe4a13
...
...
@@ -1762,6 +1762,11 @@ public class CommonServiceImpl implements ICommonService {
return
companyBo
==
null
?
new
CompanyBo
()
:
companyBo
;
}
@Override
public
Integer
checkFactoryNumUniquenessForVehicleCylinder
(
String
factoryNum
,
String
sequenceNbr
)
{
return
commonMapper
.
checkFactoryNumUniquenessForVehicleCylinder
(
factoryNum
,
sequenceNbr
);
}
/**
* 根据设备列表代码选择对应的 PDF 模板
*
...
...
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 @
22fe4a13
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -12,10 +13,12 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto
;
import
com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.ConstructionEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.config.PressureVesselListener
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
...
...
@@ -48,6 +51,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -164,6 +168,17 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Value
(
"${add.equip.dict.code.suffix:CATEGORY_LIST_ADD}"
)
private
String
equipAddDictCodeSuffix
;
@Autowired
private
IdxBizJgDesignInfoServiceImpl
idxBizJgDesignInfoService
;
@Autowired
private
IdxBizJgFactoryInfoServiceImpl
idxBizJgFactoryInfoService
;
@Autowired
private
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
@Autowired
private
IdxBizJgTechParamsVesselServiceImpl
idxBizJgTechParamsVesselService
;
@Autowired
private
IdxBizJgInspectionDetectionInfoServiceImpl
idxBizJgInspectionDetectionInfoService
;
/**
* 将对象的属性由驼峰转为纯大写下划线格式
*
...
...
@@ -1439,12 +1454,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
/**
* 设置安装告知使用的设备不能包括正在进行中的流程
*
* @param boolMust
* @param companyCode
*/
private
void
setRepeatUsedCheckFilterParam
(
BoolQueryBuilder
boolMust
,
String
companyCode
,
String
bizType
)
{
Set
<
String
>
records
=
EquipUsedCheckStrategyContext
.
getUsedStrategy
(
bizType
).
getEquipInFlow
(
companyCode
);
if
(
records
.
size
()
>
0
)
{
if
(
records
.
size
()
>
0
)
{
boolMust
.
mustNot
(
QueryBuilders
.
termsQuery
(
"SEQUENCE_NBR.keyword"
,
records
));
}
}
...
...
@@ -1478,7 +1494,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*
* @return code
*/
p
rivate
String
getRegCode
()
{
p
ublic
String
getRegCode
()
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"ZC"
);
queryWrapper
.
eq
(
"name"
,
"未注册"
);
...
...
@@ -1874,4 +1890,40 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
});
return
result
;
}
@Override
public
String
importPressureVesselData
(
MultipartFile
file
,
Map
<
String
,
Object
>
paramMap
)
{
try
{
PressureVesselListener
pressureVesselListener
=
new
PressureVesselListener
();
injectDependencies
(
pressureVesselListener
,
paramMap
);
EasyExcel
.
read
(
file
.
getInputStream
(),
EquipInfoCylinderExcelDto
.
class
,
pressureVesselListener
)
.
headRowNumber
(
4
)
.
sheet
()
.
doRead
();
return
pressureVesselListener
.
getResult
();
}
catch
(
Exception
e
)
{
return
(
e
.
getCause
()
instanceof
BadRequest
)
?
"模版数据填写有误:"
+
e
.
getCause
().
getMessage
()
:
"导入时出现异常:"
+
e
.
getMessage
();
}
}
// 注入依赖
private
void
injectDependencies
(
PressureVesselListener
listener
,
Map
<
String
,
Object
>
paramMap
)
{
listener
.
setIdxBizJgRegisterInfoService
(
idxBizJgRegisterInfoService
);
listener
.
setJgInstallationNoticeService
(
jgInstallationNoticeService
);
listener
.
setIdxBizJgUseInfoService
(
idxBizJgUseInfoService
);
listener
.
setIdxBizJgDesignInfoService
(
idxBizJgDesignInfoService
);
listener
.
setIdxBizJgFactoryInfoService
(
idxBizJgFactoryInfoService
);
listener
.
setIdxBizJgTechParamsVesselService
(
idxBizJgTechParamsVesselService
);
listener
.
setIdxBizJgInspectionDetectionInfoService
(
idxBizJgInspectionDetectionInfoService
);
listener
.
setCommonService
(
commonService
);
listener
.
setTzsJgRegistrationInfoMapper
(
tzsJgRegistrationInfoMapper
);
listener
.
setTzsJgRegistrationInfoMapper
(
tzsJgRegistrationInfoMapper
);
listener
.
setEsEquipmentCategory
(
esEquipmentCategory
);
listener
.
setCategoryOtherInfoMapper
(
categoryOtherInfoMapper
);
listener
.
setSuperviseInfoMapper
(
superviseInfoMapper
);
listener
.
setParamMap
(
paramMap
);
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
CompanyBo
company
=
reginParams
.
getCompany
();
listener
.
setCompany
(
company
);
}
}
\ 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/service/impl/IdxBizJgUseInfoServiceImpl.java
View file @
22fe4a13
...
...
@@ -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 @
22fe4a13
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