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
bfa56274
Commit
bfa56274
authored
Jan 17, 2024
by
刘凡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化:公共更新es方法
parent
c73e9e77
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
29 deletions
+41
-29
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+41
-29
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
bfa56274
...
...
@@ -98,6 +98,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.Assert
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.DateUtil
;
...
...
@@ -106,6 +107,7 @@ 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.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
...
...
@@ -126,6 +128,7 @@ import java.util.concurrent.ExecutorService;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
/**
...
...
@@ -396,7 +399,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if
(
"QTBF"
.
equals
(
type
))
{
type
=
"superviseBusiness"
;
}
mapList
=
resourceJson
.
get
(
type
)
==
null
?
resourceJson
.
get
(
EquipmentClassifityEnum
.
BDLS
.
getCode
()):
resourceJson
.
get
(
type
)
;
mapList
=
resourceJson
.
get
(
type
)
==
null
?
resourceJson
.
get
(
EquipmentClassifityEnum
.
BDLS
.
getCode
())
:
resourceJson
.
get
(
type
)
;
}
for
(
Map
map
:
mapList
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
...
...
@@ -491,7 +494,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
*/
@Override
public
Map
<
String
,
String
>
createSupervisorCode
(
Map
<
String
,
Object
>
map
)
{
String
city
,
county
,
equipCategory
,
isNotXiXian
;
String
city
,
county
,
equipCategory
,
isNotXiXian
;
//获取对应行政区划
city
=
String
.
valueOf
(
map
.
get
(
"cityCode"
));
county
=
String
.
valueOf
(
map
.
get
(
"countyCode"
));
...
...
@@ -713,7 +716,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* 具体生成监管码和电梯96333识别码逻辑
*/
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
Map
<
String
,
String
>
creatCode
(
String
isNotXiXian
,
String
city
,
String
county
,
String
equipCategory
,
String
code96333
,
String
supervisionCode
)
{
public
Map
<
String
,
String
>
creatCode
(
String
isNotXiXian
,
String
city
,
String
county
,
String
equipCategory
,
String
code96333
,
String
supervisionCode
)
{
//RLock lock = redissonClient.getLock(LOCK_KEY);
Map
<
String
,
String
>
resultMap
=
null
;
try
{
...
...
@@ -737,7 +740,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//查询未使用的电梯码
categoryOtherInfo
=
categoryOtherInfoMapper
.
selectElevatorCode
(
prefix
,
EquipmentCategoryEnum
.
WSY
.
getCode
());
//如果存在未使用的电梯码则启用未使用的否则创建
String
elevator
=
ObjectUtils
.
isEmpty
(
categoryOtherInfo
)
?
generateCodeService
.
createElevatorCode
(
"96333_"
+
prefix
)
:
categoryOtherInfo
.
getCode
();
String
elevator
=
ObjectUtils
.
isEmpty
(
categoryOtherInfo
)
?
generateCodeService
.
createElevatorCode
(
"96333_"
+
prefix
)
:
categoryOtherInfo
.
getCode
();
if
(!
ObjectUtils
.
isEmpty
(
categoryOtherInfo
))
{
supervisoryCodeInfoMapper
.
delete
(
new
QueryWrapper
<
SupervisoryCodeInfo
>().
eq
(
"code96333"
,
categoryOtherInfo
.
getCode
()));
}
...
...
@@ -836,7 +839,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
/**
*
* 生成96333电梯识别码
*
* @param prefix 电梯码前缀
...
...
@@ -1542,7 +1544,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String
supervisionCode
=
String
.
valueOf
(
superviseMap
.
get
(
"supervisionCode"
));
EquipmentCategoryServiceImpl
categoryService
=
(
EquipmentCategoryServiceImpl
)
AopContext
.
currentProxy
();
//生成码
codeMap
=
categoryService
.
creatCode
(
isNotXiXian
,
city
,
county
,
equCategory
,
code96333
,
supervisionCode
);
codeMap
=
categoryService
.
creatCode
(
isNotXiXian
,
city
,
county
,
equCategory
,
code96333
,
supervisionCode
);
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map
.
remove
(
"data"
);
supervisionMap
.
put
(
"CODE96333"
,
codeMap
.
get
(
"code96333"
));
...
...
@@ -1613,7 +1615,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
// 2查找管辖机构为西咸,但96333码不为31开头的数据recordList
List
<
String
>
recordList
=
!
"new"
.
equals
(
type
)
?
equipmentCategoryMapper
.
selectXiXian
()
:
equipmentCategoryMapper
.
selectXiXianNew
();
if
(!
ObjectUtils
.
isEmpty
(
recordList
))
{
if
(!
ObjectUtils
.
isEmpty
(
recordList
))
{
// 2.1删除码表中recordList对应的码数据
equipmentCategoryMapper
.
clearSupervisoryCode
();
// 2.2清空业务表中recordList对应的96333码和监管码
...
...
@@ -2361,7 +2363,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return
true
;
}
public
void
updateStatus
(
String
supervisoryCode
){
public
void
updateStatus
(
String
supervisoryCode
)
{
SupervisoryCodeInfo
info
=
new
SupervisoryCodeInfo
();
info
.
setStatus
(
"1"
);
LambdaQueryWrapper
<
SupervisoryCodeInfo
>
lambda
=
new
QueryWrapper
<
SupervisoryCodeInfo
>().
lambda
();
...
...
@@ -2371,16 +2373,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Transactional
public
Boolean
saveConstructionInfoData
(
IdxBizJgConstructionInfo
data
)
{
if
(!
ObjectUtils
.
isEmpty
(
data
)
&&
!
ObjectUtils
.
isEmpty
(
data
.
getSupervisoryCode
())){
if
(!
ObjectUtils
.
isEmpty
(
data
)
&&
!
ObjectUtils
.
isEmpty
(
data
.
getSupervisoryCode
()))
{
String
supervisoryCode
=
data
.
getSupervisoryCode
();
data
.
setRecDate
(
new
Date
());
if
(!
ObjectUtils
.
isEmpty
(
data
.
getSequenceNbr
())){
if
(!
ObjectUtils
.
isEmpty
(
data
.
getSequenceNbr
()))
{
idxBizJgConstructionInfoService
.
updateById
(
data
);
}
else
{
}
else
{
data
.
setRecord
(
supervisoryCode
);
idxBizJgConstructionInfoService
.
save
(
data
);
}
}
else
{
}
else
{
return
false
;
}
return
true
;
...
...
@@ -2388,16 +2390,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Transactional
public
Boolean
saveMaintenanceRecordInfoData
(
IdxBizJgMaintenanceRecordInfo
data
)
{
if
(!
ObjectUtils
.
isEmpty
(
data
)
&&
!
ObjectUtils
.
isEmpty
(
data
.
getSupervisoryCode
())){
if
(!
ObjectUtils
.
isEmpty
(
data
)
&&
!
ObjectUtils
.
isEmpty
(
data
.
getSupervisoryCode
()))
{
String
supervisoryCode
=
data
.
getSupervisoryCode
();
data
.
setRecDate
(
new
Date
());
if
(!
ObjectUtils
.
isEmpty
(
data
.
getSequenceNbr
())){
if
(!
ObjectUtils
.
isEmpty
(
data
.
getSequenceNbr
()))
{
idxBizJgMaintenanceRecordInfoService
.
updateById
(
data
);
}
else
{
}
else
{
data
.
setRecord
(
supervisoryCode
);
idxBizJgMaintenanceRecordInfoService
.
save
(
data
);
}
}
else
{
}
else
{
return
false
;
}
return
true
;
...
...
@@ -2405,22 +2407,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Transactional
public
Boolean
saveDetectionInfoData
(
IdxBizJgInspectionDetectionInfo
data
)
{
if
(!
ObjectUtils
.
isEmpty
(
data
)
&&
!
ObjectUtils
.
isEmpty
(
data
.
getSupervisoryCode
())){
if
(!
ObjectUtils
.
isEmpty
(
data
)
&&
!
ObjectUtils
.
isEmpty
(
data
.
getSupervisoryCode
()))
{
String
supervisoryCode
=
data
.
getSupervisoryCode
();
data
.
setRecDate
(
new
Date
());
if
(!
ObjectUtils
.
isEmpty
(
data
.
getSequenceNbr
())){
if
(!
ObjectUtils
.
isEmpty
(
data
.
getSequenceNbr
()))
{
idxBizJgInspectionDetectionInfoService
.
updateById
(
data
);
}
else
{
}
else
{
data
.
setRecord
(
supervisoryCode
);
idxBizJgInspectionDetectionInfoService
.
save
(
data
);
}
}
else
{
}
else
{
return
false
;
}
return
true
;
}
public
Boolean
deleteByRecord
(
String
record
)
{
if
(!
ObjectUtils
.
isEmpty
(
record
)){
if
(!
ObjectUtils
.
isEmpty
(
record
))
{
// 使用信息删除
LambdaQueryWrapper
<
IdxBizJgUseInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgUseInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
...
...
@@ -2461,7 +2464,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
LambdaQueryWrapper
<
IdxBizJgTechParamsElevator
>
lambdaPar
=
new
QueryWrapper
<
IdxBizJgTechParamsElevator
>().
lambda
();
lambdaPar
.
eq
(
IdxBizJgTechParamsElevator:
:
getRecord
,
record
);
idxBizJgTechParamsElevatorService
.
getBaseMapper
().
delete
(
lambdaPar
);
}
else
{
}
else
{
return
false
;
}
return
true
;
...
...
@@ -2469,10 +2472,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
/**
* 更新ES中的数据(公共方法)
*
* @param paramMap 更新的参数
*/
public
Map
<
String
,
Object
>
commonUpdateEsDataByIds
(
Map
<
String
,
Map
<
String
,
Object
>>
paramMap
){
if
(
paramMap
.
isEmpty
())
{
public
Map
<
String
,
Object
>
commonUpdateEsDataByIds
(
Map
<
String
,
Map
<
String
,
Object
>>
paramMap
)
{
if
(
paramMap
.
isEmpty
())
{
return
null
;
}
String
oldUscUnitCreditCode
=
""
;
...
...
@@ -2481,11 +2485,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
for
(
Map
.
Entry
<
String
,
Map
<
String
,
Object
>>
entry
:
paramMap
.
entrySet
())
{
String
record
=
entry
.
getKey
();
Map
<
String
,
Object
>
childMap
=
entry
.
getValue
();
if
(!
childMap
.
isEmpty
())
{
if
(!
childMap
.
isEmpty
())
{
ESEquipmentCategoryDto
oldData
=
null
;
//获取Es中旧的数据
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
if
(!
ObjectUtils
.
isEmpty
(
optional
))
{
if
(!
ObjectUtils
.
isEmpty
(
optional
))
{
oldData
=
optional
.
get
();
oldUscUnitCreditCode
=
oldData
.
getUSC_UNIT_CREDIT_CODE
();
oldUscUnitName
=
oldData
.
getUSC_UNIT_NAME
();
...
...
@@ -2501,9 +2505,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//整合新旧数据
Bean
.
copyExistPropertis
(
newData
,
oldData
);
//处理施工单位信息[去重]
if
(!
StringUtils
.
isEmpty
(
oldUscUnitCreditCode
))
{
if
(!
oldUscUnitCreditCode
.
contains
(
newUscUnitCreditCode
)){
oldData
.
setUSC_UNIT_CREDIT_CODE
(
oldUscUnitCreditCode
+
","
+
newUscUnitCreditCode
);
oldData
.
setUSC_UNIT_NAME
(
oldUscUnitName
+
","
+
newUscUnitName
);
oldData
.
setUSC_UNIT_CREDIT_CODE
(
oldUscUnitCreditCode
+
","
+
newUscUnitCreditCode
);
oldData
.
setUSC_UNIT_NAME
(
oldUscUnitName
+
","
+
newUscUnitName
);
}
}
else
{
oldData
.
setUSC_UNIT_CREDIT_CODE
(
newUscUnitCreditCode
);
oldData
.
setUSC_UNIT_NAME
(
newUscUnitName
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
oldData
))
{
...
...
@@ -2511,11 +2520,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
ESEquipmentCategoryDto
saveData
=
esEquipmentCategory
.
save
(
oldData
);
//组装返回数据
resultMap
.
put
(
record
,
saveData
);
resultMap
.
put
(
record
,
saveData
);
}
}
}
return
resultMap
;
}
}
\ No newline at end of file
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