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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
51 deletions
+123
-51
CylinderInspectionDto.java
...ot/module/cylinder/flc/api/dto/CylinderInspectionDto.java
+33
-31
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
+63
-14
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
;
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.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
...
@@ -15,52 +16,53 @@ import java.util.Date;
...
@@ -15,52 +16,53 @@ import java.util.Date;
*/
*/
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"CylinderInspectionDto"
,
description
=
"气瓶检验信息"
)
@ApiModel
(
value
=
"CylinderInspectionDto"
,
description
=
"气瓶检验信息"
)
public
class
CylinderInspectionDto
extends
BaseDto
{
public
class
CylinderInspectionDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"id"
)
@ApiModelProperty
(
value
=
"id"
)
private
Long
sequenceNbr
;
private
Long
sequenceNbr
;
@ApiModelProperty
(
value
=
"检验单位"
)
private
String
inspectionUnit
;
@ApiModelProperty
(
value
=
"检验单位
"
)
@ApiModelProperty
(
value
=
"气瓶唯一标识码
"
)
private
String
inspectionUnit
;
private
String
sequenceCode
;
@ApiModelProperty
(
value
=
"气瓶唯一标识码
"
)
@ApiModelProperty
(
value
=
"检验日期
"
)
private
String
sequenceCod
e
;
private
String
inspectionDat
e
;
@ApiModelProperty
(
value
=
"
检验日期"
)
@ApiModelProperty
(
value
=
"下次
检验日期"
)
private
String
i
nspectionDate
;
private
String
nextI
nspectionDate
;
@ApiModelProperty
(
value
=
"下次检验日期
"
)
@ApiModelProperty
(
value
=
"检验结果
"
)
private
String
nextInspectionDate
;
private
String
inspectionResult
;
@ApiModelProperty
(
value
=
"检验结果
"
)
@ApiModelProperty
(
value
=
"创建时间
"
)
private
String
inspectionResult
;
private
Date
recDate
;
@ApiModelProperty
(
value
=
"创建时间
"
)
@ApiModelProperty
(
value
=
"操作人员
"
)
private
Date
recDate
;
private
String
recUserId
;
@ApiModelProperty
(
value
=
"操作人员
"
)
@ApiModelProperty
(
value
=
"同步时间 yyyy-MM-dd HH24:mi:ss
"
)
private
String
recUserId
;
private
Date
syncDate
;
@ApiModelProperty
(
value
=
"同步时间 yyyy-MM-dd HH24:mi:ss
"
)
@ApiModelProperty
(
value
=
"0-新增 1-更新 2-删除
"
)
private
Date
syncD
ate
;
private
Integer
syncSt
ate
;
@ApiModelProperty
(
value
=
"0-新增 1-更新 2-删除
"
)
@ApiModelProperty
(
value
=
"对接公司编码
"
)
private
Integer
syncState
;
private
String
appId
;
@ApiModelProperty
(
value
=
"对接公司编码
"
)
@ApiModelProperty
(
value
=
"数据完整度
"
)
private
String
appId
;
private
Double
integrity
;
@ApiModelProperty
(
value
=
"数据完整度
"
)
@ApiModelProperty
(
value
=
"不合格报废数量
"
)
private
Double
integr
ity
;
private
String
scrapQuant
ity
;
@ApiModelProperty
(
value
=
"不合格报废数量
"
)
@ApiModelProperty
(
value
=
"是否处理生过问题
"
)
private
String
scrapQuantity
;
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
;
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.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
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;
...
@@ -19,14 +20,12 @@ import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
@EqualsAndHashCode
(
callSuper
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tz_cylinder_inspection"
)
@TableName
(
"tz_cylinder_inspection"
)
@ApiModel
(
value
=
"TzCylinderInspection对象"
,
description
=
"气瓶检验信息"
)
@ApiModel
(
value
=
"TzCylinderInspection对象"
,
description
=
"气瓶检验信息"
)
public
class
CylinderInspection
extends
BaseEntity
{
public
class
CylinderInspection
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"检验单位"
)
@ApiModelProperty
(
value
=
"检验单位"
)
private
String
inspectionUnit
;
private
String
inspectionUnit
;
...
@@ -43,7 +42,6 @@ public class CylinderInspection extends BaseEntity {
...
@@ -43,7 +42,6 @@ public class CylinderInspection extends BaseEntity {
private
String
inspectionResult
;
private
String
inspectionResult
;
@ApiModelProperty
(
value
=
"同步时间 yyyy-MM-dd HH24:mi:ss"
)
@ApiModelProperty
(
value
=
"同步时间 yyyy-MM-dd HH24:mi:ss"
)
private
Date
syncDate
;
private
Date
syncDate
;
...
@@ -58,4 +56,7 @@ public class CylinderInspection extends BaseEntity {
...
@@ -58,4 +56,7 @@ public class CylinderInspection extends BaseEntity {
@ApiModelProperty
(
value
=
"不合格报废数量"
)
@ApiModelProperty
(
value
=
"不合格报废数量"
)
private
String
scrapQuantity
;
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> {
...
@@ -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
);
Map
<
String
,
Object
>
countFillingTimesAndQuantityByCompany
(
@Param
(
"companyId"
)
String
companyId
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
List
<
CylinderInfoDto
>
queryCylinderOfInspectionOverdue
();
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 @@
...
@@ -455,6 +455,24 @@
and a.last_inspection_id = b.sequence_nbr
and a.last_inspection_id = b.sequence_nbr
and date_gt(CURRENT_DATE, cast(b.next_inspection_date as date))
and date_gt(CURRENT_DATE, cast(b.next_inspection_date as date))
</select>
</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
id=
"updateEsCylinderInfoStatus"
>
UPDATE tz_cylinder_info SET "is_not_es" = 1 WHERE "sequence_nbr" IN
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
;
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.entity.CylinderQuestionInfo
;
import
com.yeejoin.amos.boot.module.cylinder.api.enums.QuestionTypeEnum
;
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.biz.service.impl.CylinderQuestionInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto
;
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.api.mapper.CylinderInfoMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.CylinderInspectionServiceImpl
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
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.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -19,39 +25,82 @@ import java.util.stream.Collectors;
...
@@ -19,39 +25,82 @@ import java.util.stream.Collectors;
*/
*/
@Component
@Component
@EnableScheduling
@EnableScheduling
public
class
Inspection
Overdue
Job
{
public
class
Inspection
Question
Job
{
private
CylinderInfoMapper
cylinderInfoMapper
;
private
CylinderInfoMapper
cylinderInfoMapper
;
private
CylinderInspectionServiceImpl
cylinderInspectionService
;
private
CylinderQuestionInfoServiceImpl
questionInfoService
;
private
CylinderQuestionInfoServiceImpl
questionInfoService
;
public
InspectionOverdueJob
(
CylinderInfoMapper
cylinderInfoMapper
,
public
InspectionQuestionJob
(
CylinderInfoMapper
cylinderInfoMapper
,
CylinderQuestionInfoServiceImpl
questionInfoService
)
{
CylinderInspectionServiceImpl
cylinderInspectionService
,
CylinderQuestionInfoServiceImpl
questionInfoService
)
{
this
.
cylinderInfoMapper
=
cylinderInfoMapper
;
this
.
cylinderInfoMapper
=
cylinderInfoMapper
;
this
.
questionInfoService
=
questionInfoService
;
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 * * ?}"
)
@Scheduled
(
cron
=
"${inspection.overdue.job.cron:0 0 2 * * ?}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
genOverdueQuestion
()
{
public
void
genOverdueQuestion
()
{
List
<
CylinderInfoDto
>
cylinder
Info
=
cylinderInfoMapper
.
queryCylinderOfInspectionOverdue
();
List
<
CylinderInfoDto
>
cylinder
List
=
cylinderInfoMapper
.
queryCylinderOfInspectionOverdue
();
List
<
CylinderQuestionInfo
>
cylinderQuestionInfos
=
cylinder
Info
.
stream
().
map
(
cylinderInfoDto
->
{
List
<
CylinderQuestionInfo
>
cylinderQuestionInfos
=
cylinder
List
.
stream
().
map
(
cylinderInfoDto
->
{
CylinderQuestionInfo
cylinderQuestionInfo
=
new
CylinderQuestionInfo
();
CylinderQuestionInfo
cylinderQuestionInfo
=
new
CylinderQuestionInfo
();
cylinderQuestionInfo
.
setQuestionType
(
QuestionTypeEnum
.
JYCQ
.
getCode
());
cylinderQuestionInfo
.
setQuestionType
(
QuestionTypeEnum
.
JYCQ
.
getCode
());
cylinderQuestionInfo
.
setQuestionTypeName
(
QuestionTypeEnum
.
JYCQ
.
getName
());
cylinderQuestionInfo
.
setQuestionTypeName
(
QuestionTypeEnum
.
JYCQ
.
getName
());
cylinderQuestionInfo
.
setHappenDate
(
new
Date
());
return
fillCommonField
(
cylinderInfoDto
,
cylinderQuestionInfo
);
cylinderQuestionInfo
.
setRecDate
(
new
Date
());
cylinderQuestionInfo
.
setRegionCode
(
cylinderInfoDto
.
getRegionCode
());
cylinderQuestionInfo
.
setQuestionObjectId
(
cylinderInfoDto
.
getSequenceCode
());
cylinderQuestionInfo
.
setQuestionObjectName
(
cylinderInfoDto
.
getFactoryNum
());
cylinderQuestionInfo
.
setQuestionAttributionId
(
cylinderInfoDto
.
getAppId
());
cylinderQuestionInfo
.
setQuestionAttributionName
(
cylinderInfoDto
.
getUnitName
());
return
cylinderQuestionInfo
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
if
(
cylinderQuestionInfos
.
size
()
>
0
)
{
if
(
cylinderQuestionInfos
.
size
()
>
0
)
{
questionInfoService
.
saveBatch
(
cylinderQuestionInfos
);
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
());
cylinderQuestionInfo
.
setQuestionObjectId
(
cylinderInfoDto
.
getSequenceCode
());
cylinderQuestionInfo
.
setQuestionObjectName
(
cylinderInfoDto
.
getFactoryNum
());
cylinderQuestionInfo
.
setQuestionAttributionId
(
cylinderInfoDto
.
getAppId
());
cylinderQuestionInfo
.
setQuestionAttributionName
(
cylinderInfoDto
.
getUnitName
());
return
cylinderQuestionInfo
;
}
}
}
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