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
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
767 additions
and
370 deletions
+767
-370
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
+286
-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
+152
-143
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
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
<
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
(),
"出厂编号/产品编码不能为空"
);
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
(
BadRequest
e
)
{
throw
e
;
}
catch
(
Exception
e
)
{
log
.
error
(
String
.
format
(
"行索引数: [%s] -> 失败的 Excel 数据: [%s]"
,
rowIndex
,
JSON
.
toJSONString
(
data
)),
e
);
throw
new
BadRequest
(
result
.
toString
());
}
}
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
(
";"
);
}
}
/**
* 处理导入数据
*
* @param data excelData
*/
private
void
dealExcelData
(
EquipInfoCylinderExcelDto
data
)
{
useInnerCodeList
.
add
(
data
.
getUseInnerCode
());
equCodeList
.
add
(
data
.
getEquCode
());
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
.
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
{
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/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
...
...
@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -18,7 +17,7 @@ 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.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.config.
Yh
Listener
;
import
com.yeejoin.amos.boot.module.jg.biz.config.
PressureVessel
Listener
;
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.ymt.api.dto.ESEquipmentCategoryDto
;
...
...
@@ -58,11 +57,13 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.IOException
;
import
java.lang.reflect.Field
;
import
java.sql.Timestamp
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
...
...
@@ -74,6 +75,9 @@ import static com.alibaba.fastjson.JSON.toJSONString;
*/
@Service
public
class
IdxBizJgRegisterInfoServiceImpl
extends
BaseService
<
IdxBizJgRegisterInfoDto
,
IdxBizJgRegisterInfo
,
IdxBizJgRegisterInfoMapper
>
implements
IIdxBizJgRegisterInfoService
{
public
final
static
String
USE_TYPE_NAME
=
"使用单位"
;
public
final
static
String
INDIVIDUAL_TYPE_NAME
=
"个人主体"
;
public
final
static
String
MAINTENANCE_TYPE_NAME
=
"安装改造维修单位"
;
// 设备分类表单id
private
static
final
String
EQUIP_CLASS_FORM_ID
=
"equipClass"
;
// 设备基本信息表单id
...
...
@@ -84,36 +88,26 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private
static
final
String
EQUIP_MAINPARTS_FORM_ID
=
"mainParts"
;
// 安全附件
private
static
final
String
EQUIP_PROTECTIONDEVICES_FORM_ID
=
"protectionDevices"
;
private
static
final
String
EQUSTATE
=
"EQU_STATE"
;
private
static
final
String
CONSTRUCTIONTYPE
=
"CONSTRUCTION_TYPE"
;
private
static
final
String
EQUDEFINE
=
"EQU_DEFINE"
;
private
static
final
String
EQUDEFINECODE
=
"EQU_DEFINE_CODE"
;
// 新增修改标识
private
static
final
String
OPERATESAVE
=
"save"
;
private
static
final
String
OPERATEEDIT
=
"edit"
;
// 单位办理类型
private
static
final
String
MANAGE_TYPE_UNIT
=
"unit"
;
private
static
final
String
RECORD
=
"RECORD"
;
private
static
final
String
MANAGE_TYPE
=
"manageType"
;
private
static
final
String
EQU_CODE
=
"EQU_CODE"
;
private
static
final
String
SEQUENCE_NBR
=
"SEQUENCE_NBR"
;
// 新增设备是否复制而来
private
static
final
String
IS_COPY
=
"isCopy"
;
public
static
String
[]
jsonFields
=
{
"insOtherAccessories"
,
"installContractAttachment"
,
"installProxyStatementAttachment"
};
@Autowired
RestHighLevelClient
restHighLevelClient
;
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
RegistrationInfoMapper
tzsJgRegistrationInfoMapper
;
@Autowired
IIdxBizJgUseInfoService
idxBizJgUseInfoService
;
@Autowired
...
...
@@ -157,26 +151,58 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
DataDictionaryServiceImpl
iDataDictionaryService
;
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
CategoryOtherInfoMapper
categoryOtherInfoMapper
;
@Autowired
private
SuperviseInfoMapper
superviseInfoMapper
;
@Autowired
private
JgUseRegistrationMapper
jgUseRegistrationMapper
;
@Autowired
private
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
public
final
static
String
USE_TYPE_NAME
=
"使用单位"
;
public
final
static
String
INDIVIDUAL_TYPE_NAME
=
"个人主体"
;
public
final
static
String
MAINTENANCE_TYPE_NAME
=
"安装改造维修单位"
;
@Autowired
private
IdxBizJgDesignInfoServiceImpl
idxBizJgDesignInfoService
;
@Autowired
private
IdxBizJgFactoryInfoServiceImpl
idxBizJgFactoryInfoService
;
@Autowired
private
IdxBizJgRegisterInfoServiceImpl
idxBizJgRegisterInfoService
;
@Autowired
private
IdxBizJgTechParamsVesselServiceImpl
idxBizJgTechParamsVesselService
;
@Autowired
private
IdxBizJgInspectionDetectionInfoServiceImpl
idxBizJgInspectionDetectionInfoService
;
@Value
(
"${add.equip.dict.code.suffix:CATEGORY_LIST_ADD}"
)
private
String
equipAddDictCodeSuffix
;
public
static
String
[]
jsonFields
=
{
"insOtherAccessories"
,
"installContractAttachment"
,
"installProxyStatementAttachment"
};
/**
* 将对象的属性由驼峰转为纯大写下划线格式
*
* @param object
* @return
* @throws IllegalAccessException
*/
public
static
Map
<
String
,
Object
>
convertCamelToUnderscore
(
Object
object
,
String
[]
strToJsonArrayFields
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Class
<?>
clazz
=
object
.
getClass
();
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
String
underscoreFieldName
=
StringUtils
.
camelToUnderline
(
fieldName
).
toUpperCase
();
Object
value
;
try
{
value
=
field
.
get
(
object
);
//需要转为jsonArray的字段
if
(!
ValidationUtil
.
isEmpty
(
strToJsonArrayFields
)
&&
Arrays
.
asList
(
strToJsonArrayFields
).
contains
(
underscoreFieldName
))
{
value
=
JSON
.
parseArray
((
String
)
field
.
get
(
object
));
}
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(!
ValidationUtil
.
isEmpty
(
value
))
{
result
.
put
(
underscoreFieldName
.
toUpperCase
(),
value
);
}
}
return
result
;
}
/**
* 设备注册信息
...
...
@@ -257,9 +283,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private
void
checkForEquipEdit
(
Object
record
)
{
// 标识编辑
if
(
record
!=
null
)
{
if
(
record
!=
null
)
{
Integer
inUseTime
=
commonService
.
countEquipInUseTimesForEdit
(
record
.
toString
());
if
(
inUseTime
>
0
)
{
if
(
inUseTime
>
0
)
{
throw
new
BadRequest
(
"此设备在被其他业务引用,不可编辑!"
);
}
}
...
...
@@ -306,9 +332,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
private
void
checkForDelete
(
List
<
String
>
records
)
{
for
(
String
record:
records
)
{
for
(
String
record
:
records
)
{
Integer
useTime
=
commonService
.
countEquipInUseTimesForDel
(
record
);
if
(
useTime
>
0
)
{
if
(
useTime
>
0
)
{
String
msg
=
getTipMsgString
(
record
);
throw
new
BadRequest
(
msg
);
}
...
...
@@ -321,7 +347,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
useTime
<=
0
;
}
private
String
getTipMsgString
(
String
record
)
{
IdxBizJgRegisterInfo
registerInfo
=
this
.
getOne
(
new
QueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
"RECORD"
,
record
));
return
String
.
format
(
"存在被引用的设备,设备代码:%s"
,
registerInfo
.
getEquCode
());
...
...
@@ -418,8 +443,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
resultMap
.
put
(
"orgBranchName"
,
superviseInfo
.
getOrgBranchName
());
}
resultMap
.
remove
(
"instanceId"
);
for
(
String
field
:
jsonFields
)
{
if
(
resultMap
.
get
(
field
)
!=
null
&&
resultMap
.
get
(
field
)
instanceof
String
)
{
for
(
String
field
:
jsonFields
)
{
if
(
resultMap
.
get
(
field
)
!=
null
&&
resultMap
.
get
(
field
)
instanceof
String
)
{
resultMap
.
put
(
field
,
JSON
.
parse
(
resultMap
.
get
(
field
).
toString
()));
}
}
...
...
@@ -430,11 +455,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
public
List
<
DictionarieValueModel
>
equCategoryListByCompanyType
(
ReginParams
selectedOrgInfo
,
String
equList
)
{
String
companyType
=
selectedOrgInfo
.
getCompany
().
getCompanyType
();
String
dictCodePrefix
=
getDictCodePrefix
(
companyType
,
equList
);
if
(
StringUtils
.
isEmpty
(
dictCodePrefix
))
{
if
(
StringUtils
.
isEmpty
(
dictCodePrefix
))
{
return
new
ArrayList
<>();
}
String
dictCode
=
String
.
format
(
"%s_%s"
,
dictCodePrefix
,
equipAddDictCodeSuffix
);
return
FeignUtil
.
remoteCall
(()
->
Systemctl
.
dictionarieClient
.
dictValues
(
dictCode
));
String
dictCode
=
String
.
format
(
"%s_%s"
,
dictCodePrefix
,
equipAddDictCodeSuffix
);
return
FeignUtil
.
remoteCall
(()
->
Systemctl
.
dictionarieClient
.
dictValues
(
dictCode
));
}
private
String
getDictCodePrefix
(
String
companyType
,
String
equList
)
{
...
...
@@ -451,7 +476,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
StringUtils
.
isNotEmpty
(
equList
)
?
equList
+
"_"
+
dictCodePrefix
:
dictCodePrefix
;
}
/**
* 查询设备种类信息
*
...
...
@@ -500,7 +524,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
registerInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
registerInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -565,11 +589,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap
.
put
(
"fullAddress"
,
fullAddress
);
}
useInfoMap
.
put
(
"useinfoSeq"
,
useInfo
.
getSequenceNbr
());
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getLongitudeLatitude
()))
{
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getLongitudeLatitude
()))
{
useInfoMap
.
put
(
"longitudeLatitude"
,
JSON
.
parseObject
(
useInfo
.
getLongitudeLatitude
()));
useInfoMap
.
put
(
"useLongitudeLatitude"
,
JSON
.
parseObject
(
useInfo
.
getLongitudeLatitude
()));
}
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
{
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
{
useInfoMap
.
put
(
"useAddress"
,
useInfo
.
getAddress
());
}
...
...
@@ -591,18 +615,18 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap
.
put
(
"FULLADDRESS"
,
fullAddress
);
}
useInfoMap
.
put
(
"USEINFO_SEQ"
,
useInfo
.
getSequenceNbr
());
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getLongitudeLatitude
()))
{
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getLongitudeLatitude
()))
{
useInfoMap
.
put
(
"LONGITUDE_LATITUDE"
,
JSON
.
parseObject
(
useInfo
.
getLongitudeLatitude
()));
useInfoMap
.
put
(
"USE_LONGITUDE_LATITUDE"
,
JSON
.
parseObject
(
useInfo
.
getLongitudeLatitude
()));
}
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
{
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
{
useInfoMap
.
put
(
"USE_ADDRESS"
,
useInfo
.
getAddress
());
}
}
if
(!
useInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
useInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -620,14 +644,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
designInfoMap
.
put
(
"otherAccessoriesDes"
,
JSON
.
parse
(
String
.
valueOf
(
designInfoMap
.
get
(
"otherAccessoriesDes"
))));
}
}
else
{
String
[]
fields
=
{
"DESIGN_DOC"
,
"DESIGN_STANDARD"
,
"OTHER_ACCESSORIES_DES"
};
String
[]
fields
=
{
"DESIGN_DOC"
,
"DESIGN_STANDARD"
,
"OTHER_ACCESSORIES_DES"
};
designInfoMap
=
convertCamelToUnderscore
(
designInfo
,
fields
);
designInfoMap
.
put
(
"DESIGNINFO_SEQ"
,
designInfo
.
getSequenceNbr
());
}
if
(!
designInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
designInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -655,7 +679,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
else
{
String
[]
fields
=
{
"FACTORY_STANDARD"
,
"PRODUCT_QUALITY_YIELD_PROVE"
,
"INS_USE_MAINTAIN_EXPLAIN"
,
"OTHER_ACCESSORIES_FACT"
,
"FACT_SUPERVISION_INSPECTION_REPORT"
,
"BOILER_ENERGY_EFFICIENCY_CERTIFICATE"
};
"OTHER_ACCESSORIES_FACT"
,
"FACT_SUPERVISION_INSPECTION_REPORT"
,
"BOILER_ENERGY_EFFICIENCY_CERTIFICATE"
};
factoryInfoMap
=
convertCamelToUnderscore
(
factoryInfo
,
fields
);
String
imported
=
factoryInfo
.
getImported
();
if
(
"0"
.
equals
(
imported
))
{
...
...
@@ -668,7 +692,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
factoryInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
factoryInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -687,7 +711,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
constructionInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
constructionInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -715,7 +739,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
registerInfoMap
.
put
(
"otherAccessoriesReg"
,
JSON
.
parse
(
String
.
valueOf
(
registerInfoMap
.
get
(
"otherAccessoriesReg"
))));
}
}
else
{
String
[]
fields
=
{
"PRODUCT_PHOTO"
,
"OTHER_ACCESSORIES_REG"
};
String
[]
fields
=
{
"PRODUCT_PHOTO"
,
"OTHER_ACCESSORIES_REG"
};
registerInfoMap
=
convertCamelToUnderscore
(
registerInfo
,
fields
);
registerInfoMap
.
put
(
"REGISTERINFO_SEQ"
,
registerInfo
.
getSequenceNbr
());
registerInfoMap
.
put
(
"SEQUENCE_NBR"
,
registerInfo
.
getSequenceNbr
());
...
...
@@ -729,7 +753,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
registerInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
registerInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -751,7 +775,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
maintenanceRecordInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
maintenanceRecordInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -770,7 +794,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
supervisionInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
supervisionInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -789,7 +813,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
otherInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
otherInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -810,46 +834,46 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
inspectionDetectionInfoMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
inspectionDetectionInfoMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
}
objMap
.
put
(
"completedBusinessTypes"
,
judgeTheBusinessAccordingByRecord
(
record
,
objMap
));
objMap
.
put
(
"completedBusinessTypes"
,
judgeTheBusinessAccordingByRecord
(
record
,
objMap
));
// 账号类型(用于车用气瓶流程页面-》监管审核-》打开设备详情 时隐藏保存按钮)
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
objMap
.
put
(
"accountType"
,
reginParams
.
getCompany
().
getCompanyType
());
objMap
.
put
(
"accountType"
,
reginParams
.
getCompany
().
getCompanyType
());
return
objMap
;
}
/**
* 根据record判断设备完成了哪些业务(安装告知/维保备案/使用登记)
*
* @return
*/
public
String
judgeTheBusinessAccordingByRecord
(
String
record
,
Map
<
String
,
Object
>
objMap
)
{
public
String
judgeTheBusinessAccordingByRecord
(
String
record
,
Map
<
String
,
Object
>
objMap
)
{
String
business
=
""
;
// 安装告知
Map
<
String
,
Object
>
installDetail
=
jgUseRegistrationMapper
.
getiInstallDetail
(
record
);
if
(!
ObjectUtils
.
isEmpty
(
installDetail
)){
if
(!
ObjectUtils
.
isEmpty
(
installDetail
))
{
business
=
business
+
",安装告知"
;
objMap
.
putAll
(
installDetail
);
objMap
.
put
(
"insOtherAccessories"
,
JSON
.
parse
(
Optional
.
ofNullable
(
installDetail
.
get
(
"insOtherAccessories"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"installProxyStatementAttachment"
,
JSON
.
parse
(
Optional
.
ofNullable
(
installDetail
.
get
(
"installProxyStatementAttachment"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"installContractAttachment"
,
JSON
.
parse
(
Optional
.
ofNullable
(
installDetail
.
get
(
"installContractAttachment"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"insOtherAccessories"
,
JSON
.
parse
(
Optional
.
ofNullable
(
installDetail
.
get
(
"insOtherAccessories"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"installProxyStatementAttachment"
,
JSON
.
parse
(
Optional
.
ofNullable
(
installDetail
.
get
(
"installProxyStatementAttachment"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"installContractAttachment"
,
JSON
.
parse
(
Optional
.
ofNullable
(
installDetail
.
get
(
"installContractAttachment"
)).
orElse
(
""
).
toString
()));
}
// 维保备案
Map
<
String
,
Object
>
maintenanceDetail
=
jgUseRegistrationMapper
.
getMaintenanceDetail
(
record
);
if
(!
ObjectUtils
.
isEmpty
(
maintenanceDetail
)){
if
(!
ObjectUtils
.
isEmpty
(
maintenanceDetail
))
{
business
=
business
+
",维保备案"
;
objMap
.
putAll
(
maintenanceDetail
);
objMap
.
put
(
"maintenanceContract"
,
JSON
.
parse
(
Optional
.
ofNullable
(
maintenanceDetail
.
get
(
"maintenanceContract"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"maintOtherAccessories"
,
JSON
.
parse
(
Optional
.
ofNullable
(
maintenanceDetail
.
get
(
"maintOtherAccessories"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"maintenanceContract"
,
JSON
.
parse
(
Optional
.
ofNullable
(
maintenanceDetail
.
get
(
"maintenanceContract"
)).
orElse
(
""
).
toString
()));
objMap
.
put
(
"maintOtherAccessories"
,
JSON
.
parse
(
Optional
.
ofNullable
(
maintenanceDetail
.
get
(
"maintOtherAccessories"
)).
orElse
(
""
).
toString
()));
}
// 使用登记
Map
<
String
,
Object
>
useRegistrationDetail
=
jgUseRegistrationMapper
.
getUseRegistrationDetail
(
record
);
if
(!
ObjectUtils
.
isEmpty
(
useRegistrationDetail
)){
if
(!
ObjectUtils
.
isEmpty
(
useRegistrationDetail
))
{
business
=
business
+
",使用登记"
;
objMap
.
putAll
(
useRegistrationDetail
);
}
...
...
@@ -883,7 +907,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
elevatorMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
elevatorMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -903,7 +927,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
vehicleMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
vehicleMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -927,7 +951,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
ropewayMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
ropewayMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -950,7 +974,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
ridesMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
ridesMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -971,7 +995,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
boilerMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
boilerMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -994,7 +1018,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
vesselMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
vesselMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -1015,7 +1039,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
else
{
pipelineMap
=
convertCamelToUnderscore
(
pipeline
,
null
);
pipelineMap
.
put
(
"PIPELINE_SEQ"
,
pipeline
.
getSequenceNbr
());
pipelineMap
.
put
(
"STARTE_POSITION"
,
JSONObject
.
parseObject
(
pipeline
.
getStartePosition
()));
pipelineMap
.
put
(
"STARTE_POSITION"
,
JSONObject
.
parseObject
(
pipeline
.
getStartePosition
()));
}
Map
<
String
,
Object
>
filterMap
=
pipelineMap
.
entrySet
()
.
stream
()
...
...
@@ -1041,7 +1065,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
liftingMap
.
isEmpty
())
{
Map
<
String
,
Object
>
filterMap
=
liftingMap
.
entrySet
()
.
stream
()
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
filter
(
e
->
e
.
getValue
()
!=
null
&&
e
.
getValue
()
!=
""
)
.
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
objMap
.
putAll
(
filterMap
);
}
...
...
@@ -1127,7 +1151,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*/
public
Page
<
JSONObject
>
queryForEquipmentRegisterPage
(
JSONObject
map
)
{
if
(
map
.
containsKey
(
"flag"
)
&&
!
map
.
containsKey
(
"USE_UNIT_CREDIT_CODE"
))
{
if
(
map
.
containsKey
(
"flag"
)
&&
!
map
.
containsKey
(
"USE_UNIT_CREDIT_CODE"
))
{
return
new
Page
<>();
}
...
...
@@ -1184,7 +1208,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// DATA_SOURCE 为“jg”的数据(从监管新加的设备)
// 20240314 提出的监管业务不要让企业用户选到之前一码通认领或补录的设备,让从监管业务中去新增
BoolQueryBuilder
dBuilder
=
QueryBuilders
.
boolQuery
();
dBuilder
.
must
(
QueryBuilders
.
termQuery
(
"DATA_SOURCE"
,
QueryParser
.
escape
(
"jg"
)));
dBuilder
.
must
(
QueryBuilders
.
termQuery
(
"DATA_SOURCE"
,
QueryParser
.
escape
(
"jg"
)));
boolMust
.
must
(
dBuilder
);
String
queryType
=
map
.
getString
(
"QUERY_TYPE"
);
...
...
@@ -1299,14 +1323,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_CATEGORY_CODE"
)))
{
BoolQueryBuilder
pBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"EQU_CATEGORY_CODE"
));
pBuilder
.
must
(
QueryBuilders
.
termQuery
(
"EQU_CATEGORY_CODE"
,
test
));
pBuilder
.
must
(
QueryBuilders
.
termQuery
(
"EQU_CATEGORY_CODE"
,
test
));
boolMust
.
must
(
pBuilder
);
}
// 是否车用气瓶
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"WHETHER_VEHICLE_CYLINDER"
)))
{
BoolQueryBuilder
pBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"WHETHER_VEHICLE_CYLINDER"
));
pBuilder
.
must
(
QueryBuilders
.
termQuery
(
"WHETHER_VEHICLE_CYLINDER"
,
test
));
pBuilder
.
must
(
QueryBuilders
.
termQuery
(
"WHETHER_VEHICLE_CYLINDER"
,
test
));
boolMust
.
must
(
pBuilder
);
}
// 设备代码模糊查询
...
...
@@ -1363,34 +1387,38 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String
status
=
EquimentEnum
.
getName
.
get
(
integer
);
dto2
.
put
(
EQUSTATE
,
status
);
}
dto2
.
put
(
"record"
,
dto2
.
get
(
"SEQUENCE_NBR"
));
dto2
.
put
(
"record"
,
dto2
.
get
(
"SEQUENCE_NBR"
));
list
.
add
(
dto2
);
}
// 获取所有设备的Id
List
<
String
>
equIds
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
list
))
{
if
(!
ValidationUtil
.
isEmpty
(
list
))
{
equIds
=
list
.
stream
().
map
(
item
->
item
.
get
(
"SEQUENCE_NBR"
).
toString
()).
collect
(
Collectors
.
toList
());
}
if
(!
ValidationUtil
.
isEmpty
(
equIds
))
{
if
(!
ValidationUtil
.
isEmpty
(
equIds
))
{
// 查询设备地址
List
<
IdxBizJgUseInfo
>
useInfoListByEquIds
=
idxBizJgUseInfoService
.
getUseInfoListByEquIds
(
equIds
);
Map
<
String
,
String
>
equAddressMap
=
new
HashMap
<>();
if
(!
ValidationUtil
.
isEmpty
(
useInfoListByEquIds
))
{
if
(!
ValidationUtil
.
isEmpty
(
useInfoListByEquIds
))
{
equAddressMap
=
useInfoListByEquIds
.
stream
().
collect
(
Collectors
.
toMap
(
IdxBizJgUseInfo:
:
getRecord
,
useInfo
->
{
String
fulladdress
=
""
;
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getProvinceName
()))
fulladdress
+=
useInfo
.
getProvinceName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getCityName
()))
fulladdress
+=
useInfo
.
getCityName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getCountyName
()))
fulladdress
+=
useInfo
.
getCountyName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getStreetName
()))
fulladdress
+=
useInfo
.
getStreetName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
fulladdress
+=
useInfo
.
getAddress
();
String
fulladdress
=
""
;
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getProvinceName
()))
fulladdress
+=
useInfo
.
getProvinceName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getCityName
()))
fulladdress
+=
useInfo
.
getCityName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getCountyName
()))
fulladdress
+=
useInfo
.
getCountyName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getStreetName
()))
fulladdress
+=
useInfo
.
getStreetName
();
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
fulladdress
+=
useInfo
.
getAddress
();
return
fulladdress
;
}
)
);
}
// 更新设备使用情况和设备地址
for
(
JSONObject
item
:
list
)
{
for
(
JSONObject
item
:
list
)
{
String
fullAddress
=
equAddressMap
.
get
(
item
.
getString
(
"SEQUENCE_NBR"
));
item
.
put
(
"ADDRESS"
,
!
ValidationUtil
.
isEmpty
(
fullAddress
)
?
fullAddress
:
""
);
item
.
put
(
"CAN_EDIT"
,
this
.
checkEquipIsCanEdit
(
item
.
getString
(
"SEQUENCE_NBR"
)));
...
...
@@ -1432,9 +1460,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
/**
* 获取类型为ZC的“未注册”的字典值
*
* @return code
*/
p
rivate
String
getRegCode
()
{
p
ublic
String
getRegCode
()
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"ZC"
);
queryWrapper
.
eq
(
"name"
,
"未注册"
);
...
...
@@ -1485,7 +1514,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfo
.
setRecDate
(
date
);
useInfo
.
setDataSource
(
"jg"
);
useInfo
.
setSequenceNbr
(
OPERATESAVE
.
equals
(
operateType
)
?
null
:
String
.
valueOf
(
equipmentInfoForm
.
get
(
"USEINFO_SEQ"
)));
if
(
companyTypeStr
.
contains
(
CompanyTypeEnum
.
USE
.
getCode
())
||
companyTypeStr
.
contains
(
CompanyTypeEnum
.
INDIVIDUAL
.
getCode
()))
{
if
(
companyTypeStr
.
contains
(
CompanyTypeEnum
.
USE
.
getCode
())
||
companyTypeStr
.
contains
(
CompanyTypeEnum
.
INDIVIDUAL
.
getCode
()))
{
useInfo
.
setUseUnitCreditCode
(
companyInfoMap
.
get
(
"creditCode"
).
toString
());
useInfo
.
setUseUnitName
(
companyInfoMap
.
get
(
"companyTypeName"
).
toString
());
}
...
...
@@ -1500,7 +1529,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
// 如果既为安改维单位又是使用单位,则将厂车、起重机械-流动式起重机、压力容器-气瓶安改维单位信息置空
if
(
companyTypeStr
.
contains
(
CompanyTypeEnum
.
CONSTRUCTION
.
getCode
())
&&
companyTypeStr
.
contains
(
CompanyTypeEnum
.
USE
.
getCode
()))
{
if
(!
registerInfo
.
getEquList
().
equals
(
"5000"
)
&&
!
registerInfo
.
getEquCategory
().
equals
(
"4400"
)
&&
!
registerInfo
.
getEquCategory
().
equals
(
"2300"
)){
if
(!
registerInfo
.
getEquList
().
equals
(
"5000"
)
&&
!
registerInfo
.
getEquCategory
().
equals
(
"4400"
)
&&
!
registerInfo
.
getEquCategory
().
equals
(
"2300"
))
{
constructionInfo
.
setUscUnitCreditCode
(
null
);
constructionInfo
.
setUscUnitName
(
null
);
}
...
...
@@ -1527,7 +1556,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
constructionInfo
.
setRecord
(
record
);
constructionInfo
.
setRecDate
(
date
);
if
(
companyTypeStr
.
contains
(
CompanyTypeEnum
.
CONSTRUCTION
.
getCode
()))
{
if
(
companyTypeStr
.
contains
(
CompanyTypeEnum
.
CONSTRUCTION
.
getCode
()))
{
constructionInfo
.
setUscUnitCreditCode
(
companyCode
);
constructionInfo
.
setUscUnitName
(
companyName
);
}
...
...
@@ -1539,7 +1568,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
// 如果既为安改维单位又是使用单位,则将厂车、起重机械-流动式起重机、压力容器-气瓶安改维单位信息置空
if
(
companyTypeStr
.
contains
(
CompanyTypeEnum
.
CONSTRUCTION
.
getCode
())
&&
companyTypeStr
.
contains
(
CompanyTypeEnum
.
USE
.
getCode
()))
{
if
(
registerInfo
.
getEquList
().
equals
(
"5000"
)
||
registerInfo
.
getEquCategory
().
equals
(
"4400"
)
||
registerInfo
.
getEquCategory
().
equals
(
"2300"
)){
if
(
registerInfo
.
getEquList
().
equals
(
"5000"
)
||
registerInfo
.
getEquCategory
().
equals
(
"4400"
)
||
registerInfo
.
getEquCategory
().
equals
(
"2300"
))
{
constructionInfo
.
setUscUnitCreditCode
(
null
);
constructionInfo
.
setUscUnitName
(
null
);
}
...
...
@@ -1734,7 +1763,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
record
;
}
public
void
checkEsData
(
String
id
)
{
Map
<
String
,
Object
>
map
=
categoryOtherInfoMapper
.
selectDataById
(
id
);
categoryOtherInfoMapper
.
updateEsStatus
(
id
);
...
...
@@ -1769,7 +1797,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
return
mainPartsList
;
}
else
if
(
EQUIP_PROTECTIONDEVICES_FORM_ID
.
equals
(
subFormType
)
&&
!
ValidationUtil
.
isEmpty
(
list
))
{
}
else
if
(
EQUIP_PROTECTIONDEVICES_FORM_ID
.
equals
(
subFormType
)
&&
!
ValidationUtil
.
isEmpty
(
list
))
{
for
(
Object
s
:
list
)
{
List
subFormProtectionDevicesList
=
(
ArrayList
)
map
.
get
(
s
);
if
(!
ObjectUtils
.
isEmpty
(
subFormProtectionDevicesList
))
{
...
...
@@ -1788,37 +1816,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return
null
;
}
/**
* 将对象的属性由驼峰转为纯大写下划线格式
*
* @param object
* @return
* @throws IllegalAccessException
*/
public
static
Map
<
String
,
Object
>
convertCamelToUnderscore
(
Object
object
,
String
[]
strToJsonArrayFields
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Class
<?>
clazz
=
object
.
getClass
();
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
String
underscoreFieldName
=
StringUtils
.
camelToUnderline
(
fieldName
).
toUpperCase
();
Object
value
;
try
{
value
=
field
.
get
(
object
);
//需要转为jsonArray的字段
if
(!
ValidationUtil
.
isEmpty
(
strToJsonArrayFields
)
&&
Arrays
.
asList
(
strToJsonArrayFields
).
contains
(
underscoreFieldName
))
{
value
=
JSON
.
parseArray
((
String
)
field
.
get
(
object
));
}
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(!
ValidationUtil
.
isEmpty
(
value
))
{
result
.
put
(
underscoreFieldName
.
toUpperCase
(),
value
);
}
}
return
result
;
}
@Override
public
Page
<
JSONObject
>
queryForUnitEquipmentPage
(
JSONObject
jsonObject
)
{
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
...
...
@@ -1834,27 +1831,38 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
@Override
public
String
importByExcel
(
List
<
EquipInfoCylinderExcelDto
>
excelDtoList
,
String
equDefineCode
)
{
if
(
EquipmentClassifityEnum
.
YLRQ
.
getCode
().
equals
(
equDefineCode
)){
excelDtoList
.
forEach
(
item
->
{
EquipInfoCylinderExcelDto
equipInfoCylinderExcelDto
=
new
EquipInfoCylinderExcelDto
();
equipInfoCylinderExcelDto
=
Bean
.
toPo
(
item
,
equipInfoCylinderExcelDto
);
});
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
.
getMessage
();
}
return
"ok"
;
}
@Override
public
Object
importYh
(
MultipartFile
file
,
String
equDefineCode
)
{
YhListener
yhListener
=
new
YhListener
();
try
{
EasyExcel
.
read
(
file
.
getInputStream
(),
EquipInfoCylinderExcelDto
.
class
,
yhListener
).
headRowNumber
(
4
).
sheet
().
doRead
();
return
R
.
ok
(
yhListener
.
getFailedRows
());
}
catch
(
IOException
e
)
{
log
.
error
(
e
.
getMessage
());
return
R
.
failed
(
"导入失败"
);
}
// 注入依赖
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 @
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