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
ab26d009
Commit
ab26d009
authored
Apr 11, 2024
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监管新增设备部分代码优化
parent
3fd52a14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
29 deletions
+70
-29
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+64
-29
pom.xml
amos-boot-system-tzs/pom.xml
+6
-0
No files found.
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 @
ab26d009
...
...
@@ -15,7 +15,6 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
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.LocalBadRequest
;
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
;
...
...
@@ -46,6 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
...
...
@@ -93,6 +93,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
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"
;
@Autowired
RestHighLevelClient
restHighLevelClient
;
...
...
@@ -172,25 +178,29 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
* @param paramMap
* @return
*/
@Transactional
public
ResponseModel
equipmentRegisterSubmit
(
Map
<
String
,
Object
>
paramMap
)
{
if
(
paramMap
==
null
)
{
throw
new
IllegalArgumentException
(
"参数Map不能为空"
);
}
String
record
=
null
;
LinkedHashMap
equipmentClassForm
=
(
LinkedHashMap
)
paramMap
.
get
(
EQUIP_CLASS_FORM_ID
);
LinkedHashMap
equipmentInfoForm
=
(
LinkedHashMap
)
paramMap
.
get
(
EQUIP_INFO_FORM_ID
);
LinkedHashMap
equipmentParamsForm
=
(
LinkedHashMap
)
paramMap
.
get
(
EQUIP_PARAMS_FORM_ID
);
LinkedHashMap
equipmentClassForm
=
(
LinkedHashMap
)
checkAndCast
(
paramMap
.
get
(
EQUIP_CLASS_FORM_ID
));
LinkedHashMap
equipmentInfoForm
=
(
LinkedHashMap
)
checkAndCast
(
paramMap
.
get
(
EQUIP_INFO_FORM_ID
));
LinkedHashMap
equipmentParamsForm
=
(
LinkedHashMap
)
checkAndCast
(
paramMap
.
get
(
EQUIP_PARAMS_FORM_ID
));
// 设备代码 字段的唯一性校验
LambdaQueryWrapper
<
RegistrationInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
RegistrationInfo:
:
getEquCode
,
equipmentInfoForm
.
get
(
"EQU_CODE"
));
wrapper
.
ne
(!
ValidationUtil
.
isEmpty
(
equipmentInfoForm
.
get
(
"SEQUENCE_NBR"
)),
RegistrationInfo:
:
getSequenceNbr
,
equipmentInfoForm
.
get
(
"SEQUENCE_NBR"
));
Integer
count
=
tzsJgRegistrationInfoMapper
.
selectCount
(
wrapper
);
if
(
count
>
0
)
{
throw
new
LocalBadRequest
(
"设备代码已存在,请重新输入!"
);
try
{
checkEquCodeUniqueness
(
equipmentInfoForm
);
}
catch
(
Exception
e
)
{
return
handleError
(
e
,
null
);
}
// 使用登记按照单位办理除外,其余进行编辑校验
Object
manageType
=
equipmentInfoForm
.
get
(
"manageType"
);
boolean
isManageType
=
(!
ObjectUtils
.
isEmpty
(
manageType
)
&&
"unit"
.
equals
(
manageType
));
Object
manageType
=
equipmentInfoForm
.
get
(
MANAGE_TYPE
);
boolean
isManageType
=
(!
ObjectUtils
.
isEmpty
(
manageType
)
&&
MANAGE_TYPE_UNIT
.
equals
(
manageType
));
if
(!
isManageType
)
{
// 编辑校验
this
.
checkForEquipEdit
(
equipmentInfoForm
.
get
(
"RECORD"
));
this
.
checkForEquipEdit
(
equipmentInfoForm
.
get
(
RECORD
));
}
//操作类型
try
{
...
...
@@ -201,24 +211,49 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
checkEsData
(
record
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
//删除数据库数据和ES数据
if
(!
ObjectUtils
.
isEmpty
(
record
))
{
List
<
String
>
records
=
new
ArrayList
<>();
records
.
add
(
record
);
superviseInfoMapper
.
deleteDataAll
(
records
);
esEquipmentCategory
.
deleteById
(
record
);
}
ResponseModel
<
Object
>
response
=
new
ResponseModel
<>();
response
.
setDevMessage
(
e
.
getMessage
());
response
.
setResult
(
null
);
response
.
setMessage
(
"操作失败,请检查数据输入后重新提交"
);
response
.
setStatus
(
HttpStatus
.
BAD_REQUEST
.
value
());
return
response
;
log
.
error
(
"操作失败,数据异常: "
+
e
.
getMessage
(),
e
);
return
handleError
(
e
,
record
);
}
return
ResponseHelper
.
buildResponse
(
record
);
}
private
Object
checkAndCast
(
Object
obj
)
{
if
(
obj
instanceof
LinkedHashMap
)
{
return
obj
;
}
else
{
throw
new
ClassCastException
(
"对象类型不匹配"
);
}
}
private
void
checkEquCodeUniqueness
(
LinkedHashMap
equipmentInfoForm
)
{
// 根据设备代码检查唯一性
LambdaQueryWrapper
<
RegistrationInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
RegistrationInfo:
:
getEquCode
,
equipmentInfoForm
.
get
(
EQU_CODE
));
wrapper
.
ne
(!
ObjectUtils
.
isEmpty
(
equipmentInfoForm
.
get
(
SEQUENCE_NBR
)),
RegistrationInfo:
:
getSequenceNbr
,
equipmentInfoForm
.
get
(
SEQUENCE_NBR
));
Integer
count
=
tzsJgRegistrationInfoMapper
.
selectCount
(
wrapper
);
if
(
count
>
0
)
{
throw
new
RuntimeException
(
"设备代码已存在,请重新输入!"
);
}
}
private
ResponseModel
handleError
(
Exception
e
,
String
record
)
{
log
.
error
(
"处理异常: "
+
e
.
getMessage
(),
e
);
//删除数据库数据和ES数据
if
(!
ObjectUtils
.
isEmpty
(
record
))
{
List
<
String
>
records
=
new
ArrayList
<>();
records
.
add
(
record
);
superviseInfoMapper
.
deleteDataAll
(
records
);
esEquipmentCategory
.
deleteById
(
record
);
}
ResponseModel
<
Object
>
response
=
new
ResponseModel
<>();
response
.
setDevMessage
(
e
.
getMessage
());
response
.
setResult
(
null
);
response
.
setMessage
(
"操作失败,请检查数据输入后重新提交"
);
response
.
setStatus
(
HttpStatus
.
BAD_REQUEST
.
value
());
return
response
;
}
private
void
checkForEquipEdit
(
Object
record
)
{
// 标识编辑
if
(
record
!=
null
){
...
...
@@ -1394,8 +1429,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String
record
=
null
;
//操作类型
String
operateType
=
ValidationUtil
.
isEmpty
(
equipmentInfoForm
.
get
(
"SEQUENCE_NBR"
))
?
OPERATESAVE
:
OPERATEEDIT
;
record
=
OPERATESAVE
.
equals
(
operateType
)
?
UUID
.
randomUUID
().
toString
()
:
equipmentInfoForm
.
get
(
"RECORD"
).
toString
();
String
operateType
=
ValidationUtil
.
isEmpty
(
equipmentInfoForm
.
get
(
SEQUENCE_NBR
))
?
OPERATESAVE
:
OPERATEEDIT
;
record
=
OPERATESAVE
.
equals
(
operateType
)
?
UUID
.
randomUUID
().
toString
()
:
equipmentInfoForm
.
get
(
RECORD
).
toString
();
// 单位类型
Map
<
String
,
Object
>
companyType
=
jgInstallationNoticeService
.
getCompanyType
();
...
...
amos-boot-system-tzs/pom.xml
View file @
ab26d009
...
...
@@ -83,6 +83,12 @@
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-feign-systemctl
</artifactId>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-common-api
</artifactId>
<version>
1.0.1
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<dependencyManagement>
...
...
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