裁决书修改

This commit is contained in:
18792927508
2023-12-09 20:48:16 +08:00
parent 69b5b0d072
commit aa36758066
7 changed files with 141 additions and 43 deletions
@@ -9,6 +9,7 @@ import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
@@ -157,6 +158,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return AjaxResult.error("请先指定裁决书模板");
}
templatePath = templateManages.get(0).getTemOrigPath();
// todo 部署放开
if(templatePath!=null){
templatePath="/home/ruoyi/" +templatePath;
}
templateName = templateManages.get(0).getFileName();
// 查询案件相关表信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -228,12 +233,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
// todo
// String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
// todo
// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
// String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
// todo
// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 将word中的标签替换掉,生成新的word
String docFilePath = wordChangeText(templatePath,datas,saveFolderPath,fileName);
@@ -1277,23 +1282,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
public List<String> getBookmarkByDocx(String path){
XWPFDocument xwpfDocument = null;
try {
log.error("path===="+path);
FileInputStream fileInputStream = new FileInputStream(path);
log.error("fileInputStream====");
xwpfDocument = new XWPFDocument(fileInputStream);
log.error("xwpfDocument===="+xwpfDocument);
} catch (IOException e) {
e.printStackTrace();
}
if(xwpfDocument==null){
return new ArrayList<>();
}
List<XWPFParagraph> paragraphs = xwpfDocument.getParagraphs();
if(CollectionUtil.isEmpty( xwpfDocument.getParagraphs())){
return new ArrayList<>();
}
String regex = "\\{\\{.*?\\}\\}"; // 定义占位符的正则表达式
Pattern pattern = Pattern.compile(regex);
List<String> bookmarkList=new ArrayList<>();
for (XWPFParagraph paragraph : paragraphs) {
String text = paragraph.getText();
Matcher matcher = pattern.matcher(text);
if(StrUtil.isNotEmpty(text)) {
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
String placeholder = matcher.group();
String keyword = placeholder.substring(2, placeholder.length() - 2);
bookmarkList.add(keyword);
while (matcher.find()) {
String placeholder = matcher.group();
String keyword = placeholder.substring(2, placeholder.length() - 2);
bookmarkList.add(keyword);
}
}
}
return bookmarkList;
@@ -1447,9 +1447,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String annexName = caseAttach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
if(startIndex!=-1) {
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
caseAttach.setAnnexPath(annexPath);
String annexPath = "/uploadPath" + annexName.substring(startIndex);
caseAttach.setAnnexPath(annexPath);
}
int startIndexnew = annexName.lastIndexOf("/");
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
@@ -2307,8 +2310,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
Date startDate = messageVO.getScheduleStartTime();
Date endDate = messageVO.getScheduleEndTime();
SimpleDateFormat sdf = new SimpleDateFormat(format);
startFormat = sdf.format(startDate);
endFormat = sdf.format(endDate);
if(startDate!=null) {
startFormat = sdf.format(startDate);
}
if(endDate!=null) {
endFormat = sdf.format(endDate);
}
// 预约会议短信模板
request.setTemplateId("1983711");
@@ -3093,7 +3100,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setTemplateId(templateId);
//默认案件标的 todo 案件标的是什么,默认写死
caseApplication.setCaseSubjectAmount(new BigDecimal(10000));
caseApplication.setCaseSubjectAmount(new BigDecimal(100000));
// todo 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
// 抓取规则,0-内置字段,1-自定义字段
Map<Integer, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
@@ -3105,7 +3112,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
ColumnValue columnValue = new ColumnValue();
columnValue.setColumn(columnRule.getColumn());
columnValue.setName(columnRule.getColumnName());
columnValue.setValue(fatchMap.get(columnRule.getColumnName())); columnValue.setIsDefault(columnRule.getIsDefault());
columnValue.setValue(fatchMap.get(columnRule.getColumnName()));
columnValue.setIsDefault(1);
columnValueList.add(columnValue);
});
}
@@ -3139,12 +3147,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (null != caseApplication.getId()) {
List<CaseAttach> caseAttachs = new ArrayList<>();
for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
String pdfUrl = entry.getValue();
File file1 = new File(pdfUrl);
CaseAttach caseAttach = new CaseAttach();
String fileUrl = entry.getValue();
// 上传
String filePath = RuoYiConfig.getUploadPath();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttach.setAnnexPath(file1.getPath());
caseAttach.setAnnexName(file1.getName());
caseAttach.setAnnexPath(filePath);
if(StrUtil.isNotEmpty(fileUrl)) {
String fileName = fileUrl.replace(filePath, "/profile/upload");
caseAttach.setAnnexName(fileName);
}
// 申请人提供的证据材料
caseAttach.setAnnexType(2);
caseAttachs.add(caseAttach);
@@ -186,14 +186,14 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
}
}
Boolean aBoolean1 = generateAward(caseId);
if (aBoolean1) {
// 生成裁决书
CaseApplication application = new CaseApplication();
application.setId(caseId);
adjudicationService.createDocument(application);
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
}else {
return AjaxResult.error("裁决书生成失败");
}
}
return AjaxResult.success("审理成功");
}