From 78e307e262e2918467316132741e0136ea82a0da Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Mon, 27 May 2024 15:03:58 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/xml/WjxWjxxTmlbMapper.xml | 2 +- .../controller/ZyInfoStudentController.java | 58 ++--- .../zyJxdg/controller/ZyJxdgController.java | 205 ++++++++++-------- .../src/main/resources/application-dev.yml | 5 +- .../src/main/resources/application-test.yml | 8 +- 5 files changed, 147 insertions(+), 131 deletions(-) diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxWjxxTmlb/mapper/xml/WjxWjxxTmlbMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxWjxxTmlb/mapper/xml/WjxWjxxTmlbMapper.xml index f5592d49..3918726a 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxWjxxTmlb/mapper/xml/WjxWjxxTmlbMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxWjxxTmlb/mapper/xml/WjxWjxxTmlbMapper.xml @@ -3,7 +3,7 @@ diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java index ecbd380f..773166ec 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java @@ -84,6 +84,11 @@ public class ZyInfoStudentController extends JeecgController map = zykService.saveToZykJxdg(zykInfo); - String fileName = map.get("data"); - String pdfName = map.get("pdfData"); - zyInfoStudent.setFilePath(fileName); - zyInfoStudent.setPdfPath(pdfName); - + if(StringUtils.equals("local",uploadType)){ + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); + String docPath = upLoadPath+ File.separator+ zyInfoStudent.getFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + System.out.println("filPath:"+zyInfoStudent.getFilePath()); + System.out.println("docPath:"+docPath); + System.out.println("pdfPath:"+pdfPath); + PDFUtil.office2PDF(docPath,pdfPath); + zyInfoStudent.setPdfPath("contract/"+namePath); + }else{ + ZykInfo zykInfo = new ZykInfo(); + zykInfo.setBizId(zyInfoStudent.getId()); + zykInfo.setBizTable("zy_jxdg"); + zykInfo.setWjlx(WjlxEnum.JXDG.getType()); + zykInfo.setRwbh(zyInfo.getRwbh()); + zykInfo.setFileName(zyInfoStudent.getFilePath()); + Map map = zykService.saveToZykJxdg(zykInfo); + String fileName = map.get("data"); + String pdfName = map.get("pdfData"); + zyInfoStudent.setFilePath(fileName); + zyInfoStudent.setPdfPath(pdfName); + } } zyInfoStudentService.updateById(zyInfoStudent); - - - //作业代办提醒 ZyDbtx zyDbtx = new ZyDbtx(); zyDbtx.setCreateBy(zyInfo.getCreateBy()); diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java index ff060d6b..542a17b3 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java @@ -62,6 +62,10 @@ public class ZyJxdgController extends JeecgController { private String upLoadPath; @Autowired private IZykService zykService; + + + @Value(value="${jeecg.uploadType}") + private String uploadType; /** * 分页列表查询 * @@ -107,17 +111,20 @@ public class ZyJxdgController extends JeecgController { if(StringUtils.equals("pdf",nameLast)){ zyJxdg.setPdfPath(zyJxdg.getFilePath()); }else{ - Global global = SpringContextHolder.getBean(Global.class); - FileUtil.mkdir(global.getContractDickPath()); - String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); - String docPath = upLoadPath+ File.separator+ zyJxdg.getFilePath(); - String namePath = dd + ".pdf"; - String pdfPath = global.getContractDickPath() + namePath; - System.out.println("filPath:"+zyJxdg.getFilePath()); - System.out.println("docPath:"+docPath); - System.out.println("pdfPath:"+pdfPath); - PDFUtil.office2PDF(docPath,pdfPath); - zyJxdg.setPdfPath("contract/"+namePath); + + if(StringUtils.equals("local",uploadType)){ + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); + String docPath = upLoadPath+ File.separator+ zyJxdg.getFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + PDFUtil.office2PDF(docPath,pdfPath); + zyJxdg.setPdfPath("contract/"+namePath); + }else{ + + } + } }else if(StringUtils.isNotEmpty(zyJxdg.getJxrlFilePath())){ @@ -126,14 +133,20 @@ public class ZyJxdgController extends JeecgController { if(StringUtils.equals("pdf",nameLast)){ zyJxdg.setJxrlPdfPath(zyJxdg.getJxrlFilePath()); }else{ - Global global = SpringContextHolder.getBean(Global.class); - FileUtil.mkdir(global.getContractDickPath()); - String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); - String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath(); - String namePath = dd + ".pdf"; - String pdfPath = global.getContractDickPath() + namePath; - PDFUtil.office2PDF(docPath,pdfPath); - zyJxdg.setJxrlPdfPath("contract/"+namePath); + + if(StringUtils.equals("local",uploadType)){ + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); + String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + PDFUtil.office2PDF(docPath,pdfPath); + zyJxdg.setJxrlPdfPath("contract/"+namePath); + }else{ + + } + } } @@ -170,17 +183,22 @@ public class ZyJxdgController extends JeecgController { update.set("file_path",zyJxdg.getFilePath()); update.set("pdf_path",zyJxdg.getFilePath()); }else{ - Global global = SpringContextHolder.getBean(Global.class); - FileUtil.mkdir(global.getContractDickPath()); - String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); - String docPath = upLoadPath+ File.separator+ zyJxdg.getFilePath(); - String namePath = dd + ".pdf"; - String pdfPath = global.getContractDickPath() + namePath; - System.out.println("filPath:"+zyJxdg.getFilePath()); - System.out.println("docPath:"+docPath); - System.out.println("pdfPath:"+pdfPath); - PDFUtil.office2PDF(docPath,pdfPath); - zyJxdg.setPdfPath("contract/"+namePath); + + if(StringUtils.equals("local",uploadType)) { + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss"); + String docPath = upLoadPath + File.separator + zyJxdg.getFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + System.out.println("filPath:" + zyJxdg.getFilePath()); + System.out.println("docPath:" + docPath); + System.out.println("pdfPath:" + pdfPath); + PDFUtil.office2PDF(docPath, pdfPath); + zyJxdg.setPdfPath("contract/" + namePath); + }else { + + } update.set("file_path",zyJxdg.getFilePath()); update.set("pdf_path",zyJxdg.getPdfPath()); @@ -193,14 +211,18 @@ public class ZyJxdgController extends JeecgController { update.set("jxrl_file_path",zyJxdg.getJxrlFilePath()); update.set("jxrl_pdf_path",zyJxdg.getJxrlFilePath()); }else{ - Global global = SpringContextHolder.getBean(Global.class); - FileUtil.mkdir(global.getContractDickPath()); - String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); - String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath(); - String namePath = dd + ".pdf"; - String pdfPath = global.getContractDickPath() + namePath; - PDFUtil.office2PDF(docPath,pdfPath); - zyJxdg.setJxrlPdfPath("contract/"+namePath); + if(StringUtils.equals("local",uploadType)) { + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss"); + String docPath = upLoadPath + File.separator + zyJxdg.getJxrlFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + PDFUtil.office2PDF(docPath, pdfPath); + zyJxdg.setJxrlPdfPath("contract/" + namePath); + }else { + + } update.set("jxrl_file_path",zyJxdg.getJxrlFilePath()); update.set("jxrl_pdf_path",zyJxdg.getJxrlPdfPath()); @@ -323,50 +345,37 @@ public class ZyJxdgController extends JeecgController { if(StringUtils.equals("pdf",nameLast)){ zyJxdg.setPdfPath(zyJxdg.getFilePath()); }else{ -// Global global = SpringContextHolder.getBean(Global.class); -// FileUtil.mkdir(global.getContractDickPath()); -// String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); -//// String docPath = upLoadPath+ File.separator+ zyJxdg.getFilePath(); -// String docPath = zyJxdg.getFilePath(); -// String namePath = dd + ".pdf"; -// String pdfPath = global.getContractDickPath() + namePath; -// Map map = zykService.downloadRemoteFile(docPath); -// PDFUtil.office2PDF(map.get("data"),pdfPath); -// zyJxdg.setPdfPath("contract/"+namePath); - ZykInfo zykInfo = new ZykInfo(); - zykInfo.setBizId(zyJxdg.getId()); - zykInfo.setBizTable("zy_jxdg"); - zykInfo.setWjlx(WjlxEnum.JXDG.getType()); - zykInfo.setRwbh(zyJxdg.getRwbh()); - zykInfo.setFileName(zyJxdg.getFilePath()); - Map map = zykService.saveToZykJxdg(zykInfo); - String fileName = map.get("data"); - String pdfName = map.get("pdfData"); - zyJxdg.setFilePath(fileName); - zyJxdg.setPdfPath(pdfName); + if(StringUtils.equals("local",uploadType)) { + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss"); +// String docPath = zyJxdg.getFilePath(); + String docPath = upLoadPath + File.separator + zyJxdg.getFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; +// Map map = zykService.downloadRemoteFile(docPath); + PDFUtil.office2PDF(docPath, pdfPath); + zyJxdg.setPdfPath("contract/" + namePath); + }else { + ZykInfo zykInfo = new ZykInfo(); + zykInfo.setBizId(zyJxdg.getId()); + zykInfo.setBizTable("zy_jxdg"); + zykInfo.setWjlx(WjlxEnum.JXDG.getType()); + zykInfo.setRwbh(zyJxdg.getRwbh()); + zykInfo.setFileName(zyJxdg.getFilePath()); + Map map = zykService.saveToZykJxdg(zykInfo); + String fileName = map.get("data"); + String pdfName = map.get("pdfData"); + zyJxdg.setFilePath(fileName); + zyJxdg.setPdfPath(pdfName); + + } + } }else{ zyJxdg.setPdfPath(null); } - //--------上传ftp工具--------------- -// Map saveToZyk(ZykInfo zykInfo); -// if(StringUtils.isNotEmpty(zyJxdg.getFilePath())){ -// ZykInfo zykInfo = new ZykInfo(); -// zykInfo.setBizId(zyJxdg.getId()); -// zykInfo.setBizTable("zy_jxdg"); -// zykInfo.setWjlx(WjlxEnum.JXDG.getType()); -// zykInfo.setRwbh(zyJxdg.getRwbh()); -// zykInfo.setFileName(zyJxdg.getFilePath()); -// zykInfo.setPdfName(zyJxdg.getPdfPath()); -// Map map = zykService.saveToZyk(zykInfo); -// String fileName = map.get("data"); -// String pdfName = map.get("pdfData"); -// zyJxdg.setFilePath(fileName); -// zyJxdg.setPdfPath(pdfName); -// } - //--------上传ftp工具--------------- - if(isAdd){ zyJxdgService.save(zyJxdg); @@ -390,28 +399,32 @@ public class ZyJxdgController extends JeecgController { if(StringUtils.equals("pdf",nameLast)){ zyJxdg.setJxrlPdfPath(zyJxdg.getJxrlFilePath()); }else{ -// Global global = SpringContextHolder.getBean(Global.class); -// FileUtil.mkdir(global.getContractDickPath()); -// String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss"); -// String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath(); -// String namePath = dd + ".pdf"; -// String pdfPath = global.getContractDickPath() + namePath; -// PDFUtil.office2PDF(docPath,pdfPath); -// zyJxdg.setJxrlPdfPath("contract/"+namePath); + + if(StringUtils.equals("local",uploadType)) { + Global global = SpringContextHolder.getBean(Global.class); + FileUtil.mkdir(global.getContractDickPath()); + String dd = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss"); + String docPath = upLoadPath + File.separator + zyJxdg.getJxrlFilePath(); + String namePath = dd + ".pdf"; + String pdfPath = global.getContractDickPath() + namePath; + PDFUtil.office2PDF(docPath, pdfPath); + zyJxdg.setJxrlPdfPath("contract/" + namePath); + }else{ + ZykInfo zykInfo = new ZykInfo(); + zykInfo.setBizId(zyJxdg.getId()); + zykInfo.setBizTable("zy_jxdg"); + zykInfo.setWjlx(WjlxEnum.JXRL.getType()); + zykInfo.setRwbh(zyJxdg.getRwbh()); + zykInfo.setFileName(zyJxdg.getJxrlFilePath()); + Map map = zykService.saveToZykJxdg(zykInfo); + String fileName = map.get("data"); + String pdfName = map.get("pdfData"); + zyJxdg.setJxrlFilePath(fileName); + zyJxdg.setJxrlPdfPath(pdfName); + } - ZykInfo zykInfo = new ZykInfo(); - zykInfo.setBizId(zyJxdg.getId()); - zykInfo.setBizTable("zy_jxdg"); - zykInfo.setWjlx(WjlxEnum.JXRL.getType()); - zykInfo.setRwbh(zyJxdg.getRwbh()); - zykInfo.setFileName(zyJxdg.getJxrlFilePath()); - Map map = zykService.saveToZykJxdg(zykInfo); - String fileName = map.get("data"); - String pdfName = map.get("pdfData"); - zyJxdg.setJxrlFilePath(fileName); - zyJxdg.setJxrlPdfPath(pdfName); } }else{ diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml index daa11fab..01ab2730 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml @@ -136,6 +136,7 @@ spring: url: jdbc:mysql://127.0.0.1:3306/course_information_center_jeecg_db?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai username: root password: root +# password: ABCabc@123 driver-class-name: com.mysql.cj.jdbc.Driver # 多数据源配置 # multi-oracle: @@ -176,8 +177,8 @@ jeecg: # 签名拦截接口 signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys #local、minio、alioss -# uploadType: local - uploadType: sftp + uploadType: local +# uploadType: sftp # 前端访问地址 domainUrl: pc: http://localhost:3100 diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml index f3dd95a3..6b18b7f6 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml @@ -175,8 +175,8 @@ jeecg: # 签名拦截接口 signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys #local\minio\alioss -# uploadType: local - uploadType: sftp + uploadType: local +# uploadType: sftp # 前端访问地址 domainUrl: pc: http://210.47.17.166 @@ -347,10 +347,10 @@ wjx: url: https://www.wjx.cn/openapi/default.aspx #SFTP sftp: - hostname: 192.168.2.200 + hostname: 210.47.29.99 port: 22 username: sftp - password: sftp + password: Nenujwc@99 timeout: 1000 uploadpath: /kczx fullpath: /home/sftp \ No newline at end of file From 873d80fe19f84bbbe193df35a56eaf7fa59c1d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E7=A3=8A?= <45566618@qq.com> Date: Mon, 27 May 2024 19:43:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9B=A0SFTP=E6=B5=81=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E4=B8=8D=E5=85=A8=EF=BC=9B?= =?UTF-8?q?=E6=94=B9=E6=88=90SFTP=E4=B8=8B=E8=BD=BD=E5=88=B0=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=EF=BC=8C=E5=86=8D=E4=BB=8E=E6=9C=AC=E5=9C=B0=E6=B5=81?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=88=B0=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jeecg/common/util/SFTPUtil.java | 75 +++++++- .../zyJxdg/controller/ZyJxdgController.java | 27 +-- .../modules/zyk/controller/ZykController.java | 166 ++++++++++-------- .../zyk/service/impl/ZykServiceImpl.java | 14 +- .../modules/zyk/utils/FileHandleUtil.java | 8 +- .../system/controller/CommonController.java | 66 +++++-- 6 files changed, 233 insertions(+), 123 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java index e3c10362..9b877b27 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java @@ -19,7 +19,7 @@ import java.util.Properties; public class SFTPUtil { private static long count = 3; private static long count1 = 0; - private static long sleepTime = 1800000;//30分钟 + private static long sleepTime = 1000;//1秒 private static final Logger logger = LoggerFactory.getLogger(SFTPUtil.class); private static Session sshSession = null; private static ChannelSftp sftp = null; @@ -228,7 +228,7 @@ public class SFTPUtil { public static Map download(SftpConfig sftpConfig, String directory, String downloadFile, String saveFile) { Map map = new HashMap(); map.put("code","0"); - map.put("msg","删除成功"); + map.put("msg","下载成功"); try{ if(sftp == null){ getChannelSftp(sftpConfig); @@ -270,6 +270,72 @@ public class SFTPUtil { return map; } + /** + * 下载文件 + * @param directory 下载目录 + * @param saveFile 存在本地的路径 + */ + public static Map download(SftpConfig sftpConfig, String directory, String saveFile) { + Map map = new HashMap(); + map.put("code","0"); + map.put("msg","下载成功"); + String[] df = getDirectoryAndFileName(directory); + + File localDirFile = new File(saveFile); + // 判断本地目录是否存在,不存在需要新建各级目录 + if (!localDirFile.exists()) { + localDirFile.mkdirs(); + } + + String newName = CommonUtils.getFileName(df[1]); + String newDownloadFile = saveFile.concat(File.separator).concat(newName); + + File localFile = new File(newDownloadFile); + // 判断本地目录是否存在,不存在需要新建各级目录 + if (localFile.exists()) { + map.put("fileName",newDownloadFile); + return map; + } + + try{ + if(sftp == null){ + getChannelSftp(sftpConfig); + if(sftp == null){ + map.put("code","1"); + map.put("msg","sftp链接异常:"); + return map; + } + } + OutputStream output = null; + try { + if (logger.isInfoEnabled()) { + logger.info("开始获取远程文件:[{}]---->[{}]", new Object[]{directory, saveFile}); + } +// sftp.cd(directory); + if (logger.isInfoEnabled()) { + logger.info("打开远程文件:[{}]", new Object[]{directory}); + } + output = new FileOutputStream(localFile); + sftp.get(directory, output); + if (logger.isInfoEnabled()) { + logger.info("文件下载成功"); + } + map.put("fileName",newDownloadFile); + } catch (Exception e) { + if (logger.isInfoEnabled()) { + logger.info("文件下载出现异常,[{}]", e); + } + throw new RuntimeException("文件下载出现异常,[{}]", e); + } finally { + closeStream(null,output); + } + }catch (Exception e) { + map.put("code","1"); + map.put("msg","sftp异常:" + e.getMessage()); + } + return map; + } + /** * 网页下载文件 * @param response @@ -301,7 +367,7 @@ public class SFTPUtil { // e1.printStackTrace(); // throw new Exception(StringUtils.format("sftp exception,sftp exception。 ", e1.getMessage())); } finally { - closeStream(inputStream,outputStream); + closeStream(null,outputStream); } }catch (Exception e) { e.printStackTrace(); @@ -371,7 +437,7 @@ public class SFTPUtil { break; } try { - Thread.sleep(1000); + Thread.sleep(sleepTime); } catch (Exception ee) { } } @@ -467,6 +533,7 @@ public class SFTPUtil { String path = sb.toString(); path = path.substring(0,path.length()-1); map.put("data",path); + logger.info("移动文件成功...."); } catch (Exception e1) { map.put("code","1"); map.put("msg",e1.getMessage()); diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java index ba58f118..02a2d270 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java @@ -111,7 +111,6 @@ public class ZyJxdgController extends JeecgController { if(StringUtils.equals("pdf",nameLast)){ zyJxdg.setPdfPath(zyJxdg.getFilePath()); }else{ - if(StringUtils.equals("local",uploadType)){ Global global = SpringContextHolder.getBean(Global.class); FileUtil.mkdir(global.getContractDickPath()); @@ -121,12 +120,10 @@ public class ZyJxdgController extends JeecgController { String pdfPath = global.getContractDickPath() + namePath; PDFUtil.office2PDF(docPath,pdfPath); zyJxdg.setPdfPath("contract/"+namePath); - }else{ + }else if(StringUtils.equals("sftp",uploadType)){ } - } - }else if(StringUtils.isNotEmpty(zyJxdg.getJxrlFilePath())){ String nameLast = zyJxdg.getJxrlFilePath().substring(zyJxdg.getJxrlFilePath().lastIndexOf(".")+1); @@ -143,7 +140,7 @@ public class ZyJxdgController extends JeecgController { String pdfPath = global.getContractDickPath() + namePath; PDFUtil.office2PDF(docPath,pdfPath); zyJxdg.setJxrlPdfPath("contract/"+namePath); - }else{ + }else if(StringUtils.equals("sftp",uploadType)){ } @@ -183,7 +180,6 @@ public class ZyJxdgController extends JeecgController { update.set("file_path",zyJxdg.getFilePath()); update.set("pdf_path",zyJxdg.getFilePath()); }else{ - if(StringUtils.equals("local",uploadType)) { Global global = SpringContextHolder.getBean(Global.class); FileUtil.mkdir(global.getContractDickPath()); @@ -196,10 +192,9 @@ public class ZyJxdgController extends JeecgController { System.out.println("pdfPath:" + pdfPath); PDFUtil.office2PDF(docPath, pdfPath); zyJxdg.setPdfPath("contract/" + namePath); - }else { + }else if(StringUtils.equals("sftp",uploadType)){ } - update.set("file_path",zyJxdg.getFilePath()); update.set("pdf_path",zyJxdg.getPdfPath()); } @@ -223,7 +218,6 @@ public class ZyJxdgController extends JeecgController { }else { } - update.set("jxrl_file_path",zyJxdg.getJxrlFilePath()); update.set("jxrl_pdf_path",zyJxdg.getJxrlPdfPath()); } @@ -357,7 +351,7 @@ public class ZyJxdgController extends JeecgController { // Map map = zykService.downloadRemoteFile(docPath); PDFUtil.office2PDF(docPath, pdfPath); zyJxdg.setPdfPath("contract/" + namePath); - }else { + }else if(StringUtils.equals("sftp",uploadType)){ ZykInfo zykInfo = new ZykInfo(); zykInfo.setBizId(zyJxdg.getId()); zykInfo.setBizTable("zy_jxdg"); @@ -369,14 +363,11 @@ public class ZyJxdgController extends JeecgController { String pdfName = map.get("pdfData"); zyJxdg.setFilePath(fileName); zyJxdg.setPdfPath(pdfName); - } - } }else{ zyJxdg.setPdfPath(null); } - if(isAdd){ KcKechengbiao kcKechengbiao = new KcKechengbiao(); kcKechengbiao.setRwbh(zyJxdg.getRwbh()); @@ -419,7 +410,7 @@ public class ZyJxdgController extends JeecgController { String pdfPath = global.getContractDickPath() + namePath; PDFUtil.office2PDF(docPath, pdfPath); zyJxdg.setJxrlPdfPath("contract/" + namePath); - }else{ + }else if(StringUtils.equals("sftp",uploadType)){ ZykInfo zykInfo = new ZykInfo(); zykInfo.setBizId(zyJxdg.getId()); zykInfo.setBizTable("zy_jxdg"); @@ -432,18 +423,10 @@ public class ZyJxdgController extends JeecgController { zyJxdg.setJxrlFilePath(fileName); zyJxdg.setJxrlPdfPath(pdfName); } - - - - } }else{ zyJxdg.setJxrlPdfPath(null); } - - - - if(StringUtils.isEmpty(zyJxdg.getId())){ zyJxdgService.save(zyJxdg); }else{ diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/controller/ZykController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/controller/ZykController.java index 00268a57..c3b5f211 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/controller/ZykController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/controller/ZykController.java @@ -5,15 +5,28 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.util.AntPathMatcher; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.util.DySmsHelper; +import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.zyk.entity.ZykInfo; import org.jeecg.modules.zyk.service.IZykService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.HandlerMapping; + import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; import java.util.Arrays; +import java.util.Date; +import java.util.Map; /** * @Description: 资源库信息 @@ -27,6 +40,8 @@ import java.util.Arrays; @Slf4j public class ZykController extends JeecgController { + private final static Logger logger= LoggerFactory.getLogger(ZykController.class); + @Autowired private IZykService zykService; @@ -89,71 +104,74 @@ public class ZykController extends JeecgController { return Result.OK(res); } -// /** -// * 预览图片&下载文件 -// * 请求地址:http://localhost:8080/common/static/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg} -// * @param request -// * @param response -// */ -// @GetMapping(value = "/static/**") -// public void view(HttpServletRequest request, HttpServletResponse response) { -// // ISO-8859-1 ==> UTF-8 进行编码转换 -// String filePath = extractPathFromPattern(request); -// if(oConvertUtils.isEmpty(filePath) || CommonConstant.STRING_NULL.equals(filePath)){ -// return; -// } -// // 其余处理略 -// InputStream inputStream = null; -// OutputStream outputStream = null; -// try { -// filePath = filePath.replace("..", "").replace("../",""); -// if (filePath.endsWith(SymbolConstant.COMMA)) { -// filePath = filePath.substring(0, filePath.length() - 1); -// } -// Map map = zykService.downloadRemoteFile(filePath); -// if(!map.get("code").equals("0")){ -// throw new RuntimeException(map.get("msg")); -// } -// String localFilePath = map.get("data"); -// File file = new File(localFilePath); -// if(!file.exists()){ -// response.setStatus(404); -// throw new RuntimeException("文件["+filePath+"]不存在.."); -// } -// // 设置强制下载不打开 -// response.setContentType("application/force-download"); -// response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1")); -// inputStream = new BufferedInputStream(new FileInputStream(localFilePath)); -// outputStream = response.getOutputStream(); -// byte[] buf = new byte[1024]; -// int len; -// while ((len = inputStream.read(buf)) > 0) { -// outputStream.write(buf, 0, len); -// } -// response.flushBuffer(); -// } catch (IOException e) { -// log.error("预览文件失败" + e.getMessage()); -// response.setStatus(404); -// e.printStackTrace(); -// } finally { -// if (inputStream != null) { -// try { -// inputStream.close(); -// } catch (IOException e) { -// log.error(e.getMessage(), e); -// } -// } -// if (outputStream != null) { -// try { -// outputStream.close(); -// } catch (IOException e) { -// log.error(e.getMessage(), e); -// } -// } -// } -// } + /** + * 预览图片&下载文件 + * 请求地址:http://localhost:8080/common/static/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg} + * @param request + * @param response + */ + @GetMapping(value = "/static/**") + public void view(HttpServletRequest request, HttpServletResponse response) { + logger.info("zyk/zykInfo/static/SFTP下载 ..."+new Date()); + // ISO-8859-1 ==> UTF-8 进行编码转换 + String filePath = extractPathFromPattern(request); + if(oConvertUtils.isEmpty(filePath) || CommonConstant.STRING_NULL.equals(filePath)){ + return; + } + // 其余处理略 + InputStream inputStream = null; + OutputStream outputStream = null; + try { + filePath = filePath.replace("..", "").replace("../",""); + if (filePath.endsWith(SymbolConstant.COMMA)) { + filePath = filePath.substring(0, filePath.length() - 1); + } + Map map = zykService.downloadRemoteFile(filePath); + if(!map.get("code").equals("0")){ + throw new RuntimeException(map.get("msg")); + } + String localFilePath = map.get("data"); + File file = new File(localFilePath); + if(!file.exists()){ + response.setStatus(404); + throw new RuntimeException("文件["+filePath+"]不存在.."); + } + // 设置强制下载不打开 + response.setContentType("application/force-download"); + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1")); + inputStream = new BufferedInputStream(new FileInputStream(localFilePath)); + outputStream = response.getOutputStream(); + byte[] buf = new byte[1024]; + int len; + while ((len = inputStream.read(buf)) > 0) { + outputStream.write(buf, 0, len); + } + response.flushBuffer(); + } catch (IOException e) { + log.error("预览文件失败" + e.getMessage()); + response.setStatus(404); + e.printStackTrace(); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + } + } + // @GetMapping(value = "/static/**") // public void view(HttpServletRequest request, HttpServletResponse response) { +// logger.info("SFTP下载 ..."+new Date()); // // ISO-8859-1 ==> UTF-8 进行编码转换 // String filePath = extractPathFromPattern(request); // if(oConvertUtils.isEmpty(filePath) || CommonConstant.STRING_NULL.equals(filePath)){ @@ -171,16 +189,16 @@ public class ZykController extends JeecgController { // } // } -// /** -// * 把指定URL后的字符串全部截断当成参数 -// * 这么做是为了防止URL中包含中文或者特殊字符(/等)时,匹配不了的问题 -// * @param request -// * @return -// */ -// private static String extractPathFromPattern(final HttpServletRequest request) { -// String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); -// String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); -// return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path); -// } + /** + * 把指定URL后的字符串全部截断当成参数 + * 这么做是为了防止URL中包含中文或者特殊字符(/等)时,匹配不了的问题 + * @param request + * @return + */ + private static String extractPathFromPattern(final HttpServletRequest request) { + String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); + String bestMatchPattern = (String) request.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); + return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path); + } } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/service/impl/ZykServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/service/impl/ZykServiceImpl.java index bba5e330..a88cc4fc 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/service/impl/ZykServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/service/impl/ZykServiceImpl.java @@ -58,7 +58,7 @@ public class ZykServiceImpl extends ServiceImpl implements I // Map map = fileHandleUtil.uploadFile(zykInfo); Map map = fileHandleUtil.moveFiles(zykInfo); if(!map.get("code").equals("0")){ - return map.get("msg").toString(); + return map.get("msg"); } if(StringUtils.isNotNull(map.get("data"))){ String fileName = map.get("data"); @@ -250,12 +250,12 @@ public class ZykServiceImpl extends ServiceImpl implements I String namePath = dd + ".pdf"; String pdfPath = global.getContractDickPath() + namePath; - PDFUtil.office2PDF(downloadMap.get("data"),pdfPath); - Map uploadMap = uploadFileToSftp("contract/"+namePath); - if(!uploadMap.get("code").equals("0")){ - return uploadMap; - } - zykInfo.setPdfName(uploadMap.get("data")); +// PDFUtil.office2PDF(downloadMap.get("data"),pdfPath); +// Map uploadMap = uploadFileToSftp("contract/"+namePath); +// if(!uploadMap.get("code").equals("0")){ +// return uploadMap; +// } +// zykInfo.setPdfName(uploadMap.get("data")); Map map = fileHandleUtil.moveFiles(zykInfo); if(!map.get("code").equals("0")){ diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/utils/FileHandleUtil.java b/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/utils/FileHandleUtil.java index 74408653..0b06c0d7 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/utils/FileHandleUtil.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/zyk/utils/FileHandleUtil.java @@ -102,15 +102,15 @@ public class FileHandleUtil { public Map download(String directory, String downloadFile){ Map map = SFTPUtil.download(sftpConfig,directory,downloadFile,getDownloadPath("temp")); -// SFTPUtil.disChannel(); -// SFTPUtil.disSession(); + SFTPUtil.disChannel(); + SFTPUtil.disSession(); return map; } public void downloadRes(String downloadFile,HttpServletResponse response) throws Exception{ SFTPUtil.writeFileToRes(sftpConfig,downloadFile,response); - SFTPUtil.disChannel(); - SFTPUtil.disSession(); +// SFTPUtil.disChannel(); +// SFTPUtil.disSession(); } public Map moveFile(ZykInfo zykInfo){ diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java index c9930f23..d939a7bf 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java @@ -1,10 +1,8 @@ package org.jeecg.modules.system.controller; -import cn.hutool.core.io.FastByteArrayOutputStream; + import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.fileupload.FileItem; @@ -17,13 +15,11 @@ import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.util.*; import org.jeecg.common.util.filter.FileTypeFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.util.AntPathMatcher; import org.springframework.util.FileCopyUtils; import org.springframework.web.bind.annotation.*; @@ -36,7 +32,6 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; -import java.net.URLDecoder; import java.nio.file.Files; import java.util.*; import java.util.stream.Collectors; @@ -54,9 +49,14 @@ import java.util.stream.Collectors; @RequestMapping("/sys/common") public class CommonController { + private final static Logger logger= LoggerFactory.getLogger(CommonController.class); + @Value(value = "${jeecg.path.upload}") private String uploadpath; + @Value(value = "${jeecg.path.webapp}") + private String downloadpath; + /** * 本地:local minio:minio 阿里:alioss */ @@ -110,8 +110,8 @@ public class CommonController { } /** * 文件上传统一方法 - * @param request - * @param response + * @param bizPath + * @param file * @return */ public String upload(String bizPath, MultipartFile file) throws Exception { @@ -469,7 +469,30 @@ public class CommonController { } if(CommonConstant.UPLOAD_TYPE_SFTP.equals(uploadType)) { try{ - SFTPUtil.writeFileToRes(sftpConfig,imgPath,response); + logger.info("/sys/common/static/SFTP下载 ..."+new Date()); +// SFTPUtil.writeFileToRes(sftpConfig,imgPath,response); + Map map = SFTPUtil.download(sftpConfig,imgPath,getDownloadPath("temp")); + if(!map.get("code").equals("0")){ + response.setStatus(404); + throw new RuntimeException(map.get("msg")); + } + String localFilePath = map.get("fileName"); + File file = new File(localFilePath); + if(!file.exists()){ + response.setStatus(404); + throw new RuntimeException("文件["+imgPath+"]不存在.."); + } + // 设置强制下载不打开 + response.setContentType("application/force-download"); + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1")); + inputStream = new BufferedInputStream(new FileInputStream(localFilePath)); + outputStream = response.getOutputStream(); + byte[] buf = new byte[1024]; + int len; + while ((len = inputStream.read(buf)) > 0) { + outputStream.write(buf, 0, len); + } + response.flushBuffer(); }catch (Exception e){ // e.printStackTrace(); }finally { @@ -511,7 +534,7 @@ public class CommonController { try { outputStream.close(); } catch (IOException e) { - log.error(e.getMessage(), e); +// log.error(e.getMessage(), e); } } } @@ -599,4 +622,23 @@ public class CommonController { return new AntPathMatcher().extractPathWithinPattern(bestMatchPattern, path); } + /** + * 获取文件真实路径 + * @param path + * @return + */ + private String getDownloadPath(String path){ + String filePath = ""; + if(org.jeecg.common.util.text.StringUtils.isEmpty(path)){ + return ""; + } + int idx = path.indexOf(downloadpath); + if(idx==-1){ + filePath = downloadpath + File.separator + path; + }else{ + filePath = path; + } + return filePath; + } + } From 342e37594afa82ccb91b049c44f9320b038b5b61 Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Tue, 28 May 2024 15:06:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kc/wjxDjxx/mapper/xml/WjxDjxxMapper.xml | 18 ++++ .../controller/ZyInfoStudentController.java | 19 +++- .../zyInfoStudent/entity/ZyInfoStudent.java | 88 +++++++++++++------ .../mapper/ZyInfoStudentMapper.java | 4 + .../mapper/xml/ZyInfoStudentMapper.xml | 18 ++++ .../service/IZyInfoStudentService.java | 4 + .../impl/ZyInfoStudentServiceImpl.java | 10 ++- 7 files changed, 127 insertions(+), 34 deletions(-) diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxDjxx/mapper/xml/WjxDjxxMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxDjxx/mapper/xml/WjxDjxxMapper.xml index adf358d2..58e38aac 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxDjxx/mapper/xml/WjxDjxxMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/wjxDjxx/mapper/xml/WjxDjxxMapper.xml @@ -119,6 +119,12 @@ from wjx_wjxx a inner join wjx_djxx b on a.vid = b.vid where a.id = #{params.id} + + and b.user_id like concat('%',#{params.userId},'%') + + + and b.user_name like concat('%',#{params.userName},'%') + order by b.user_id @@ -132,6 +138,12 @@ ) y on y.KCAPZBBH = x.rwbh WHERE x.id = #{params.id} + + and y.xh like concat('%',#{params.userId},'%') + + + and y.xm like concat('%',#{params.userName},'%') + and y.xh not in( select user_id from wjx_djxx c where c.vid = x.vid ) @@ -149,6 +161,12 @@ on y.KCAPZBBH = a.rwbh left join wjx_djxx b on a.vid = b.vid and y.xh = b.user_id where a.id = #{params.id} + + and y.xh like concat('%',#{params.userId},'%') + + + and y.xm like concat('%',#{params.userName},'%') + order by b.total_score desc \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java index 773166ec..c02998d4 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/controller/ZyInfoStudentController.java @@ -112,6 +112,24 @@ public class ZyInfoStudentController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper("a",zyInfoStudent, req.getParameterMap()); Page page = new Page(pageNo, pageSize); IPage pageList = zyInfoStudentService.page(page, queryWrapper); + for(ZyInfoStudent ZyInfoStudentPar:pageList.getRecords()){ + List list = zyInfoStudentService.getCcjg(ZyInfoStudentPar); + for(ZyInfoStudent par:list){ + if(StringUtils.equals(par.getCcType(),"0")){//外网 + ZyInfoStudentPar.setWwpaperdownurl(par.getPaperdownurl()); + ZyInfoStudentPar.setWwpaperviewurl(par.getPaperviewurl()); + }else if(StringUtils.equals(par.getCcType(),"1")){//作业 + ZyInfoStudentPar.setZypaperdownurl(par.getPaperdownurl()); + ZyInfoStudentPar.setZypaperviewurl(par.getPaperviewurl()); + }else if(StringUtils.equals(par.getCcType(),"2")){//aigc + ZyInfoStudentPar.setAigcpaperdownurl(par.getPaperdownurl()); + ZyInfoStudentPar.setAigcpaperviewurl(par.getPaperviewurl()); + }else if(StringUtils.equals(par.getCcType(),"3")){//学校 + ZyInfoStudentPar.setXxpaperdownurl(par.getPaperdownurl()); + ZyInfoStudentPar.setXxpaperviewurl(par.getPaperviewurl()); + } + } + } return Result.OK(pageList); } @@ -235,7 +253,6 @@ public class ZyInfoStudentController extends JeecgController { void deleteMainId(@Param("mainId") String id); IPage cdxxlist(Page page,@Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + List getCcjg(ZyInfoStudent zyInfoStudent); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml index a68077e5..7eca13a6 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/mapper/xml/ZyInfoStudentMapper.xml @@ -10,10 +10,28 @@ left join zy_info b on a.main_id = b.id ${ew.customSqlSegment} + + + + \ No newline at end of file diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java index b3b1a25f..a6329543 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/IZyInfoStudentService.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.jeecg.modules.kc.zyInfoStudent.entity.ZyInfoStudent; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @Description: 学生提交作业 * @Author: jeecg-boot @@ -23,4 +25,6 @@ public interface IZyInfoStudentService extends IService { void editFabu(ZyInfoStudent zyInfoStudent); IPage cdxxlist(Page page, QueryWrapper queryWrapper); + + List getCcjg(ZyInfoStudent zyInfoStudent); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java index 5619e848..2cda6cb6 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyInfoStudent/service/impl/ZyInfoStudentServiceImpl.java @@ -33,10 +33,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; +import java.util.*; /** * @Description: 学生提交作业 @@ -131,6 +128,11 @@ public class ZyInfoStudentServiceImpl extends ServiceImpl getCcjg(ZyInfoStudent zyInfoStudent) { + return baseMapper.getCcjg(zyInfoStudent); + } + //aigc提交 private void aigcSave(ZyInfoStudent zyInfoStudent) { String url = "https://vims.fanyu.com/tool/AIGCCheck/paperSubmit";