修改bug
This commit is contained in:
parent
fdbcf00229
commit
2e9b941b8c
|
|
@ -0,0 +1,47 @@
|
|||
package org.jeecg.modules.kc.detection.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.kc.detection.service.IKcDetectionDetailedService;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
|
||||
import org.jeecg.modules.kc.zyInfoStudent.service.IZyInfoStudentService;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class VideoJobParams extends BaseSync {
|
||||
|
||||
@Resource
|
||||
private IKcDetectionDetailedService detectionDetailedService;
|
||||
|
||||
/**
|
||||
* 若参数变量名修改 QuartzJobController中也需对应修改
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) {
|
||||
start();
|
||||
run(getParamMap());
|
||||
end();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 有参定时任务实现
|
||||
* @param param
|
||||
*/
|
||||
public void run(Map<String, Object> param){
|
||||
String jsbh = param.get("jsbh").toString();
|
||||
detectionDetailedService.videoScreenshotByJsbh(jsbh);//
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参定时任务实现
|
||||
*/
|
||||
public void run(){
|
||||
run(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,4 +15,5 @@ public interface IKcDetectionDetailedService extends IService<KcDetectionDetaile
|
|||
|
||||
void videoScreenshotAll();
|
||||
|
||||
void videoScreenshotByJsbh(String jsbh);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -266,32 +266,33 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
JSONObject object= JSON.parseObject(rJson);
|
||||
|
||||
log.info("----------百度-object--------------{}",object);
|
||||
Integer num = object.getInteger("person_num");
|
||||
if(num == null){
|
||||
if(detectionDetailed.getNum() == null){
|
||||
detectionDetailed.setNum(0);
|
||||
if(object != null){
|
||||
Integer num = object.getInteger("person_num");
|
||||
if(num == null){
|
||||
if(detectionDetailed.getNum() == null){
|
||||
detectionDetailed.setNum(0);
|
||||
}
|
||||
} else {
|
||||
detectionDetailed.setNum(num);
|
||||
}
|
||||
} else {
|
||||
detectionDetailed.setNum(num);
|
||||
Integer allNum = detectionMain.getAllNum();
|
||||
allNum += detectionDetailed.getNum();
|
||||
detectionMain.setAllNum(allNum);
|
||||
detectionMain.setAverageNum(allNum/detectionNum);
|
||||
log.info("----------detectionMain--------------{}",detectionMain);
|
||||
//保存主表
|
||||
if(StringUtils.isBlank(detectionMain.getId())){
|
||||
kcDetectionMainService.save(detectionMain);
|
||||
} else {
|
||||
kcDetectionMainService.updateById(detectionMain);
|
||||
}
|
||||
detectionDetailed.setPid(detectionMain.getId());
|
||||
log.info("----------detectionDetailed--------------{}",detectionDetailed);
|
||||
//保存子表
|
||||
save(detectionDetailed);
|
||||
}
|
||||
}
|
||||
|
||||
Integer allNum = detectionMain.getAllNum();
|
||||
allNum += detectionDetailed.getNum();
|
||||
detectionMain.setAllNum(allNum);
|
||||
detectionMain.setAverageNum(allNum/detectionNum);
|
||||
log.info("----------detectionMain--------------{}",detectionMain);
|
||||
//保存主表
|
||||
if(StringUtils.isBlank(detectionMain.getId())){
|
||||
kcDetectionMainService.save(detectionMain);
|
||||
} else {
|
||||
kcDetectionMainService.updateById(detectionMain);
|
||||
}
|
||||
detectionDetailed.setPid(detectionMain.getId());
|
||||
log.info("----------detectionDetailed--------------{}",detectionDetailed);
|
||||
//保存子表
|
||||
save(detectionDetailed);
|
||||
|
||||
});
|
||||
|
||||
calls.forEach(threadService::submit);
|
||||
|
|
@ -305,4 +306,209 @@ public class KcDetectionDetailedServiceImpl extends ServiceImpl<KcDetectionDetai
|
|||
log.info("----------抓取图片结束--------------");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void videoScreenshotByJsbh(String jsbh) {
|
||||
DateTime now = DateTime.now();
|
||||
String nowStr = now.toString("yyyy-MM-dd");
|
||||
|
||||
String yearMonthStr = now.toString("yyyy-MM");
|
||||
|
||||
CompletionService<Boolean> threadService = ThreadUtil.newCompletionService(Executors.newFixedThreadPool(2));
|
||||
|
||||
List<Callable<Boolean>> calls = Lists.newArrayList();
|
||||
|
||||
log.info("------videoScreenshotByJsbh----抓取图片开始--------------");
|
||||
|
||||
//新版,查询当前是否有课
|
||||
KcZhihuijiaoshi jiaoshi = new KcZhihuijiaoshi();
|
||||
jiaoshi.setXm("学生全景");
|
||||
jiaoshi.setChangshang("奥威亚");
|
||||
QueryWrapper<KcZhihuijiaoshi> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("xm","学生全景");
|
||||
queryWrapper.eq("changshang","奥威亚");
|
||||
|
||||
String hh = "";
|
||||
KcJieci kcJieci = new KcJieci();
|
||||
List<KcJieci> kcJieciList = jieciService.getIndexJcList(kcJieci);
|
||||
log.info("------videoScreenshotByJsbh----kcJieciList--------------{}",kcJieciList);
|
||||
if(kcJieciList != null && !kcJieciList.isEmpty()){
|
||||
KcJieci kcJieciParam = kcJieciList.get(0);
|
||||
String[] jcArray = StringUtils.split(kcJieciParam.getJieci(),"、");
|
||||
|
||||
hh = kcJieciParam.getJieci() + "," + String.join(",", jcArray);
|
||||
}
|
||||
|
||||
|
||||
log.info("-----videoScreenshotByJsbh----hh--------------{}",hh);
|
||||
KcKetangbiao kcKetangbiao = new KcKetangbiao();
|
||||
kcKetangbiao.setSfyzhjs("1");
|
||||
kcKetangbiao.setHh(hh);
|
||||
kcKetangbiao.setSkrq(nowStr);
|
||||
// kcKetangbiao.setSkrq("2024-06-14");
|
||||
kcKetangbiao.setSkxs(1);
|
||||
kcKetangbiao.setSbType("1");
|
||||
kcKetangbiao.setSftkb("1");
|
||||
kcKetangbiao.setYwskxs("");
|
||||
log.info("-----videoScreenshotByJsbh-----kcKetangbiao--------------{}",kcKetangbiao);
|
||||
if(StringUtils.equals(",", hh)){
|
||||
log.error("未查到节次,原因未知!");
|
||||
return;
|
||||
}
|
||||
|
||||
Page<KcKetangbiao> page = new Page<>(1, -1);
|
||||
if(StringUtils.isNotBlank(jsbh)){
|
||||
kcKetangbiao.setJsbh(jsbh);
|
||||
}
|
||||
IPage<KcKetangbiao> pageList = kcKetangbiaoService.getKclblist(page, kcKetangbiao);
|
||||
|
||||
log.info("-----videoScreenshotByJsbh-----pageList--------------{},{}",pageList.getRecords().size(),pageList.getRecords());
|
||||
if(pageList != null){
|
||||
List<KcKetangbiao> list = pageList.getRecords();
|
||||
Set<String> jsbhSet = Sets.newHashSet();
|
||||
Map<String, KcKetangbiao> KcKetangbiaoMap = Maps.newHashMap();
|
||||
list.forEach(x -> {
|
||||
KcKetangbiaoMap.put(x.getJsbh(), x);
|
||||
jsbhSet.add(x.getJsbh());
|
||||
});
|
||||
log.info("-----videoScreenshotByJsbh-----jsbhSet--------------{}",jsbhSet);
|
||||
if(jsbhSet.isEmpty()){
|
||||
log.error("未找到对应的可线上听课课堂");
|
||||
return;
|
||||
}
|
||||
//取智慧教室信息
|
||||
//id: item.jsbh, ktId: item.id
|
||||
QueryWrapper<KcZhihuijiaoshi> zhjsQW = new QueryWrapper<>();
|
||||
zhjsQW.lambda().eq(KcZhihuijiaoshi::getXm,"学生全景");
|
||||
zhjsQW.lambda().eq(KcZhihuijiaoshi::getChangshang,"奥威亚");
|
||||
zhjsQW.lambda().in(KcZhihuijiaoshi::getJsbh, jsbhSet);
|
||||
|
||||
List<KcZhihuijiaoshi> zhihuijiaoshiList = zhihuijiaoshiService.list(zhjsQW);
|
||||
|
||||
log.info("---videoScreenshotByJsbh-------zhihuijiaoshiList--------------{}",zhihuijiaoshiList);
|
||||
zhihuijiaoshiList.forEach(x -> {
|
||||
try {
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
KcKetangbiao ketangbiao = KcKetangbiaoMap.get(x.getJsbh());
|
||||
String rwbh = ketangbiao.getRwbh();
|
||||
|
||||
String fileName;
|
||||
File uploadpathFile = new File(uploadpath);
|
||||
String uploadpathFilePath = uploadpathFile.getPath();
|
||||
|
||||
File file = new File(uploadpathFilePath + File.separator + "temp" + File.separator + "videoScreenshot" + File.separator + ketangbiao.getXnxq() + File.separator + yearMonthStr + File.separator + x.getJsbh() + File.separator);
|
||||
File fileBak = new File(downloadpath + File.separator + "temp" + File.separator + "videoScreenshot" + File.separator + ketangbiao.getXnxq() + File.separator + yearMonthStr + File.separator + x.getJsbh() + File.separator);
|
||||
String orgName = x.getPullUrl();// 获取文件名
|
||||
orgName = CommonUtil.getFileName(orgName);
|
||||
if(orgName.lastIndexOf(".")!=-1){
|
||||
//qn更改-- 修复特殊字符上传后无法下载的问题,修复多个.名称错乱的问题
|
||||
orgName = URLEncoder.DEFAULT.encode(orgName);
|
||||
//原名是m3u8,不是图片,改成jpeg
|
||||
// fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + DateUtils.getTradeNo() + orgName.substring(orgName.lastIndexOf("."));
|
||||
fileName = DateUtils.getTradeNo() + "_" + orgName.substring(0, orgName.lastIndexOf(".")) + ".jpeg";
|
||||
}else{
|
||||
// fileName = x.getRw"_" + orgName+ "_" + DateUtils.getTradeNo();
|
||||
fileName = DateUtils.getTradeNo() + "_" + orgName;
|
||||
}
|
||||
fileName = rwbh + "_" + fileName;
|
||||
//qn更改-- 修复特殊字符上传后无法下载的问题,修复多个.名称错乱的问题END
|
||||
//截图
|
||||
String outImagePath = file.getPath() + File.separator + fileName;
|
||||
log.info("------videoScreenshotByJsbh----outImagePath--------------{}",outImagePath);
|
||||
FileUtil.touch(outImagePath);
|
||||
String miniOutImagePath = StringUtils.replace(outImagePath, uploadpathFilePath + File.separator, "");
|
||||
miniOutImagePath = StringUtils.replace(miniOutImagePath,"\\","/");
|
||||
log.info("------videoScreenshotByJsbh----x.getPullUrl()--------------{}",x.getPullUrl());
|
||||
boolean isSuccess = _FFmpegTools.videoScreenshot(x.getPullUrl(), outImagePath);
|
||||
|
||||
log.info("------videoScreenshotByJsbh----isSuccess--------------{}",isSuccess);
|
||||
FileUtil.copy(outImagePath,fileBak.getPath() + File.separator + fileName, true);
|
||||
//查找主表,
|
||||
QueryWrapper<KcDetectionMain> detectionMainQw = new QueryWrapper<>();
|
||||
|
||||
detectionMainQw.apply("create_time >= '" + nowStr + " 00:00:00' and create_time <= '" + nowStr + " 23:59:59'");
|
||||
detectionMainQw.lambda().eq(KcDetectionMain::getRwbh, ketangbiao.getRwbh());
|
||||
detectionMainQw.last("limit 1");
|
||||
KcDetectionMain detectionMain = kcDetectionMainService.getOne(detectionMainQw);
|
||||
if(detectionMain == null) {
|
||||
detectionMain = new KcDetectionMain();
|
||||
detectionMain.setRwbh(ketangbiao.getRwbh());
|
||||
detectionMain.setKcbh(ketangbiao.getKcbh());
|
||||
detectionMain.setKcmc(ketangbiao.getKcmc());
|
||||
detectionMain.setJsbh(x.getJsbh());
|
||||
detectionMain.setXnxq(ketangbiao.getXnxq());
|
||||
detectionMain.setDetectionUrl(x.getPullUrl());
|
||||
detectionMain.setDetectionNum(0);
|
||||
detectionMain.setAllNum(0);
|
||||
detectionMain.setAverageNum(0);
|
||||
}
|
||||
Integer detectionNum = detectionMain.getDetectionNum();
|
||||
detectionNum++;
|
||||
detectionMain.setDetectionNum(detectionNum);
|
||||
detectionMain.setKetangbiaoInfo(ketangbiao);
|
||||
|
||||
KcDetectionDetailed detectionDetailed = new KcDetectionDetailed();
|
||||
detectionDetailed.setRwbh(ketangbiao.getRwbh());
|
||||
detectionDetailed.setKcbh(ketangbiao.getKcbh());
|
||||
detectionDetailed.setKcmc(ketangbiao.getKcmc());
|
||||
detectionDetailed.setJsbh(x.getJsbh());
|
||||
detectionDetailed.setXnxq(ketangbiao.getXnxq());
|
||||
detectionDetailed.setDetectionUrl(x.getPullUrl());
|
||||
detectionDetailed.setDetectionOutImgUrl(miniOutImagePath);
|
||||
detectionDetailed.setDetectionOutImgRes("{\"log_id\": \"没有图片,无法查询\", \"person_num\": 0}");//
|
||||
detectionDetailed.setDetectionNum(detectionNum);//截图序列号
|
||||
detectionDetailed.setNum(0);
|
||||
|
||||
//取数量
|
||||
if(isSuccess){
|
||||
String rJson = authService.body_num(outImagePath);
|
||||
log.info("-----videoScreenshotByJsbh-----rJson--------------{}",rJson);
|
||||
detectionDetailed.setDetectionOutImgRes(rJson);
|
||||
//解析获取数
|
||||
JSONObject object= JSON.parseObject(rJson);
|
||||
|
||||
log.info("-----videoScreenshotByJsbh-----百度-object--------------{}",object);
|
||||
if(object != null){
|
||||
Integer num = object.getInteger("person_num");
|
||||
if(num == null){
|
||||
if(detectionDetailed.getNum() == null){
|
||||
detectionDetailed.setNum(0);
|
||||
}
|
||||
} else {
|
||||
detectionDetailed.setNum(num);
|
||||
}
|
||||
Integer allNum = detectionMain.getAllNum();
|
||||
allNum += detectionDetailed.getNum();
|
||||
detectionMain.setAllNum(allNum);
|
||||
detectionMain.setAverageNum(allNum/detectionNum);
|
||||
log.info("---videoScreenshotByJsbh-------detectionMain--------------{}",detectionMain);
|
||||
//保存主表
|
||||
if(StringUtils.isBlank(detectionMain.getId())){
|
||||
kcDetectionMainService.save(detectionMain);
|
||||
} else {
|
||||
kcDetectionMainService.updateById(detectionMain);
|
||||
}
|
||||
detectionDetailed.setPid(detectionMain.getId());
|
||||
log.info("----videoScreenshotByJsbh------detectionDetailed--------------{}",detectionDetailed);
|
||||
//保存子表
|
||||
save(detectionDetailed);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
calls.forEach(threadService::submit);
|
||||
calls.forEach(fn -> {
|
||||
try {
|
||||
threadService.take();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
log.info("-----videoScreenshotByJsbh-----抓取图片结束--------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package org.jeecg.modules.kc.grab.SynchronizationService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.kc.grab.SynchronizationService.base.BaseSync;
|
||||
import org.jeecg.modules.kc.wjxWjxx.service.IWjxWjxxService;
|
||||
import org.jeecg.modules.kc.zyCcjg.service.IZyCcjgService;
|
||||
import org.jeecg.modules.kc.zyInfo.service.IZyInfoService;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作业修改没有提交给维普的作业信息
|
||||
*/
|
||||
@Slf4j
|
||||
public class SyncZyCxtjParams extends BaseSync {
|
||||
|
||||
@Autowired
|
||||
private IZyCcjgService zyCcjgService;
|
||||
|
||||
@Autowired
|
||||
private IZyInfoService zyInfoService;
|
||||
@Autowired
|
||||
private IWjxWjxxService wjxWjxxService;
|
||||
|
||||
/**
|
||||
* 若参数变量名修改 QuartzJobController中也需对应修改
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) {
|
||||
start();
|
||||
run(getParamMap());
|
||||
end();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 有参定时任务实现
|
||||
* @param param
|
||||
*/
|
||||
public void run(Map<String, Object> param){
|
||||
try {
|
||||
zyCcjgService.getCxtjParam(param);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 无参定时任务实现
|
||||
*/
|
||||
public void run(){
|
||||
run(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -95,6 +95,9 @@
|
|||
<if test='kcKetangbiao.zhjs!=null and kcKetangbiao.zhjs!="" and kcKetangbiao.zhjs=="0"'>
|
||||
and js.jsbh is NULL
|
||||
</if>
|
||||
<if test='kcKetangbiao.jsbh!=null and kcKetangbiao.jsbh!=""'>
|
||||
and js.jsbh = #{kcKetangbiao.jsbh}
|
||||
</if>
|
||||
<if test="kcKetangbiao.jzwh!=null and kcKetangbiao.jzwh!=''">
|
||||
and jxljbxx.jzwh = #{kcKetangbiao.jzwh}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 查重结果
|
||||
|
|
@ -30,4 +31,6 @@ public interface IZyCcjgService extends IService<ZyCcjg> {
|
|||
void delByPaperId(String paperId);
|
||||
|
||||
void getCxtj();
|
||||
|
||||
void getCxtjParam(Map<String, Object> param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,6 +186,20 @@ public class ZyCcjgServiceImpl extends ServiceImpl<ZyCcjgMapper, ZyCcjg> impleme
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCxtjParam(Map<String, Object> param) {
|
||||
if(StringUtils.isNotBlank(param.get("id").toString())){
|
||||
ZyInfoStudent zyInfoStudent = zyInfoStudentService.selectById(param.get("id").toString());
|
||||
if(zyInfoStudent!=null){
|
||||
HttpServletResponse response = null;
|
||||
zyInfoStudent.setId(zyInfoStudent.getMainId());
|
||||
zyInfoNewStudent2Service.stuWpKsjc(zyInfoStudent,response);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> aigcCxjcjg(ZyCcjg zyCcjg) {
|
||||
String url = "https://vims.fanyu.com/tool/AIGCCheck/searchPaper";
|
||||
|
|
|
|||
|
|
@ -176,10 +176,10 @@ public class ZyInfoStudentService2Impl extends ServiceImpl<ZyInfoStudentMapper,
|
|||
zyInfoStudent.setFilePath(fileName);
|
||||
System.out.println("----------------1---------------------" + zyInfoStudent.getStuId());
|
||||
if (StringUtils.isEmpty(zyInfoStudent.getStuId())) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
QueryWrapper<ZyInfoStudent> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("a.main_id", zyInfoStudent.getId());
|
||||
queryWrapper.eq("a.create_by", sysUser.getUsername());
|
||||
queryWrapper.eq("a.create_by", zyInfoStudent.getCreateBy());
|
||||
List<ZyInfoStudent> list1 = baseMapper.selectList(queryWrapper);
|
||||
zyInfoStudent = list1.get(0);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ jodconverter:
|
|||
# 媒体处理器
|
||||
ffmpeg:
|
||||
# 根路径
|
||||
path: /usr/local/ffmpeg-make/bin
|
||||
path: /usr/bin
|
||||
# 执行命令的核心文件
|
||||
executableFile: ${ffmpeg.path}/ffmpeg
|
||||
# 压缩相关
|
||||
|
|
@ -336,7 +336,7 @@ ffmpeg:
|
|||
# 是否开启压缩【true:开启压缩 | false:关闭压缩 】
|
||||
enable: false
|
||||
# 日志等级,【 quiet | panic | fatal | error | warning | info | verbose | debug | trace】默认值为info
|
||||
loglevel: error
|
||||
loglevel: debug
|
||||
# 压缩比,正整数,数越大压缩比越高
|
||||
compressionRatio: 50
|
||||
# 是否覆盖输出文件【 y:覆盖 | n:不覆盖 】
|
||||
|
|
@ -354,7 +354,7 @@ ffmpeg:
|
|||
# 压缩 数越大,图越小
|
||||
compressionRatio: 2
|
||||
# 视频过滤器参数,,此处用意为截1张原尺寸当前时间的最新帧
|
||||
vf: '"select=not(mod(n\,15)),scale=-1:-1"'
|
||||
vf: 'select=not(mod(n\,15)),scale=-1:-1'
|
||||
# 维普检测接口
|
||||
weipu:
|
||||
userId: 765996
|
||||
|
|
|
|||
Loading…
Reference in New Issue