Merge branch 'hjb' of SH-Arbitrate/Arbitrate-Backend into dev
This commit was merged in pull request #186.
This commit is contained in:
+63
-41
@@ -35,6 +35,7 @@ import java.nio.file.StandardCopyOption;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
@@ -52,6 +53,8 @@ public class TestPOIController {
|
|||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SendMailRecordMapper sendMailRecordMapper;
|
private SendMailRecordMapper sendMailRecordMapper;
|
||||||
|
@Autowired
|
||||||
|
private ICaseApplicationService caseApplicationService;
|
||||||
|
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
public AjaxResult createDocument(@RequestBody CaseApplication caseApplication) {
|
public AjaxResult createDocument(@RequestBody CaseApplication caseApplication) {
|
||||||
@@ -92,10 +95,10 @@ public class TestPOIController {
|
|||||||
datas.put("resName", affiliate.getName());
|
datas.put("resName", affiliate.getName());
|
||||||
datas.put("resAddress", affiliate.getResidenAffili());
|
datas.put("resAddress", affiliate.getResidenAffili());
|
||||||
String responSex = affiliate.getResponSex();
|
String responSex = affiliate.getResponSex();
|
||||||
if (responSex.equals("0")){
|
if (responSex.equals("0")) {
|
||||||
datas.put("resSex","男");
|
datas.put("resSex", "男");
|
||||||
}else{
|
} else {
|
||||||
datas.put("resSex","女");
|
datas.put("resSex", "女");
|
||||||
}
|
}
|
||||||
Date responBirth = affiliate.getResponBirth();
|
Date responBirth = affiliate.getResponBirth();
|
||||||
if (responBirth != null) {
|
if (responBirth != null) {
|
||||||
@@ -244,12 +247,37 @@ public class TestPOIController {
|
|||||||
}
|
}
|
||||||
datas.put("claims", caseApplication1.getArbitratClaims());
|
datas.put("claims", caseApplication1.getArbitratClaims());
|
||||||
datas.put("request", caseApplication1.getRequestRule());
|
datas.put("request", caseApplication1.getRequestRule());
|
||||||
//申请人证据材料
|
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
|
||||||
datas.put("appEvidenceMaterial", null);
|
List<CaseAttach> caseAttachList1 = caseApplication2.getCaseAttachList();
|
||||||
//被申请人证据材料
|
if (caseAttachList1 != null && caseAttachList1.size() > 0) {
|
||||||
|
for (CaseAttach caseAttach : caseAttachList1) {
|
||||||
PictureRenderData pictureRenderData = WordUtil.rebuildImageContent(100, 100, null, "D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg");
|
if (caseAttach.getAnnexType() == 6) { //被申请人证据材料
|
||||||
datas.put("resEvidenceMaterial", "证据详情可查询附件");
|
String annexName = caseAttach.getAnnexName();
|
||||||
|
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||||
|
if (isImageFile) {
|
||||||
|
String prefix = "/profile";
|
||||||
|
int startIndex = annexName.indexOf(prefix);
|
||||||
|
startIndex += prefix.length();
|
||||||
|
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||||
|
System.out.println("路径是===========" + annexPath);
|
||||||
|
PictureRenderData pictureRenderData = WordUtil
|
||||||
|
.rebuildImageContent(100, 100, null, annexPath);
|
||||||
|
datas.put("resEvidenceMaterial", pictureRenderData);
|
||||||
|
}
|
||||||
|
} else if (caseAttach.getAnnexType() == 2) { //申请人证据材料
|
||||||
|
String annexName = caseAttach.getAnnexName();
|
||||||
|
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||||
|
if (isImageFile) {
|
||||||
|
String annexPath = "/home/ruoyi"+caseAttach.getAnnexPath();
|
||||||
|
System.out.println("路径是===========" + annexPath);
|
||||||
|
PictureRenderData pictureRenderData = WordUtil
|
||||||
|
.rebuildImageContent(100, 100, null, annexPath);
|
||||||
|
//申请人证据材料
|
||||||
|
datas.put("appEvidenceMaterial", pictureRenderData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
|
datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
|
||||||
if (arbitrateRecord1 != null) {
|
if (arbitrateRecord1 != null) {
|
||||||
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
||||||
@@ -261,10 +289,10 @@ public class TestPOIController {
|
|||||||
datas.put("year", year);
|
datas.put("year", year);
|
||||||
String month = String.format("%02d", now.getMonthValue());
|
String month = String.format("%02d", now.getMonthValue());
|
||||||
String day = String.format("%02d", now.getDayOfMonth());
|
String day = String.format("%02d", now.getDayOfMonth());
|
||||||
//String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
|
String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
|
||||||
String modalFilePath = "D:/develop/新裁决书模板.docx";
|
// String modalFilePath = "D:/develop/新裁决书模板.docx";
|
||||||
//String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
|
// String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
|
||||||
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
||||||
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||||
@@ -311,11 +339,13 @@ public class TestPOIController {
|
|||||||
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
||||||
caseApplicationMapper.submitCaseApplication(caseApplication1);
|
caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||||
return AjaxResult.success("裁决书已生成");
|
return AjaxResult.success("裁决书已生成");
|
||||||
} catch (IOException e) {
|
} catch(IOException e)
|
||||||
return AjaxResult.error(e + "请检查文件路径是否有误");
|
{
|
||||||
}
|
return AjaxResult.error(e + "请检查文件路径是否有误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String getNewEquipmentNo() {
|
public String getNewEquipmentNo() {
|
||||||
Object awardNum = redisCache.getCacheObject("awardNum");
|
Object awardNum = redisCache.getCacheObject("awardNum");
|
||||||
if (awardNum == null) {
|
if (awardNum == null) {
|
||||||
@@ -343,30 +373,22 @@ public class TestPOIController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
// 创建一个新的Word文档
|
Map<String, Object> datas = new HashMap<String, Object>() {
|
||||||
XWPFDocument document = new XWPFDocument();
|
{
|
||||||
|
//本地图片
|
||||||
|
put("resEvidenceMaterial", new PictureRenderData(100, 120, "D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg"));
|
||||||
|
//网路图片
|
||||||
|
// put("urlPicture", new PictureRenderData(100, 100, ".png", BytePictureUtils.getUrlByteArray("https://avatars3.githubusercontent.com/u/1394854?v=3&s=40")));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 创建一个段落
|
XWPFTemplate template = XWPFTemplate.compile("D:\\develop\\新裁决书模板.docx")
|
||||||
XWPFParagraph paragraph = document.createParagraph();
|
.render(datas);
|
||||||
|
|
||||||
// 创建一个文本区域
|
|
||||||
XWPFRun run = paragraph.createRun();
|
|
||||||
|
|
||||||
// 加载图片文件
|
|
||||||
File imageFile = new File("D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg");
|
|
||||||
FileInputStream fis = new FileInputStream(imageFile);
|
|
||||||
|
|
||||||
// 将图片插入到文档中
|
|
||||||
run.addPicture(fis, Document.PICTURE_TYPE_JPEG, "image.jpg", Units.toEMU(100), Units.toEMU(100));
|
|
||||||
|
|
||||||
// 关闭输入流
|
|
||||||
fis.close();
|
|
||||||
|
|
||||||
// 保存文档
|
|
||||||
String filePath= "D:\\develop\\"+UUID.randomUUID()+"document.docx";
|
|
||||||
FileOutputStream fos = new FileOutputStream(filePath);
|
|
||||||
document.write(fos);
|
|
||||||
fos.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
FileOutputStream out = new FileOutputStream("D:\\develop\\out_picture.docx");
|
||||||
|
template.write(out);
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
template.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class WordUtil {
|
|||||||
public static PictureRenderData rebuildImageContent(Integer with, Integer height, String imageUrl, String relatedPath) {
|
public static PictureRenderData rebuildImageContent(Integer with, Integer height, String imageUrl, String relatedPath) {
|
||||||
PictureRenderData pictureRenderData = null;
|
PictureRenderData pictureRenderData = null;
|
||||||
if (!StringUtils.isBlank(imageUrl)) {
|
if (!StringUtils.isBlank(imageUrl)) {
|
||||||
// pictureRenderData = Pictures.of(imageUrl).size(with, height).create();
|
//pictureRenderData = Pictures.of(imageUrl).size(with, height).create();
|
||||||
//Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
|
//Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
|
||||||
} else if (!StringUtils.isBlank(relatedPath)) {
|
} else if (!StringUtils.isBlank(relatedPath)) {
|
||||||
pictureRenderData = Pictures.ofLocal(relatedPath).size(with, height).create();
|
pictureRenderData = Pictures.ofLocal(relatedPath).size(with, height).create();
|
||||||
|
|||||||
+58
-8
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.deepoove.poi.data.PictureRenderData;
|
||||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.redis.RedisCache;
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
@@ -36,6 +37,7 @@ import java.nio.file.StandardCopyOption;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||||
|
|
||||||
@@ -254,10 +256,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
}
|
}
|
||||||
datas.put("claims", caseApplication1.getArbitratClaims());
|
datas.put("claims", caseApplication1.getArbitratClaims());
|
||||||
datas.put("request", caseApplication1.getRequestRule());
|
datas.put("request", caseApplication1.getRequestRule());
|
||||||
//申请人证据材料
|
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
|
||||||
datas.put("appEvidenceMaterial", null);
|
List<CaseAttach> caseAttachList1 = caseApplication2.getCaseAttachList();
|
||||||
//被申请人证据材料
|
if (caseAttachList1 != null && caseAttachList1.size() > 0) {
|
||||||
datas.put("resEvidenceMaterial","(详见附件列表)");
|
for (CaseAttach caseAttach : caseAttachList1) {
|
||||||
|
if (caseAttach.getAnnexType() == 6) { //被申请人证据材料
|
||||||
|
String annexName = caseAttach.getAnnexName();
|
||||||
|
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||||
|
if (isImageFile) {
|
||||||
|
String annexPath = "/home/ruoyi"+caseAttach.getAnnexPath();
|
||||||
|
System.out.println("路径是===========" + annexPath);
|
||||||
|
PictureRenderData pictureRenderData = WordUtil
|
||||||
|
.rebuildImageContent(100, 100, null, annexPath);
|
||||||
|
datas.put("resEvidenceMaterial", pictureRenderData);
|
||||||
|
}
|
||||||
|
} else if (caseAttach.getAnnexType() == 2) { //申请人证据材料
|
||||||
|
String annexName = caseAttach.getAnnexName();
|
||||||
|
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||||
|
if (isImageFile) {
|
||||||
|
String annexPath = "/home/ruoyi"+caseAttach.getAnnexPath();
|
||||||
|
System.out.println("路径是===========" + annexPath);
|
||||||
|
PictureRenderData pictureRenderData = WordUtil
|
||||||
|
.rebuildImageContent(100, 100, null, annexPath);
|
||||||
|
//申请人证据材料
|
||||||
|
datas.put("appEvidenceMaterial", pictureRenderData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
|
datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
|
||||||
if (arbitrateRecord1 != null) {
|
if (arbitrateRecord1 != null) {
|
||||||
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
||||||
@@ -804,10 +830,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
}
|
}
|
||||||
datas.put("claims", caseApplication1.getArbitratClaims());
|
datas.put("claims", caseApplication1.getArbitratClaims());
|
||||||
datas.put("request", caseApplication1.getRequestRule());
|
datas.put("request", caseApplication1.getRequestRule());
|
||||||
//申请人证据材料
|
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
|
||||||
datas.put("appEvidenceMaterial", null);
|
List<CaseAttach> caseAttachList1 = caseApplication2.getCaseAttachList();
|
||||||
//被申请人证据材料
|
if (caseAttachList1 != null && caseAttachList1.size() > 0) {
|
||||||
datas.put("resEvidenceMaterial","(详见附件列表)");
|
for (CaseAttach caseAttach : caseAttachList1) {
|
||||||
|
if (caseAttach.getAnnexType() == 6) { //被申请人证据材料
|
||||||
|
String annexName = caseAttach.getAnnexName();
|
||||||
|
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||||
|
if (isImageFile) {
|
||||||
|
String annexPath = "/home/ruoyi"+caseAttach.getAnnexPath();
|
||||||
|
System.out.println("路径是===========" + annexPath);
|
||||||
|
PictureRenderData pictureRenderData = WordUtil
|
||||||
|
.rebuildImageContent(100, 100, null, annexPath);
|
||||||
|
datas.put("resEvidenceMaterial", pictureRenderData);
|
||||||
|
}
|
||||||
|
} else if (caseAttach.getAnnexType() == 2) { //申请人证据材料
|
||||||
|
String annexName = caseAttach.getAnnexName();
|
||||||
|
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||||
|
if (isImageFile) {
|
||||||
|
String annexPath = "/home/ruoyi"+caseAttach.getAnnexPath();
|
||||||
|
System.out.println("路径是===========" + annexPath);
|
||||||
|
PictureRenderData pictureRenderData = WordUtil
|
||||||
|
.rebuildImageContent(100, 100, null, annexPath);
|
||||||
|
//申请人证据材料
|
||||||
|
datas.put("appEvidenceMaterial", pictureRenderData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
|
datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
|
||||||
if (arbitrateRecord1 != null) {
|
if (arbitrateRecord1 != null) {
|
||||||
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
|
||||||
|
|||||||
Reference in New Issue
Block a user