From c6f155424f6da72f46e2f86d97c27633f52d99b9 Mon Sep 17 00:00:00 2001 From: bai <1643359946@qq.com> Date: Tue, 31 Oct 2023 01:32:44 +0800 Subject: [PATCH] =?UTF-8?q?2023=E5=B9=B410=E6=9C=8831=E6=97=A5=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RefreshLiveServer.java | 16 ++++++++++++---- .../SynchronizationService/SyncTJwJsjbxxb.java | 17 +++++++++++++++++ .../controller/KcZhihuijiaoshiController.java | 4 ++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java index 422c9645..863f864a 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/RefreshLiveServer.java @@ -6,6 +6,7 @@ import cn.hutool.core.util.CharsetUtil; import cn.hutool.crypto.SecureUtil; import cn.hutool.http.HttpUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; @@ -24,6 +25,7 @@ import org.quartz.JobExecutionContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -138,14 +140,16 @@ public class RefreshLiveServer extends BaseSync { /** * 刷新日志 */ - public void refreshState(){ - QueryWrapper qw = new QueryWrapper(); + public void refreshState(String jxlName){ + QueryWrapper qw = new QueryWrapper<>(); //qw.eq("xm","教师近景"); - + qw.eq(StringUtils.isNotBlank(jxlName),"jxl_name",jxlName); List list = kcZhihuijiaoshiService.list(qw); //删除旧数据 - kcZhihuijiaoshiStateLogService.remove(new QueryWrapper<>()); + QueryWrapper rqw = new QueryWrapper<>(); + rqw.eq(StringUtils.isNotBlank(jxlName),"jxl_name",jxlName); + kcZhihuijiaoshiStateLogService.remove(rqw); Map stateLogMap = Maps.newHashMap(); list.forEach(x -> { @@ -195,6 +199,10 @@ public class RefreshLiveServer extends BaseSync { } }); kcZhihuijiaoshiStateLogService.saveBatch(stateLogMap.values()); + //更新全部的修改时间 + UpdateWrapper uqw = new UpdateWrapper<>(); + uqw.set("create_time",new Date()); + kcZhihuijiaoshiStateLogService.update(uqw); } /** diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwJsjbxxb.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwJsjbxxb.java index 44c6931f..afe8dac7 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwJsjbxxb.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/grab/SynchronizationService/SyncTJwJsjbxxb.java @@ -1,6 +1,7 @@ package org.jeecg.modules.kc.grab.SynchronizationService; import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.compress.utils.Lists; import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync; @@ -9,6 +10,8 @@ import org.jeecg.modules.kc.grab.exports.service.ITJwJsjbxxService; import org.jeecg.modules.kc.grab.imports.entity.Xxhbjsjbxx; import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog; import org.jeecg.modules.kc.grab.imports.service.IXxhbjsjbxxService; +import org.jeecg.modules.kc.jiaoshi.entity.KcJiaoxuelouInfo; +import org.jeecg.modules.kc.jiaoshi.service.IKcJiaoxuelouInfoService; import org.quartz.JobExecutionContext; import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +27,9 @@ public class SyncTJwJsjbxxb extends BaseSync { @Autowired private IXxhbjsjbxxService impService; + @Autowired + private IKcJiaoxuelouInfoService kcJiaoxuelouInfoService; + /** * 若参数变量名修改 QuartzJobController中也需对应修改 */ @@ -70,6 +76,17 @@ public class SyncTJwJsjbxxb extends BaseSync { xxhbsynclog.setSynctype("0");//同步类型 0全量 1增量 xxhbsynclog.setErrormessage(errorMessage); saveLog(xxhbsynclog,Xxhbjsjbxx.class); + //更新到表里 + List list = kcJiaoxuelouInfoService.list(); + list.forEach(x -> { + QueryWrapper qw = new QueryWrapper<>(); + qw.apply("jxlh in (select JZWH from xxhbjxljbxx where jzwmc in ('"+x.getJxlhName()+"') and yxh is not null)"); + x.setJsNum(String.valueOf(impService.count(qw))); + }); +// "select count(*) from xxhbjsjbxx where jxlh in (select JZWH from xxhbjxljbxx where jzwmc in ('逸夫教学楼') and yxh is not null); +// select count(*) from xxhbjsjbxx where jxlh in (select JZWH from xxhbjxljbxx where jzwmc in ('惟真楼') and yxh is not null); +// select count(*) from xxhbjsjbxx where jxlh in (select JZWH from xxhbjxljbxx where jzwmc in ('净月综合教学楼') and yxh is null);" + } /** diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/jiaoshi/controller/KcZhihuijiaoshiController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/jiaoshi/controller/KcZhihuijiaoshiController.java index 5f83cce8..224e668f 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/jiaoshi/controller/KcZhihuijiaoshiController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/jiaoshi/controller/KcZhihuijiaoshiController.java @@ -401,8 +401,8 @@ public class KcZhihuijiaoshiController extends JeecgController refreshLogs(){ - refreshLiveServer.refreshState(); + public Result refreshLogs(String jxlName){ + refreshLiveServer.refreshState(jxlName); return Result.OK(kcZhihuijiaoshiStateLogService.list()); }