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
3646b4c8
Commit
3646b4c8
authored
Dec 18, 2023
by
liufan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加:更新ES数据的公共方法
parent
5ce89779
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
IEquipmentCategoryService.java
...oot/module/ymt/api/service/IEquipmentCategoryService.java
+3
-0
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+43
-0
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/service/IEquipmentCategoryService.java
View file @
3646b4c8
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.ymt.api.service;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.CategoryOtherInfo
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -43,4 +44,6 @@ public interface IEquipmentCategoryService {
ResponseModel
submit
(
Map
<
String
,
Object
>
map
);
void
creatXiXian
(
String
type
);
Map
<
String
,
Object
>
commonUpdateEsDataByIds
(
Map
<
String
,
Map
<
String
,
Object
>>
paramMap
);
}
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 @
3646b4c8
...
...
@@ -98,6 +98,7 @@ import org.springframework.util.Assert;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.DateUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -2452,4 +2453,45 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
return
true
;
}
/**
* 更新ES中的数据(公共方法)
* @param paramMap 更新的参数
*/
public
Map
<
String
,
Object
>
commonUpdateEsDataByIds
(
Map
<
String
,
Map
<
String
,
Object
>>
paramMap
){
if
(
paramMap
.
isEmpty
()){
return
null
;
}
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Map
<
String
,
Object
>>
entry
:
paramMap
.
entrySet
())
{
String
record
=
entry
.
getKey
();
Map
<
String
,
Object
>
childMap
=
entry
.
getValue
();
if
(!
childMap
.
isEmpty
()){
ESEquipmentCategoryDto
oldData
=
null
;
//获取Es中旧的数据
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
if
(!
ObjectUtils
.
isEmpty
(
optional
)){
oldData
=
optional
.
get
();
}
//获取Es中新的参数
ESEquipmentCategoryDto
newData
=
JSON
.
parseObject
(
toJSONString
(
childMap
),
ESEquipmentCategoryDto
.
class
);
//删除Es中旧的数据
if
(!
ObjectUtils
.
isEmpty
(
oldData
))
{
esEquipmentCategory
.
deleteById
(
record
);
//整合新旧数据
Bean
.
copyExistPropertis
(
newData
,
oldData
);
}
if
(!
ObjectUtils
.
isEmpty
(
oldData
))
{
oldData
.
setREC_DATE
(
System
.
currentTimeMillis
());
ESEquipmentCategoryDto
saveData
=
esEquipmentCategory
.
save
(
oldData
);
//组装返回数据
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