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
22979784
Commit
22979784
authored
Sep 15, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
气瓶基本信息同步es修改
parent
16caeba5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
28 deletions
+39
-28
CylinderInfoMapper.java
...ot/module/cylinder/flc/api/mapper/CylinderInfoMapper.java
+2
-0
CylinderInfoMapper.xml
...nder-api/src/main/resources/mapper/CylinderInfoMapper.xml
+7
-0
CylinderInfoController.java
...e/cylinder/flc/biz/controller/CylinderInfoController.java
+9
-16
CylinderInfoServiceImpl.java
...ylinder/flc/biz/service/impl/CylinderInfoServiceImpl.java
+21
-12
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/mapper/CylinderInfoMapper.java
View file @
22979784
...
...
@@ -87,4 +87,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Integer
getInfoTotal
();
void
updateEsCylinderInfoStatus
(
@Param
(
"ids"
)
List
<
String
>
ids
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
22979784
...
...
@@ -338,4 +338,11 @@
where ci.is_not_es IS NULL
AND region_code is not null
</select>
<update
id=
"updateEsCylinderInfoStatus"
>
UPDATE tz_cylinder_info SET "is_not_es" = 1 WHERE "sequence_nbr" IN
<foreach
collection=
"ids"
separator=
","
item=
"id"
open=
"("
close=
")"
>
#{id}
</foreach>
</update>
</mapper>
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/controller/CylinderInfoController.java
View file @
22979784
...
...
@@ -567,7 +567,7 @@ public class CylinderInfoController extends BaseController {
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/saveCyinderInfo"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶基本信息存入es"
,
notes
=
"气瓶基本信息存入es"
)
public
void
saveCyinderInfo
()
{
...
...
@@ -584,30 +584,27 @@ public class CylinderInfoController extends BaseController {
return
;
}
for
(
int
i
=
0
;
i
<=
times
;
i
++)
{
cylinderInfoPage
.
setCurrent
(
i
);
cylinderInfoPage
.
setCurrent
(
0
);
cylinderInfoPage
.
setSize
(
1000
);
cylinderInfoPage
=
cylinderInfoServiceImpl
.
getCyinderInfoList
(
cylinderInfoPage
);
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
))
{
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
)
&&
!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
.
getRecords
())
)
{
cylinderInfoServiceImpl
.
saveCylinderInfo2ES
(
cylinderInfoPage
.
getRecords
());
}
// for (CylinderInfoDto ci : cylinderInfoPage.getRecords()) {
// cylinderInfoServiceImpl.saveCylinderInfoToES(ci);
// }
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/getCyinderInfo"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"气瓶基本信息存入es入口"
,
notes
=
"气瓶基本信息存入es入口"
)
public
Page
<
CylinderInfoDto
>
getCyinderInfo
()
{
public
ResponseModel
getCyinderInfo
()
{
Page
<
CylinderInfoDto
>
cylinderInfoPage
=
new
Page
<>();
cylinderInfoPage
.
setCurrent
(
1
);
cylinderInfoPage
.
setSize
(
1000
);
cylinderInfoPage
=
cylinderInfoServiceImpl
.
getCyinderInfoList
(
cylinderInfoPage
);
for
(
CylinderInfoDto
ci
:
cylinderInfoPage
.
getRecords
(
))
{
cylinderInfoServiceImpl
.
saveCylinderInfoToES
(
ci
);
}
return
cylinderInfoServiceImpl
.
getCyinderInfoList
(
cylinderInfoPag
e
);
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
))
{
cylinderInfoServiceImpl
.
saveCylinderInfo2ES
(
cylinderInfoPage
.
getRecords
()
);
}
return
ResponseHelper
.
buildResponse
(
tru
e
);
}
...
...
@@ -661,10 +658,6 @@ public class CylinderInfoController extends BaseController {
for
(
int
i
=
0
;
i
<=
times
;
i
++)
{
recordDtoPage
.
setCurrent
(
1
);
recordDtoPage
.
setSize
(
1000
);
// CylinderFillingRecordDto cylinderFillingRecordDto = new CylinderFillingRecordDto();
// if (StringUtils.isEmpty(cylinderFillingRecordDto.getSequenceCode())) {
// cylinderFillingRecordDto.setAppId("9B150BB7D0C21A7A62BD6837E14A44BF");
// }
Page
<
ESCylinderFillingRecordDto
>
cyinderFillingRecord
=
cylinderFillingRecordServiceImpl
.
getCyinderFillingRecord
(
recordDtoPage
);
if
(!
ObjectUtils
.
isEmpty
(
cyinderFillingRecord
))
{
cylinderFillingRecordServiceImpl
.
saveCylinderFillingRecord2ES
(
cyinderFillingRecord
.
getRecords
());
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderInfoServiceImpl.java
View file @
22979784
...
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.WarningMsgDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderInfoDto
;
...
...
@@ -40,6 +41,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
@@ -746,18 +748,17 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@SchedulerLock
(
name
=
"cylinderInfoToESTask"
,
lockAtMostFor
=
"PT6H"
)
public
void
setTimeSaveCylinderInfoToES
()
{
Page
<
CylinderInfoDto
>
cylinderInfoPage
=
new
Page
<>();
Page
<
CylinderInfoDto
>
cyinderInfoList
=
cylinderInfoMapper
.
getCyinderInfoList
(
cylinderInfoPage
);
Long
count
=
cyinderInfoList
.
getCurrent
();
Long
times
=
0L
;
Integer
count
=
getInfoTotal
();
Integer
times
=
0
;
if
(
count
!=
0
)
{
times
=
count
/
1000
;
Long
last
=
count
%
1000
;
int
last
=
count
%
1000
;
if
(
last
>
0
)
{
times
++;
}
}
for
(
int
i
=
0
;
i
<=
times
;
i
++)
{
cylinderInfoPage
.
setCurrent
(
1
);
cylinderInfoPage
.
setCurrent
(
0
);
cylinderInfoPage
.
setSize
(
1000
);
cylinderInfoPage
=
cylinderInfoMapper
.
getCyinderInfoList
(
cylinderInfoPage
);
if
(!
ObjectUtils
.
isEmpty
(
cylinderInfoPage
))
{
...
...
@@ -772,19 +773,27 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Override
public
void
saveCylinderInfo2ES
(
List
<
CylinderInfoDto
>
records
)
{
List
<
ESCylinderInfoDto
>
esCylinderInfoDto
=
new
ArrayList
<>();
List
<
CylinderInfo
>
CylinderInfoList
=
new
ArrayList
<>
();
List
<
String
>
ids
=
Lists
.
newArrayList
();
for
(
CylinderInfoDto
record
:
records
)
{
ESCylinderInfoDto
esCylinderInfo
=
new
ESCylinderInfoDto
();
BeanUtils
.
copyProperties
(
record
,
esCylinderInfo
);
esCylinderInfoDto
.
add
(
esCylinderInfo
);
CylinderInfo
cylinderInfo
=
new
CylinderInfo
();
BeanUtils
.
copyProperties
(
record
,
cylinderInfo
);
cylinderInfo
.
setSequenceNbr
(
record
.
getSequenceNbr
());
cylinderInfo
.
setIsNotEs
(
"1"
);
CylinderInfoList
.
add
(
cylinderInfo
);
ids
.
add
(
String
.
valueOf
(
record
.
getSequenceNbr
()));
}
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
esCylinderInfoRepository
.
saveAll
(
esCylinderInfoDto
);
this
.
updateBatchById
(
CylinderInfoList
);
stopWatch
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"批量存入es耗时:{} 秒"
,
stopWatch
.
getTotalTimeSeconds
());
}
StopWatch
stopWatch1
=
new
StopWatch
();
stopWatch1
.
start
();
cylinderInfoMapper
.
updateEsCylinderInfoStatus
(
ids
);
stopWatch1
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"批量更新业务数据耗时:{} 秒"
,
stopWatch1
.
getTotalTimeSeconds
());
}
}
@Override
...
...
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