This commit is contained in:
gy b
2023-10-13 15:26:32 +08:00
11 changed files with 425 additions and 242 deletions
@@ -1,6 +1,8 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import java.util.List;
@@ -40,4 +42,8 @@ public interface ICaseApplicationService {
CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
String sendRoomNoMessage(SendRoomNoMessageVO messageVO);
SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException;
SealSignRecord selectSealUrl(CaseApplication caseApplication) throws EsignDemoException;
}
@@ -188,9 +188,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
//File file = new File("/home/ruoyi/" + annexPath);
String path = "/home/ruoyi/" + annexPath;
File file = new File(path);
System.out.println("文件是:" + file);
String path = "/home/ruoyi" + annexPath;
System.out.println("原文件路径是:" + path);
String newpath = path.replace("/", "\\");
System.out.println("新文件路径是:" + newpath);
File file = new File(newpath);
System.out.println("新文件是:" + file);
fileList.add(file);
}
}
@@ -424,21 +427,21 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return AjaxResult.success(archivesDetailVO);
}
/*public static void main(String[] args) {
public static void main(String[] args) {
try {
List<File> fileList = new ArrayList<>();
fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"));
File file = fileList.get(0);
// List<File> fileList = new ArrayList<>();
// fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"));
// File file = fileList.get(0);//System.out.println("这是文件"+file);
//电子邮件送达
EmailOutUtil emailOutUtil = new EmailOutUtil();
JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
if (javaMailSender != null) {
emailOutUtil.sendMessageCarryFile("1154956315@qq.com", "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
, "hjbjava@163.com", javaMailSender);
}
// EmailOutUtil emailOutUtil = new EmailOutUtil();
// JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
// if (javaMailSender != null) {
// emailOutUtil.sendMessageCarryFile("1154956315@qq.com", "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
// , "hjbjava@163.com", javaMailSender);
// }
} catch (MailSendException e) {
e.printStackTrace();
}
}*/
}
}
@@ -716,121 +716,120 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck();
if(agreeOrNotCheck.intValue()==1){//同意审核
//TODO 取消一下注释
// try {
// //获取当前案件的裁决书
// CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
// List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
// if (caseAttachList != null && caseAttachList.size() > 0) {
// for (CaseAttach caseAttach : caseAttachList) {
// if (caseAttach.getAnnexType() == 3) {
// String annexPath = caseAttach.getAnnexPath();
// String path = "/home/ruoyi/" + annexPath;
//// String path ="D:\\home\\仲裁裁决书模板.docx";
// //获取文件上传地址
// EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
// String body = response.getBody();
// if (body != null){
// JSONObject jsonObject = JSONObject.parseObject(body);
// String fileId = jsonObject.getJSONObject("data").getString("fileId");
// String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
// //上传文件流
// EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
// JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
// if (jsonObject1.getIntValue("errCode")==0){
// //查看文件上传状态
// Thread.sleep(5000);
// EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
// JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
// JSONObject data = jsonObject2.getJSONObject("data");
// int fileStatus =data.getIntValue("fileStatus");
// if (fileStatus == 2 || fileStatus == 5){
// String fileName = data.getString("fileName");
// //上传成功,获取文件签名印章位置
// SealSignRecord sealSignRecord = new SealSignRecord();
// sealSignRecord.setFileid(fileId);
// EsignHttpResponse positions = SignAward.getPositions(sealSignRecord);
// Gson gson = new Gson();
// JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
// JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
// String keywordPositions = positionsData.get("keywordPositions").getAsString();
// //发起签署
// sealSignRecord.setFilename(fileName);
// String arbitratorId = caseApplication2.getArbitratorId();
// if (arbitratorId!=null){
// SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
// if (sysUser == null){
// return rows;
// }
// sealSignRecord.setPensonAccount(sysUser.getPhonenumber());
// sealSignRecord.setPensonName(sysUser.getNickName());
// }
// sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
// sealSignRecord.setOrgnizeNamePsnAccount("秦桃则");
// sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
// sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
// sealSignRecord.setOrgnizeNamepsnName("韩超勃");
// //解析文件签名印章位置
// JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
// for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject jsonObject3 = jsonArray.getJSONObject(i);
// String keyword = jsonObject3.getString("keyword");
// if (keyword.equals("仲裁员")){
// //签名
// JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// // 遍历 positionsArray 中的每个元素
// for (int j = 0; j < positionsArray.size(); j++){
// JSONObject positionObj = positionsArray.getJSONObject(j);
// int pageNum = positionObj.getIntValue("pageNum");
// sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
// JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
// JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
// double positionX = coordinateObj.getDoubleValue("positionX");
// double positionY = coordinateObj.getDoubleValue("positionY");
// sealSignRecord.setPositionXpsn(positionX);
// sealSignRecord.setPositionYpsn(positionY);
// }
// }else {
// //用印
// JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// // 遍历 positionsArray 中的每个元素
// for (int j = 0; j < positionsArray.size(); j++) {
// JSONObject positionObj = positionsArray.getJSONObject(j);
// int pageNum = positionObj.getIntValue("pageNum");
// sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
// JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
// JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
// double positionX = coordinateObj.getDoubleValue("positionX");
// double positionY = coordinateObj.getDoubleValue("positionY");
// sealSignRecord.setPositionXorg(positionX);
// sealSignRecord.setPositionYorg(positionY);
// }
// }
// }
// EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
// JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
// if (jsonObject1.getIntValue("code")==0){
// //获取签署流程ID
// JSONObject data1 = jsonObject3.getJSONObject("data");
// String signFlowId = data1.getString("signFlowId");
// //保存案件id,文件id,文件名称.流程id到签署用印记录表里
// sealSignRecord.setCaseAppliId(caseApplication.getId());
// sealSignRecord.setSignFlowid(signFlowId);
// sealSignRecord.setSignFlowStatus(1);//待签名
// sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
// }
// }
// }
// }
// break;
// }
// }
// }
// } catch (EsignDemoException e) {
// e.printStackTrace();
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
try {
//获取当前案件的裁决书
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
String path = "/home/ruoyi/" + annexPath;
// String path ="D:\\home\\仲裁裁决书模板.docx";
//获取文件上传地址
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody();
if (body != null){
JSONObject jsonObject = JSONObject.parseObject(body);
String fileId = jsonObject.getJSONObject("data").getString("fileId");
String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
//上传文件流
EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
if (jsonObject1.getIntValue("errCode")==0){
//查看文件上传状态
Thread.sleep(5000);
EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
JSONObject data = jsonObject2.getJSONObject("data");
int fileStatus =data.getIntValue("fileStatus");
if (fileStatus == 2 || fileStatus == 5){
String fileName = data.getString("fileName");
//上传成功,获取文件签名印章位置
SealSignRecord sealSignRecord = new SealSignRecord();
sealSignRecord.setFileid(fileId);
EsignHttpResponse positions = SignAward.getPositions(sealSignRecord);
Gson gson = new Gson();
JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
String keywordPositions = positionsData.get("keywordPositions").getAsString();
//发起签署
sealSignRecord.setFilename(fileName);
String arbitratorId = caseApplication2.getArbitratorId();
if (arbitratorId!=null){
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
if (sysUser == null){
return rows;
}
sealSignRecord.setPensonAccount(sysUser.getPhonenumber());
sealSignRecord.setPensonName(sysUser.getNickName());
}
sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
sealSignRecord.setOrgnizeNamePsnAccount("秦桃则");
sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
sealSignRecord.setOrgnizeNamepsnName("韩超勃");
//解析文件签名印章位置
JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject3 = jsonArray.getJSONObject(i);
String keyword = jsonObject3.getString("keyword");
if (keyword.equals("仲裁员")){
//签名
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// 遍历 positionsArray 中的每个元素
for (int j = 0; j < positionsArray.size(); j++){
JSONObject positionObj = positionsArray.getJSONObject(j);
int pageNum = positionObj.getIntValue("pageNum");
sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXpsn(positionX);
sealSignRecord.setPositionYpsn(positionY);
}
}else {
//用印
JSONArray positionsArray = jsonObject3.getJSONArray("positions");
// 遍历 positionsArray 中的每个元素
for (int j = 0; j < positionsArray.size(); j++) {
JSONObject positionObj = positionsArray.getJSONObject(j);
int pageNum = positionObj.getIntValue("pageNum");
sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
double positionX = coordinateObj.getDoubleValue("positionX");
double positionY = coordinateObj.getDoubleValue("positionY");
sealSignRecord.setPositionXorg(positionX);
sealSignRecord.setPositionYorg(positionY);
}
}
}
EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
if (jsonObject1.getIntValue("code")==0){
//获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId");
//保存案件id,文件id,文件名称.流程id到签署用印记录表里
sealSignRecord.setCaseAppliId(caseApplication.getId());
sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名
sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
}
}
}
}
break;
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,"");