添加同步关键零部件数据定时任务

This commit is contained in:
梁琦涛
2024-09-27 09:52:34 +08:00
parent f5e5d88fc2
commit b11235d06a
5 changed files with 33 additions and 1 deletions
@@ -1,19 +1,25 @@
package com.jero.modules.laws.part.job;
import com.jero.modules.laws.part.service.ILawsPartPmmPartitionInfoService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import javax.annotation.Resource;
/**
* 同步关键零部件数据
*/
@Slf4j
public class SyncPartPmmPartitionInfoJob implements Job {
@Resource
private ILawsPartPmmPartitionInfoService lawsPartPmmPartitionInfoService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
lawsPartPmmPartitionInfoService.truncateLawsPartPmmPartitionInfo();
lawsPartPmmPartitionInfoService.syncLawsPartPmmPartitionInfo();
}
}
@@ -12,6 +12,9 @@ public interface LawsPartPmmPartitionInfoMapper extends BaseMapper<LawsPartPmmPa
IPage<LawsPartPmmPartitionInfo> pageList(Page<LawsPartPmmPartitionInfo> page,
@Param(Constants.WRAPPER) QueryWrapper<LawsPartPmmPartitionInfo> queryWrapper);
void truncateLawsPartPmmPartitionInfo();
void syncLawsPartPmmPartitionInfo();
}
@@ -4,6 +4,15 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.laws.part.mapper.LawsPartPmmPartitionInfoMapper">
<insert id="syncLawsPartPmmPartitionInfo">
insert into laws_part_pmm_partition_info(reg_part_name_cn,fnd_gpc)
(SELECT regpartnamecn as reg_part_name_cn,CONCAT(fna,upc) as fnd_gpc FROM `ods_qr_cgbom_pmm_partition_info_df` where fna is not null and upc is not null
and regpartnamecn is not null and regpartnamecn != '-' and regpartnamecn != '/' group by CONCAT(fna,upc))
</insert>
<delete id="truncateLawsPartPmmPartitionInfo">
TRUNCATE TABLE laws_part_pmm_partition_info;
</delete>
<select id="pageList" resultType="com.jero.modules.laws.part.entity.LawsPartPmmPartitionInfo">
select l1.reg_part_name_cn,IF(l2.id is null,'2','1') as status from laws_part_pmm_partition_info l1
left join laws_part_relevance l2 on l1.reg_part_name_cn = l2.reg_part_name_cn and l2.del_flag = 0
@@ -12,4 +12,8 @@ public interface ILawsPartPmmPartitionInfoService extends IService<LawsPartPmmPa
IPage<LawsPartPmmPartitionInfo> page(LawsPartPmmPartitionInfo lawsPartPmmPartitionInfo,Integer pageNo,
Integer pageSize, HttpServletRequest req);
void truncateLawsPartPmmPartitionInfo();
void syncLawsPartPmmPartitionInfo();
}
@@ -38,6 +38,16 @@ public class LawsPartPmmPartitionInfoServiceImpl extends ServiceImpl<LawsPartPmm
IPage<LawsPartPmmPartitionInfo> re = lawsPartPmmPartitionInfoMapper.pageList(page, queryWrapper);
return re;
}
@Override
public void truncateLawsPartPmmPartitionInfo() {
lawsPartPmmPartitionInfoMapper.truncateLawsPartPmmPartitionInfo();
}
@Override
public void syncLawsPartPmmPartitionInfo() {
lawsPartPmmPartitionInfoMapper.syncLawsPartPmmPartitionInfo();
}
}