Merge branch 'hjb' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #29.
This commit is contained in:
2023-09-27 15:40:50 +08:00
committed by Gitea
9 changed files with 447 additions and 71 deletions
@@ -6,18 +6,44 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/adjudication") @RequestMapping("/adjudication")
public class AdjudicationController extends BaseController { public class AdjudicationController extends BaseController {
@Autowired @Autowired
private IAdjudicationService adjudicationService; private IAdjudicationService adjudicationService;
/**
* 生成裁决书
* @param caseApplication
* @return
*/
@PostMapping("/document") @PostMapping("/document")
public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){ public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){
return adjudicationService.createDocument(caseApplication); return adjudicationService.createDocument(caseApplication);
} }
/**
* 裁决书送达(电子邮件)
* @param id 案件id
* @param appEmail 申请人邮箱
* @param resEmail 被申请人邮箱
* @return
*/
@PostMapping("/delivery")
public AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail){
return adjudicationService.sendDocumentByEmail(id,appEmail,resEmail);
}
/**
* 根据快递单号查询物流信息
* @param trackingNum 单号
* @param phoneLastFour 收/寄件人手机号后四位,顺丰快递需填写本字段。
* @return
*/
@GetMapping("/logistics")
public AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour){
return adjudicationService.getLogisticsInfo(trackingNum,phoneLastFour);
}
} }
@@ -91,6 +91,17 @@ spring:
web: web:
resources: resources:
static-locations: file:/home/ruoyi/ static-locations: file:/home/ruoyi/
mail:
host: smtp.163.com
port: 25
username: hjbjava@163.com
password: BSRSSEPJWGNNVYYL
default-encoding: UTF-8
properties:
mail:
smtp:
socketFactoryClass: javax.net.ssl.SSLSocketFactory
debug: false
# token配置 # token配置
token: token:
+22
View File
@@ -152,6 +152,28 @@
<version>1.9.1</version> <version>1.9.1</version>
</dependency> </dependency>
<!-- 发送邮件-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>3.1.4</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
@@ -0,0 +1,187 @@
package com.ruoyi.common.utils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.validation.constraints.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @ClassName EmailInUtil
* @Description 邮件发送工具
*/
@Component
@Data
@Slf4j
public class EmailOutUtil {
private static Pattern emailPattern = Pattern.compile("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$");
// private static Pattern phonePattern = Pattern.compile("0?(13|14|15|18)[0-9]{9}");
private static Pattern phonePattern = Pattern.compile("^1\\d{10}$");
// @Autowired
// private JavaMailSender mailSender;
// 发送发邮箱地址(外网地址)
// @Value("${spring.mail-out-network.from}")
// private static String fromOut;
@Value("${spring.mail.host}")
private String hostOut;
@Value("${spring.mail.username}")
private String usernameOut;
@Value("${spring.mail.password}")
private String passwordOut;
@Value("${spring.mail.port}")
private Integer portOut;
public JavaMailSender rebuildMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(hostOut);
mailSender.setUsername(usernameOut);
mailSender.setPassword(passwordOut);
mailSender.setPort(portOut);
mailSender.setProtocol("smtp");
mailSender.setDefaultEncoding("UTF-8");
return mailSender;
}
/**
* 发送纯文本邮件信息
*
* @param to 接收方
* @param subject 邮件主题
* @param content 邮件内容(发送内容)
*/
public void sendMessage(String to, String subject, String content, String from, JavaMailSender mailSender) {
// 创建一个邮件对象
SimpleMailMessage msg = new SimpleMailMessage();
msg.setFrom(from);
msg.setTo(to);
// 设置邮件主题
msg.setSubject(subject);
// 设置邮件内容
msg.setText(content);
// 发送邮件
mailSender.send(msg);
////System.out.println("发送成功:" + from + ":to:" + to);
}
/**
* 发送带附件的邮件信息
*
* @param to 接收方
* @param subject 邮件主题
* @param content 邮件内容(发送内容)
* @param fileList 文件集合 // 可发送多个附件
*/
public void sendMessageCarryFiles(String to, String subject, String content, List<File> fileList, String from, @NotNull JavaMailSender mailSender) {
MimeMessage mimeMessage = mailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setFrom(from);
helper.setTo(to);
// 设置邮件主题
helper.setSubject(subject);
// 设置邮件内容
helper.setText(content);
// 添加附件(多个)
if (fileList != null && fileList.size() > 0) {
for (File file : fileList) {
helper.addAttachment(file.getName(), file);
}
}
} catch (MessagingException e) {
e.printStackTrace();
}
// 发送邮件
mailSender.send(mimeMessage);
}
/**
* 发送带附件的邮件信息
*
* @param to 接收方
* @param subject 邮件主题
* @param content 邮件内容(发送内容)
* @param file 单个文件
*/
public void sendMessageCarryFile(String to, String subject, String content, File file, String from, JavaMailSender mailSender) {
MimeMessage mimeMessage = mailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
helper.setFrom(from);
helper.setTo(to);
// 设置邮件主题
helper.setSubject(subject);
// 设置邮件内容
helper.setText(content);
// 单个附件
helper.addAttachment(file.getName(), file);
} catch (MessagingException e) {
e.printStackTrace();
}
// 发送邮件
mailSender.send(mimeMessage);
}
/**
* 初始化内外网邮件发送对象
*
* @param num
*/
// public static JavaMailSender initJavaMailSender(Integer num) {
// if (num != null && num == 1) {
// //内网
// return rebuildMailSender(hostIn, usernameIn, passwordIn, Integer.parseInt(portIn), "smtps");
// } else {
// //外网
// return rebuildMailSender(hostOut, usernameOut, passwordOut, Integer.parseInt(portOut), "smtps");
// }
// }
// public static String getInnerFrom() {
// return EmailInUtil;
// }
//
// public static String getOutterFrom() {
// return fromOut;
// }
/**
* 验证邮箱格式
*
* @param str
* @return
*/
public static boolean isEmail(String str) {
boolean flag = false;
Matcher matcher = emailPattern.matcher(str);
if (matcher.matches()) {
flag = true;
}
return flag;
}
public static boolean isPhoneNumber(String str) {
boolean flag = false;
Matcher matcher = phonePattern.matcher(str);
if (matcher.matches()) {
flag = true;
}
return flag;
}
}
@@ -19,8 +19,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @Author: ymbgy * 文档生成工具类
* @Date: 2022-09-21 13:26
*/ */
public class WordUtil { public class WordUtil {
@@ -5,4 +5,8 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
public interface IAdjudicationService { public interface IAdjudicationService {
AjaxResult createDocument(CaseApplication caseApplication); AjaxResult createDocument(CaseApplication caseApplication);
AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail);
AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour);
} }
@@ -1,7 +1,9 @@
package com.ruoyi.wisdomarbitrate.service.impl; package com.ruoyi.wisdomarbitrate.service.impl;
import com.deepoove.poi.config.Configure; import com.deepoove.poi.config.Configure;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.EmailOutUtil;
import com.ruoyi.common.utils.WordUtil; import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.wisdomarbitrate.domain.*; import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
@@ -11,9 +13,14 @@ import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.apache.poi.xwpf.usermodel.*; import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSendException;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
@@ -24,6 +31,8 @@ import java.util.*;
@Service @Service
public class AdjudicationServiceImpl implements IAdjudicationService { public class AdjudicationServiceImpl implements IAdjudicationService {
private final String apiUrl = "http://api.cainiaoapi.com/api/exp/v1/index";
@Autowired @Autowired
private CaseApplicationMapper caseApplicationMapper; private CaseApplicationMapper caseApplicationMapper;
@Autowired @Autowired
@@ -32,14 +41,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private ArbitrateRecordMapper arbitrateRecordMapper; private ArbitrateRecordMapper arbitrateRecordMapper;
@Autowired @Autowired
private CaseAttachMapper caseAttachMapper; private CaseAttachMapper caseAttachMapper;
@Autowired
private EmailOutUtil emailOutUtil;
@Override @Override
public AjaxResult createDocument(CaseApplication caseApplication) { public AjaxResult createDocument(CaseApplication caseApplication) {
try { try {
Map<String, Object> datas = new HashMap<>(); Map<String, Object> datas = new HashMap<>();
Adjudication adjudication = new Adjudication();
Long id = caseApplication.getId(); Long id = caseApplication.getId();
if (id == null){ if (id == null) {
return null; return null;
} }
//获取案件详细信息 //获取案件详细信息
@@ -53,59 +63,60 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
CaseAffiliate caseAffiliate = new CaseAffiliate(); CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(id); caseAffiliate.setCaseAppliId(id);
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliates != null && caseAffiliates.size() > 0){ if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates){ for (CaseAffiliate affiliate : caseAffiliates) {
//获取身份类型 //获取身份类型
int identityType = affiliate.getIdentityType(); int identityType = affiliate.getIdentityType();
if (identityType == 1) { //申请人 if (identityType == 1) { //申请人
datas.put("appName", affiliate.getName()); datas.put("appName", affiliate.getName());
datas.put("appSex", null);
datas.put("appIDNo", affiliate.getIdentityNum()); datas.put("appIDNo", affiliate.getIdentityNum());
datas.put("appAddress", affiliate.getContactAddress()); datas.put("appAddress", affiliate.getContactAddress());
datas.put("appAgentName", affiliate.getNameAgent()); datas.put("appAgentName", affiliate.getNameAgent());
datas.put("appAgentIDNo",affiliate.getIdentityNumAgent()); datas.put("appAgentIDNo", affiliate.getIdentityNumAgent());
}else if (identityType == 2){ //被申请人 } else if (identityType == 2) { //被申请人
datas.put("resName", affiliate.getName()); datas.put("resName", affiliate.getName());
datas.put("resSex", null);
datas.put("resIDNo", affiliate.getIdentityNum()); datas.put("resIDNo", affiliate.getIdentityNum());
datas.put("resAddress", affiliate.getContactAddress()); datas.put("resAddress", affiliate.getContactAddress());
datas.put("resAgentName", affiliate.getNameAgent()); datas.put("resAgentName", affiliate.getNameAgent());
datas.put("resAgentIDNo",affiliate.getIdentityNumAgent()); datas.put("resAgentIDNo", affiliate.getIdentityNumAgent());
} }
} }
} }
String arbitratorName = caseApplication1.getArbitratorName(); String arbitratorName = caseApplication1.getArbitratorName();
datas.put("caseName",caseApplication1.getCaseName()); datas.put("caseName", caseApplication1.getCaseName());
datas.put("arbitratorName",arbitratorName); datas.put("arbitratorName", arbitratorName);
LocalDate localDate = caseApplication1.getHearDate() Date hearDate = caseApplication1.getHearDate();
.toInstant() if (hearDate != null) {
.atZone(ZoneId.systemDefault()) LocalDate localDate = hearDate.toInstant()
.toLocalDate(); .atZone(ZoneId.systemDefault())
datas.put("hearYear", localDate.getYear()); .toLocalDate();
datas.put("hearMonths", localDate.getMonthValue()); datas.put("hearYear", localDate.getYear());
datas.put("hearDay", localDate.getDayOfMonth()); datas.put("hearMonths", localDate.getMonthValue());
datas.put("appArbitrationClaims", null); datas.put("hearDay", localDate.getDayOfMonth());
datas.put("appEvidenceName", null); } else {
datas.put("appProveFacts", null); datas.put("hearYear", null);
datas.put("resDefenseContentToApp", null); datas.put("hearMonths", null);
datas.put("resArbitrationClaims", null); datas.put("hearDay", null);
datas.put("resEvidenceName", null); }
datas.put("resProveFacts", null); datas.put("appArbitrationClaims", caseApplication1.getArbitratClaims());
datas.put("appDefenseContentToRes", null); if (arbitrateRecord1 != null) {
datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi()); datas.put("evidenDetermi", arbitrateRecord1.getEvidenDetermi());
datas.put("factDetermi", arbitrateRecord1.getFactDetermi()); datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
datas.put("caseSketch", arbitrateRecord1.getCaseSketch()); datas.put("caseSketch", arbitrateRecord1.getCaseSketch());
datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink()); datas.put("arbitrateThink", arbitrateRecord1.getArbitrateThink());
datas.put("legalProvisions", null); datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
datas.put("rulingFollows", arbitrateRecord1.getRulingFollows()); }
datas.put("umpire", null); datas.put("legalProvisions", "仲裁法");
if (arbitratorName.contains(",")){ if (arbitratorName == null) {
datas.put("arbitratorName1", null);
datas.put("arbitratorName2", null);
} else if (arbitratorName.contains(",")) {
String[] nameArray = arbitratorName.split(","); String[] nameArray = arbitratorName.split(",");
String firstName = nameArray[0]; String firstName = nameArray[0];
String secondName = nameArray[1]; String secondName = nameArray[1];
datas.put("arbitratorName1", firstName); datas.put("arbitratorName1", firstName);
datas.put("arbitratorName2", secondName); datas.put("arbitratorName2", secondName);
}else { } else {
String secondName = ""; String secondName = "";
datas.put("arbitratorName1", arbitratorName); datas.put("arbitratorName1", arbitratorName);
datas.put("arbitratorName2", secondName); datas.put("arbitratorName2", secondName);
@@ -114,19 +125,24 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("year", now.getYear()); datas.put("year", now.getYear());
datas.put("months", now.getMonthValue()); datas.put("months", now.getMonthValue());
datas.put("day", now.getDayOfMonth()); datas.put("day", now.getDayOfMonth());
datas.put("clerk", null); //String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx"; String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
//String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
String currentDateStr = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
String saveFolderPath = "/data/arbitrate-document/formal/" + currentDateStr; String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String resultFilePath = saveFolderPath + "/" + fileName;
// 创建日期目录 // 创建日期目录
File saveFolder = new File(saveFolderPath); File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) { if (!saveFolder.exists()) {
saveFolder.mkdirs(); saveFolder.mkdirs();
} }
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx"; Path sourcePath = new File(modalFilePath).toPath();
String resultFilePath = saveFolderPath+ fileName; Path destinationPath = new File(resultFilePath).toPath();
Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath); String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
caseApplicationMapper.submitCaseApplication(caseApplication1);
//将裁决书保存到附件表里 //将裁决书保存到附件表里
CaseAttach caseAttach = CaseAttach.builder() CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id) .caseAppliId(id)
@@ -135,13 +151,93 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
.annexType(3) .annexType(3)
.build(); .build();
int i = caseAttachMapper.save(caseAttach); int i = caseAttachMapper.save(caseAttach);
if (i>0){ if (i > 0) {
Integer annexId = caseAttach.getAnnexId(); if (arbitrateRecord1 != null) {
//将附件id保存到仲裁记录表里面 Integer annexId = caseAttach.getAnnexId();
arbitrateRecord1.setAnnexId(annexId); //将附件id保存到仲裁记录表里面
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1); arbitrateRecord1.setAnnexId(annexId);
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
}
}
return AjaxResult.success("裁决书已生成");
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
if (caseApplication1 == null) {
return AjaxResult.error("未查询到相关案件");
}
//根据案件id查询裁决书
try {
List<File> fileList = new ArrayList<>();
List<CaseAttach> caseAttachList = caseAttachMapper.queryAnnexPathByCaseId(id);
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
fileList.add(new File(annexPath));
}
}
}
//电子邮件送达
JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
if (appEmail != null) {
emailOutUtil.sendMessageCarryFiles(appEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", fileList
, "hjbjava@163.com", javaMailSender);
}
if (resEmail != null) {
emailOutUtil.sendMessageCarryFiles(resEmail, "案件裁决书", "您的裁决书已送达,详情请查阅附件", fileList
, "hjbjava@163.com", javaMailSender);
}
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
caseApplicationMapper.submitCaseApplication(caseApplication1);
return AjaxResult.success("仲裁文书送达成功");
} catch (MailSendException e) {
return AjaxResult.error("发送失败,请检查文件路径");
}
}
@Override
public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) {
try {
//快递单号查询
String key = "70ba5c7b327f71fccd5924f70e3e7b7f";
String com = "auto";
// 构造查询字符串参数
String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
URLEncoder.encode(key, "UTF-8"),
URLEncoder.encode(com, "UTF-8"),
URLEncoder.encode(trackingNum, "UTF-8"),
phoneLastFour);
// 拼接到API URL中
String fullUrl = apiUrl + "?" + queryParameters;
URL url = new URL(fullUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
// 处理返回的响应数据
return AjaxResult.success(response);
} else {
// 请求失败
return AjaxResult.error("请求失败,错误码:" + responseCode);
} }
return AjaxResult.success("裁决书保存路径为" + docFilePath);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -42,12 +42,22 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
if (opinion==0){ //拒绝 if (opinion==0){ //拒绝
if (arbitratMethod == 2){ if (arbitratMethod == 2){
caseApplication1.setArbitratMethod(1); // 更改仲裁方式 caseApplication1.setArbitratMethod(1); // 更改仲裁方式
//修改案件状态为待开庭审理
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
}else { }else {
caseApplication1.setArbitratMethod(2); caseApplication1.setArbitratMethod(2);
//修改案件状态为待书面审理
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
}
}else {
if (arbitratMethod == 2){
//修改案件状态为待书面审理
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
}else {
//修改案件状态为待开庭审理
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
} }
} }
//修改案件状态为待开庭
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR);
int i = caseApplicationMapper.submitCaseApplication(caseApplication1); int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
if (i > 0) { if (i > 0) {
String arbitratMethodStr = caseApplication1.getArbitratMethod() == 1 ? "开庭审理" : "书面审理"; String arbitratMethodStr = caseApplication1.getArbitratMethod() == 1 ? "开庭审理" : "书面审理";
@@ -92,21 +102,42 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
if (createBy!=null){ if (createBy!=null){
arbitrateRecord.setCreateBy(createBy); arbitrateRecord.setCreateBy(createBy);
} }
//提交仲裁结果 //先判断案件是否已经提交过仲裁结果
int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord); ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
if (i>0){ if (arbitrateRecord1!=null){
//案件日志表里添加数据 int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
CaseLogRecord caseLogRecord = new CaseLogRecord(); if (i>0){
caseLogRecord.setCaseAppliId(caseApplication1.getId()); //案件日志表里添加数据
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus()); CaseLogRecord caseLogRecord = new CaseLogRecord();
if (createBy!=null){ caseLogRecord.setCaseAppliId(caseApplication1.getId());
caseLogRecord.setCreateBy(createBy); caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
if (createBy!=null){
caseLogRecord.setCreateBy(createBy);
}
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
//修改案件状态
caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
caseApplicationMapper.submitCaseApplication(caseApplication);
return AjaxResult.success("提交成功");
}
}else {
//提交仲裁结果
int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
if (i>0){
//案件日志表里添加数据
CaseLogRecord caseLogRecord = new CaseLogRecord();
caseLogRecord.setCaseAppliId(caseApplication1.getId());
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
if (createBy!=null){
caseLogRecord.setCreateBy(createBy);
}
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
//修改案件状态
caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
caseApplicationMapper.submitCaseApplication(caseApplication);
return AjaxResult.success("提交成功");
} }
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
//修改案件状态
caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION);
caseApplicationMapper.submitCaseApplication(caseApplication);
return AjaxResult.success("提交成功");
} }
return AjaxResult.error("暂无需要提交仲裁结果的案件"); return AjaxResult.error("暂无需要提交仲裁结果的案件");
} }
@@ -85,7 +85,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM); caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
//修改案件状态 //修改案件状态
caseApplicationMapper.submitCaseApplication(caseApplication1); caseApplicationMapper.submitCaseApplication(caseApplication1);
return AjaxResult.success(); return AjaxResult.success("支付成功");
} }
@Override @Override