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
046d6d48
Commit
046d6d48
authored
Jun 20, 2025
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):导入功能修改
parent
a5aded56
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
320 additions
and
31 deletions
+320
-31
DictParamsConverter.java
...mos/boot/module/jg/api/converter/DictParamsConverter.java
+2
-0
EquCategoryConverter.java
...os/boot/module/jg/api/converter/EquCategoryConverter.java
+2
-1
EquDefineConverter.java
...amos/boot/module/jg/api/converter/EquDefineConverter.java
+2
-1
EquListConverter.java
...n/amos/boot/module/jg/api/converter/EquListConverter.java
+2
-1
EquipInfoExcelDto.java
...eejoin/amos/boot/module/jg/api/dto/EquipInfoExcelDto.java
+78
-0
DataDockController.java
...mos/boot/module/jg/biz/controller/DataDockController.java
+80
-0
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+1
-1
DataDockServiceImpl.java
.../boot/module/jg/biz/service/impl/DataDockServiceImpl.java
+152
-26
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+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/DictParamsConverter.java
View file @
046d6d48
...
...
@@ -12,6 +12,7 @@ import java.util.Map;
public
class
DictParamsConverter
implements
Converter
<
String
>
{
public
static
final
Map
<
String
,
String
>
dictMap
=
new
HashMap
<>();
public
static
final
Map
<
String
,
String
>
reverseEquipmentMap
=
new
HashMap
<>();
static
{
// 填充映射关系
...
...
@@ -77,6 +78,7 @@ public class DictParamsConverter implements Converter<String> {
dictMap
.
put
(
"其他控制方式"
,
"4"
);
dictMap
.
put
(
"直接顶升"
,
"1"
);
dictMap
.
put
(
"间接顶升"
,
"2"
);
dictMap
.
forEach
((
key
,
value
)
->
reverseEquipmentMap
.
put
(
value
,
key
));
}
@Override
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/EquCategoryConverter.java
View file @
046d6d48
...
...
@@ -12,7 +12,7 @@ import java.util.Map;
public
class
EquCategoryConverter
implements
Converter
<
String
>
{
public
static
final
Map
<
String
,
String
>
equipmentMap
=
new
HashMap
<>();
public
static
final
Map
<
String
,
String
>
reverseEquipmentMap
=
new
HashMap
<>();
static
{
// 填充映射关系
equipmentMap
.
put
(
"承压蒸汽锅炉"
,
"1100"
);
...
...
@@ -56,6 +56,7 @@ public class EquCategoryConverter implements Converter<String> {
equipmentMap
.
put
(
"长输管道"
,
"8100"
);
equipmentMap
.
put
(
"公用管道"
,
"8200"
);
equipmentMap
.
put
(
"工业管道"
,
"8300"
);
equipmentMap
.
forEach
((
key
,
value
)
->
reverseEquipmentMap
.
put
(
value
,
key
));
}
@Override
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/EquDefineConverter.java
View file @
046d6d48
...
...
@@ -12,7 +12,7 @@ import java.util.Map;
public
class
EquDefineConverter
implements
Converter
<
String
>
{
private
static
final
Map
<
String
,
String
>
equipmentMap
=
new
HashMap
<>();
public
static
final
Map
<
String
,
String
>
reverseEquipmentMap
=
new
HashMap
<>();
static
{
// 填充映射关系
equipmentMap
.
put
(
"有机热载体气相炉"
,
"1310"
);
...
...
@@ -87,6 +87,7 @@ public class EquDefineConverter implements Converter<String> {
equipmentMap
.
put
(
"工艺管道"
,
"8310"
);
equipmentMap
.
put
(
"动力管道"
,
"8320"
);
equipmentMap
.
put
(
"制冷管道"
,
"8330"
);
equipmentMap
.
forEach
((
key
,
value
)
->
reverseEquipmentMap
.
put
(
value
,
key
));
}
@Override
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/converter/EquListConverter.java
View file @
046d6d48
...
...
@@ -12,7 +12,7 @@ import java.util.Map;
public
class
EquListConverter
implements
Converter
<
String
>
{
public
static
final
Map
<
String
,
String
>
equipmentMap
=
new
HashMap
<>();
public
static
final
Map
<
String
,
String
>
reverseEquipmentMap
=
new
HashMap
<>();
static
{
// 填充映射关系
equipmentMap
.
put
(
"起重机械"
,
"4000"
);
...
...
@@ -23,6 +23,7 @@ public class EquListConverter implements Converter<String> {
equipmentMap
.
put
(
"大型游乐设施"
,
"6000"
);
equipmentMap
.
put
(
"客运索道"
,
"9000"
);
equipmentMap
.
put
(
"电梯"
,
"3000"
);
equipmentMap
.
forEach
((
key
,
value
)
->
reverseEquipmentMap
.
put
(
value
,
key
));
}
@Override
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/EquipInfoExcelDto.java
View file @
046d6d48
...
...
@@ -11,6 +11,7 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
javax.validation.constraints.NotBlank
;
import
java.util.List
;
@Data
...
...
@@ -45,6 +46,27 @@ public class EquipInfoExcelDto extends BaseDto {
@ExcelProperty
(
value
=
"设备品种"
,
converter
=
EquDefineConverter
.
class
)
private
String
equDefine
;
/**
* 保留导入的"设备种类"原始名称(未转换前的值)
*/
@ApiModelProperty
(
value
=
"设备种类名称(原始)"
)
@ExcelIgnore
private
String
equListName
;
/**
* 保留导入的"设备类别"原始名称(未转换前的值)
*/
@ApiModelProperty
(
value
=
"设备类别名称(原始)"
)
@ExcelIgnore
private
String
equCategoryName
;
/**
* 保留导入的"设备品种"原始名称(未转换前的值)
*/
@ApiModelProperty
(
value
=
"设备品种名称(原始)"
)
@ExcelIgnore
private
String
equDefineName
;
@ApiModelProperty
(
value
=
"单位内编号"
)
@ExcelProperty
(
value
=
"单位内编号"
)
@NotBlank
(
message
=
"单位内编号不能为空"
)
...
...
@@ -201,6 +223,46 @@ public class EquipInfoExcelDto extends BaseDto {
@ExcelProperty
(
value
=
"制造国"
)
private
String
produceCountry
;
//--------------------------------------------------------------------检验信息
@ApiModelProperty
(
value
=
"检验机构名称"
)
@ExcelProperty
(
value
=
"检验机构名称"
)
private
String
inspectOrgName
;
@ApiModelProperty
(
value
=
"检验机构统一信用代码"
)
@ExcelProperty
(
value
=
"检验机构统一信用代码"
)
private
String
inspectOrgCode
;
@ApiModelProperty
(
value
=
"检验类型"
)
@ExcelProperty
(
value
=
"检验类型"
)
private
String
inspectType
;
@ApiModelProperty
(
value
=
"检验结论"
)
@ExcelProperty
(
value
=
"检验结论"
)
private
String
inspectConclusion
;
@ApiModelProperty
(
value
=
"检验日期"
)
@ExcelProperty
(
value
=
"检验日期"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
inspectDate
;
@ApiModelProperty
(
value
=
"下次检验日期"
)
@ExcelProperty
(
value
=
"下次检验日期"
)
@DateTimeFormat
(
"yyyy-MM-dd"
)
private
String
nextInspectDate
;
@ApiModelProperty
(
value
=
"检验人员名称"
)
@ExcelProperty
(
value
=
"检验人员名称"
)
private
String
inspectStaff
;
@ApiModelProperty
(
value
=
"检验人员身份证号"
)
@ExcelProperty
(
value
=
"检验人员身份证号"
)
private
String
inspectStaffIDNumber
;
@ApiModelProperty
(
value
=
"检验报告编号"
)
@ExcelProperty
(
value
=
"检验报告编号"
)
private
String
inspectReportNo
;
//--------------------------------------------------------起重机械----技术参数
@ExcelProperty
(
value
=
"额定起重量(t)"
)
@ApiModelProperty
(
value
=
"额定起重量(t)"
)
...
...
@@ -1047,4 +1109,19 @@ public class EquipInfoExcelDto extends BaseDto {
@ExcelProperty
(
value
=
"控制方式"
,
converter
=
DictParamsConverter
.
class
)
@ApiModelProperty
(
value
=
"控制方式"
)
private
String
CONTROL_MODE
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"附件信息"
)
private
List
fileData
;
@ExcelIgnore
@ApiModelProperty
(
value
=
"设备来源"
)
private
String
DataSourceDesc
;
/**
* "管道级别"
*/
@ApiModelProperty
(
value
=
"管道级别"
)
@ExcelIgnore
private
String
deviceLevel_GD
;
}
\ 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/DataDockController.java
View file @
046d6d48
...
...
@@ -60,6 +60,86 @@ public class DataDockController {
}
/**
* 历史-台套类设备导入字段校验
* @param file 导入文件
* @return 导入数据
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/checkHisSetEquipImportData"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"历史-台套类设备导入字段校验"
,
notes
=
"历史-台套类设备导入字段校验"
)
public
Object
checkSetEquipImportData
(
@RequestParam
MultipartFile
file
)
{
// 校验文件是否为空
if
(
file
.
isEmpty
())
{
return
ResponseHelper
.
buildResponse
(
"文件不能为空"
);
}
// 校验文件类型为 Excel
String
contentType
=
file
.
getContentType
();
String
fileExtension
=
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
());
// 校验 Excel 文件的 MIME type 和扩展名
if
(!(
"application/vnd.ms-excel"
.
equals
(
contentType
)
||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
.
equals
(
contentType
))
||
!(
"xls"
.
equalsIgnoreCase
(
fileExtension
)
||
"xlsx"
.
equalsIgnoreCase
(
fileExtension
)))
{
return
ResponseHelper
.
buildResponse
(
"文件类型必须是 Excel 文件"
);
}
return
ResponseHelper
.
buildResponse
(
dataDockService
.
checkSetEquipImportData
(
"his"
,
file
));
}
/**
* 新设备台套类设备导入字段校验
* @param file 导入文件
* @return 导入数据
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/checkNewSetEquipImportData"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新设备台套类设备导入字段校验"
,
notes
=
"新设备台套类设备导入字段校验"
)
public
Object
checkNewSetEquipImportData
(
@RequestParam
MultipartFile
file
)
{
// 校验文件是否为空
if
(
file
.
isEmpty
())
{
return
ResponseHelper
.
buildResponse
(
"文件不能为空"
);
}
// 校验文件类型为 Excel
String
contentType
=
file
.
getContentType
();
String
fileExtension
=
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
());
// 校验 Excel 文件的 MIME type 和扩展名
if
(!(
"application/vnd.ms-excel"
.
equals
(
contentType
)
||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
.
equals
(
contentType
))
||
!(
"xls"
.
equalsIgnoreCase
(
fileExtension
)
||
"xlsx"
.
equalsIgnoreCase
(
fileExtension
)))
{
return
ResponseHelper
.
buildResponse
(
"文件类型必须是 Excel 文件"
);
}
return
ResponseHelper
.
buildResponse
(
dataDockService
.
checkSetEquipImportData
(
"new"
,
file
));
}
/**
* 新设备台套类设备导入字段校验
* @param file 导入文件
* @return 导入数据
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/checkBlackSetEquipImportData"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新设备台套类设备导入字段校验"
,
notes
=
"新设备台套类设备导入字段校验"
)
public
Object
checkBlackSetEquipImportData
(
@RequestParam
MultipartFile
file
)
{
// 校验文件是否为空
if
(
file
.
isEmpty
())
{
return
ResponseHelper
.
buildResponse
(
"文件不能为空"
);
}
// 校验文件类型为 Excel
String
contentType
=
file
.
getContentType
();
String
fileExtension
=
FilenameUtils
.
getExtension
(
file
.
getOriginalFilename
());
// 校验 Excel 文件的 MIME type 和扩展名
if
(!(
"application/vnd.ms-excel"
.
equals
(
contentType
)
||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
.
equals
(
contentType
))
||
!(
"xls"
.
equalsIgnoreCase
(
fileExtension
)
||
"xlsx"
.
equalsIgnoreCase
(
fileExtension
)))
{
return
ResponseHelper
.
buildResponse
(
"文件类型必须是 Excel 文件"
);
}
return
ResponseHelper
.
buildResponse
(
dataDockService
.
checkSetEquipImportData
(
"black"
,
file
));
}
/**
* 气瓶批量保存
**/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/saveSetEquipImportData"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"台套类设备导入字段保存"
,
notes
=
"台套类设备导入字段保存"
)
@RestEventTrigger
(
value
=
"operateLogRestEventHandler"
)
public
ResponseModel
<?>
saveSetEquipImportData
(
@RequestBody
Map
<
String
,
Object
>
paramMap
)
{
return
ResponseHelper
.
buildResponse
(
dataDockService
.
saveSetEquipImportData
(
paramMap
));
}
/**
* 工业管道批量检查
**/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/CommonServiceImpl.java
View file @
046d6d48
...
...
@@ -740,7 +740,7 @@ public class CommonServiceImpl implements ICommonService {
Iterator
<
Map
<
String
,
Object
>>
iterator
=
resourceJson
.
get
(
businessType
).
iterator
();
while
(
iterator
.
hasNext
())
{
Map
<
String
,
Object
>
item
=
iterator
.
next
();
if
(
item
.
get
(
CODE
).
equals
(
PL_DR
)
||
item
.
get
(
CODE
).
equals
(
DW_LR
))
{
if
(
item
.
get
(
CODE
).
equals
(
DW_LR
))
{
iterator
.
remove
();
}
}
...
...
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/DataDockServiceImpl.java
View file @
046d6d48
...
...
@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.ExcelImportErrorLogDto;
import
com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter
;
import
com.yeejoin.amos.boot.module.jg.api.converter.EquCategoryConverter
;
import
com.yeejoin.amos.boot.module.jg.api.converter.EquDefineConverter
;
import
com.yeejoin.amos.boot.module.jg.api.converter.EquListConverter
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
...
...
@@ -79,8 +80,8 @@ import java.util.concurrent.CompletableFuture;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
IdxBizJgRegisterInfoServiceImpl
.
toCamelCase
;
@Slf4j
@Service
...
...
@@ -141,6 +142,15 @@ public class DataDockServiceImpl {
private
final
JgVehicleInformationMapper
jgVehicleInformationMapper
;
private
final
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
private
final
ExcelImportErrorLogDao
excelImportErrorLogDao
;
// 设备分类表单id
public
static
final
String
EQUIP_CLASS_FORM_ID
=
"equipClass"
;
// 设备基本信息表单id
public
static
final
String
EQUIP_INFO_FORM_ID
=
"equipInfo"
;
// 设备技术参数表单id
public
static
final
String
EQUIP_PARAMS_FORM_ID
=
"equipParams"
;
private
static
final
String
ATTACHMENT_UPLOAD
=
"attachmentUpload"
;
// 模版上传集合
public
static
final
String
EQU_LISTS
=
"equLists"
;
/**
* 西安数据对接-保存设备信息
...
...
@@ -169,6 +179,8 @@ public class DataDockServiceImpl {
public
void
saveEquipmentDataInTransaction
(
Map
<
String
,
Object
>
equ
,
String
dataSource
,
String
remark
)
{
String
record
=
UUID
.
randomUUID
().
toString
();
try
{
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
CompanyBo
company
=
reginParams
.
getCompany
();
// transactionTemplate.execute(status -> {
String
equList
=
String
.
valueOf
(
equ
.
get
(
"equList"
));
String
isCompleteXa
=
String
.
valueOf
(
equ
.
get
(
"isCompleteXa"
));
...
...
@@ -181,6 +193,10 @@ public class DataDockServiceImpl {
saveRegisterInfo
(
equ
,
record
,
equList
);
saveSupervisionInfo
(
equ
,
record
);
saveOtherInfo
(
equ
,
record
,
equList
);
saveInspectInfo
(
equ
,
record
);
if
(
"安装改造维修单位"
.
equals
(
company
.
getCompanyType
())){
saveConstructionInfo
(
equ
,
record
,
company
);
}
// 保存技术参数
saveTechParams
(
equ
,
record
,
equList
);
// 保存到ES
...
...
@@ -196,6 +212,24 @@ public class DataDockServiceImpl {
}
}
/**
* 保存施工信息表
*
* @param equ
* @param record
*/
private
void
saveConstructionInfo
(
Map
<
String
,
Object
>
equ
,
String
record
,
CompanyBo
company
)
{
log
.
error
(
"数据===>{}"
,
JSONObject
.
toJSONString
(
equ
));
IdxBizJgConstructionInfo
constructionInfo
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
equ
),
IdxBizJgConstructionInfo
.
class
);
if
(!
ValidationUtil
.
isEmpty
(
constructionInfo
))
{
constructionInfo
.
setRecord
(
record
);
constructionInfo
.
setRecDate
(
new
Date
());
constructionInfo
.
setUscUnitCreditCode
(
company
.
getCompanyCode
());
constructionInfo
.
setUscUnitName
(
company
.
getCompanyName
());
idxBizJgConstructionInfoService
.
save
(
constructionInfo
);
}
}
public
Integer
writeOrgBranchCode2YanChang
(
String
remark
)
{
List
<
String
>
records
=
idxBizJgUseInfoService
.
lambdaQuery
().
select
(
IdxBizJgUseInfo:
:
getRecord
).
eq
(
IdxBizJgUseInfo:
:
getRemark
,
remark
).
list
().
stream
().
map
(
IdxBizJgUseInfo:
:
getRecord
).
collect
(
Collectors
.
toList
());
...
...
@@ -322,8 +356,6 @@ public class DataDockServiceImpl {
useInfo
.
setDataSource
(
dataSource
);
useInfo
.
setIsNotEs
(
"1"
);
useInfo
.
setIsIntoManagement
(
Boolean
.
FALSE
);
useInfo
.
setUseUnitCreditCode
(
Objects
.
toString
(
equ
.
get
(
"useUnitCode"
),
""
).
trim
());
useInfo
.
setUseUnitName
(
Objects
.
toString
(
equ
.
get
(
"useUnit"
),
""
).
trim
());
useInfo
.
setRemark
(
remark
);
//useInfo.setEquState(EquimentEnum.ZAIYONG.getCode()+"");
useInfo
.
setProjectContraptionId
(
Objects
.
toString
(
equ
.
get
(
"projectContraptionId"
),
""
));
...
...
@@ -401,7 +433,10 @@ public class DataDockServiceImpl {
if
(
ObjectUtils
.
isEmpty
(
supervisionInfo
))
return
;
supervisionInfo
.
setRecord
(
record
);
supervisionInfo
.
setRecDate
(
new
Date
());
if
(!
ValidationUtil
.
isEmpty
(
equ
.
get
(
"orgBranchCode"
))){
supervisionInfo
.
setOrgBranchCode
(
String
.
valueOf
(
equ
.
get
(
"orgBranchCode"
)));
supervisionInfo
.
setOrgBranchName
(
String
.
valueOf
(
equ
.
get
(
"orgBranchName"
)));
}
else
{
// 获取符合条件的公司 Map
Map
<
String
,
Map
<
String
,
String
>>
countyMap
;
try
{
...
...
@@ -456,6 +491,7 @@ public class DataDockServiceImpl {
supervisionInfo
.
setOrgBranchName
(
"西安市市场监督管理局"
);
}
}
}
idxBizJgSupervisionInfoService
.
save
(
supervisionInfo
);
equ
.
put
(
"orgBranchCode"
,
supervisionInfo
.
getOrgBranchCode
()
+
"_"
+
supervisionInfo
.
getOrgBranchName
());
}
...
...
@@ -678,7 +714,7 @@ public class DataDockServiceImpl {
List
<
EquipInfoExcelDto
>
equipInfoExcelDtos
;
try
{
// 1, 数据读取 + 格式、类型异常检查
equipInfoExcelDtos
=
this
.
checkData
(
file
);
equipInfoExcelDtos
=
this
.
checkData
(
file
,
remark
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
String
.
format
(
"参数校验失败,详细请看返回信息:%s"
,
e
.
getMessage
()));
}
...
...
@@ -688,6 +724,17 @@ public class DataDockServiceImpl {
return
Boolean
.
TRUE
;
}
public
Object
checkSetEquipImportData
(
String
remark
,
MultipartFile
file
)
{
List
<
EquipInfoExcelDto
>
equipInfoExcelDtos
;
try
{
// 1, 数据读取 + 格式、类型异常检查
equipInfoExcelDtos
=
this
.
checkData
(
file
,
remark
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
String
.
format
(
"参数校验失败,详细请看返回信息:%s"
,
e
.
getMessage
()));
}
return
equipInfoExcelDtos
;
}
/**
* excel 文件读取,字段校验
*
...
...
@@ -695,7 +742,7 @@ public class DataDockServiceImpl {
* @return 设备数据
* @throws Exception 异常信息
*/
public
List
<
EquipInfoExcelDto
>
checkData
(
MultipartFile
file
)
{
public
List
<
EquipInfoExcelDto
>
checkData
(
MultipartFile
file
,
String
remark
)
{
List
<
EquipInfoExcelDto
>
dataList
=
new
ArrayList
<>();
resultError
.
clear
();
useInnerCodeList
.
clear
();
...
...
@@ -723,7 +770,7 @@ public class DataDockServiceImpl {
@Override
public
void
invoke
(
EquipInfoExcelDto
data
,
AnalysisContext
context
)
{
// 数据检查
checkExcelData
(
sheetName
,
data
,
context
,
sheetError
);
checkExcelData
(
sheetName
,
data
,
context
,
sheetError
,
remark
);
// if (!ValidationUtil.isEmpty(data.getUseInnerCode())) {
// useInnerCodeList.add(data.getUseInnerCode());
// }
...
...
@@ -768,7 +815,7 @@ public class DataDockServiceImpl {
* @param data excel数据
* @param context
*/
public
void
checkExcelData
(
String
sheetName
,
EquipInfoExcelDto
data
,
AnalysisContext
context
,
Map
<
String
,
Object
>
sheetError
)
{
public
void
checkExcelData
(
String
sheetName
,
EquipInfoExcelDto
data
,
AnalysisContext
context
,
Map
<
String
,
Object
>
sheetError
,
String
remark
)
{
ReadRowHolder
readRowHolder
=
context
.
readRowHolder
();
int
rowIndex
=
readRowHolder
.
getRowIndex
()
+
1
;
StringBuffer
rowError
=
new
StringBuffer
();
...
...
@@ -794,7 +841,7 @@ public class DataDockServiceImpl {
log
.
info
(
"解析第{}行数据:{}"
,
rowIndex
,
JSON
.
toJSONString
(
data
));
// 通用字段检查 每一个sheet页都有的基本信息,设计信息,制造信息和使用信息
this
.
commonFieldCheck
(
data
,
rowError
);
this
.
commonFieldCheck
(
data
,
rowError
,
remark
);
// 起重机械----技术参数 检查
if
(
isQZJX
)
{
...
...
@@ -846,8 +893,7 @@ public class DataDockServiceImpl {
* @param data 源数据
* @param rowError 错误集合
*/
private
void
commonFieldCheck
(
EquipInfoExcelDto
data
,
StringBuffer
rowError
)
{
private
void
commonFieldCheck
(
EquipInfoExcelDto
data
,
StringBuffer
rowError
,
String
remark
)
{
boolean
isYLRQ
=
!
ObjectUtils
.
isEmpty
(
data
.
getEquList
())
&&
EquipmentClassifityEnum
.
YLRQ
.
getCode
().
equals
(
data
.
getEquList
());
// 是否压力容器
boolean
isYLGD
=
!
ObjectUtils
.
isEmpty
(
data
.
getEquList
())
&&
EquipmentClassifityEnum
.
YLGD
.
getCode
().
equals
(
data
.
getEquList
());
// 是否压力管道
boolean
isDT
=
!
ObjectUtils
.
isEmpty
(
data
.
getEquList
())
&&
EquipmentClassifityEnum
.
DT
.
getCode
().
equals
(
data
.
getEquList
());
// 是否电梯
...
...
@@ -857,6 +903,10 @@ public class DataDockServiceImpl {
// 基本信息
checkNotBlank
(
data
.
getEquList
(),
"设备种类不能为空;"
,
rowError
);
checkNotBlank
(
data
.
getEquCategory
(),
"设备类别不能为空;"
,
rowError
);
data
.
setEquListName
(
EquListConverter
.
reverseEquipmentMap
.
get
(
data
.
getEquList
()));
data
.
setEquCategoryName
(
EquCategoryConverter
.
reverseEquipmentMap
.
get
(
data
.
getEquCategory
()));
data
.
setEquDefineName
(
Optional
.
ofNullable
(
data
.
getEquDefine
()).
map
(
EquDefineConverter
.
reverseEquipmentMap
::
get
).
orElse
(
""
));
data
.
setDeviceLevel_GD
(
Optional
.
ofNullable
(
data
.
getDeviceLevel_YLGD
()).
map
(
DictParamsConverter
.
reverseEquipmentMap
::
get
).
orElse
(
""
));
// checkNotBlank(data.getUseInnerCode(), "单位内编号不能为空;", rowError);
// if (useInnerCodeList.contains(data.getUseInnerCode())) {
// rowError.append("单位内编号不能重复;");
...
...
@@ -892,6 +942,7 @@ public class DataDockServiceImpl {
checkNotBlank
(
data
.
getPipeName
(),
"管道名称不能为空;"
,
rowError
);
checkNotBlank
(
data
.
getProjectContraption
(),
"工程(装置)名称不能为空;"
,
rowError
);
checkNotBlank
(
data
.
getProjectContraptionNo
(),
"工程(装置)编号不能为空;"
,
rowError
);
if
(
remark
.
equals
(
"his"
)){
// 使用登记证编号校验
List
<
IdxBizJgRegisterInfo
>
idxBizJgRegisterInfos
=
idxBizJgRegisterInfoServiceImpl
.
getBaseMapper
().
selectList
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
IdxBizJgRegisterInfo:
:
getUseOrgCode
,
data
.
getUseOrgCode
()).
notLike
(
IdxBizJgRegisterInfo:
:
getUseOrgCode
,
"管"
));
if
(!
idxBizJgRegisterInfos
.
isEmpty
())
{
...
...
@@ -901,6 +952,7 @@ public class DataDockServiceImpl {
if
(!
projectContraptions
.
isEmpty
())
{
rowError
.
append
(
"使用登记证编号已存在系统中;"
);
}
}
// 同一工程装置下管道编号不能重复
if
(!
ValidationUtil
.
isEmpty
(
data
.
getProjectContraption
()))
{
...
...
@@ -993,6 +1045,7 @@ public class DataDockServiceImpl {
data
.
setInformationManageCode
(
""
);
}
}
if
(
remark
.
equals
(
"his"
)){
checkNotBlank
(
data
.
getUseOrgCode
(),
"使用登记证编号不能为空;"
,
rowError
);
if
(!
StringUtils
.
isEmpty
(
data
.
getUseOrgCode
()))
{
if
(!
this
.
useOrgCodeRegularMatching
(
data
))
{
...
...
@@ -1010,6 +1063,7 @@ public class DataDockServiceImpl {
rowError
.
append
(
"使用登记证编号已存在系统中;"
);
}
}
}
// 使用信息
checkNotBlank
(
data
.
getUseUnitCode
(),
"使用单位统一社会信用代码不能为空;"
,
rowError
);
Optional
.
ofNullable
(
data
.
getUseUnitCode
()).
ifPresent
(
v
->
checkCreditCode
(
v
,
"使用单位统一社会信用代码格式不正确;"
,
rowError
));
...
...
@@ -1075,6 +1129,7 @@ public class DataDockServiceImpl {
data
.
setFactoryIsComplete
(
"1"
);
}
}
data
.
setDataSourceDesc
(
"his"
.
equals
(
remark
)
?
"历史设备"
:
"new"
.
equals
(
remark
)
?
"新设备"
:
"历史无证设备"
);
}
/**
...
...
@@ -1413,28 +1468,77 @@ public class DataDockServiceImpl {
private
void
DTTechnicalParamsCheck
(
EquipInfoExcelDto
data
,
StringBuffer
rowError
)
{
}
private
void
batchSaveHisEquipmentData
(
String
remark
,
List
<
EquipInfoExcelDto
>
equipInfoExcelDtos
,
LinkedHashMap
equipmentInfoForm
)
{
String
[]
keys
=
{
"PRODUCT_PHOTO"
,
"OTHER_ACCESSORIES_REG"
,
"DESIGN_DOC"
,
"DESIGN_STANDARD"
,
"OTHER_ACCESSORIES_DES"
,
"PRODUCT_QUALITY_YIELD_PROVE"
,
"FACTORY_STANDARD"
,
"INS_USE_MAINTAIN_EXPLAIN"
,
"OTHER_ACCESSORIES_FACT"
,
"BOILER_ENERGY_EFFICIENCY_CERTIFICATE"
,
"FACT_SUPERVISION_INSPECTION_REPORT"
,
"INSPECT_REPORT"
};
String
[]
parts
=
Optional
.
ofNullable
(
equipmentInfoForm
.
get
(
"orgBranchCode"
))
.
map
(
String:
:
valueOf
)
.
map
(
s
->
s
.
split
(
"_"
,
2
))
.
orElse
(
new
String
[
0
]);
String
orgBranchCode
=
parts
.
length
>
0
?
parts
[
0
]
:
""
;
String
orgBranchName
=
parts
.
length
>
1
?
parts
[
1
]
:
""
;
String
equList
=
String
.
valueOf
(
equipmentInfoForm
.
get
(
"EQU_LIST"
));
String
equCategory
=
String
.
valueOf
(
equipmentInfoForm
.
get
(
"EQU_CATEGORY"
));
String
dataSource
=
"new"
.
equals
(
equipmentInfoForm
.
get
(
"DATA_SOURCE"
))
?
"jg_pl"
:
"his"
.
equals
(
equipmentInfoForm
.
get
(
"DATA_SOURCE"
))
?
"jg_his_pl"
:
"jg_black_pl"
;
Arrays
.
stream
(
equipInfoExcelDtos
.
toArray
(
new
EquipInfoExcelDto
[
0
])).
forEach
(
equ
->
{
if
(!
equ
.
getEquList
().
equals
(
equList
)
||
!
equ
.
getEquCategory
().
equals
(
equCategory
)){
throw
new
BadRequest
(
"设备种类或设备类型与模板上传不一致,请核对后进行上传!"
);
}
List
<
Map
<
String
,
Object
>>
fileDataList
=
(
List
<
Map
<
String
,
Object
>>)
equ
.
getFileData
();
Map
<
String
,
Object
>
equMap
=
(
Map
<
String
,
Object
>)
JSON
.
parseObject
(
JSON
.
toJSONString
(
equ
),
Map
.
class
);
for
(
String
key
:
keys
)
{
String
camelKey
=
toCamelCase
(
key
.
toLowerCase
());
equMap
.
put
(
camelKey
,
getUrlByKey
(
fileDataList
,
key
));
equMap
.
put
(
"orgBranchName"
,
orgBranchName
);
equMap
.
put
(
"orgBranchCode"
,
orgBranchCode
);
}
this
.
saveEquipmentDataInTransaction
(
equMap
,
dataSource
,
remark
);
});
}
/**
* 批量异步保存设备数据
*
* @param equipInfoExcelDtos
*/
public
void
batchSaveEquipmentData
(
String
remark
,
List
<
EquipInfoExcelDto
>
equipInfoExcelDtos
)
{
String
[]
keys
=
{
"PRODUCT_PHOTO"
,
"OTHER_ACCESSORIES_REG"
,
"DESIGN_DOC"
,
"DESIGN_STANDARD"
,
"OTHER_ACCESSORIES_DES"
,
"PRODUCT_QUALITY_YIELD_PROVE"
,
"FACTORY_STANDARD"
,
"INS_USE_MAINTAIN_EXPLAIN"
,
"OTHER_ACCESSORIES_FACT"
,
"BOILER_ENERGY_EFFICIENCY_CERTIFICATE"
,
"FACT_SUPERVISION_INSPECTION_REPORT"
,
"INSPECT_REPORT"
};
Arrays
.
stream
(
equipInfoExcelDtos
.
toArray
(
new
EquipInfoExcelDto
[
0
])).
forEach
(
equ
->
{
List
<
Map
<
String
,
Object
>>
fileDataList
=
(
List
<
Map
<
String
,
Object
>>)
equ
.
getFileData
();
Map
<
String
,
Object
>
equMap
=
(
Map
<
String
,
Object
>)
JSON
.
parseObject
(
JSON
.
toJSONString
(
equ
),
Map
.
class
);
for
(
String
key
:
keys
)
{
String
camelKey
=
toCamelCase
(
key
.
toLowerCase
());
equMap
.
put
(
camelKey
,
getUrlByKey
(
fileDataList
,
key
));
}
this
.
saveEquipmentDataInTransaction
(
equMap
,
"jg_his"
,
remark
);
});
}
equipInfoExcelDtos
.
forEach
(
equ
->
this
.
saveEquipmentDataInTransaction
((
Map
<
String
,
Object
>)
JSON
.
parseObject
(
JSON
.
toJSONString
(
equ
),
Map
.
class
),
"jg_his"
,
remark
));
// int batchSize = 1000;
// int totalSize = equipInfoExcelDtos.size();
// for (int i = 0; i < totalSize; i += batchSize) {
// List<EquipInfoExcelDto> batch = equipInfoExcelDtos.subList(i, Math.min(totalSize, i + batchSize));
// try {
// CompletableFuture.allOf(batch.stream().map(equ -> CompletableFuture.runAsync(
// () -> this.saveEquipmentDataInTransaction((Map<String, Object>) JSON.parseObject(JSON.toJSONString(equ), Map.class), "jg_his", remark)
// )
// ).toArray(CompletableFuture[]::new)).join();
// } catch (Exception e) {
// log.error("数据上传,保存设备数据失败: {}", e.getMessage());
// throw new BadRequest("数据上传,保存设备数据失败!");
// }
// }
private
String
getUrlByKey
(
List
<
Map
<
String
,
Object
>>
dataList
,
String
key
)
{
if
(
dataList
==
null
||
dataList
.
isEmpty
())
{
return
null
;
}
for
(
Map
<
String
,
Object
>
item
:
dataList
)
{
if
(
key
.
equals
(
item
.
get
(
"key"
)))
{
return
JSON
.
toJSONString
(
item
.
get
(
"value"
));
}
}
return
null
;
}
/**
...
...
@@ -1553,6 +1657,28 @@ public class DataDockServiceImpl {
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Object
saveSetEquipImportData
(
Map
<
String
,
Object
>
paramMap
)
{
if
(
paramMap
==
null
)
{
throw
new
IllegalArgumentException
(
"参数Map不能为空"
);
}
LinkedHashMap
equipmentInfoForm
=
(
LinkedHashMap
)
checkAndCast
(
paramMap
.
get
(
EQUIP_INFO_FORM_ID
));
LinkedHashMap
attachmentUpload
=
(
LinkedHashMap
)
checkAndCast
(
paramMap
.
get
(
ATTACHMENT_UPLOAD
));
List
<
EquipInfoExcelDto
>
equipInfoExcelDtos
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
attachmentUpload
.
get
(
EQU_LISTS
)),
EquipInfoExcelDto
.
class
);
// 2, 保存设备数据
this
.
batchSaveHisEquipmentData
(
""
,
equipInfoExcelDtos
,
equipmentInfoForm
);
return
Boolean
.
TRUE
;
}
private
Object
checkAndCast
(
Object
obj
)
{
if
(
obj
instanceof
LinkedHashMap
)
{
return
obj
;
}
else
{
throw
new
ClassCastException
(
"对象类型不匹配"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Object
savePipingData
(
Map
<
String
,
Object
>
paramMap
)
{
// 获取数据
JSONObject
equipInfo
=
JSON
.
parseObject
(
toJSONString
(
paramMap
.
get
(
"equipInfo"
)),
JSONObject
.
class
);
...
...
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 @
046d6d48
...
...
@@ -1195,7 +1195,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if
(!
ObjectUtils
.
isEmpty
(
type
)
&&
"PL_DR"
.
equals
(
type
))
{
if
(
EquipmentClassifityEnum
.
YLRQ
.
getCode
().
equals
(
equList
))
{
return
this
.
baseMapper
.
queryAllEquCategoriesUnderTheEquList
(
equList
).
stream
()
.
filter
(
x
->
"23
00"
.
equals
(
x
.
getDictDataKey
()))
.
filter
(
x
->
!
"22
00"
.
equals
(
x
.
getDictDataKey
()))
.
collect
(
Collectors
.
toList
());
}
if
(
EquipmentClassifityEnum
.
YLGD
.
getCode
().
equals
(
equList
)
&&
"his"
.
equals
(
dataSource
))
{
...
...
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