diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index c809b33..0b4250b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -429,4 +429,17 @@ public class CaseApplicationController extends BaseController { return success(caseApplicationService.reserveConferenceList(caseId)); } + + /** + * 案件压缩包导入 + * @param file + * @return + * @throws IOException + */ + @PostMapping("/uploadCaseZipFile") + public AjaxResult uploadCaseZipFile(@RequestParam("file") MultipartFile file) throws IOException { + return caseApplicationService.uploadCaseZipFile(file); + } + + } diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 7c73190..971c071 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -22,6 +22,7 @@ com.ruoyi ruoyi-common + com.ruoyi pay @@ -32,6 +33,7 @@ tls-sig-api-v2 1.2 + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java index 8d12171..5ffc79d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java @@ -112,4 +112,6 @@ public interface ICaseApplicationService { AjaxResult deleteRoom( String roomId); + AjaxResult uploadCaseZipFile(MultipartFile file); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 03f8bfd..7c7616d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -4,6 +4,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdcardUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.ZipUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -11,6 +12,7 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.*; @@ -19,6 +21,7 @@ import com.ruoyi.common.enums.UpdateSubmitStatus; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.SaaSAPIFileUtils; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.thread.ThreadPoolUtil; @@ -49,6 +52,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; + import java.io.*; import java.math.BigDecimal; import java.math.RoundingMode; @@ -61,6 +65,8 @@ import java.time.ZoneId; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.utils.PageUtils.startPage; @@ -157,7 +163,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } for (SysRole role : roles) { - if(StrUtil.isEmpty(role.getRoleName())){ + if (StrUtil.isEmpty(role.getRoleName())) { continue; } // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √ @@ -188,7 +194,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setDeptIds(deptIds); } if ("申请人".equals(role.getRoleName())) { - // caseApplication.setIsOtherRole(1); + // caseApplication.setIsOtherRole(1); // 查询有关的用户部门 caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId())); } @@ -200,7 +206,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if ("代理人".equals(role.getRoleName())) { caseApplication.setIsOtherRole(1); // 查询角色有关的用户部门 - // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); + // List agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId()); List agentDeptIds = new ArrayList<>(); agentDeptIds.add(sysUser.getDeptId()); caseApplication.setAgentDeptIds(agentDeptIds); @@ -233,7 +239,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { CaseApplication caseApplication = new CaseApplication(); List caseStatusList = new ArrayList<>(); for (SysRole role : roles) { - if(StrUtil.isEmpty(role.getRoleName())){ + if (StrUtil.isEmpty(role.getRoleName())) { continue; } // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √ @@ -264,7 +270,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setDeptIds(deptIds); } if ("申请人".equals(role.getRoleName())) { - // caseApplication.setIsOtherRole(1); + // caseApplication.setIsOtherRole(1); // 查询角色有关的用户部门 caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId())); } @@ -286,7 +292,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 根据条件查询申请人,被申请人,仲裁员,法律顾问案件 ToDoCount toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication); - if(toDoCount==null){ + if (toDoCount == null) { return new ToDoCount(); } return toDoCount; @@ -360,7 +366,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return AjaxResult.error("请选择要上传的文件"); } String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile"; -// String targetPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile"; + // String targetPath = "D:\\home\\unzip\\"; File zipFile = null; InputStream ins = null; try { @@ -540,7 +546,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } } } - return success(); } @@ -878,6 +883,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { /** * 新增案件 + * * @param caseApplication * @return */ @@ -898,7 +904,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setVersion(1); // 新增立案信息 int rows = caseApplicationMapper.insertCaseApplication(caseApplication); - if(rows==0){ + if (rows == 0) { return rows; } List caseAffiliates = caseApplication.getCaseAffiliates(); @@ -1010,12 +1016,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setFeePayable(feePayable); caseApplication.setUpdateBy(getUsername()); // 立案申请状态直接修改主表信息 - if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { + if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { caseApplicationMapper.updataCaseApplication(caseApplication); // 修改记录表状态为同意提交修改的内容 caseApplication.setUpdateSubmitStatus(0); - }else { + } else { // 修改记录表状态为已提交修改的内容 caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode()); } @@ -1064,7 +1070,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } // 立案申请状态直接修改主表信息 - if(caseApplication.getCaseStatus()!=null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { + if (caseApplication.getCaseStatus() != null && caseApplication.getCaseStatus().equals(CaseApplicationConstants.CASE_APPLICATION)) { caseAffiliateMapper.updataCaseAffiliate(caseAffiliate); } @@ -1084,11 +1090,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if (maxVersion == null) { maxVersion = 1; } - caseApplication.setVersion(maxVersion+1); + caseApplication.setVersion(maxVersion + 1); // 将修改提交状态改为未提交 - // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); + // caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode()); // 修改案件表的版本号 - // caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion()); + // caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion()); // 异步新增案件日志 ThreadPoolUtil.execute(() -> { @@ -1307,7 +1313,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { StringBuilder failureMsg = new StringBuilder(); StringBuilder successMsg = new StringBuilder(); int successNum = 0; - List caseAffiliateLogList=new ArrayList<>(); + List caseAffiliateLogList = new ArrayList<>(); if (caseApplicationList != null && caseApplicationList.size() > 0) { // 1,查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); @@ -1374,7 +1380,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationItera.setCreateBy(getUsername()); caseApplicationItera.setImportFlag(1); int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera); - if(rows==0){ + if (rows == 0) { continue; } // 新增日志 @@ -1394,7 +1400,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationItera.setVersion(1); int insertRow = caseApplicationLogMapper.insert(caseApplicationItera); - if(insertRow>0){ + if (insertRow > 0) { caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplicationItera.getId())); caseAffiliateLogList.addAll(caseAffiliates); } @@ -1408,7 +1414,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } // 异步新增案件日志 ThreadPoolUtil.execute(() -> { - if ( CollectionUtil.isNotEmpty(caseAffiliateLogList)) { + if (CollectionUtil.isNotEmpty(caseAffiliateLogList)) { // 插入案件日志人员相关表 caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliateLogList); } @@ -1457,7 +1463,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) { failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;"); - } else if (! IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) { + } else if (!IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) { failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;"); } String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent(); @@ -1487,7 +1493,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) { failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;"); - } else if (! IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) { + } else if (!IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) { failureMsg.append("【被申请人主体信息-身份证号】不合法;"); } String debtorContactTelphone = caseApplication.getDebtorContactTelphone(); @@ -1524,7 +1530,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getDebtorEmail())) { failureMsg.append("【被申请人主体信息-邮箱】字段不能为空;"); - } else if(!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()){ + } else if (!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()) { failureMsg.append("【被申请人主体信息-邮箱】字段不合法;"); } @@ -1630,7 +1636,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } if (StrUtil.isEmpty(caseApplication.getEmail())) { failureMsg.append("【申请人主体信息-邮箱】字段不能为空;"); - } else if(!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()){ + } else if (!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()) { failureMsg.append("【申请人主体信息-邮箱】字段不合法;"); } @@ -1928,7 +1934,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord, sealIdList); JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null){ + if (jsonObject3 != null) { if (jsonObject3.getIntValue("code") == 0) { //获取签署流程ID JSONObject data1 = jsonObject3.getJSONObject("data"); @@ -1941,7 +1947,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } else { throw new ServiceException("发起签署流程失败,请检查参数是否有误"); } - }else { + } else { return AjaxResult.error(); } @@ -2692,14 +2698,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { */ @Transactional @Override - public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) { + public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) { // 新增预约会议表 - ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(),SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(), - reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime()); + ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(), + reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime()); - reservedConferenceMapper.insert(conference); - return success("预约会议成功"); + reservedConferenceMapper.insert(conference); + return success("预约会议成功"); } @@ -2728,10 +2734,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // 查询最大房间号 Long maxRoomId = caseApplicationMapper.selectMaxRoomId(); - if (null == maxRoomId || maxRoomId >4294967294L) { + if (null == maxRoomId || maxRoomId > 4294967294L) { return 1L; } else { - return maxRoomId+1; + return maxRoomId + 1; } } @@ -2776,10 +2782,72 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Override public AjaxResult deleteRoom(String roomId) { - return success( reservedConferenceMapper.deleteByRoomId(roomId)); + return success(reservedConferenceMapper.deleteByRoomId(roomId)); } + @Override + public AjaxResult uploadCaseZipFile(MultipartFile file) { + if (file.isEmpty()) { + return AjaxResult.error("请选择要上传的文件"); + } + //String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile"; + String targetPath = "D:\\home\\unzip\\"; + File zipFile = null; + InputStream ins = null; + try { + ins = file.getInputStream(); + zipFile = new File(file.getOriginalFilename()); + inputChangeToFile(ins, zipFile); + } catch (IOException e) { + e.printStackTrace(); + } + //解压缩上传的压缩包 + boolean unzipSuccess = UnZipFileUtils.unZipFile(zipFile, targetPath); + if (unzipSuccess ) { + String unzipPath = targetPath + file.getOriginalFilename() + "\\"; + File directory = new File(targetPath); + String pdfFilePath = findAndConvertPDF(directory); + if (pdfFilePath != null){ + // 返回找到的PDF文件路径 + return AjaxResult.success(pdfFilePath); + }else { + // 没有找到符合条件的文件 + return AjaxResult.error("未找到符合条件的文件"); + } + }else { + // 解压失败 + return AjaxResult.error("解压失败"); + } + } + public static String findAndConvertPDF(File directory) { + + File[] matches = directory.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.contains("仲裁申请书"); + } + }); + + if (matches != null && matches.length > 0) { + for (File file : matches) { + if (file.isFile() && file.getName().toLowerCase().endsWith(".pdf")) { + // 如果是PDF格式直接返回路径 + return file.getAbsolutePath(); + } else { + // 如果不是PDF格式,进行转换成PDF并返回路径 + String pdfPath = convertToPDF(file); + return pdfPath; + } + } + } + return null; + } + + private static String convertToPDF(File file) { + // 实现文件格式转换逻辑,这里假设已经实现了转换逻辑,返回转换后的PDF文件路径 + String pdfPath = "convertedFilePath.pdf"; // 这里替换为实际转换后的PDF文件路径 + return pdfPath; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java index e346c4f..7e84baa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java @@ -223,7 +223,6 @@ public class CasePaymentServiceImpl implements ICasePaymentService { casePaymentRecordMapper.saveRecord(paymentRecord); // 新增日志 CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, ""); - } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index b532b5e..f4892e1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -182,192 +182,93 @@ public class FixSelectFlowDetailUtils { public void fixExecuteSelectDeptIndentifyUtils() throws Exception { Gson gson = new Gson(); DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIdentifyStatus(0); List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { for (int i = 0; i < deptIdentifysnew.size(); i++) { DeptIdentify deptIdentify1 = deptIdentifysnew.get(i); - String authFlowId = deptIdentify1.getAuthFlowId(); - if (authFlowId != null) { - EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1); - JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class); - int code = identifyInfoJsonObject.get("code").getAsInt(); - if (code == 0) { - JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data"); - int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt(); - if (realnameStatus == 1) { - String orgId = identifyInfoData.get("orgId").getAsString(); - //查询企业内部印章 - EsignHttpResponse response = SignAward.deptIdentifySealList(orgId); - JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class); - int code1 = jsonObject.get("code").getAsInt(); - if (code1 == 0) { - JsonObject data = jsonObject.getAsJsonObject("data"); - JsonArray seals = data.get("seals").getAsJsonArray(); - if (seals.size() > 0) { - for (int j = 0; j < seals.size(); j++) { - //保存印章信息到数据库 - JsonObject asJsonObject = seals.get(j).getAsJsonObject(); - SealManage sealManage = new SealManage(); - String sealName = asJsonObject.get("sealName").toString(); - String sealId = asJsonObject.get("sealId").toString(); - String url = asJsonObject.get("sealImageDownloadUrl").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("-", "") + ".jpg"; - String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String savePath = "/home/ruoyi/uploadPath/upload/"; - // 创建日期目录 - 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 = url.substring(1, url.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - CaseAttach caseAttach = new CaseAttach(); - caseAttach.setAnnexType(10); //10代表印章图片 - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - int i1 = caseAttachMapper.save(caseAttach); - if (i1 > 0) { - //将印章信息保存到公章管理表里 - String sealName1 = sealName.substring(1, sealName.length() - 1); - String sealId1 = sealId.substring(1, sealId.length() - 1); - Integer annexId1 = caseAttach.getAnnexId(); - sealManage.setAnnexId(annexId1); - sealManage.setSealId(sealId1); - sealManage.setSealName(sealName1); - sealManage.setIdentifyId(deptIdentify1.getId()); - sealManage.setSealStatus(1); - sealManage.setIsUse(1); - sealManageMapper.insertSealManage(sealManage); + Integer identifyStatus = deptIdentify1.getIdentifyStatus(); + if (identifyStatus!=1){ + String authFlowId = deptIdentify1.getAuthFlowId(); + if (authFlowId != null) { + EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1); + JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class); + int code = identifyInfoJsonObject.get("code").getAsInt(); + if (code == 0) { + JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data"); + int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt(); + if (realnameStatus == 1) { + String orgId = identifyInfoData.get("orgId").getAsString(); + //查询企业内部印章 + EsignHttpResponse response = SignAward.deptIdentifySealList(orgId); + JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class); + int code1 = jsonObject.get("code").getAsInt(); + if (code1 == 0) { + JsonObject data = jsonObject.getAsJsonObject("data"); + JsonArray seals = data.get("seals").getAsJsonArray(); + if (seals.size() > 0) { + for (int j = 0; j < seals.size(); j++) { + //保存印章信息到数据库 + JsonObject asJsonObject = seals.get(j).getAsJsonObject(); + SealManage sealManage = new SealManage(); + String sealName = asJsonObject.get("sealName").toString(); + String sealId = asJsonObject.get("sealId").toString(); + String url = asJsonObject.get("sealImageDownloadUrl").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("-", "") + ".jpg"; + String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + String savePath = "/home/ruoyi/uploadPath/upload/"; + // 创建日期目录 + 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 = url.substring(1, url.length() - 1); + boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + if (downLoadFile) { + CaseAttach caseAttach = new CaseAttach(); + caseAttach.setAnnexType(10); //10代表印章图片 + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + int i1 = caseAttachMapper.save(caseAttach); + if (i1 > 0) { + //将印章信息保存到公章管理表里 + String sealName1 = sealName.substring(1, sealName.length() - 1); + String sealId1 = sealId.substring(1, sealId.length() - 1); + Integer annexId1 = caseAttach.getAnnexId(); + sealManage.setAnnexId(annexId1); + sealManage.setSealId(sealId1); + sealManage.setSealName(sealName1); + sealManage.setIdentifyId(deptIdentify1.getId()); + sealManage.setSealStatus(1); + sealManage.setIsUse(1); + sealManageMapper.insertSealManage(sealManage); + } } } } - } + } + //将orgId保存到数据库里 + deptIdentify1.setOrgId(orgId); + deptIdentify1.setIdentifyStatus(1); + deptIdentify1.setIsUse(0); //默认机构为未启用 + int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1); } - //将orgId保存到数据库里 - deptIdentify1.setOrgId(orgId); - deptIdentify1.setIdentifyStatus(1); - deptIdentify1.setIsUse(0); //默认机构为未启用 - int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1); + }else { + deptIdentify1.setIdentifyStatus(2); + deptIdentifyMapper.updateDeptIdentify(deptIdentify1); } - }else { - deptIdentify1.setIdentifyStatus(2); - deptIdentifyMapper.updateDeptIdentify(deptIdentify1); } } - - } - } - } - - /** - * 定时查询企业认证状态 - * - * @throws Exception - */ - @Scheduled(cron = "*/30 * * * * *") - @Transactional - public void fixExecuteSelectDeptIndentify() throws Exception { - Gson gson = new Gson(); - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIdentifyStatus(2); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - for (int i = 0; i < deptIdentifysnew.size(); i++) { - DeptIdentify deptIdentify1 = deptIdentifysnew.get(i); - String authFlowId = deptIdentify1.getAuthFlowId(); - if (authFlowId != null) { - EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1); - JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class); - int code = identifyInfoJsonObject.get("code").getAsInt(); - if (code == 0) { - JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data"); - int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt(); - if (realnameStatus == 1) { - String orgId = identifyInfoData.get("orgId").getAsString(); - //查询企业内部印章 - EsignHttpResponse response = SignAward.deptIdentifySealList(orgId); - JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class); - int code1 = jsonObject.get("code").getAsInt(); - if (code1 == 0) { - JsonObject data = jsonObject.getAsJsonObject("data"); - JsonArray seals = data.get("seals").getAsJsonArray(); - if (seals.size() > 0) { - for (int j = 0; j < seals.size(); j++) { - //保存印章信息到数据库 - JsonObject asJsonObject = seals.get(j).getAsJsonObject(); - SealManage sealManage = new SealManage(); - String sealName = asJsonObject.get("sealName").toString(); - String sealId = asJsonObject.get("sealId").toString(); - String url = asJsonObject.get("sealImageDownloadUrl").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("-", "") + ".jpg"; - String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; - String savePath = "/home/ruoyi/uploadPath/upload/"; - // 创建日期目录 - 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 = url.substring(1, url.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - CaseAttach caseAttach = new CaseAttach(); - caseAttach.setAnnexType(10); //10代表印章图片 - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - int i1 = caseAttachMapper.save(caseAttach); - if (i1 > 0) { - //将印章信息保存到公章管理表里 - String sealName1 = sealName.substring(1, sealName.length() - 1); - String sealId1 = sealId.substring(1, sealId.length() - 1); - Integer annexId1 = caseAttach.getAnnexId(); - sealManage.setAnnexId(annexId1); - sealManage.setSealId(sealId1); - sealManage.setSealName(sealName1); - sealManage.setIdentifyId(deptIdentify1.getId()); - sealManage.setSealStatus(1); - sealManage.setIsUse(1); - sealManageMapper.insertSealManage(sealManage); - } - } - } - } - - } - //将orgId保存到数据库里 - deptIdentify1.setOrgId(orgId); - deptIdentify1.setIdentifyStatus(1); - deptIdentify1.setIsUse(0); //默认机构为未启用 - int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1); - } - }else { - deptIdentify1.setIdentifyStatus(2); - deptIdentifyMapper.updateDeptIdentify(deptIdentify1); - } - } - } } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/UnZipFileUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/UnZipFileUtils.java index a787cc2..3a6877d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/UnZipFileUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/UnZipFileUtils.java @@ -17,43 +17,14 @@ import java.util.zip.ZipFile; public class UnZipFileUtils { public static void main(String[] args) { - // 压缩包路径 -// String zipPath = "F:\\testZip\\zipFile\\上传申请书证据材料.zip"; - // 解压后存放路径 -// String targetPath = "F:\\testZip\\unzipFile"; -// unZipFile(new File(zipPath),targetPath); - - -// String zipPath = "F:\\testZip\\unzipFile\\上传申请书证据材料"; -// File dirUnzipPath = new File(zipPath); -// List allFiles = new ArrayList<>(); -// getFiles(dirUnzipPath,allFiles); -// if(allFiles!=null&&allFiles.size()>0){ -// for (File fileIter : allFiles) { -// System.out.println(fileIter.getName()); -// System.out.println(fileIter.getAbsolutePath()); -// } -// } - - String key = "\\"; - String str = "F:\\testZip\\上传申请书证据材料\\证据材料\\仲裁裁决书模板.docx"; - List allindex = new ArrayList<>(); - int a = str.indexOf(key);//*第一个出现的索引位置 - allindex.add(a); - while (a != -1) { - System.out.print(a + "\t"); - a = str.indexOf(key, a + 1);//*从这个索引往后开始第一个出现的位置 - allindex.add(a); - } - String substr = str.substring(allindex.get(1)+1,allindex.get(2)); - System.out.println("substr---"+substr); - - + File file = new File("D:\\home\\ruoyi\\仲裁委项目-测试单.zip"); + String targetPath = "D:\\home\\unzip\\"; + unZipFile(file,targetPath); } public static boolean unZipFile(File aboriginalFile, String targetPath) { if (!aboriginalFile.exists()) { - log.error("此文件不存在:",aboriginalFile.getPath()); + log.error("此文件不存在:", aboriginalFile.getPath()); return false; } try { @@ -65,18 +36,18 @@ public class UnZipFileUtils { String directPath = targetPath + File.separator + entryZip.getName(); File directFile = new File(directPath); boolean makeDirs = directFile.mkdirs(); - System.out.println("创建文件夹是否成功:" +makeDirs); + System.out.println("创建文件夹是否成功:" + makeDirs); } else { //若是文件,就创建文件 File sourceFile = new File(targetPath + File.separator + entryZip.getName()); - if(!sourceFile.getParentFile().exists()){ + if (!sourceFile.getParentFile().exists()) { boolean mDirect = sourceFile.getParentFile().mkdirs(); - System.out.println("创建压缩文件时,创建父文件夹是否成功:" +mDirect); + System.out.println("创建压缩文件时,创建父文件夹是否成功:" + mDirect); } boolean newUnZipFile = sourceFile.createNewFile(); - if (newUnZipFile){ + if (newUnZipFile) { // 将压缩文件内容写入到这个文件中 - try{ + try { InputStream is = srcZipFile.getInputStream(entryZip); FileOutputStream fos = new FileOutputStream(sourceFile); int len; @@ -84,8 +55,8 @@ public class UnZipFileUtils { while ((len = is.read(buf)) != -1) { fos.write(buf, 0, len); } - } catch (Exception e){ - log.error("解压失败",e); + } catch (Exception e) { + log.error("解压失败", e); } } } @@ -93,7 +64,7 @@ public class UnZipFileUtils { return true; } catch (IOException e) { - log.error("解压失败",e); + log.error("解压失败", e); return false; } @@ -106,11 +77,11 @@ public class UnZipFileUtils { return; } File[] fileArray = fileSource.listFiles(); - if(fileArray!=null&&fileArray.length>0){ + if (fileArray != null && fileArray.length > 0) { for (File fileIter : fileArray) { if (fileIter.isDirectory()) { - getFiles(fileIter,allFiles); - }else { + getFiles(fileIter, allFiles); + } else { allFiles.add(fileIter); } @@ -120,7 +91,4 @@ public class UnZipFileUtils { } - - - }