Merge remote-tracking branch 'origin/master'

This commit is contained in:
纪晓慧
2024-03-07 16:49:14 +08:00
3 changed files with 79 additions and 5 deletions
@@ -1,6 +1,7 @@
package com.jero.modules.onlyoffice.controller; package com.jero.modules.onlyoffice.controller;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -21,7 +22,9 @@ import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.oss.service.IOSSFileService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -39,6 +42,8 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.*; import java.util.*;
/** /**
@@ -369,7 +374,11 @@ public class OnlyOfficeController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LambdaQueryWrapper<OnlineFileLog> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OnlineFileLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OnlineFileLog::getHisId, fileId); wrapper.eq(OnlineFileLog::getHisId, fileId);
wrapper.eq(OnlineFileLog::getDataType, dataType); if (StringUtils.equals(dataType,"0")) {
wrapper.isNull(OnlineFileLog::getDataType);
} else if (StringUtils.equals(dataType,"1")) {
wrapper.eq(OnlineFileLog::getDataType, dataType);
}
wrapper.eq(OnlineFileLog::getValidFlag, "0"); wrapper.eq(OnlineFileLog::getValidFlag, "0");
wrapper.orderByDesc(OnlineFileLog::getCreateTime); wrapper.orderByDesc(OnlineFileLog::getCreateTime);
List<OnlineFileLog> onlineFileLogList = onlineFileLogDao.selectList(wrapper); List<OnlineFileLog> onlineFileLogList = onlineFileLogDao.selectList(wrapper);
@@ -486,5 +495,69 @@ public class OnlyOfficeController {
} }
return fileName; return fileName;
} }
@ApiOperation(value = "更新基线信息")
@PostMapping("/updateOnlineFileLogJxInfo")
public Result<String> updateOnlineFileLogJxInfo(@RequestBody JSONObject json){
String jxFileName = json.getString("jxFileName");
String fileId = json.getString("fileId");
String dataType = "1";
Date now = new Date();
OnlineFileLog createTimeLatestOnlineFileLog = this.getCreateTimeLatestOnlineFileLog(fileId,now);
createTimeLatestOnlineFileLog.setJxFileName(jxFileName);
createTimeLatestOnlineFileLog.setDataType(dataType);
this.onlineFileLogDao.updateById(createTimeLatestOnlineFileLog);
return Result.OK();
}
/**
* 获取在线编辑文件保存历史,更新基线信息使用。
* @return
*/
public OnlineFileLog getCreateTimeLatestOnlineFileLog(String fileId,Date now){
QueryWrapper<OnlineFileLog> ofLogQueryWrap = new QueryWrapper<>();
ofLogQueryWrap.lambda().eq(OnlineFileLog::getHisId,fileId);
ofLogQueryWrap.lambda().ge(OnlineFileLog::getCreateTime,now);
ofLogQueryWrap.lambda().orderByAsc(OnlineFileLog::getCreateTime);
List<OnlineFileLog> onlineFileLogs = this.onlineFileLogDao.selectList(ofLogQueryWrap);
OnlineFileLog result = null;
if (CollectionUtils.isNotEmpty(onlineFileLogs)) {
result = onlineFileLogs.get(0);
}
// if (ObjectUtils.isNotEmpty(result)) {
// long nowTime = now.getTime();
// long createTime = result.getCreateTime().getTime();
//
// // 如果数据的创建时间大于当前时间,直接返回
// if (createTime > nowTime) {
// return result;
// }
//
// // 计算时间差
// long diff = Math.abs(nowTime - createTime);
//
// // 判断时间差是否小于等于10秒
// if (diff <= 10 * 1000) {
// System.out.println("两个日期在十秒内");
// } else {
// System.out.println("两个日期不在十秒内");
//
// result = null;
// }
// }
if (ObjectUtils.isEmpty(result)){
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
result = this.getCreateTimeLatestOnlineFileLog(fileId,now);
}
return result;
}
} }
@@ -111,8 +111,8 @@ public class LawsUserInfoService {
onlineFileLog.setValidFlag("0"); onlineFileLog.setValidFlag("0");
onlineFileLog.setFileKey(key); onlineFileLog.setFileKey(key);
onlineFileLog.setFilePath(fileUrl); onlineFileLog.setFilePath(fileUrl);
onlineFileLog.setDataType(dataType); // onlineFileLog.setDataType(dataType);
onlineFileLog.setJxFileName(jxFileName); // onlineFileLog.setJxFileName(jxFileName);
onlineFileLogDao.insert(onlineFileLog); onlineFileLogDao.insert(onlineFileLog);
log.info("======================日志存入成功==============================="); log.info("======================日志存入成功===============================");
if (StringUtils.isNotBlank(standName)) { if (StringUtils.isNotBlank(standName)) {
@@ -121,6 +121,7 @@ public class LawsUserInfoService {
log.info("======================文件名称修改成功===============================" + standName + ".docx" + "======" + "传入对象为:" + ossFile.getFileName()); log.info("======================文件名称修改成功===============================" + standName + ".docx" + "======" + "传入对象为:" + ossFile.getFileName());
} }
QueryWrapper<OnlineFileLog> onlineFileLogQueryWrapperHis = new QueryWrapper<>(); QueryWrapper<OnlineFileLog> onlineFileLogQueryWrapperHis = new QueryWrapper<>();
onlineFileLogQueryWrapperHis.isNull("DATA_TYPE");
onlineFileLogQueryWrapperHis.eq("HIS_ID", onlineFileId); onlineFileLogQueryWrapperHis.eq("HIS_ID", onlineFileId);
onlineFileLogQueryWrapperHis.eq("VALID_FLAG", "0"); onlineFileLogQueryWrapperHis.eq("VALID_FLAG", "0");
onlineFileLogQueryWrapperHis.orderByAsc("CREATE_TIME"); onlineFileLogQueryWrapperHis.orderByAsc("CREATE_TIME");
+2 -2
View File
@@ -6,8 +6,8 @@
<!-- <img v-if="navTheme === 'dark'" src="~@/assets/logo.png" alt="logo">--> <!-- <img v-if="navTheme === 'dark'" src="~@/assets/logo.png" alt="logo">-->
<!-- <img v-else src="~@/assets/logo.png" alt="logo">--> <!-- <img v-else src="~@/assets/logo.png" alt="logo">-->
<!-- update-begin- author:sunjianlei --- date:20190814 --- for: logo颜色根据主题颜色变化 --> <!-- update-begin- author:sunjianlei --- date:20190814 --- for: logo颜色根据主题颜色变化 -->
<span v-if="showTitle">拆分比工具</span> <span v-if="showTitle">拆分比工具</span>
<span v-else class="noTitle">拆分比工具</span> <span v-else class="noTitle">拆分比工具</span>
<!-- <img v-if="showTitle" src='../../assets/image/logoExpand.png' alt="logo" />--> <!-- <img v-if="showTitle" src='../../assets/image/logoExpand.png' alt="logo" />-->
<!--<img src="~@/assets/image/analysisLogo.png" alt="logo">--> <!--<img src="~@/assets/image/analysisLogo.png" alt="logo">-->
<!-- <img v-else src="../../assets/image/logoFold.png" />--> <!-- <img v-else src="../../assets/image/logoFold.png" />-->