2023年6月17日 修复定时任务

This commit is contained in:
bai 2023-06-17 00:44:21 +08:00
parent aa1a428dc3
commit b8517526db
19 changed files with 424 additions and 27 deletions

View File

@ -71,7 +71,7 @@ public class SyncTFwdtBkjxtkpj extends BaseSync {
Date date = new Date();//获取当前时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, -1);//当前时间前去一
calendar.add(Calendar.DAY_OF_MONTH, -1);//当前时间前去一
QueryWrapper<TFwdtBkjxtkpj> queryWrapper = new QueryWrapper<>();
// queryWrapper.like("timestamps", DateUtils.formatDate(calendar.getTime(),"yyyy-MM-dd"));//增量数据
queryWrapper.apply("trunc(timestamps,'dd') = to_date('"+DateUtils.formatDate(calendar.getTime(),"yyyy-MM-dd")+"','yyyy-mm-dd')");
@ -82,7 +82,7 @@ public class SyncTFwdtBkjxtkpj extends BaseSync {
inDataList.forEach(x -> outDataList.add(BeanUtil.toBean(x, Xxhbbkjxtkpj.class)));
//保存到胃
xxhbbkjxtkpjService.syncList(outDataList);
xxhbbkjxtkpjService.syncList(outDataList,false);
// for(Xxhbbkjxtkpj xxhbbkjxtkpj : outDataList){
// KcEvaluation kcEvaluation = new KcEvaluation();
@ -385,7 +385,7 @@ public class SyncTFwdtBkjxtkpj extends BaseSync {
Xxhbsynclog xxhbsynclog = new Xxhbsynclog();
xxhbsynclog.setTablename("附加定时任务,清洗服务大厅数据");
// xxhbsynclog.setTablename("附加定时任务,清洗服务大厅数据");
xxhbsynclog.setOratabname("T_ZZB_LDXX");//oracle表名
xxhbsynclog.setOratabnum(inDataList.size());//oracle表数量
xxhbsynclog.setTablenum(mysqlnum);//mysql表数量

View File

@ -0,0 +1,82 @@
package org.jeecg.modules.kc.grab.SynchronizationService;
import cn.hutool.core.bean.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
import org.jeecg.modules.kc.grab.exports.entity.TJzgXskc;
import org.jeecg.modules.kc.grab.exports.service.ITJzgXskcService;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbxskc;
import org.jeecg.modules.kc.grab.imports.service.IXxhbxskcService;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
@Slf4j
public class SyncTJzgXskc extends BaseSync {
@Autowired
private ITJzgXskcService expService;
@Autowired
private IXxhbxskcService impService;
/**
* 若参数变量名修改 QuartzJobController中也需对应修改
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) {
start();
run(getParamMap());
end();
}
/**
* 有参定时任务实现
* @param param
*/
public void run(Map<String, Object> param){
//查询数据
List<TJzgXskc> inDataList = expService.list();
List<Xxhbxskc> outDataList = Lists.newArrayList();
//清洗数据
inDataList.forEach(x -> outDataList.add(BeanUtil.toBean(x, Xxhbxskc.class)));
//保存到胃
int syncnum=0;
String errorMessage = "";
try {
impService.syncList(outDataList);
syncnum = outDataList.size();
}catch (Exception e){
e.printStackTrace();
errorMessage = e.getMessage();
}
Xxhbxskc xxhbxskc = impService.getSumnum();
int mysqlnum=xxhbxskc.getMysqlnum();
Xxhbsynclog xxhbsynclog = new Xxhbsynclog();
xxhbsynclog.setSyncRowNum(String.valueOf(outDataList.size()));
xxhbsynclog.setOratabname("T_JZG_XSKC");//oracle表名
xxhbsynclog.setOratabnum(inDataList.size());//oracle表数量
xxhbsynclog.setTablenum(mysqlnum);//mysql表数量
xxhbsynclog.setSyncnum(syncnum);//本次同步数据量
xxhbsynclog.setSynctype("0");//同步类型 0全量 1增量
xxhbsynclog.setErrormessage(errorMessage);
saveLog(xxhbsynclog,Xxhbxskc.class);
}
/**
* 无参定时任务实现
*/
public void run(){
run(null);
}
}

View File

@ -25,10 +25,10 @@ import lombok.experimental.Accessors;
* @Version: V1.0
*/
@Data
@TableName("TJwJsjbxx")
@TableName("T_JW_JSJBXX")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TJwJsjbxx对象", description="TJwJsjbxx")
@ApiModel(value="T_JW_JSJBXX对象", description="T_JW_JSJBXX")
public class TJwJsjbxx implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -25,10 +25,10 @@ import lombok.experimental.Accessors;
* @Version: V1.0
*/
@Data
@TableName("TJwJxljbxx")
@TableName("T_JW_JXLJBXX")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TJwJxljbxx对象", description="TJwJxljbxx")
@ApiModel(value="T_JW_JXLJBXX对象", description="T_JW_JXLJBXX")
public class TJwJxljbxx implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -0,0 +1,72 @@
package org.jeecg.modules.kc.grab.exports.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* @Description: T_ZZB_LDXX-抓取
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
@Data
@TableName("T_JZG_XSKC")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="T_JZG_XSKC对象", description="T_JZG_XSKC-抓取")
public class TJzgXskc {
/**gh*/
@Excel(name = "gh", width = 15)
@ApiModelProperty(value = "gh")
private java.lang.String gh;
/**xm*/
@Excel(name = "xm", width = 15)
@ApiModelProperty(value = "xm")
private java.lang.String xm;
/**xbm*/
@Excel(name = "xbm", width = 15)
@ApiModelProperty(value = "xbm")
private java.lang.String xbm;
/**dwh*/
@Excel(name = "dwh", width = 15)
@ApiModelProperty(value = "dwh")
private java.lang.String dwh;
/**dwmc*/
@Excel(name = "dwmc", width = 15)
@ApiModelProperty(value = "dwmc")
private java.lang.String dwmc;
/**csrq*/
@Excel(name = "csrq", width = 15)
@ApiModelProperty(value = "csrq")
private java.lang.String csrq;
/**spxldm*/
@Excel(name = "spxldm", width = 15)
@ApiModelProperty(value = "spxldm")
private java.lang.String spxldm;
/**sfzxm*/
@Excel(name = "sfzxm", width = 15)
@ApiModelProperty(value = "sfzxm")
private java.lang.String sfzxm;
/**zdxms*/
@Excel(name = "zdxms", width = 15)
@ApiModelProperty(value = "zdxms")
private java.lang.String zdxms;
/**zzzt*/
@Excel(name = "zzzt", width = 15)
@ApiModelProperty(value = "zzzt")
private java.lang.String zzzt;
/**timestamps*/
@Excel(name = "timestamps", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "timestamps")
private java.util.Date timestamps;
}

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.kc.grab.exports.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.kc.grab.exports.entity.TJzgXskc;
/**
* @Description: T_JZG_XSKC-抓取
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
public interface TJzgXskcMapper extends BaseMapper<TJzgXskc> {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.grab.exports.mapper.TJzgXskcMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.kc.grab.exports.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.kc.grab.exports.entity.TJzgXskc;
/**
* @Description: T_JZG_XSKC-抓取
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
public interface ITJzgXskcService extends IService<TJzgXskc> {
}

View File

@ -0,0 +1,20 @@
package org.jeecg.modules.kc.grab.exports.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.kc.grab.exports.entity.TJzgXskc;
import org.jeecg.modules.kc.grab.exports.mapper.TJzgXskcMapper;
import org.jeecg.modules.kc.grab.exports.service.ITJzgXskcService;
import org.springframework.stereotype.Service;
/**
* @Description: T_JZG_XSKC-抓取
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
@DS("multi-oracle")
@Service
public class TJzgXskcServiceImpl extends ServiceImpl<TJzgXskcMapper, TJzgXskc> implements ITJzgXskcService {
}

View File

@ -0,0 +1,87 @@
package org.jeecg.modules.kc.grab.imports.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 同步数据表(Xxhbxskc)
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
@Data
@TableName("Xxhbxskc")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Xxhbxskc对象", description="同步数据表(Xxhbxskc)")
public class Xxhbxskc implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**课程性质代码*/
/**gh*/
@Excel(name = "gh", width = 15)
@ApiModelProperty(value = "gh")
private java.lang.String gh;
/**xm*/
@Excel(name = "xm", width = 15)
@ApiModelProperty(value = "xm")
private java.lang.String xm;
/**xbm*/
@Excel(name = "xbm", width = 15)
@ApiModelProperty(value = "xbm")
private java.lang.String xbm;
/**dwh*/
@Excel(name = "dwh", width = 15)
@ApiModelProperty(value = "dwh")
private java.lang.String dwh;
/**dwmc*/
@Excel(name = "dwmc", width = 15)
@ApiModelProperty(value = "dwmc")
private java.lang.String dwmc;
/**csrq*/
@Excel(name = "csrq", width = 15)
@ApiModelProperty(value = "csrq")
private java.lang.String csrq;
/**spxldm*/
@Excel(name = "spxldm", width = 15)
@ApiModelProperty(value = "spxldm")
private java.lang.String spxldm;
/**sfzxm*/
@Excel(name = "sfzxm", width = 15)
@ApiModelProperty(value = "sfzxm")
private java.lang.String sfzxm;
/**zdxms*/
@Excel(name = "zdxms", width = 15)
@ApiModelProperty(value = "zdxms")
private java.lang.String zdxms;
/**zzzt*/
@Excel(name = "zzzt", width = 15)
@ApiModelProperty(value = "zzzt")
private java.lang.String zzzt;
/**timestamps*/
@Excel(name = "timestamps", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value = "timestamps")
private java.util.Date timestamps;
@TableField(exist = false)
private Integer mysqlnum;
}

View File

@ -0,0 +1,15 @@
package org.jeecg.modules.kc.grab.imports.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbxskc;
/**
* @Description: 同步数据表(xsxkb)
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
public interface XxhbxskcMapper extends BaseMapper<Xxhbxskc> {
Xxhbxskc getSumnum();
}

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.grab.imports.mapper.XxhbbkjxtkpjMapper">
<select id="getSumnum">
<select id="getSumnum" resultType="org.jeecg.modules.kc.grab.imports.entity.Xxhbbkjxtkpj">
select count(*) as mysqlnum from xxhbbkjxtkpj
</select>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.kc.grab.imports.mapper.XxhbxskcMapper">
<select id="getSumnum" resultType="org.jeecg.modules.kc.grab.imports.entity.Xxhbxskc">
select count(*) as mysqlnum from xxhbxskc
</select>
</mapper>

View File

@ -0,0 +1,34 @@
package org.jeecg.modules.kc.grab.imports.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbxskc;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbxsxkb;
import java.util.Collection;
/**
* @Description: 同步数据表(xsxkb)
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
public interface IXxhbxskcService extends IService<Xxhbxskc> {
/**
* 同步数据
* @param entityList
* @return
*/
boolean syncList(Collection<Xxhbxskc> entityList);
/**
*
* @param entityList
* @param isDelete
* @return
*/
boolean syncList(Collection<Xxhbxskc> entityList, QueryWrapper queryWrapper, boolean isDelete);
Xxhbxskc getSumnum();
}

