Commit f01389b5 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents c6dd0218 1cbbd022
......@@ -19,7 +19,7 @@
<sql id="selectAPPIdByRegionCode">
select u.app_id from tz_cylinder_unit u where u.region_code like CONCAT('%',#{regionCode},'%')
</sql>
<select id="getMonthInfoTotal" resultType="java.lang.Integer">
select
IFNULL(count(sequence_nbr), 0)
......@@ -66,7 +66,7 @@
select count(1) from view_cylider_outofdate v where v.app_id in (<include refid="selectAPPIdByRegionCode"/>)
and v.next_inspection_date <![CDATA[ < ]]> now()
</select>
<select id="getMonthInfoTotalUnit" resultType="java.lang.Integer">
select
IFNULL(count(sequence_nbr), 0)
......@@ -76,7 +76,7 @@
date_format(sync_date ,'yyyy-mm') LIKE date_format ( NOW() , 'yyyy-mm' )
AND app_id = #{appId}
</select>
<select id="getLastMonthInfoTotalUnit" resultType="java.lang.Integer">
select
IFNULL(count(sequence_nbr), 0)
......@@ -468,29 +468,28 @@
</select>
<select id="queryCylinderOfInspectionOverdue" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto">
SELECT
a.app_id,
u.unit_name,
u.region_code,
a.sequence_nbr,
a.factory_num,
a.sequence_code
u.unit_name,
u.app_id,
u.region_code
FROM
tz_cylinder_info a,
tz_cylinder_inspection b,
tz_cylinder_unit u
tz_cylinder_unit u,
tz_cylinder_inspection b
where
a.sequence_code = b.sequence_code
and u.app_id = a.app_id
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>
<select id="queryCylinderOfUnqualifiedQuestion" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderInfoDto">
SELECT
b.sequence_nbr,
a.sequence_code,
a.app_id,
a.sequence_nbr,
a.factory_num,
u.app_id,
u.unit_name,
u.region_code,
a.factory_num
a.last_inspection_id
FROM
tz_cylinder_info a,
tz_cylinder_inspection b,
......@@ -499,6 +498,7 @@
a.sequence_code = b.sequence_code
and u.app_id = a.app_id
and a.last_inspection_id = b.sequence_nbr
and b.inspection_result = '3124'
and (b.is_deal_question = false or b.is_deal_question is null)
</select>
......
......@@ -71,12 +71,13 @@
u.app_id,
u.unit_name,
u.region_code,
u.credit_code
u.credit_code,
u.sequence_nbr
FROM
tz_cylinder_unit u
where
date_gt(CURRENT_DATE, expire_date)
and not EXISTS (select 1 from tz_cylinder_question_info q where u.credit_code = q.question_object_id and q.question_type = #{questionType} )
and not EXISTS (select 1 from tz_cylinder_question_info q where u.sequence_nbr = q.question_object_id and q.question_type = #{questionType} )
</select>
<insert id="saveOrUpdateBatch" parameterType="com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit">
INSERT INTO "tz_cylinder_unit" ("sequence_nbr","unit_id","region_code","unit_name","credit_code","address","unit_person","person_mobile_phone","person_telephone","postal_code","rec_date","rec_user_id","sync_date","sync_state","app_id","security_adm","security_adm_phone","region_name")
......
......@@ -38,7 +38,7 @@ public class CompanyQuestionJob {
/**
* 资质超期
*/
@SchedulerLock(name = "genCompanyQuestionOfPermissionExpireJob", lockAtMostFor = "PT4M")
@SchedulerLock(name = "genCompanyQuestionOfPermissionExpireJob", lockAtMostFor = "PT30M")
@Scheduled(cron = "${inspection.cert.expire.job.cron:0 0 5 * * ?}")
@Transactional(rollbackFor = Exception.class)
public void genCompanyQuestionOfPermissionExpire() {
......@@ -59,7 +59,7 @@ public class CompanyQuestionJob {
cylinderQuestionInfo.setHappenDate(new Date());
cylinderQuestionInfo.setRecDate(new Date());
cylinderQuestionInfo.setRegionCode(cylinderUnitDto.getRegionCode());
cylinderQuestionInfo.setQuestionObjectId(cylinderUnitDto.getCreditCode());
cylinderQuestionInfo.setQuestionObjectId(cylinderUnitDto.getSequenceNbr() + "");
cylinderQuestionInfo.setQuestionObjectName(cylinderUnitDto.getUnitName());
cylinderQuestionInfo.setQuestionAttributionId(cylinderUnitDto.getAppId());
cylinderQuestionInfo.setQuestionAttributionName(cylinderUnitDto.getUnitName());
......
......@@ -49,8 +49,8 @@ public class InspectionQuestionJob {
/**
* 检验超期
*/
@SchedulerLock(name = "genOverdueQuestionJobCylinder2", lockAtMostFor = "PT1H")
@Scheduled(cron = "${inspection.overdue.job.cron:0 0 1 * * ?}")
@SchedulerLock(name = "genOverdueQuestionJobCylinder", lockAtMostFor = "PT20M")
@Scheduled(cron = "${inspection.overdue.job.cron:0 0/30 * * * ?}")
@Transactional(rollbackFor = Exception.class)
public void genOverdueQuestion() {
List<CylinderInfoDto> cylinderList = cylinderInfoMapper.queryCylinderOfInspectionOverdue();
......@@ -70,14 +70,12 @@ public class InspectionQuestionJob {
private List<CylinderQuestionInfo> removeRepeatData(List<CylinderQuestionInfo> cylinderQuestionInfos) {
if (cylinderQuestionInfos.size() > 0) {
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>()
List<CylinderQuestionInfo> haveCreateQuestionInfos = questionInfoService.list(new LambdaQueryWrapper<CylinderQuestionInfo>()
.in(CylinderQuestionInfo::getQuestionObjectId, questionObjectIds)
.in(CylinderQuestionInfo::getQuestionAttributionId, appIds).eq(CylinderQuestionInfo::getQuestionType, QuestionTypeEnum.JYCQ.getCode()));
.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 cylinderQuestionInfos.stream().filter(c -> haveCreateQuestionInfos.stream().noneMatch(d -> d.getQuestionObjectId().equals(c.getQuestionObjectId()))).collect(Collectors.toList());
}
return new ArrayList<>();
}
......@@ -86,8 +84,8 @@ public class InspectionQuestionJob {
/**
* 检验不合格任务
*/
@SchedulerLock(name = "genInspectionUnqualifiedQuestionJobCylinder2", lockAtMostFor = "PT20M")
@Scheduled(cron = "${inspection.unqualified.job.cron:0 0/10 * * * ?}")
@SchedulerLock(name = "genInspectionUnqualifiedQuestionJobCylinder", lockAtMostFor = "PT20M")
@Scheduled(cron = "${inspection.unqualified.job.cron:0 0/30 * * * ?}")
@Transactional(rollbackFor = Exception.class)
public void genInspectionUnqualifiedQuestion() {
List<CylinderInfoDto> cylinderList = cylinderInfoMapper.queryCylinderOfUnqualifiedQuestion();
......@@ -106,7 +104,7 @@ public class InspectionQuestionJob {
private void updateDealStatusAfterJobDeal(List<CylinderInfoDto> cylinderList) {
LambdaUpdateWrapper<CylinderInspection> updateWrapper = new LambdaUpdateWrapper<>();
cylinderList.forEach(cylinder -> {
updateWrapper.eq(BaseEntity::getSequenceNbr, cylinder.getSequenceNbr());
updateWrapper.eq(BaseEntity::getSequenceNbr, cylinder.getLastInspectionId());
updateWrapper.set(CylinderInspection::getIsDealQuestion, true);
cylinderInspectionService.update(updateWrapper);
});
......@@ -117,7 +115,7 @@ public class InspectionQuestionJob {
cylinderQuestionInfo.setHappenDate(new Date());
cylinderQuestionInfo.setRecDate(new Date());
cylinderQuestionInfo.setRegionCode(cylinderInfoDto.getRegionCode());
cylinderQuestionInfo.setQuestionObjectId(cylinderInfoDto.getSequenceCode());
cylinderQuestionInfo.setQuestionObjectId(cylinderInfoDto.getSequenceNbr() + "");
cylinderQuestionInfo.setQuestionObjectName(cylinderInfoDto.getFactoryNum());
cylinderQuestionInfo.setQuestionAttributionId(cylinderInfoDto.getAppId());
cylinderQuestionInfo.setQuestionAttributionName(cylinderInfoDto.getUnitName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment