修改课程信息表同步数据

This commit is contained in:
yangjun 2023-10-08 10:12:46 +08:00
parent 8b6103d001
commit 13de93bf7e
2 changed files with 88 additions and 87 deletions

View File

@ -71,98 +71,98 @@ public class SyncKcktStat extends BaseSync {
//-----------------修改课程表数据------------------------
KcKechengbiao kcKechengbiao = new KcKechengbiao();
kcKechengbiao.setXqxn(kcSysConfig.getFlag1());
List<KcKechengbiao> kckblist = kcKechengbiaoService.getKechengbiaoList(kcKechengbiao);
for(KcKechengbiao KcKechengbiaoPar:kckblist){
QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
kcKechengbiaoQueryWrapper.eq("kcbh",KcKechengbiaoPar.getKcbh());
kcKechengbiaoQueryWrapper.eq("kcmc",KcKechengbiaoPar.getKcmc());
kcKechengbiaoQueryWrapper.eq("jgh",KcKechengbiaoPar.getJgh());
kcKechengbiaoQueryWrapper.eq("skjs",KcKechengbiaoPar.getSkjs());
kcKechengbiaoQueryWrapper.eq("zc",KcKechengbiaoPar.getZc());
kcKechengbiaoQueryWrapper.eq("rwbh",KcKechengbiaoPar.getRwbh());
kcKechengbiaoQueryWrapper.eq("kkdwid",KcKechengbiaoPar.getKkdwid());
kcKechengbiaoQueryWrapper.eq("kcxz",KcKechengbiaoPar.getKcxz());
kcKechengbiaoQueryWrapper.eq("jsbh",KcKechengbiaoPar.getJsbh());
kcKechengbiaoQueryWrapper.eq("skdd",KcKechengbiaoPar.getSkdd());
kcKechengbiaoQueryWrapper.eq("sksj",KcKechengbiaoPar.getSksj());
kcKechengbiaoQueryWrapper.eq("jkzc",KcKechengbiaoPar.getJkzc());
kcKechengbiaoQueryWrapper.eq("xf",KcKechengbiaoPar.getXf());
kcKechengbiaoQueryWrapper.eq("xnxq",KcKechengbiaoPar.getXnxq());
kcKechengbiaoQueryWrapper.eq("kcdl",KcKechengbiaoPar.getKcdl());
List<KcKechengbiao> KcKechengbiaoInsList = kcKechengbiaoService.list(kcKechengbiaoQueryWrapper);
if(KcKechengbiaoInsList!=null&&KcKechengbiaoInsList.size()>0){
for(KcKechengbiao KcKechengbiao : KcKechengbiaoInsList){
BeanUtils.copyProperties(KcKechengbiaoPar,KcKechengbiao);
kcKechengbiaoService.updateById(KcKechengbiao);
}
}else{
kcKechengbiaoService.saveOne(KcKechengbiaoPar);
}
}
//-----------------初始化数据------------------------
//-------------------删除本年的课程数据冰倩是当天及以后的----------------------
QueryWrapper<KcKetangbiao> KcKetangbiaoQueryWrapper = new QueryWrapper<>();
KcKetangbiaoQueryWrapper.eq("xnxq",kcSysConfig.getFlag1());
KcKetangbiaoQueryWrapper.ge("skrq",DateUtils.formatDate(dateNow,"yyyy-MM-dd"));
kcKetangbiaoService.remove(KcKetangbiaoQueryWrapper);
//-------------------删除本年的课程数据冰倩是当天及以后的----------------------
String bxqkssj = kcSysConfig.getBxqkssj();
//插入数据
KcKetangbiao kcKetangbiao = new KcKetangbiao();
kcKetangbiao.setXnxq(kcSysConfig.getFlag1());
List<KcKetangbiao> list = kcKetangbiaoService.selectSyncList(kcKetangbiao);
List<KcKetangbiao> arrayList = new ArrayList<>();
for(int i=0;i<list.size();i++){
KcKetangbiao kcKetangbiaoOld = list.get(i);
try {
String jkzc[] = kcKetangbiaoOld.getJkzc().split(",");
String week = kcKetangbiaoOld.getWeek();
for(int j=0;j<jkzc.length;j++){
KcKetangbiao kcKetangbiaoAddNew = new KcKetangbiao();
int djz = Integer.parseInt(jkzc[j]);
BeanUtils.copyProperties(kcKetangbiaoOld,kcKetangbiaoAddNew);
kcKetangbiaoAddNew.setId(null);
//skrq 生成规则取本学开始时间kc_sys_config.bxqkssj+(jkzc-1)*7+week
int addSj = (djz -1 )*7+Integer.parseInt(week)-1;
Date date = DateUtils.parseDate(bxqkssj,"yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, addSj);
String skrq = DateUtils.formatDate(c,"yyyy-MM-dd");
String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
//判断生成数据的skrq是否大于等于当前日期如果满足则进行新增否则不动
if(DateUtils.parseDate(skrq,"yyyy-MM-dd").getTime()>=DateUtils.parseDate(dasj,"yyyy-MM-dd").getTime()){
kcKetangbiaoAddNew.setSkrq(skrq);
kcKetangbiaoAddNew.setDijizhou(djz);
kcKetangbiaoAddNew.setXnxq(kcSysConfig.getFlag1());
arrayList.add(kcKetangbiaoAddNew);
}
}
}catch (Exception e){
e.printStackTrace();
}
}
kcKetangbiaoService.saveBatch(arrayList);
//修改智慧教室关联的课堂表id-- 清洗智慧教室数据
kcKetangbiaoService.updateJsbh();
//修改智慧教室关联的课堂表id-- 清洗智慧教室数据
KcKetangbiao kcKetangbiaoup = new KcKetangbiao();
kcKetangbiaoup.setSkxs(1);
kcKetangbiaoup.setXnxq(kcSysConfig.getFlag1());
kcKetangbiaoService.updateSkxs(kcKetangbiaoup);
// KcKechengbiao kcKechengbiao = new KcKechengbiao();
// kcKechengbiao.setXqxn(kcSysConfig.getFlag1());
// List<KcKechengbiao> kckblist = kcKechengbiaoService.getKechengbiaoList(kcKechengbiao);
// for(KcKechengbiao KcKechengbiaoPar:kckblist){
// QueryWrapper<KcKechengbiao> kcKechengbiaoQueryWrapper = new QueryWrapper<>();
// kcKechengbiaoQueryWrapper.eq("kcbh",KcKechengbiaoPar.getKcbh());
// kcKechengbiaoQueryWrapper.eq("kcmc",KcKechengbiaoPar.getKcmc());
// kcKechengbiaoQueryWrapper.eq("jgh",KcKechengbiaoPar.getJgh());
// kcKechengbiaoQueryWrapper.eq("skjs",KcKechengbiaoPar.getSkjs());
// kcKechengbiaoQueryWrapper.eq("zc",KcKechengbiaoPar.getZc());
// kcKechengbiaoQueryWrapper.eq("rwbh",KcKechengbiaoPar.getRwbh());
// kcKechengbiaoQueryWrapper.eq("kkdwid",KcKechengbiaoPar.getKkdwid());
// kcKechengbiaoQueryWrapper.eq("kcxz",KcKechengbiaoPar.getKcxz());
// kcKechengbiaoQueryWrapper.eq("jsbh",KcKechengbiaoPar.getJsbh());
// kcKechengbiaoQueryWrapper.eq("skdd",KcKechengbiaoPar.getSkdd());
// kcKechengbiaoQueryWrapper.eq("sksj",KcKechengbiaoPar.getSksj());
// kcKechengbiaoQueryWrapper.eq("jkzc",KcKechengbiaoPar.getJkzc());
// kcKechengbiaoQueryWrapper.eq("xf",KcKechengbiaoPar.getXf());
// kcKechengbiaoQueryWrapper.eq("xnxq",KcKechengbiaoPar.getXnxq());
// kcKechengbiaoQueryWrapper.eq("kcdl",KcKechengbiaoPar.getKcdl());
//
// List<KcKechengbiao> KcKechengbiaoInsList = kcKechengbiaoService.list(kcKechengbiaoQueryWrapper);
// if(KcKechengbiaoInsList!=null&&KcKechengbiaoInsList.size()>0){
// for(KcKechengbiao KcKechengbiao : KcKechengbiaoInsList){
// BeanUtils.copyProperties(KcKechengbiaoPar,KcKechengbiao);
// kcKechengbiaoService.updateById(KcKechengbiao);
// }
// }else{
// kcKechengbiaoService.saveOne(KcKechengbiaoPar);
// }
// }
// //-----------------初始化数据------------------------
//
// //-------------------删除本年的课程数据冰倩是当天及以后的----------------------
// QueryWrapper<KcKetangbiao> KcKetangbiaoQueryWrapper = new QueryWrapper<>();
// KcKetangbiaoQueryWrapper.eq("xnxq",kcSysConfig.getFlag1());
// KcKetangbiaoQueryWrapper.ge("skrq",DateUtils.formatDate(dateNow,"yyyy-MM-dd"));
// kcKetangbiaoService.remove(KcKetangbiaoQueryWrapper);
// //-------------------删除本年的课程数据冰倩是当天及以后的----------------------
//
// String bxqkssj = kcSysConfig.getBxqkssj();
// //插入数据
// KcKetangbiao kcKetangbiao = new KcKetangbiao();
// kcKetangbiao.setXnxq(kcSysConfig.getFlag1());
// List<KcKetangbiao> list = kcKetangbiaoService.selectSyncList(kcKetangbiao);
// List<KcKetangbiao> arrayList = new ArrayList<>();
// for(int i=0;i<list.size();i++){
// KcKetangbiao kcKetangbiaoOld = list.get(i);
// try {
// String jkzc[] = kcKetangbiaoOld.getJkzc().split(",");
// String week = kcKetangbiaoOld.getWeek();
// for(int j=0;j<jkzc.length;j++){
// KcKetangbiao kcKetangbiaoAddNew = new KcKetangbiao();
// int djz = Integer.parseInt(jkzc[j]);
// BeanUtils.copyProperties(kcKetangbiaoOld,kcKetangbiaoAddNew);
// kcKetangbiaoAddNew.setId(null);
// //skrq 生成规则取本学开始时间kc_sys_config.bxqkssj+(jkzc-1)*7+week
// int addSj = (djz -1 )*7+Integer.parseInt(week)-1;
// Date date = DateUtils.parseDate(bxqkssj,"yyyy-MM-dd");
// Calendar c = Calendar.getInstance();
// c.setTime(date);
// c.add(Calendar.DAY_OF_MONTH, addSj);
// String skrq = DateUtils.formatDate(c,"yyyy-MM-dd");
// String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
// //判断生成数据的skrq是否大于等于当前日期如果满足则进行新增否则不动
// if(DateUtils.parseDate(skrq,"yyyy-MM-dd").getTime()>=DateUtils.parseDate(dasj,"yyyy-MM-dd").getTime()){
// kcKetangbiaoAddNew.setSkrq(skrq);
// kcKetangbiaoAddNew.setDijizhou(djz);
// kcKetangbiaoAddNew.setXnxq(kcSysConfig.getFlag1());
// arrayList.add(kcKetangbiaoAddNew);
// }
// }
// }catch (Exception e){
// e.printStackTrace();
// }
// }
// kcKetangbiaoService.saveBatch(arrayList);
//
// //修改智慧教室关联的课堂表id-- 清洗智慧教室数据
// kcKetangbiaoService.updateJsbh();
//
// //修改智慧教室关联的课堂表id-- 清洗智慧教室数据
// KcKetangbiao kcKetangbiaoup = new KcKetangbiao();
// kcKetangbiaoup.setSkxs(1);
// kcKetangbiaoup.setXnxq(kcSysConfig.getFlag1());
// kcKetangbiaoService.updateSkxs(kcKetangbiaoup);
//修改调停课时间
String dasj = DateUtils.formatDate(dateNow,"yyyy-MM-dd");
QueryWrapper<KcKetangbiaoSkrqLog> kcKetangbiaoSkrqLogQueryWrapper = new QueryWrapper<>();
kcKetangbiaoSkrqLogQueryWrapper.ge("tzrq",dasj);
kcKetangbiaoSkrqLogQueryWrapper.ge("jsrq",dasj);
List<KcKetangbiaoSkrqLog> list1 = kcKetangbiaoSkrqLogService.list(kcKetangbiaoSkrqLogQueryWrapper);
for(KcKetangbiaoSkrqLog KcKetangbiaoSkrqLog:list1){
UpdateWrapper<KcKetangbiao> KcKetangbiaoUpdateWrapper = new UpdateWrapper<>();

View File

@ -34,6 +34,7 @@ public class KcKetangbiaoSkrqLog implements Serializable {
private String skrq;
private String tzrq;
private String jsrq;
}