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
ea2eab80
Commit
ea2eab80
authored
Jun 01, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.气瓶检验超期、检验不合格定时任务
parent
34b5fbfa
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
19 deletions
+91
-19
CylinderInspectionDto.java
...ot/module/cylinder/flc/api/dto/CylinderInspectionDto.java
+6
-4
CylinderInspection.java
...ot/module/cylinder/flc/api/entity/CylinderInspection.java
+7
-6
CylinderInfoMapper.java
...ot/module/cylinder/flc/api/mapper/CylinderInfoMapper.java
+2
-0
CylinderInfoMapper.xml
...nder-api/src/main/resources/mapper/CylinderInfoMapper.xml
+18
-0
InspectionQuestionJob.java
...s/boot/module/cylinder/biz/job/InspectionQuestionJob.java
+58
-9
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/dto/CylinderInspectionDto.java
View file @
ea2eab80
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
dto
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
...
...
@@ -15,14 +16,12 @@ import java.util.Date;
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"CylinderInspectionDto"
,
description
=
"气瓶检验信息"
)
@ApiModel
(
value
=
"CylinderInspectionDto"
,
description
=
"气瓶检验信息"
)
public
class
CylinderInspectionDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"id"
)
private
Long
sequenceNbr
;
...
...
@@ -63,4 +62,7 @@ public class CylinderInspectionDto extends BaseDto {
@ApiModelProperty
(
value
=
"不合格报废数量"
)
private
String
scrapQuantity
;
@ApiModelProperty
(
value
=
"是否处理生过问题"
)
private
Boolean
isDealQuestion
;
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/entity/CylinderInspection.java
View file @
ea2eab80
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
entity
;
import
java.util.Dat
e
;
import
com.baomidou.mybatisplus.annotation.TableNam
e
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
java.util.Date
;
/**
* 气瓶检验信息
*
...
...
@@ -19,14 +20,12 @@ import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tz_cylinder_inspection"
)
@ApiModel
(
value
=
"TzCylinderInspection对象"
,
description
=
"气瓶检验信息"
)
@ApiModel
(
value
=
"TzCylinderInspection对象"
,
description
=
"气瓶检验信息"
)
public
class
CylinderInspection
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"检验单位"
)
private
String
inspectionUnit
;
...
...
@@ -43,7 +42,6 @@ public class CylinderInspection extends BaseEntity {
private
String
inspectionResult
;
@ApiModelProperty
(
value
=
"同步时间 yyyy-MM-dd HH24:mi:ss"
)
private
Date
syncDate
;
...
...
@@ -58,4 +56,7 @@ public class CylinderInspection extends BaseEntity {
@ApiModelProperty
(
value
=
"不合格报废数量"
)
private
String
scrapQuantity
;
@ApiModelProperty
(
value
=
"是否处理生过问题"
)
private
Boolean
isDealQuestion
=
false
;
}
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 @
ea2eab80
...
...
@@ -109,4 +109,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Map
<
String
,
Object
>
countFillingTimesAndQuantityByCompany
(
@Param
(
"companyId"
)
String
companyId
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
List
<
CylinderInfoDto
>
queryCylinderOfInspectionOverdue
();
List
<
CylinderInfoDto
>
queryCylinderOfUnqualifiedQuestion
();
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylinderInfoMapper.xml
View file @
ea2eab80
...
...
@@ -455,6 +455,24 @@
and a.last_inspection_id = b.sequence_nbr
and date_gt(CURRENT_DATE, cast(b.next_inspection_date as date))
</select>
<select
id=
"queryCylinderOfUnqualifiedQuestion"
resultType=
"com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto"
>
SELECT
b.sequence_nbr,
a.sequence_code,
a.app_id,
u.unit_name,
u.region_code,
a.factory_num
FROM
tz_cylinder_info a,
tz_cylinder_inspection b,
tz_cylinder_unit u
where
a.sequence_code = b.sequence_code
and u.credit_code = a.credit_code
and a.last_inspection_id = b.sequence_nbr
and b.is_deal_question = false
</select>
<update
id=
"updateEsCylinderInfoStatus"
>
UPDATE tz_cylinder_info SET "is_not_es" = 1 WHERE "sequence_nbr" IN
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/biz/job/Inspection
Overdue
Job.java
→
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/biz/job/Inspection
Question
Job.java
View file @
ea2eab80
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
biz
.
job
;
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
;
import
com.yeejoin.amos.boot.module.cylinder.biz.service.impl.CylinderQuestionInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderInspection
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderInfoMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.CylinderInspectionServiceImpl
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
javax.validation.constraints.NotNull
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -19,28 +25,75 @@ import java.util.stream.Collectors;
*/
@Component
@EnableScheduling
public
class
Inspection
Overdue
Job
{
public
class
Inspection
Question
Job
{
private
CylinderInfoMapper
cylinderInfoMapper
;
private
CylinderInspectionServiceImpl
cylinderInspectionService
;
private
CylinderQuestionInfoServiceImpl
questionInfoService
;
public
InspectionOverdueJob
(
CylinderInfoMapper
cylinderInfoMapper
,
public
InspectionQuestionJob
(
CylinderInfoMapper
cylinderInfoMapper
,
CylinderInspectionServiceImpl
cylinderInspectionService
,
CylinderQuestionInfoServiceImpl
questionInfoService
)
{
this
.
cylinderInfoMapper
=
cylinderInfoMapper
;
this
.
questionInfoService
=
questionInfoService
;
this
.
cylinderInspectionService
=
cylinderInspectionService
;
}
@SchedulerLock
(
name
=
"overdueQuestionJobCylinder"
,
lockAtMostFor
=
"PT1H"
)
/**
* 检验超期
*/
@SchedulerLock
(
name
=
"genOverdueQuestionJobCylinder"
,
lockAtMostFor
=
"PT1H"
)
@Scheduled
(
cron
=
"${inspection.overdue.job.cron:0 0 2 * * ?}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
genOverdueQuestion
()
{
List
<
CylinderInfoDto
>
cylinder
Info
=
cylinderInfoMapper
.
queryCylinderOfInspectionOverdue
();
List
<
CylinderQuestionInfo
>
cylinderQuestionInfos
=
cylinder
Info
.
stream
().
map
(
cylinderInfoDto
->
{
List
<
CylinderInfoDto
>
cylinder
List
=
cylinderInfoMapper
.
queryCylinderOfInspectionOverdue
();
List
<
CylinderQuestionInfo
>
cylinderQuestionInfos
=
cylinder
List
.
stream
().
map
(
cylinderInfoDto
->
{
CylinderQuestionInfo
cylinderQuestionInfo
=
new
CylinderQuestionInfo
();
cylinderQuestionInfo
.
setQuestionType
(
QuestionTypeEnum
.
JYCQ
.
getCode
());
cylinderQuestionInfo
.
setQuestionTypeName
(
QuestionTypeEnum
.
JYCQ
.
getName
());
return
fillCommonField
(
cylinderInfoDto
,
cylinderQuestionInfo
);
}).
collect
(
Collectors
.
toList
());
if
(
cylinderQuestionInfos
.
size
()
>
0
)
{
questionInfoService
.
saveBatch
(
cylinderQuestionInfos
);
}
}
/**
* 检验不合格任务
*/
@SchedulerLock
(
name
=
"genInspectionUnqualifiedQuestionJobCylinder"
,
lockAtMostFor
=
"PT1H"
)
@Scheduled
(
cron
=
"${inspection.unqualified.job.cron:0 0/5 * * * ?}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
genInspectionUnqualifiedQuestion
()
{
List
<
CylinderInfoDto
>
cylinderList
=
cylinderInfoMapper
.
queryCylinderOfUnqualifiedQuestion
();
List
<
CylinderQuestionInfo
>
cylinderQuestionInfos
=
cylinderList
.
stream
().
map
(
cylinderInfoDto
->
{
CylinderQuestionInfo
cylinderQuestionInfo
=
new
CylinderQuestionInfo
();
cylinderQuestionInfo
.
setQuestionType
(
QuestionTypeEnum
.
JYBHG
.
getCode
());
cylinderQuestionInfo
.
setQuestionTypeName
(
QuestionTypeEnum
.
JYBHG
.
getName
());
return
fillCommonField
(
cylinderInfoDto
,
cylinderQuestionInfo
);
}).
collect
(
Collectors
.
toList
());
if
(
cylinderQuestionInfos
.
size
()
>
0
)
{
questionInfoService
.
saveBatch
(
cylinderQuestionInfos
);
updateDealStatusAfterJobDeal
(
cylinderList
);
}
}
private
void
updateDealStatusAfterJobDeal
(
List
<
CylinderInfoDto
>
cylinderList
)
{
LambdaUpdateWrapper
<
CylinderInspection
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
cylinderList
.
forEach
(
cylinder
->
{
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
cylinder
.
getSequenceNbr
());
updateWrapper
.
set
(
CylinderInspection:
:
getIsDealQuestion
,
true
);
cylinderInspectionService
.
update
(
updateWrapper
);
});
}
@NotNull
private
CylinderQuestionInfo
fillCommonField
(
CylinderInfoDto
cylinderInfoDto
,
CylinderQuestionInfo
cylinderQuestionInfo
)
{
cylinderQuestionInfo
.
setHappenDate
(
new
Date
());
cylinderQuestionInfo
.
setRecDate
(
new
Date
());
cylinderQuestionInfo
.
setRegionCode
(
cylinderInfoDto
.
getRegionCode
());
...
...
@@ -49,9 +102,5 @@ public class InspectionOverdueJob {
cylinderQuestionInfo
.
setQuestionAttributionId
(
cylinderInfoDto
.
getAppId
());
cylinderQuestionInfo
.
setQuestionAttributionName
(
cylinderInfoDto
.
getUnitName
());
return
cylinderQuestionInfo
;
}).
collect
(
Collectors
.
toList
());
if
(
cylinderQuestionInfos
.
size
()
>
0
)
{
questionInfoService
.
saveBatch
(
cylinderQuestionInfos
);
}
}
}
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