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
1cf4df0c
Commit
1cf4df0c
authored
Jun 01, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.气瓶检验超期后只生成一条数据不是每天都生成
parent
bb47c8dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
CylinderInfoMapper.xml
...nder-api/src/main/resources/mapper/CylinderInfoMapper.xml
+2
-2
InspectionQuestionJob.java
...s/boot/module/cylinder/biz/job/InspectionQuestionJob.java
+25
-5
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
1cf4df0c
...
...
@@ -463,7 +463,7 @@
tz_cylinder_unit u
where
a.sequence_code = b.sequence_code
and u.
credit_code = a.credit_code
and u.
app_id = a.app_id
and a.last_inspection_id = b.sequence_nbr
and date_gt(CURRENT_DATE, cast(b.next_inspection_date as date))
</select>
...
...
@@ -481,7 +481,7 @@
tz_cylinder_unit u
where
a.sequence_code = b.sequence_code
and u.
credit_code = a.credit_code
and u.
app_id = a.app_id
and a.last_inspection_id = b.sequence_nbr
and (b.is_deal_question = false or b.is_deal_question is null)
</select>
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/biz/job/InspectionQuestionJob.java
View file @
1cf4df0c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
biz
.
job
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.CylinderQuestionInfo
;
import
com.yeejoin.amos.boot.module.cylinder.api.enums.QuestionTypeEnum
;
...
...
@@ -16,8 +17,10 @@ import org.springframework.transaction.annotation.Transactional;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
javax.validation.constraints.NotNull
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -46,8 +49,8 @@ public class InspectionQuestionJob {
/**
* 检验超期
*/
@SchedulerLock
(
name
=
"genOverdueQuestionJobCylinder"
,
lockAtMostFor
=
"PT1H"
)
@Scheduled
(
cron
=
"${inspection.overdue.job.cron:0 0
2
* * ?}"
)
@SchedulerLock
(
name
=
"genOverdueQuestionJobCylinder
2
"
,
lockAtMostFor
=
"PT1H"
)
@Scheduled
(
cron
=
"${inspection.overdue.job.cron:0 0
1
* * ?}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
genOverdueQuestion
()
{
List
<
CylinderInfoDto
>
cylinderList
=
cylinderInfoMapper
.
queryCylinderOfInspectionOverdue
();
...
...
@@ -57,17 +60,34 @@ public class InspectionQuestionJob {
cylinderQuestionInfo
.
setQuestionTypeName
(
QuestionTypeEnum
.
JYCQ
.
getName
());
return
fillCommonField
(
cylinderInfoDto
,
cylinderQuestionInfo
);
}).
collect
(
Collectors
.
toList
());
// 已经生成的数据不再重复生成
List
<
CylinderQuestionInfo
>
needToDbQuestionInfos
=
this
.
removeRepeatData
(
cylinderQuestionInfos
);
if
(
needToDbQuestionInfos
.
size
()
>
0
)
{
questionInfoService
.
saveBatch
(
needToDbQuestionInfos
);
}
}
private
List
<
CylinderQuestionInfo
>
removeRepeatData
(
List
<
CylinderQuestionInfo
>
cylinderQuestionInfos
)
{
if
(
cylinderQuestionInfos
.
size
()
>
0
)
{
questionInfoService
.
saveBatch
(
cylinderQuestionInfos
);
Set
<
String
>
questionObjectIds
=
cylinderQuestionInfos
.
stream
().
map
(
CylinderQuestionInfo:
:
getQuestionObjectId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
appIds
=
cylinderQuestionInfos
.
stream
().
map
(
CylinderQuestionInfo:
:
getQuestionAttributionId
).
collect
(
Collectors
.
toSet
());
// 已经生成问题的气瓶
List
<
CylinderQuestionInfo
>
questionInfos
=
questionInfoService
.
list
(
new
LambdaQueryWrapper
<
CylinderQuestionInfo
>()
.
in
(
CylinderQuestionInfo:
:
getQuestionObjectId
,
questionObjectIds
)
.
in
(
CylinderQuestionInfo:
:
getQuestionAttributionId
,
appIds
).
eq
(
CylinderQuestionInfo:
:
getQuestionType
,
QuestionTypeEnum
.
JYCQ
.
getCode
()));
// 去掉已经生成的气瓶问题,不在重复生成问题
return
cylinderQuestionInfos
.
stream
().
filter
(
c
->
questionInfos
.
stream
().
noneMatch
(
d
->
d
.
getQuestionObjectId
().
equals
(
c
.
getQuestionObjectId
())
&&
d
.
getQuestionAttributionId
().
equals
(
c
.
getQuestionAttributionId
()))).
collect
(
Collectors
.
toList
());
}
return
new
ArrayList
<>();
}
/**
* 检验不合格任务
*/
@SchedulerLock
(
name
=
"genInspectionUnqualifiedQuestionJobCylinder
"
,
lockAtMostFor
=
"PT1H
"
)
@Scheduled
(
cron
=
"${inspection.unqualified.job.cron:0 0/
5
* * * ?}"
)
@SchedulerLock
(
name
=
"genInspectionUnqualifiedQuestionJobCylinder
2"
,
lockAtMostFor
=
"PT20M
"
)
@Scheduled
(
cron
=
"${inspection.unqualified.job.cron:0 0/
10
* * * ?}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
genInspectionUnqualifiedQuestion
()
{
List
<
CylinderInfoDto
>
cylinderList
=
cylinderInfoMapper
.
queryCylinderOfUnqualifiedQuestion
();
...
...
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