onlyoffice
This commit is contained in:
+3
-3
@@ -73,8 +73,8 @@ public class MsCaseAttach {
|
||||
private Long sealStatus;
|
||||
|
||||
/**
|
||||
* 是否是证据上传,0-否,1-是
|
||||
* onlyOffice附件id
|
||||
*/
|
||||
@Column(name = "is_batch_upload")
|
||||
private Long isBatchUpload;
|
||||
@Column(name = "only_office_file_id")
|
||||
private String onlyOfficeFileId;
|
||||
}
|
||||
+12
-1
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.mscase;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
@@ -219,6 +220,11 @@ public interface MsCaseApplicationService {
|
||||
* @param dictDataList 内置字段
|
||||
*/
|
||||
void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ;
|
||||
/**
|
||||
* 调解书上传到onlyoffice服务器
|
||||
* @param annexPath
|
||||
*/
|
||||
JSONArray uploadOnlyOffice(String annexPath);
|
||||
/**
|
||||
* 案件受理
|
||||
* @param application
|
||||
@@ -255,6 +261,11 @@ public interface MsCaseApplicationService {
|
||||
* @return
|
||||
*/
|
||||
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
|
||||
/**
|
||||
* 保存onlyOffice在线编辑的文件
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach);
|
||||
}
|
||||
|
||||
+85
-16
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -47,7 +48,6 @@ import com.ruoyi.wisdomarbitrate.mapper.template.FatchRuleMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.template.TemplateManageMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.*;
|
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -92,6 +92,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
|
||||
@Value("${arbitrateConfig.url}")
|
||||
private String arbitrateUrl;
|
||||
@Value("${onlyOfficeConfig.url}")
|
||||
private String onlyOfficeUrl;
|
||||
@Autowired
|
||||
MsCaseApplicationService caseApplicationService;
|
||||
@Autowired
|
||||
@@ -1548,7 +1550,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
.annexType(annexType)
|
||||
.useId(SecurityUtils.getUserId())
|
||||
.useAccount(SecurityUtils.getUsername())
|
||||
.isBatchUpload(1L)
|
||||
.build();
|
||||
int count = msCaseAttachMapper.save(caseAttach);
|
||||
if (count > 0 ) {
|
||||
@@ -2154,6 +2155,25 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) {
|
||||
return smsRecordMapper.getSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
/**
|
||||
* 保存onlyOffice在线编辑的文件
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach) {
|
||||
if(StrUtil.isEmpty(caseAttach.getAnnexName())){
|
||||
caseAttach.setAnnexName("调解书");
|
||||
caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
||||
caseAttach.setUseId(getUserInfo().getUserId());
|
||||
caseAttach.setUseAccount(getUserInfo().getUserName());
|
||||
// 先删除之前的在新增
|
||||
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), caseAttach.getAnnexType());
|
||||
msCaseAttachMapper.save(caseAttach);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询预约信息
|
||||
@@ -2224,10 +2244,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
for (MsCaseAttach caseAttach : caseAttachList) {
|
||||
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
||||
String prefix = "/profile";
|
||||
int startIndex = prefix.length();
|
||||
// String prefix = "/profile";
|
||||
// int startIndex = prefix.length();
|
||||
String annexPath = caseAttach.getAnnexPath();
|
||||
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
|
||||
// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
|
||||
String path = annexPath;
|
||||
//获取文件上传地址
|
||||
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
||||
String body = response.getBody();
|
||||
@@ -2635,10 +2656,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
for (MsCaseAttach caseAttach : caseAttachList) {
|
||||
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
|
||||
String prefix = "/profile";
|
||||
int startIndex = prefix.length();
|
||||
// String prefix = "/profile";
|
||||
// int startIndex = prefix.length();
|
||||
String annexPath = caseAttach.getAnnexPath();
|
||||
String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
|
||||
// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
|
||||
String path = annexPath;
|
||||
//获取文件上传地址
|
||||
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
|
||||
String body = response.getBody();
|
||||
@@ -3729,15 +3751,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
||||
// 将word中的标签替换掉,生成新的word
|
||||
wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath);
|
||||
|
||||
MsCaseAttach caseAttach = MsCaseAttach.builder()
|
||||
.caseAppliId(application.getId())
|
||||
.annexName(orgFileName+".docx")
|
||||
.annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
|
||||
.annexType(annexType)
|
||||
.build();
|
||||
MsCaseAttach caseAttach = null;
|
||||
String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX);
|
||||
// 如果是调解书或者调解协议上传到onlyoffice服务器
|
||||
if(annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){
|
||||
JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath);
|
||||
if(jsonArray!=null && jsonArray.size() > 0){
|
||||
for (Object obj : jsonArray) {
|
||||
JSONObject jsonObject = (JSONObject) obj;
|
||||
caseAttach= MsCaseAttach.builder()
|
||||
.caseAppliId(application.getId())
|
||||
.annexName(jsonObject.getString("fileName"))
|
||||
.annexPath(jsonObject.getString("filePath"))
|
||||
.annexType(annexType)
|
||||
.onlyOfficeFileId(jsonObject.getString("fileId"))
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//保存到附件表里,先删除之前的在保存
|
||||
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
|
||||
msCaseAttachMapper.save(caseAttach);
|
||||
if(caseAttach != null) {
|
||||
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
|
||||
msCaseAttachMapper.save(caseAttach);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调解书上传到onlyoffice服务器
|
||||
* @param annexPath
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public JSONArray uploadOnlyOffice(String annexPath) {
|
||||
annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath");
|
||||
File file = new File(annexPath);
|
||||
if (file.exists()) {
|
||||
// 调用onlyoffice
|
||||
// String url = "http://121.40.189.20:9090/files/upload";
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("file", file);
|
||||
String postResult = HttpUtil.post(onlyOfficeUrl, params);
|
||||
if(StrUtil.isNotEmpty(postResult)){
|
||||
// 转为jsonArray
|
||||
JSONArray jsonArray = JSONArray.parseArray(postResult);
|
||||
|
||||
return jsonArray;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("上传OnlyOffice服务器失败");
|
||||
}
|
||||
}else {
|
||||
throw new ServiceException("文件不存在");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+8
-10
@@ -13,18 +13,19 @@
|
||||
<result property="sealStatus" column="seal_status" />
|
||||
<result property="useId" column="use_id" />
|
||||
<result property="useAccount" column="use_account" />
|
||||
<result property="onlyOfficeFileId" column="only_office_file_id" />
|
||||
</resultMap>
|
||||
<insert id="save" useGeneratedKeys="true" keyProperty="annexId">
|
||||
INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
|
||||
VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus},#{isBatchUpload})
|
||||
INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,only_office_file_id)
|
||||
VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus},#{onlyOfficeFileId})
|
||||
</insert>
|
||||
<insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId">
|
||||
INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
|
||||
INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,only_office_file_id)
|
||||
VALUES
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
|
||||
|
||||
(#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.useId},#{item.useAccount},#{item.sealStatus},#{item.isBatchUpload})
|
||||
(#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.useId},#{item.useAccount},#{item.sealStatus},#{item.onlyOfficeFileId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<delete id="deleteByFileIds">
|
||||
@@ -38,19 +39,16 @@
|
||||
delete from ms_case_attach
|
||||
where case_appli_id = #{caseAppliId}
|
||||
and annex_type = #{annexType}
|
||||
<if test="isBatchUpload != null ">
|
||||
AND is_batch_upload = #{isBatchUpload}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
|
||||
select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
|
||||
select *
|
||||
from ms_case_attach
|
||||
where case_appli_id =#{id}
|
||||
</select>
|
||||
|
||||
<select id="listCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
|
||||
select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
|
||||
select *
|
||||
from ms_case_attach
|
||||
<where>
|
||||
<if test="caseAppliId != null ">
|
||||
@@ -78,7 +76,7 @@
|
||||
</delete>
|
||||
|
||||
<select id="queryCaseAttachList" resultMap="CaseAttachResult">
|
||||
select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
|
||||
select *
|
||||
from ms_case_attach
|
||||
<where>
|
||||
<if test="id != null ">
|
||||
|
||||
Reference in New Issue
Block a user