9.21日开发提交

This commit is contained in:
hejinbo
2023-09-21 19:16:12 +08:00
parent 34867898b9
commit a23b662332
11 changed files with 474 additions and 51 deletions
@@ -0,0 +1,23 @@
package com.ruoyi.web.controller.wisdomarbitrate;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/adjudication")
public class AdjudicationController extends BaseController {
@Autowired
private IAdjudicationService adjudicationService;
@PostMapping("/document")
public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){
return adjudicationService.createDocument(caseApplication);
}
}
@@ -16,22 +16,20 @@ public class CaseArbitrateController extends BaseController {
private ICaseArbitrateService caseArbitrateService;
/**
* 确定仲裁方式
* 审核仲裁方式
* @param caseApplication
* @param arbitratMethod
* @param opinion 1同意,0拒绝
* @return
*/
@PutMapping("/method")
public AjaxResult chooseArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication
,Integer arbitratMethod){
return caseArbitrateService.chooseArbitrateMethod(caseApplication,arbitratMethod);
public AjaxResult examineArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication
,Integer opinion){
return caseArbitrateService.examineArbitrateMethod(caseApplication,opinion);
}
/**
* 书面审理
* @param caseApplication
* @param accidentDescription
* @param arbitrationResult
* @param arbitrateRecord
* @return
*/
@PostMapping("/writtenHear")
@@ -80,7 +80,11 @@ public class CaseEvidenceController extends BaseController {
return caseEvidenceService.evidenceConfirmation(caseApplication);
}
/**
* 案件质证
* @param caseEvidenceDTO
* @return
*/
@PostMapping("/crossexami")
public AjaxResult caseCrossexamination(@Validated @RequestBody CaseEvidenceDTO caseEvidenceDTO){
return caseEvidenceService.caseCrossexamination(caseEvidenceDTO);
+6
View File
@@ -145,6 +145,12 @@
<version>3.1.701</version>
</dependency>
<!-- poi-tl-->
<dependency>
<groupId>com.deepoove</groupId>
<artifactId>poi-tl</artifactId>
<version>1.9.1</version>
</dependency>
</dependencies>
@@ -0,0 +1,157 @@
package com.ruoyi.common.utils;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.data.*;
import com.deepoove.poi.data.style.ParagraphStyle;
import com.deepoove.poi.data.style.Style;
import com.deepoove.poi.util.PoitlIOUtils;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Author: ymbgy
* @Date: 2022-09-21 13:26
*/
public class WordUtil {
private CellRenderData cell;
/**
* 查询生成的word文件流
*
* @param response
* @param datas
* @param modalFilePath
* @param resultFilePath
* @throws IOException
*/
public static void getDocStreamFile(HttpServletResponse response, Map<String, Object> datas, String modalFilePath, String resultFilePath, String fileName) throws IOException {
//获取word模板和填充数据
XWPFTemplate template = XWPFTemplate.compile(modalFilePath).render(datas);
//设置返回类型及文件名
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment;filename=\"" + fileName + "\"");
//获取返回输出流
OutputStream out = response.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(out);
template.write(bos);
bos.flush();
out.flush();
PoitlIOUtils.closeQuietlyMulti(template, bos, out);
}
/**
* 查询生成的word文件路径
*
* @param datas
* @param modalFilePath
* @param resultFilePath
* @return
* @throws IOException
*/
public static String getDocFilePath(Map<String, Object> datas, String modalFilePath, String resultFilePath) throws IOException {
//获取word模板和填充数据
XWPFTemplate template = XWPFTemplate.compile(modalFilePath).render(datas);
template.writeAndClose(new FileOutputStream(resultFilePath));
return resultFilePath;
}
/**
* 构造绘制表格的方法
*/
public static TableRenderData rebuildWordTableData(List<String> headerList, String headerBackgroundColor, String textColor, List<List<String>> tableContentList) {
RowRenderData header = rebuildWordTableHead(headerList, headerBackgroundColor, textColor);
List<RowRenderData> content = rebuildWordTableContent(tableContentList);
TableRenderData tableRenderData = Tables.create().addRow(header);
for (int i = 0; content != null && i < content.size(); i++) {
tableRenderData.addRow(content.get(i));
}
return tableRenderData;
}
/**
* 构造表格表头
*
* @return
*/
public static RowRenderData rebuildWordTableHead(List<String> headerList, String headerBackgroundColor, String textColor) {
RowRenderData header = new RowRenderData();
for (int i = 0; headerList != null && i < headerList.size(); i++) {
CellRenderData cellRenderData = new CellRenderData();
ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
Style style = new Style();
style.setColor(textColor);
style.setFontSize(12.0);
ParagraphStyle paragraphStyle = ParagraphStyle.builder()
.withAlign(ParagraphAlignment.CENTER)
// .withBackgroundColor(headerBackgroundColor)
.withDefaultTextStyle(style)
.build();
paragraphRenderData.addText(headerList.get(i));
paragraphRenderData.setParagraphStyle(paragraphStyle);
cellRenderData.addParagraph(paragraphRenderData);
header.addCell(cellRenderData);
}
return header;
}
/**
* 构造表格内容
*
* @return
*/
public static List<RowRenderData> rebuildWordTableContent(List<List<String>> tableContentList) {
List<RowRenderData> rowContentList = new ArrayList<>();
for (int i = 0; tableContentList != null && i < tableContentList.size(); i++) {
List<String> rowdataList = tableContentList.get(i);
RowRenderData rowcontent = new RowRenderData();
for (int j = 0; rowdataList != null && j < rowdataList.size(); j++) {
CellRenderData cellRenderData = new CellRenderData();
ParagraphRenderData paragraphRenderData = new ParagraphRenderData();
Style style = new Style();
style.setFontSize(12.0);
ParagraphStyle paragraphStyle = ParagraphStyle.builder()
.withAlign(ParagraphAlignment.CENTER)
.withDefaultTextStyle(style)
.build();
paragraphRenderData.addText(rowdataList.get(j));
paragraphRenderData.setParagraphStyle(paragraphStyle);
cellRenderData.addParagraph(paragraphRenderData);
rowcontent.addCell(cellRenderData);
}
rowContentList.add(rowcontent);
}
return rowContentList;
}
/**
* 构建图片内容
*/
public static PictureRenderData rebuildImageContent(Integer with, Integer height, String imageUrl, String relatedPath, Byte[] imageBytes) {
PictureRenderData pictureRenderData = null;
if (!StringUtils.isBlank(imageUrl)) {
// 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");
}else if (!StringUtils.isBlank(relatedPath)) {
pictureRenderData = Pictures.ofLocal(relatedPath).size(with,height).create();
// Pictures.PictureBuilder pictureBuilder = Pictures.of("https://res.wx.qq.com/a/wx_fed/weixin_portal/res/static/img/1EtCRvm.png");
}
return pictureRenderData;
}
public static String getResultFilePath(Map<String, Object> datas, Configure config, String modalFilePath, String resultFilePath) throws IOException {
//获取word模板和填充数据
XWPFTemplate template = XWPFTemplate.compile(modalFilePath,config).render(datas);
template.writeAndClose(new FileOutputStream(resultFilePath));
return resultFilePath;
}
}
@@ -0,0 +1,165 @@
package com.ruoyi.wisdomarbitrate.domain;
import lombok.Data;
@Data
public class Adjudication {
/**
* 申请人姓名
*/
private String applicantName;
/**
* 申请人性别
*/
private String applicantSex;
/**
* 申请人身份证号码
*/
private String applicantIDNo;
/**
* 申请人住所
*/
private String appAddress;
/**
* 申请人邮编
*/
private String appZipCode;
/**
* 申请人组织名称
*/
private String appOrgName;
/**
* 申请人组织地址
*/
private String appOrgAddress;
/**
* 申请人法人姓名
*/
private String appLegalPerName;
/**
* 申请人法人职务
*/
private String appLegalPerJob;
/**
* 申请人代理人姓名
*/
private String appAgentName;
/**
* 申请人代理人性别
*/
private String appAgentSex;
/**
* 被申请人姓名
*/
private String resName;
/**
* 被申请人性别
*/
private String resSex;
/**
* 被申请人身份证号码
*/
private String resIDNo;
/**
* 被申请人住所
*/
private String resAddress;
/**
* 被申请人邮编
*/
private String resZipCode;
/**
* 被申请人组织名称
*/
private String resOrgName;
/**
* 被申请人组织地址
*/
private String resOrgAddress;
/**
* 被申请人法人姓名
*/
private String resLegalPerName;
/**
* 被申请人法人职务
*/
private String resLegalPerJob;
/**
* 被申请人代理人姓名
*/
private String resAgentName;
/**
* 被申请人代理人性别
*/
private String resAgentSex;
/**
* 第三人姓名
*/
private String thirdName;
/**
* 第三人性别
*/
private String thirdSex;
/**
* 第三人身份证
*/
private String thirdDNo;
/**
* 第三人住所
*/
private String thirdAddress;
/**
* 第三人邮编
*/
private String thirdZipCode;
/**
* 第三人组织名称
*/
private String thirdOrgName;
/**
* 第三人组织地址
*/
private String thirdOrgAddress;
/**
* 第三人法人姓名
*/
private String thirdLegalPerName;
/**
* 第三人法人职务
*/
private String thirdLegalPerJob;
/**
* 第三人代理人姓名
*/
private String thirdAgentName;
/**
* 第三人代理人性别
*/
private String thirdAgentSex;
/**
* 案件描述
*/
private String caseDescribe;
/**
* 仲裁员名称
*/
private String arbitratorName;
/**
* 开庭年
*/
private String hearYear;
/**
* 开庭月
*/
private String hearMonths;
/**
* 开庭日
*/
private String hearDay;
}
@@ -0,0 +1,8 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
public interface IAdjudicationService {
AjaxResult createDocument(CaseApplication caseApplication);
}
@@ -5,7 +5,9 @@ import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
public interface ICaseArbitrateService {
AjaxResult chooseArbitrateMethod(CaseApplication caseApplication,Integer arbitratMethod);
AjaxResult writtenHear(ArbitrateRecord arbitrateRecord);
AjaxResult examineArbitrateMethod(CaseApplication caseApplication, Integer opinion);
}
@@ -0,0 +1,46 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import com.deepoove.poi.config.Configure;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Service
public class AdjudicationServiceImpl implements IAdjudicationService {
@Autowired
private CaseApplicationMapper caseApplicationMapper;
@Autowired
private CaseAffiliateMapper caseAffiliateMapper;
@Override
public AjaxResult createDocument(CaseApplication caseApplication) {
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
try {
Map<String, Object> datas = new HashMap<>();
datas.put("1", "张三");
String modalFilePath = "D:/develop/ceshi.docx";
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String resultFilePath = "D:/data/" + fileName;
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
return AjaxResult.success("裁决书保存路径为"+docFilePath);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
@@ -31,21 +31,31 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
@Override
@Transactional
public AjaxResult chooseArbitrateMethod(CaseApplication caseApplication, Integer arbitratMethod) {
if (arbitratMethod != null) {
String arbitratMethodStr = arbitratMethod == 1 ? "开庭审理" : "书面审理";
public AjaxResult examineArbitrateMethod(CaseApplication caseApplication, Integer opinion) {
//查询案件详细信息
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
if (caseApplication1 == null) {
return AjaxResult.error();
}
int arbitratMethod = caseApplication1.getArbitratMethod();
String caseNum = caseApplication1.getCaseNum();
//选择仲裁方式
caseApplication.setArbitratMethod(arbitratMethod);
if (opinion==0){ //拒绝
switch (arbitratMethod) {
case 1:
caseApplication1.setArbitratMethod(2); // 更改仲裁方式
break;
case 2:
caseApplication1.setArbitratMethod(1);
break;
default:
return AjaxResult.error();
}
}
//修改案件状态为待开庭
caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
int i = caseApplicationMapper.submitCaseApplication(caseApplication);
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
if (i > 0) {
String arbitratMethodStr = caseApplication1.getArbitratMethod() == 1 ? "开庭审理" : "书面审理";
//发送短信通知
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1931000");
@@ -72,11 +82,9 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
}
}
}
return AjaxResult.success("选择成功");
return AjaxResult.success("审核成功");
}
}
return AjaxResult.error("请选择开庭方式");
return AjaxResult.error();
}
@Override
@@ -151,6 +151,12 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
}
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT);
//选择仲裁方式
if (caseEvidenceDTO.getOpenCourtHear()==1){ //开庭审理
caseApplication1.setArbitratMethod(1);
}else {
caseApplication1.setArbitratMethod(2); //书面审理
}
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
if (i > 0) {
//案件日志表里添加数据