Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #115.
This commit is contained in:
2024-03-13 14:52:55 +08:00
committed by Gitea
6 changed files with 126 additions and 31 deletions
@@ -412,4 +412,17 @@ public class MsCaseApplicationController extends BaseController {
List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord); List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord);
return getDataTable(list); return getDataTable(list);
} }
/**
* 保存onlyOffice在线编辑的文件
* @param
* @return
*/
@GetMapping("/saveOnlyOfficeFile")
public AjaxResult saveOnlyOfficeFile( @RequestBody MsCaseAttach caseAttach) {
if(caseAttach.getCaseAppliId()==null||StrUtil.isEmpty(caseAttach.getOnlyOfficeFileId())||StrUtil.isEmpty(caseAttach.getAnnexPath())){
return error("参数校验失败");
}
return caseApplicationService.saveOnlyOfficeFile(caseAttach);
}
} }
@@ -18,7 +18,7 @@ ruoyi:
# 开发环境配置 # 开发环境配置
server: server:
# 测试环境6001,开发环境7001 # 测试环境6001,开发环境7001
port: 7001 port: 6001
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@@ -194,6 +194,10 @@ arbitrateConfig:
# 回调通知 # 回调通知
signSealCallbackConfig: signSealCallbackConfig:
url: http://121.40.189.20:6001/mssignSeal/signSeaalCaseApplicaCallback url: http://121.40.189.20:6001/mssignSeal/signSeaalCaseApplicaCallback
# onlyOffice系统url配置
onlyOfficeConfig:
# url: http://172.16.0.254:9090/files/upload
url: http://121.40.189.20:9090/files/upload
#jodconverter: #jodconverter:
# local: # local:
# host: 121.40.189.20 # host: 121.40.189.20
@@ -73,8 +73,8 @@ public class MsCaseAttach {
private Long sealStatus; private Long sealStatus;
/** /**
* 是否是证据上传,0-否,1-是 * onlyOffice附件id
*/ */
@Column(name = "is_batch_upload") @Column(name = "only_office_file_id")
private Long isBatchUpload; private String onlyOfficeFileId;
} }
@@ -1,5 +1,6 @@
package com.ruoyi.wisdomarbitrate.service.mscase; package com.ruoyi.wisdomarbitrate.service.mscase;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
@@ -219,6 +220,11 @@ public interface MsCaseApplicationService {
* @param dictDataList 内置字段 * @param dictDataList 内置字段
*/ */
void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList, Integer templateType) ; 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 * @param application
@@ -255,6 +261,11 @@ public interface MsCaseApplicationService {
* @return * @return
*/ */
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord); List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
/**
* 保存onlyOffice在线编辑的文件
* @param
* @return
*/
AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach);
} }
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.mapper.template.TemplateManageMapper;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import com.ruoyi.wisdomarbitrate.utils.*; import com.ruoyi.wisdomarbitrate.utils.*;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@@ -92,6 +92,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Value("${arbitrateConfig.url}") @Value("${arbitrateConfig.url}")
private String arbitrateUrl; private String arbitrateUrl;
@Value("${onlyOfficeConfig.url}")
private String onlyOfficeUrl;
@Autowired @Autowired
MsCaseApplicationService caseApplicationService; MsCaseApplicationService caseApplicationService;
@Autowired @Autowired
@@ -1548,7 +1550,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
.annexType(annexType) .annexType(annexType)
.useId(SecurityUtils.getUserId()) .useId(SecurityUtils.getUserId())
.useAccount(SecurityUtils.getUsername()) .useAccount(SecurityUtils.getUsername())
.isBatchUpload(1L)
.build(); .build();
int count = msCaseAttachMapper.save(caseAttach); int count = msCaseAttachMapper.save(caseAttach);
if (count > 0 ) { if (count > 0 ) {
@@ -2154,6 +2155,25 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) { public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) {
return smsRecordMapper.getSmsSendRecord(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) { if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) { for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
String prefix = "/profile"; // String prefix = "/profile";
int startIndex = prefix.length(); // int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath(); 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); EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody(); String body = response.getBody();
@@ -2635,10 +2656,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (caseAttachList != null && caseAttachList.size() > 0) { if (caseAttachList != null && caseAttachList.size() > 0) {
for (MsCaseAttach caseAttach : caseAttachList) { for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
String prefix = "/profile"; // String prefix = "/profile";
int startIndex = prefix.length(); // int startIndex = prefix.length();
String annexPath = caseAttach.getAnnexPath(); 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); EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody(); String body = response.getBody();
@@ -3729,15 +3751,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 将word中的标签替换掉,生成新的word // 将word中的标签替换掉,生成新的word
wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath); wordChangeText(templatePath, bookmarkValueMap,saveFolderPath,resultFilePath);
MsCaseAttach caseAttach = MsCaseAttach.builder() MsCaseAttach caseAttach = null;
.caseAppliId(application.getId()) String annexPath=resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX);
.annexName(orgFileName+".docx") // 如果是调解书或者调解协议上传到onlyoffice服务器
.annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX)) if(annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())){
.annexType(annexType) JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(annexPath);
.build(); 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); if(caseAttach != null) {
msCaseAttachMapper.save(caseAttach); 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;
} }
/** /**
@@ -13,18 +13,19 @@
<result property="sealStatus" column="seal_status" /> <result property="sealStatus" column="seal_status" />
<result property="useId" column="use_id" /> <result property="useId" column="use_id" />
<result property="useAccount" column="use_account" /> <result property="useAccount" column="use_account" />
<result property="onlyOfficeFileId" column="only_office_file_id" />
</resultMap> </resultMap>
<insert id="save" useGeneratedKeys="true" keyProperty="annexId"> <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) 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},#{isBatchUpload}) VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus},#{onlyOfficeFileId})
</insert> </insert>
<insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId"> <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 VALUES
<foreach item="item" index="index" collection="list" separator=","> <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> </foreach>
</insert> </insert>
<delete id="deleteByFileIds"> <delete id="deleteByFileIds">
@@ -38,19 +39,16 @@
delete from ms_case_attach delete from ms_case_attach
where case_appli_id = #{caseAppliId} where case_appli_id = #{caseAppliId}
and annex_type = #{annexType} and annex_type = #{annexType}
<if test="isBatchUpload != null ">
AND is_batch_upload = #{isBatchUpload}
</if>
</delete> </delete>
<select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult"> <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 from ms_case_attach
where case_appli_id =#{id} where case_appli_id =#{id}
</select> </select>
<select id="listCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult"> <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 from ms_case_attach
<where> <where>
<if test="caseAppliId != null "> <if test="caseAppliId != null ">
@@ -78,7 +76,7 @@
</delete> </delete>
<select id="queryCaseAttachList" resultMap="CaseAttachResult"> <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 from ms_case_attach
<where> <where>
<if test="id != null "> <if test="id != null ">