bug修复

This commit is contained in:
18792927508
2024-04-22 09:20:45 +08:00
parent a73b5ca3b4
commit 29d7cd37bf
8 changed files with 257 additions and 211 deletions
@@ -324,6 +324,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
if (identifyName == null) {
AjaxResult.error("请检查参数是否完整");
}
// 查询是否存在机构
SysDept sysDept = sysDeptMapper.selectDeptByName(identifyName);
Integer identifyType = deptIdentify.getIdentifyType();
if (identifyType == null) {
deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构
@@ -331,11 +333,19 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证
deptIdentify.setIsUse(0); //设置机构默认为未启用
//将机构名称保存到部门表里
SysDept sysDept = new SysDept();
sysDept.setDeptName(identifyName);
sysDept.setParentId(0L);
sysDept.setDeptType(1);
int i1 = sysDeptMapper.insertDept(sysDept);
int i1=0;
if(sysDept == null) {
sysDept = new SysDept();
sysDept.setParentId(0L);
sysDept.setDeptName(identifyName);
sysDept.setDeptType(1);
i1 = sysDeptMapper.insertDept(sysDept);
}
else {
sysDept.setDeptType(1);
sysDeptMapper.updateDept(sysDept);
}
if (i1 > 0) {
/* //将经办人信息存入到用户表里
Long deptId = sysDept.getDeptId();
@@ -2132,6 +2132,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 根据案件id查询案件
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(application.getId());
if (caseApplication == null) {
throw new ServiceException("未找到案件");
}
caseApplication.setHearDate(application.getHearDate());
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
@@ -2141,15 +2144,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 申请人发送开庭日期短信
sendHearDateSms(caseApplication, affiliates);
// 调解员发送开庭短信
sendMeditorHearDateSms(caseApplication,vo);
}
}
}, executor);
// 调解员发送短信,根据调解员id查询用户
CompletableFuture.runAsync(() -> { if (caseApplication.getMediatorId() != null) {
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
}
/**
* 调解员发送开庭短信
* @param caseApplication
* @param vo
*/
private void sendMeditorHearDateSms(MsCaseApplication caseApplication, BookingVO vo) {
if (caseApplication.getMediatorId() != null && CollectionUtil.isNotEmpty(vo.getHerDates()) && StrUtil.isNotEmpty(caseApplication.getHearDate())) {
// 线下调解 2077966 尊敬的用户,您的{1}案件,线下调解日期已确定为{2},请知晓,如非本人操作,请忽略本短信。
SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + application.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。";
String content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "的案件,线下调解日期已确定为" + caseApplication.getHearDate() + ",请知晓,如非本人操作,请忽略本短信。";
String templateId = "2077966";
String subject = "开庭日期通知";
MsCaseAffiliate meditorAffliate = new MsCaseAffiliate();
@@ -2163,17 +2178,17 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
roomUuid = shortMessageService.buildMeetingInfoRecord(meetingInfoVO);
// 短信模板:2130103 线上调解时间和会议通知 尊敬的用户,您的{2}线上开庭时间为{3},会议链接https://txroom.xayunmei.com/#/home?{4},请点击链接参加会议,如非本人操作,请忽略本短信.
content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + application.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
content = "尊敬的用户,您的" + caseApplication.getCaseNum() + "线上开庭时间为" + caseApplication.getHearDate() + "会议链接https://txroom.xayunmei.com/#/home?" +"authId="+ roomUuid + ",请点击链接参加会议,如非本人操作,请忽略本短信.";
templateId = "2130103";
}
// 电话号不为空,发送短信,否则发邮箱
if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) {
if (roomUuid == null) {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate()});
new String[]{caseApplication.getCaseNum(), caseApplication.getHearDate()});
} else {
SmsUtils.sendSms(caseApplication, templateId, sysUser.getPhonenumber(),
new String[]{caseApplication.getCaseNum(), application.getHearDate(), "authId="+roomUuid});
new String[]{caseApplication.getCaseNum(), caseApplication.getHearDate(), "authId="+roomUuid});
}
@@ -2182,11 +2197,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content);
}
} }, executor);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "");
}
}
/**
* 发送开庭日期短信
* @param application
@@ -2386,6 +2400,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
public AjaxResult saveOnlyOfficeFile(MsCaseAttach caseAttach) {
if(StrUtil.isEmpty(caseAttach.getAnnexName())) {
caseAttach.setAnnexName("调解书");
}
if(StrUtil.isNotEmpty(caseAttach.getAnnexPath())) {
String replace = caseAttach.getAnnexPath().replace("/home/ruoyi/uploadPath", "/profile");
caseAttach.setAnnexPath(replace);
}
caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
caseAttach.setUseId(getUserInfo().getUserId());
@@ -2483,8 +2501,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
String annexPath = caseAttach.getAnnexPath();
if (annexPath.contains("/profile/upload")) {
annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
if (annexPath.contains("/profile")) {
annexPath = annexPath.replace("/profile", "/home/ruoyi/uploadPath");
}
String path = annexPath;
//获取文件上传地址
@@ -2829,8 +2847,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
for (MsCaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
String annexPath = caseAttach.getAnnexPath();
if (annexPath.contains("/profile/upload")) {
annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload");
if (annexPath.contains("/profile")) {
annexPath = annexPath.replace("/profile", "/home/ruoyi/uploadPath");
}
String path = annexPath;
//获取文件上传地址
@@ -2959,7 +2977,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
SmsUtils.sendSms(application, "2047719",resAffiliateOpt.get().getPhone(), new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew});
} else {
throw new ServiceException(jsonObject3.getString("message"));
return AjaxResult.error(jsonObject3.getString("message"));
}
} else {
return AjaxResult.error();
@@ -3019,14 +3037,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
List<MsCaseAttach> msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) {
for (MsCaseAttach msCaseAttach : msCaseAttaches) {
String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath();
File file = new File(templatePath.replace("/profile", "/uploadPath"));
if (StrUtil.isEmpty(msCaseAttach.getAnnexPath())) {
continue;
}
String replacePath = msCaseAttach.getAnnexPath().replace("/profile/", "/home/ruoyi/uploadPath/");
File file = new File(replacePath);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId());
msCaseAttachMapper.updateCaseAttach(msCaseAttach);
}
}
}
// 修改案件状态为待送达
@@ -3398,12 +3422,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
caseAttach= MsCaseAttach.builder()
.caseAppliId(application.getId())
.annexName(jsonObject.getString("fileName"))
.annexPath(jsonObject.getString("filePath"))
.annexType(annexType)
.onlyOfficeFileId(jsonObject.getString("fileId"))
.build();
if(jsonObject.get("filePath")!=null){
String officePath = jsonObject.getString("filePath");
String replace = officePath.replace("/home/ruoyi/uploadPath/", "/profile/");
caseAttach.setAnnexPath(replace);
}
}
//保存到附件表里,先删除之前的在保存
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
msCaseAttachMapper.save(caseAttach);
@@ -3430,16 +3461,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
if(StrUtil.isEmpty(application.getCaseSource())) {
// 北明推送
String path = "/home/ruoyi" + caseAttach.getAnnexPath();
File file = new File(path.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK);
if (StrUtil.isNotEmpty(caseAttach.getAnnexPath())) {
String replacePath = caseAttach.getAnnexPath().replace("/profile/", "/home/ruoyi/uploadPath/");
File file = new File(replacePath);
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_APPLY_BOOK);
// 更新附件表
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
// 更新附件表
if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) {
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
}
}
}
msCaseAttachMapper.save(caseAttach);
msCaseAttachMapper.save(caseAttach);
}
}
}
@@ -3451,7 +3486,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Override
@Transactional
public JSONArray uploadOnlyOffice(String annexPath,Long caseId) {
annexPath=annexPath.replace("/profile","/home/ruoyi/uploadPath");
annexPath=annexPath.replace("/profile/","/home/ruoyi/uploadPath/");
File file = new File(annexPath);
if (file.exists()) {
// 调用onlyoffice
@@ -59,6 +59,7 @@ import com.ruoyi.wisdomarbitrate.service.shortmessage.ShortMessageService;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
import com.ruoyi.wisdomarbitrate.utils.SmsUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -76,7 +77,7 @@ import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.domain.AjaxResult.success;
@Slf4j
@Service
public class MsSignSealServiceImpl implements MsSignSealService {
@@ -706,6 +707,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
JSONObject jsonObjectCallback = JSONObject.parseObject(reqbodystr);
Gson gson = new Gson();
if (jsonObjectCallback != null) {
log.info("签名回调======"+jsonObjectCallback);
int signResult = jsonObjectCallback.getIntValue("signResult");
String action = jsonObjectCallback.getString("action");
String signFlowId = jsonObjectCallback.getString("signFlowId");
@@ -857,11 +859,15 @@ public class MsSignSealServiceImpl implements MsSignSealService {
//修改"签署用印记录表"的状态为待用印
if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) {
sealSignRecordsel.setSignFlowStatus(2);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
}else {
// 否则为已完成
sealSignRecordsel.setSignFlowStatus(3);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
// 下载调解书
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
}
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
}
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){
//需要用印
@@ -915,71 +921,72 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
//下载审核完成的调解书
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
String resultFilePath = saveFolderPath + "/" + fileName;
File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile();
}
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if (downLoadFile) {
// 先删除已经存在的调解书
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){
// 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue;
}
beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
}
}
}
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.save(caseAttach);
// 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}
}
}
}
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
// JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
// if (filesArray != null && filesArray.size() > 0) {
// JsonObject fileObject = (JsonObject) filesArray.get(0);
// String fileDownloadUrl = fileObject.get("downloadUrl").toString();
// LocalDate now = LocalDate.now();
// String year = Integer.toString(now.getYear());
// String month = String.format("%02d", now.getMonthValue());
// String day = String.format("%02d", now.getDayOfMonth());
// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
// String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
// String saveName = fileName;
// String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
//
// // 创建日期目录
// File saveFolder = new File(saveFolderPath);
// if (!saveFolder.exists()) {
// saveFolder.mkdirs();
// }
// String resultFilePath = saveFolderPath + "/" + fileName;
// File resultFilePathFile = new File(resultFilePath);
// if (!resultFilePathFile.exists()) {
// resultFilePathFile.createNewFile();
// }
//
// String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
// boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
// if (downLoadFile) {
// // 先删除已经存在的调解书
// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
// List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
// if(CollectionUtil.isNotEmpty(existAttach)){
// // 对接北明,同步案件状态,删除
// for (MsCaseAttach msCaseAttach : existAttach) {
// if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
// continue;
// }
// beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
// }
// }
// }
// msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
// MsCaseAttach caseAttach = new MsCaseAttach();
// caseAttach.setCaseAppliId(caseAppliId);
// caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
// caseAttach.setAnnexPath(savePath);
// caseAttach.setAnnexName(saveName);
// caseAttachMapper.save(caseAttach);
// // 对接北明,调用上传附件接口
// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
// String templatePath = "/home/ruoyi" + savePath;
// File file = new File(templatePath.replace("/profile", "/uploadPath"));
// MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// // 更新附件表
// if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
// caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
// msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach);
// }
//
// }
// }
//
// }
}
}else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){
//被申请人签名
@@ -1005,71 +1012,72 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
//下载审核完成的调解书
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
String saveName = fileName;
String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}
String resultFilePath = saveFolderPath + "/" + fileName;
File resultFilePathFile = new File(resultFilePath);
if (!resultFilePathFile.exists()) {
resultFilePathFile.createNewFile();
}
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if (downLoadFile) {
// 先删除已经存在的调解书
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
if(CollectionUtil.isNotEmpty(existAttach)){
// 对接北明,同步案件状态,删除
for (MsCaseAttach msCaseAttach : existAttach) {
if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
continue;
}
beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
}
}
}
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(7);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
// 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
String templatePath = "/home/ruoyi" + savePath;
File file = new File(templatePath.replace("/profile", "/uploadPath"));
MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// 更新附件表
if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
}
}
caseAttachMapper.save(caseAttach);
}
}
downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId);
// EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
// JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
// JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
// JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
// if (filesArray != null && filesArray.size() > 0) {
// JsonObject fileObject = (JsonObject) filesArray.get(0);
// String fileDownloadUrl = fileObject.get("downloadUrl").toString();
// LocalDate now = LocalDate.now();
// String year = Integer.toString(now.getYear());
// String month = String.format("%02d", now.getMonthValue());
// String day = String.format("%02d", now.getDayOfMonth());
// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
// String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
// String saveName = fileName;
// String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
//
// // 创建日期目录
// File saveFolder = new File(saveFolderPath);
// if (!saveFolder.exists()) {
// saveFolder.mkdirs();
// }
// String resultFilePath = saveFolderPath + "/" + fileName;
// File resultFilePathFile = new File(resultFilePath);
// if (!resultFilePathFile.exists()) {
// resultFilePathFile.createNewFile();
// }
//
// String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
// boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
// if (downLoadFile) {
// // 先删除已经存在的调解书
// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
// List<MsCaseAttach> existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
// if(CollectionUtil.isNotEmpty(existAttach)){
// // 对接北明,同步案件状态,删除
// for (MsCaseAttach msCaseAttach : existAttach) {
// if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){
// continue;
// }
// beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath()));
// }
// }
// }
// msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
// MsCaseAttach caseAttach = new MsCaseAttach();
// caseAttach.setCaseAppliId(caseAppliId);
// caseAttach.setAnnexType(7);
// caseAttach.setAnnexPath(savePath);
// caseAttach.setAnnexName(saveName);
//
// // 对接北明,调用上传附件接口
//
// if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
// String templatePath = "/home/ruoyi" + savePath;
// File file = new File(templatePath.replace("/profile", "/uploadPath"));
// MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT);
// // 更新附件表
// if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){
// caseAttach.setOtherSysFileId(caseFileInfo.getFileId());
// }
// }
// caseAttachMapper.save(caseAttach);
// }
//
// }
}
}
}
@@ -1082,10 +1090,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
}
private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException {
log.info("signFlowId===="+signFlowId);
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
log.info("下载成功===="+fileDownload);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
log.info("下载调解书pdf===="+filesArray);
if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
@@ -1111,6 +1122,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
log.info("是否下载成功======="+downLoadFile);
if (downLoadFile) {
// 先删除已经存在的调解书
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){
@@ -1126,11 +1138,13 @@ public class MsSignSealServiceImpl implements MsSignSealService {
}
}
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode());
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode());
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
log.info("调解书保存======="+downLoadFile);
caseAttachMapper.save(caseAttach);
// 对接北明,调用上传附件接口
if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) {
@@ -113,7 +113,7 @@
<select id="list" resultType="com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO">
select t.* from(
SELECT
c.id,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus,
c.id,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus,
c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,
u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
c.mediation_method mediationMethod,
@@ -123,7 +123,7 @@
c.id
union
SELECT
c.id,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus,
c.id,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus,
c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,
u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
c.mediation_method mediationMethod,