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
4ef9a44c
Commit
4ef9a44c
authored
Apr 18, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(JG):气瓶导入功能开发
parent
073d9697
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
553 additions
and
5 deletions
+553
-5
ExcelDictConvert.java
...n/amos/boot/module/jg/api/converter/ExcelDictConvert.java
+30
-0
GenderConverter.java
...in/amos/boot/module/jg/api/converter/GenderConverter.java
+54
-0
EquipInfoCylinderExcelDto.java
...mos/boot/module/jg/api/dto/EquipInfoCylinderExcelDto.java
+249
-0
YhListener.java
...om/yeejoin/amos/boot/module/jg/biz/config/YhListener.java
+159
-0
IdxBizJqEquipmentRegisterController.java
...g/biz/controller/IdxBizJqEquipmentRegisterController.java
+23
-0
IIdxBizJgRegisterInfoService.java
...t/module/jg/biz/service/IIdxBizJgRegisterInfoService.java
+6
-2
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+31
-2
application.properties
...t-module-jg-biz/src/main/resources/application.properties
+1
-1
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/ExcelDictConvert.java
0 → 100644
View file @
4ef9a44c
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
ExcelDictConvert
implements
Converter
<
Object
>
{
@Override
public
Class
supportJavaTypeKey
()
{
return
null
;
}
@Override
public
CellDataTypeEnum
supportExcelTypeKey
()
{
return
null
;
}
@Override
public
Object
convertToJavaData
(
CellData
cellData
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
throws
Exception
{
return
null
;
}
@Override
public
CellData
convertToExcelData
(
Object
o
,
ExcelContentProperty
excelContentProperty
,
GlobalConfiguration
globalConfiguration
)
throws
Exception
{
return
null
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/GenderConverter.java
0 → 100644
View file @
4ef9a44c
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
GenderConverter
implements
Converter
<
String
>
{
private
static
final
String
MAN
=
"是"
;
private
static
final
String
WOMAN
=
"否"
;
@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
gender
=
cellData
.
getStringValue
();
// 判断Excel中的值,将其转换为预期的数值
if
(
MAN
.
equals
(
gender
))
{
return
"0"
;
}
else
if
(
WOMAN
.
equals
(
gender
))
{
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
(
MAN
);
}
else
if
(
o
.
equals
(
"1"
))
{
return
new
CellData
(
WOMAN
);
}
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 @
4ef9a44c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
dto
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.module.jg.api.converter.GenderConverter
;
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
=
GenderConverter
.
class
)
@NotBlank
(
message
=
"是否车用气瓶不能为空"
)
private
String
whetherVehicleCylinder
;
//转换
@ApiModelProperty
(
value
=
"有无设备代码"
)
@ExcelProperty
(
value
=
"有无设备代码"
,
index
=
5
,
converter
=
GenderConverter
.
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
)
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
)
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
=
"制造日期不能为空"
)
private
String
produceDate
;
@ApiModelProperty
(
value
=
"是否进口"
)
@ExcelProperty
(
value
=
"是否进口"
,
index
=
21
)
private
String
imported
;
@ApiModelProperty
(
value
=
"制造国"
)
@ExcelProperty
(
value
=
"制造国"
,
index
=
22
)
private
String
produceCountry
;
//技术参数
@ExcelProperty
(
value
=
"额定质量(kg)"
,
index
=
23
)
@ApiModelProperty
(
value
=
"额定质量(kg)"
)
private
String
ratedQuality
;
@ExcelProperty
(
value
=
"使用环境温度(℃)"
,
index
=
24
)
@ApiModelProperty
(
value
=
"使用环境温度(℃)"
)
private
String
ambientTemperature
;
@ExcelProperty
(
value
=
"单瓶容积(m3)"
,
index
=
25
)
@ApiModelProperty
(
value
=
"单瓶容积(m3)"
)
private
String
singleBottleVolume
;
@ExcelProperty
(
value
=
"总容积(m3)"
,
index
=
26
)
@ApiModelProperty
(
value
=
"总容积(m3)"
)
private
String
totalVolume
;
@ExcelProperty
(
value
=
"型号"
,
index
=
27
)
@ApiModelProperty
(
value
=
"型号"
)
private
String
modelNumber
;
@ExcelProperty
(
value
=
"数量"
,
index
=
28
)
@ApiModelProperty
(
value
=
"数量"
)
private
String
num
;
@ExcelProperty
(
value
=
"充装介质"
,
index
=
29
)
@ApiModelProperty
(
value
=
"充装介质"
)
private
String
chargingMedium
;
@ExcelProperty
(
value
=
"规格"
,
index
=
30
)
@ApiModelProperty
(
value
=
"规格"
)
private
String
specification
;
@ExcelProperty
(
value
=
"外径"
,
index
=
31
)
@ApiModelProperty
(
value
=
"外径"
)
private
String
outsideDiameter
;
@ExcelProperty
(
value
=
"壁厚"
,
index
=
32
)
@ApiModelProperty
(
value
=
"壁厚"
)
private
String
wallThickness
;
@ExcelProperty
(
value
=
"长度"
,
index
=
33
)
@ApiModelProperty
(
value
=
"长度"
)
private
String
length
;
@ExcelProperty
(
value
=
"公称工作压力(MPa)"
,
index
=
34
)
@ApiModelProperty
(
value
=
"公称工作压力(MPa)"
)
private
String
nominalWorkingPressure
;
@ExcelProperty
(
value
=
"材料(管路)"
,
index
=
35
)
@ApiModelProperty
(
value
=
"材料(管路)"
)
private
String
piping
;
@ExcelProperty
(
value
=
"无损检测方法(气瓶)"
,
index
=
36
)
@ApiModelProperty
(
value
=
"无损检测方法(气瓶)"
)
private
String
qpLossless
;
//5988
@ExcelProperty
(
value
=
"材料(瓶体)"
,
index
=
37
)
@ApiModelProperty
(
value
=
"材料(瓶体)"
)
private
String
bottleBody
;
@ExcelProperty
(
value
=
"材料(端塞)"
,
index
=
38
)
@ApiModelProperty
(
value
=
"材料(端塞)"
)
private
String
endPlug
;
@ExcelProperty
(
value
=
"无损检测比例(管路)(%)"
,
index
=
39
)
@ApiModelProperty
(
value
=
"无损检测比例(管路)(%)"
)
private
String
glRatio
;
@ExcelProperty
(
value
=
"无损检测比例(气瓶)(%)"
,
index
=
40
)
@ApiModelProperty
(
value
=
"无损检测比例(气瓶)(%)"
)
private
String
qpRatio
;
@ExcelProperty
(
value
=
"无损检测方法(管路)"
,
index
=
41
)
@ApiModelProperty
(
value
=
"无损检测方法(管路)"
)
private
String
glLossless
;
@ExcelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
,
index
=
42
)
@ApiModelProperty
(
value
=
"耐压实验压力(气瓶)(Mpa)"
)
private
String
qpPressure
;
@ExcelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
,
index
=
43
)
@ApiModelProperty
(
value
=
"耐压实验压力(管路)(Mpa)"
)
private
String
glPressure
;
@ExcelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
,
index
=
44
)
@ApiModelProperty
(
value
=
"气密性试验压力(气瓶)(Mpa)"
)
private
String
qpAirTightness
;
@ExcelProperty
(
value
=
"气体置换后压力(MPa)"
,
index
=
45
)
@ApiModelProperty
(
value
=
"气体置换后压力(MPa)"
)
private
String
displacementPressure
;
@ExcelProperty
(
value
=
"热处理方式"
,
index
=
46
)
@ApiModelProperty
(
value
=
"热处理方式"
)
private
String
heatTreatmentMethod
;
@ExcelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
,
index
=
47
)
@ApiModelProperty
(
value
=
"气密性实验压力(管路)(MPa)"
)
private
String
glAirTightness
;
@ExcelProperty
(
value
=
"气瓶安装位置"
,
index
=
48
)
@ApiModelProperty
(
value
=
"气瓶安装位置"
)
private
String
installationPosition
;
@ExcelProperty
(
value
=
"瓶体内含氧量(%)"
,
index
=
49
)
@ApiModelProperty
(
value
=
"瓶体内含氧量(%)"
)
private
String
oxygen
;
@ExcelProperty
(
value
=
"热处理温度(℃)"
,
index
=
50
)
@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/YhListener.java
0 → 100644
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 @
4ef9a44c
...
@@ -3,12 +3,16 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
...
@@ -3,12 +3,16 @@ package com.yeejoin.amos.boot.module.jg.biz.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
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.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.tomcat.util.http.ResponseUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
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.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
...
@@ -127,4 +131,23 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
...
@@ -127,4 +131,23 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
JSONObject
jsonObject
=
new
JSONObject
(
queryMap
);
JSONObject
jsonObject
=
new
JSONObject
(
queryMap
);
return
ResponseHelper
.
buildResponse
(
idxBizJgRegisterInfoService
.
queryForUnitEquipmentPage
(
jsonObject
));
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
(
"/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
));
}
}
}
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 @
4ef9a44c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -33,4 +33,8 @@ public interface IIdxBizJgRegisterInfoService {
...
@@ -33,4 +33,8 @@ public interface IIdxBizJgRegisterInfoService {
List
<
DictionarieValueModel
>
equCategoryListByCompanyType
(
ReginParams
selectedOrgInfo
,
String
equList
);
List
<
DictionarieValueModel
>
equCategoryListByCompanyType
(
ReginParams
selectedOrgInfo
,
String
equList
);
Page
<
JSONObject
>
queryForUnitEquipmentPage
(
JSONObject
jsonObject
);
Page
<
JSONObject
>
queryForUnitEquipmentPage
(
JSONObject
jsonObject
);
String
importByExcel
(
List
<
EquipInfoCylinderExcelDto
>
excelDtoList
,
String
equDefineCode
);
Object
importYh
(
MultipartFile
file
,
String
equDefineCode
);
}
}
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 @
4ef9a44c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
@@ -12,9 +14,11 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
...
@@ -12,9 +14,11 @@ 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.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
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.CompanyTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.ConstructionEnum
;
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.api.mapper.JgUseRegistrationMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.config.YhListener
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
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.*
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
...
@@ -46,6 +50,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -46,6 +50,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
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.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
@@ -53,13 +58,11 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
...
@@ -53,13 +58,11 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
...
@@ -1829,4 +1832,29 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
...
@@ -1829,4 +1832,29 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
}
return
page
;
return
page
;
}
}
@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
);
});
}
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
(
"导入失败"
);
}
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/application.properties
View file @
4ef9a44c
spring.application.name
=
TZS-JG
spring.application.name
=
TZS-JG
-LL
server.servlet.context-path
=
/jg
server.servlet.context-path
=
/jg
server.port
=
11007
server.port
=
11007
spring.profiles.active
=
dev
spring.profiles.active
=
dev
...
...
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