2023年10月31日 修复问题

This commit is contained in:
bai 2023-10-31 01:32:44 +08:00
parent 06d806d9c2
commit c6f155424f
3 changed files with 31 additions and 6 deletions

View File

@ -6,6 +6,7 @@ import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -24,6 +25,7 @@ import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -138,14 +140,16 @@ public class RefreshLiveServer extends BaseSync {
/** /**
* 刷新日志 * 刷新日志
*/ */
public void refreshState(){ public void refreshState(String jxlName){
QueryWrapper<KcZhihuijiaoshi> qw = new QueryWrapper<KcZhihuijiaoshi>(); QueryWrapper<KcZhihuijiaoshi> qw = new QueryWrapper<>();
//qw.eq("xm","教师近景"); //qw.eq("xm","教师近景");
qw.eq(StringUtils.isNotBlank(jxlName),"jxl_name",jxlName);
List<KcZhihuijiaoshi> list = kcZhihuijiaoshiService.list(qw); List<KcZhihuijiaoshi> list = kcZhihuijiaoshiService.list(qw);
//删除旧数据 //删除旧数据
kcZhihuijiaoshiStateLogService.remove(new QueryWrapper<>()); QueryWrapper<KcZhihuijiaoshiStateLog> rqw = new QueryWrapper<>();
rqw.eq(StringUtils.isNotBlank(jxlName),"jxl_name",jxlName);
kcZhihuijiaoshiStateLogService.remove(rqw);
Map<String, KcZhihuijiaoshiStateLog> stateLogMap = Maps.newHashMap(); Map<String, KcZhihuijiaoshiStateLog> stateLogMap = Maps.newHashMap();
list.forEach(x -> { list.forEach(x -> {
@ -195,6 +199,10 @@ public class RefreshLiveServer extends BaseSync {
} }
}); });
kcZhihuijiaoshiStateLogService.saveBatch(stateLogMap.values()); kcZhihuijiaoshiStateLogService.saveBatch(stateLogMap.values());
//更新全部的修改时间
UpdateWrapper<KcZhihuijiaoshiStateLog> uqw = new UpdateWrapper<>();
uqw.set("create_time",new Date());
kcZhihuijiaoshiStateLogService.update(uqw);
} }
/** /**

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.kc.grab.SynchronizationService; package org.jeecg.modules.kc.grab.SynchronizationService;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync; 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.Xxhbjsjbxx;
import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog; import org.jeecg.modules.kc.grab.imports.entity.Xxhbsynclog;
import org.jeecg.modules.kc.grab.imports.service.IXxhbjsjbxxService; 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.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -24,6 +27,9 @@ public class SyncTJwJsjbxxb extends BaseSync {
@Autowired @Autowired
private IXxhbjsjbxxService impService; private IXxhbjsjbxxService impService;
@Autowired
private IKcJiaoxuelouInfoService kcJiaoxuelouInfoService;
/** /**
* 若参数变量名修改 QuartzJobController中也需对应修改 * 若参数变量名修改 QuartzJobController中也需对应修改
*/ */
@ -70,6 +76,17 @@ public class SyncTJwJsjbxxb extends BaseSync {
xxhbsynclog.setSynctype("0");//同步类型 0全量 1增量 xxhbsynclog.setSynctype("0");//同步类型 0全量 1增量
xxhbsynclog.setErrormessage(errorMessage); xxhbsynclog.setErrormessage(errorMessage);
saveLog(xxhbsynclog,Xxhbjsjbxx.class); saveLog(xxhbsynclog,Xxhbjsjbxx.class);
//更新到表里
List<KcJiaoxuelouInfo> list = kcJiaoxuelouInfoService.list();
list.forEach(x -> {
QueryWrapper<Xxhbjsjbxx> 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);"
} }
/** /**

View File

@ -401,8 +401,8 @@ public class KcZhihuijiaoshiController extends JeecgController<KcZhihuijiaoshi,
* @return * @return
*/ */
@GetMapping(value = "/refreshLogs") @GetMapping(value = "/refreshLogs")
public Result<?> refreshLogs(){ public Result<?> refreshLogs(String jxlName){
refreshLiveServer.refreshState(); refreshLiveServer.refreshState(jxlName);
return Result.OK(kcZhihuijiaoshiStateLogService.list()); return Result.OK(kcZhihuijiaoshiStateLogService.list());
} }