View File

@ -29,10 +29,10 @@ public class XxhbbkjxtkpjServiceImpl extends ServiceImpl<XxhbbkjxtkpjMapper, Xxh
@Override
@Transactional(rollbackFor = {Exception.class})
public boolean syncList(Collection<Xxhbbkjxtkpj> entityList, boolean isDelete) {
// QueryWrapper dqw = new QueryWrapper();
// if(isDelete){
// baseMapper.delete(dqw);
// }
QueryWrapper dqw = new QueryWrapper();
if(isDelete){
baseMapper.delete(dqw);
}
return this.saveBatch(entityList, 1000);
}

View File

@ -0,0 +1,42 @@
package org.jeecg.modules.kc.grab.imports.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbxskc;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbxsxkb;
import org.jeecg.modules.kc.grab.imports.mapper.XxhbxskcMapper;
import org.jeecg.modules.kc.grab.imports.service.IXxhbxskcService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
/**
* @Description: 同步数据表(xsxkb)
* @Author: jeecg-boot
* @Date: 2023-04-11
* @Version: V1.0
*/
@Service
public class XxhbxskcServiceImpl extends ServiceImpl<XxhbxskcMapper, Xxhbxskc> implements IXxhbxskcService {
@Override
@Transactional(rollbackFor = {Exception.class})
public boolean syncList(Collection<Xxhbxskc> entityList) {
return syncList(entityList,new QueryWrapper(), true);
}
@Override
@Transactional(rollbackFor = {Exception.class})
public boolean syncList(Collection<Xxhbxskc> entityList,QueryWrapper queryWrapper , boolean isDelete) {
if(isDelete){
baseMapper.delete(queryWrapper);
}
return this.saveBatch(entityList, 1000);
}
@Override
public Xxhbxskc getSumnum() {
return baseMapper.getSumnum();
}
}

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.kc.jiaoshi.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -13,6 +14,7 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.beust.jcommander.internal.Sets;
import com.google.common.collect.Maps;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
@ -119,7 +121,7 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
jcqw.like("jieci","");
List<KcJieci> kcJieciList= kcJieciService.list(jcqw);
Map<String, JieciIntTime> kcJieciMap = Maps.newHashMap();
Map<String, JieciIntTime> nextKcJieciMap = Maps.newHashMap();
Set<String> nextKcJieciSet = Sets.newHashSet();
kcJieciList.forEach(x -> {
JieciIntTime jieciIntTime = new JieciIntTime();
jieciIntTime.setKsTime(Integer.parseInt(x.getHhks()));
@ -129,28 +131,30 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
//符合当前节
kcJieciMap.put(x.getJieci(), jieciIntTime);
}
//下一节次
});
//补充进下一节次里
kcJieciMap.forEach((k,v) -> {
if(nextJcMap.containsKey(k)){
String nextKey = nextJcMap.get(k);
if(kcJieciMap.containsKey(nextKey)){
nextKcJieciMap.put(nextKey,kcJieciMap.get(nextKey));
}
//if(kcJieciMap.containsKey(nextKey)){
nextKcJieciSet.add(nextKey);//存下一节课占个可以就行
//}
}
});
//根据节次信息包装进Map
Map<String, KcKetangbiao> kcKetangbiaoNowMap = Maps.newHashMap();
Map<String, KcKetangbiao> kcKetangbiaoNextMap = Maps.newHashMap();
Set<String> kcKetangbiaoNowSet = Sets.newHashSet();
Set<String> kcKetangbiaoNextSet = Sets.newHashSet();
kcKetangbiaoList.forEach(x -> {
//匹配是否在上课范围内
if(kcJieciMap.containsKey(x.getHh())){
kcKetangbiaoNowMap.put(x.getJsbh(),x);
kcKetangbiaoNowSet.add(x.getJsbh());
}
if(nextKcJieciMap.containsKey(x.getHh())){
kcKetangbiaoNextMap.put(x.getJsbh(),x);
if(nextKcJieciSet.contains(x.getHh())){
kcKetangbiaoNextSet.add(x.getJsbh());
}
});
@ -165,10 +169,10 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
//kcJieciMap.containsKey(x.getHh)
//nowTimeNum
if(kcKetangbiaoNowMap.containsKey(x.getJsbh())){
if(kcKetangbiaoNowSet.contains(x.getJsbh())){
x.setNowIsClass(true);
}
if(kcKetangbiaoNextMap.containsKey(x.getJsbh())){
if(kcKetangbiaoNextSet.contains(x.getJsbh())){
x.setNextIsClass(true);
}
});
@ -182,7 +186,7 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
String nowTimeStr = starTime.toString("HHmm");
int nowTimeNum = Integer.parseInt(nowTimeStr);
// 0102, 0800, 0930
// 0102, 0800, 0930
// 0304, 1000, 1130
// 0506, 1330, 1500
// 0708, 1515, 1645

View File

@ -251,7 +251,7 @@ public class KcEvaluationController extends JeecgController<KcEvaluation, IKcEva
List<KcEvaluation> exportList = kcEvaluationService.selectKkdwExportList(kcEvaluation);
Map<Integer,String> sourceDictMap = Maps.newHashMap();
//0门户添加1老系统2政务大厅3后台导入
sourceDictMap.put(0,"信息中心");
sourceDictMap.put(0,"课程中心");
sourceDictMap.put(1,"老系统");
sourceDictMap.put(2,"服务大厅");
sourceDictMap.put(3,"线下纸质");
@ -353,7 +353,7 @@ public class KcEvaluationController extends JeecgController<KcEvaluation, IKcEva
Map<Integer,String> sourceDictMap = Maps.newHashMap();
//0门户添加1老系统2政务大厅3后台导入
sourceDictMap.put(0,"信息中心");
sourceDictMap.put(0,"课程中心");
sourceDictMap.put(1,"老系统");
sourceDictMap.put(2,"服务大厅");
sourceDictMap.put(3,"线下纸质");

View File

@ -106,7 +106,7 @@ public class TingKeStatisticsController {
//---------------------补数据1------------------------------------------
Map<Integer,String> sourceDictMap = Maps.newHashMap();
//0门户添加1老系统2政务大厅3后台导入
sourceDictMap.put(0,"信息中心");
sourceDictMap.put(0,"课程中心");
sourceDictMap.put(1,"老系统");
sourceDictMap.put(2,"服务大厅");
sourceDictMap.put(3,"线下纸质");