implements IXxhbjwxtxsmdService {
@Override
diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/Vkczxzy0002.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/Vkczxzy0002.java
index 71280ac..d28a8b7 100644
--- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/Vkczxzy0002.java
+++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/Vkczxzy0002.java
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
@@ -129,4 +130,11 @@ public class Vkczxzy0002 implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "考核材料上传时间")
private Date khclTime;
+ /**作业类型*/
+ @Excel(name = "作业类型", width = 15, dicCode = "zyLeixing")
+ @ApiModelProperty(value = "作业类型")
+ @Dict(dicCode = "zyLeixing")
+ private String zyLeixing;
+
+
}
diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/ZyHuizongXiangxi.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/ZyHuizongXiangxi.java
index 9b04b6e..7be8579 100644
--- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/ZyHuizongXiangxi.java
+++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/zyHuizongXiangxi/entity/ZyHuizongXiangxi.java
@@ -148,4 +148,10 @@ public class ZyHuizongXiangxi implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "考核材料上传时间")
private java.util.Date khclTime;
+
+ /**作业类型*/
+ @Excel(name = "作业类型", width = 15, dicCode = "zyLeixing")
+ @ApiModelProperty(value = "作业类型")
+ @Dict(dicCode = "zyLeixing")
+ private String zyLeixing;
}
diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/pom.xml b/jeecg-boot/jeecg-module-system/jeecg-system-biz/pom.xml
index fc69d70..ed3167a 100644
--- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/pom.xml
+++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/pom.xml
@@ -38,11 +38,15 @@
org.jeecgframework.jimureport
drag-free
-
+ com.jcraft
+ jsch
+
+
diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java
index a90f8b6..bdee88a 100644
--- a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java
+++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/controller/CommonController.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.system.controller;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant;
@@ -9,6 +10,9 @@ import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.filter.SsrfFileTypeFilter;
import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.utils.SFTPUtil;
+import org.jeecg.modules.utils.SftpConfig;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.util.AntPathMatcher;
@@ -22,6 +26,8 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
+import java.util.Date;
+import java.util.Map;
/**
*
@@ -45,6 +51,10 @@ public class CommonController {
@Value(value="${jeecg.uploadType}")
private String uploadType;
+
+ @Value(value = "${jeecg.path.webapp}")
+ private String downloadpath;
+
/**
* @Author 政辉
* @return
@@ -54,6 +64,10 @@ public class CommonController {
return Result.error("没有权限,请联系管理员授权后刷新缓存!");
}
+
+ @Autowired
+ SftpConfig sftpConfig;
+
/**
* 文件上传统一方法
* @param request
@@ -224,7 +238,46 @@ public class CommonController {
//update-begin---author:liusq ---date:20230912 for:检查下载文件类型--------------
SsrfFileTypeFilter.checkDownloadFileType(imgPath);
//update-end---author:liusq ---date:20230912 for:检查下载文件类型--------------
+ if(CommonConstant.UPLOAD_TYPE_SFTP.equals(uploadType)) {
+ try{
+// SFTPUtil.writeFileToRes(sftpConfig,imgPath,response);
+ int index = imgPath.lastIndexOf("/");
+ String path = "temp";
+ if(index != -1){
+ path = imgPath.substring(0,index);
+ }
+ //TODO 不确定是否有问题,
+ Map map = SFTPUtil.download(sftpConfig,imgPath,getDownloadPath(path));
+ 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 {
+ SFTPUtil.disChannel();
+ SFTPUtil.disSession();
+ }
+ }else {
+ }
String filePath = uploadpath + File.separator + imgPath;
File file = new File(filePath);
if(!file.exists()){
@@ -267,6 +320,24 @@ public class CommonController {
}
+ /**
+ * 获取文件真实路径
+ * @param path
+ * @return
+ */
+ private String getDownloadPath(String path){
+ String filePath = "";
+// if(StringUtils.isNotBlank(path)){
+// return "";
+// }
+ int idx = path.indexOf(downloadpath);
+ if(idx==-1){
+ filePath = downloadpath + File.separator + path;
+ }else{
+ filePath = path;
+ }
+ return filePath;
+ }
// /**
// * 下载文件
// * 请求地址:http://localhost:8080/common/download/{user/20190119/e1fe9925bc315c60addea1b98eb1cb1349547719_1547866868179.jpg}
diff --git a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/utils/SFTPUtil.java b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/utils/SFTPUtil.java
new file mode 100644
index 0000000..946ed67
--- /dev/null
+++ b/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/utils/SFTPUtil.java
@@ -0,0 +1,806 @@
+package org.jeecg.modules.utils;
+
+import org.jeecg.common.constant.SymbolConstant;
+import org.jeecg.common.util.CommonUtils;
+import org.jeecg.common.util.filter.StrAttackFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.jcraft.jsch.*;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class SFTPUtil {
+ private static long count = 3;
+ private static long count1 = 0;
+ 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;
+
+ public static void getSession(SftpConfig sftpConfig){
+ try {
+ if(sshSession == null ){
+ JSch jsch = new JSch();
+ sshSession = jsch.getSession(sftpConfig.getUsername(), sftpConfig.getHostname(), sftpConfig.getPort());
+ logger.info("Session created ... host=" + sftpConfig.getHostname() + ";port=" + sftpConfig.getPort()+";UserName=" + sftpConfig.getUsername() + ";Password="+sftpConfig.getPassword());
+// jsch.addIdentity("e:/sftp_keys.ppk","");
+ sshSession.setPassword(sftpConfig.getPassword());
+ Properties sshConfig = new Properties();
+ sshConfig.put("StrictHostKeyChecking", "no");
+ sshSession.setConfig(sshConfig);
+ sshSession.setTimeout(sftpConfig.getTimeout());
+ sshSession.connect();
+ logger.info("Session connected ...");
+ logger.info("Opening Channel ...");
+ }
+ } catch (Exception e){
+ try{
+ count1 += 1;
+ if(count == count1){
+ throw new RuntimeException(e);
+ }
+ Thread.sleep(sleepTime);
+ logger.info("重新连接....");
+ getSession(sftpConfig);
+ } catch (InterruptedException e1){
+ throw new RuntimeException(e1);
+ }
+ }
+ }
+
+ public static void getChannelSftp(SftpConfig sftpConfig){
+ try {
+ if(sshSession == null){
+ getSession(sftpConfig);
+ Channel channel = sshSession.openChannel("sftp");
+ channel.connect();
+ sftp = (ChannelSftp) channel;
+ logger.info("登录成功");
+ }else{
+ Channel channel = sshSession.openChannel("sftp");
+ channel.connect();
+ sftp = (ChannelSftp) channel;
+ }
+ } catch (Exception e){
+ try{
+ count1 += 1;
+ if(count == count1){
+ throw new RuntimeException(e);
+ }
+ Thread.sleep(sleepTime);
+ logger.info("重新连接....");
+ getChannelSftp(sftpConfig);
+ } catch (InterruptedException e1){
+ throw new RuntimeException(e1);
+ }
+ }
+ }
+
+ private static void mkdirs(String directory) throws SftpException {
+ String[] dics = directory.split("/");
+ for(int i=0;i< dics.length;i++){
+ try {
+ if(dics[i].equals("")){
+ continue;
+ }
+ sftp.cd(dics[i]);
+ } catch (SftpException e1) {
+ try {
+ sftp.mkdir(dics[i]);
+ sftp.cd(dics[i]);
+ } catch (SftpException e2) {
+ throw new RuntimeException("打开文件夹错误,"+e2.getMessage(), e2);
+ }
+ }
+ }
+ }
+
+ /**
+ * 上传文件
+ * @param isConcat 是否拼接,true时拼接/kczx
+ * @param directory 上传的目录
+ * @param uploadFilePath 要上传的文件路径(文件真实路径+名称)
+ * @param uploadFileName 要上传的文件名称(重新定义的文件名称)
+ * @param
+ */
+ public static Map upload(SftpConfig sftpConfig,boolean isConcat, String directory, String uploadFilePath, String uploadFileName) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","上传成功");
+ try{
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ try {
+ sftp.cd(sftpConfig.getFullpath());
+ } catch (SftpException e1) {
+ try {
+ mkdirs(sftpConfig.getFullpath());
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败");
+ }
+ }
+ try {
+ if(isConcat){
+ directory = getDirectory(sftpConfig.getUploadpath(),directory);
+ }
+ sftp.cd(directory);
+ } catch (SftpException e1) {
+ try {
+ mkdirs(directory);
+// sftp.mkdir(directory);
+// sftp.cd(directory);
+ } catch (SftpException e2) {
+ map.put("code","1");
+ map.put("msg","ftp创建"+directory+"文件路径失败");
+// throw new RuntimeException("ftp创建文件路径失败" + directory);
+ }
+ }
+ File file = new File(uploadFilePath);
+ InputStream inputStream=null;
+ try {
+ inputStream = new FileInputStream(file);
+ sftp.put(inputStream, uploadFileName);
+ map.put("data",directory.concat(uploadFileName));
+ } catch (Exception e3) {
+ map.put("code","1");
+ map.put("msg","上传文件异常:" + e3.getMessage());
+// throw new RuntimeException("sftp异常" + e3);
+ } finally {
+ closeStream(inputStream,null);
+ }
+ }catch (Exception e) {
+ map.put("code","1");
+ map.put("msg","sftp异常:" + e.getMessage());
+ }
+ return map;
+ }
+
+ public static Map upload(SftpConfig sftpConfig, MultipartFile file, String directory) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","上传成功");
+ try{
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ try {
+ sftp.cd(sftpConfig.getFullpath());
+ } catch (SftpException e1) {
+ try {
+ mkdirs(sftpConfig.getFullpath());
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败");
+ }
+ }
+ try {
+ sftp.cd(directory);
+ } catch (SftpException e1) {
+ try {
+ mkdirs(directory);
+ } catch (SftpException e2) {
+ map.put("code","1");
+ map.put("msg","ftp创建"+directory+"文件路径失败");
+// throw new RuntimeException("ftp创建文件路径失败" + directory);
+ }
+ }
+ String fileName = null;
+ // 获取文件名
+ String orgName = StrAttackFilter.filter2(file.getOriginalFilename());
+ orgName = CommonUtils.getFileName(orgName);
+ if(orgName.indexOf(SymbolConstant.SPOT)!=-1){
+ fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
+ }else{
+ fileName = orgName+ "_" + System.currentTimeMillis();
+ }
+ InputStream inputStream=null;
+ try {
+ sftp.put(file.getInputStream(), fileName);
+ map.put("data",directory.concat("/").concat(fileName));
+ } catch (Exception e3) {
+ map.put("code","1");
+ map.put("msg","上传文件异常:" + e3.getMessage());
+// throw new RuntimeException("sftp异常" + e3);
+ } finally {
+ closeStream(inputStream,null);
+ }
+ }catch (Exception e) {
+ map.put("code","1");
+ map.put("msg","sftp异常:" + e.getMessage());
+ }
+ return map;
+ }
+
+ /**
+ * 下载文件
+ *
+ * @param directory 下载目录
+ * @param downloadFile 下载的文件
+ * @param saveFile 存在本地的路径
+ */
+ public static Map download(SftpConfig sftpConfig, String directory, String downloadFile, String saveFile) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","下载成功");
+ try{
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ OutputStream output = null;
+ try {
+ File localDirFile = new File(saveFile);
+ // 判断本地目录是否存在,不存在需要新建各级目录
+ if (!localDirFile.exists()) {
+ localDirFile.mkdirs();
+ }
+ if (logger.isInfoEnabled()) {
+ logger.info("开始获取远程文件:[{}]---->[{}]", new Object[]{directory, saveFile});
+ }
+// sftp.cd(directory);
+ if (logger.isInfoEnabled()) {
+ logger.info("打开远程文件:[{}]", new Object[]{directory});
+ }
+ String newName = CommonUtils.getFileName(downloadFile);
+ String newDownloadFile = saveFile.concat(File.separator).concat(newName);
+ output = new FileOutputStream(new File(newDownloadFile));
+ 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 directory 下载目录
+ * @param saveFile 存在本地的路径
+ */
+ public static Map download(SftpConfig sftpConfig, String directory, String saveFile) {
+ Map map = new HashMap<>();
+ map.put("code","0");
+ map.put("msg","下载成功");
+ directory = sftpConfig.getFullpath()+"/"+ directory;
+ String[] df = getDirectoryAndFileName(directory);
+
+ File localDirFile = new File(saveFile);
+ // 判断本地目录是否存在,不存在需要新建各级目录
+ if (!localDirFile.exists()) {
+ localDirFile.mkdirs();
+ }
+ saveFile = saveFile.replace("\\","/");
+ String newName = CommonUtils.getFileName(df[1]);
+ if(!newName.startsWith("/")){
+ newName = "/"+newName;
+ }
+ String newDownloadFile = saveFile.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;
+ }
+ }else{
+ sftp.cd(sftpConfig.getFullpath());
+ }
+ OutputStream output = null;
+ try {
+ if (logger.isInfoEnabled()) {
+ logger.info("开始获取远程文件:[{}]---->[{}]", new Object[]{directory, newDownloadFile});
+ }
+// 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
+ * @param downloadFilePath
+ * @throws Exception
+ */
+ public static void writeFileToRes(SftpConfig sftpConfig, String downloadFilePath, HttpServletResponse response) throws Exception {
+ String[] df = getDirectoryAndFileName(downloadFilePath);
+ String directory = df[0];
+ String downloadFile = df[1];
+ try{
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ InputStream inputStream = null;
+ ServletOutputStream outputStream=null;
+ try {
+// sftp.cd(directory);
+ inputStream = sftp.get(downloadFilePath);
+ byte[] buf = new byte[1024 * 10];
+ outputStream = response.getOutputStream();
+ response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(downloadFile, "UTF-8"));
+ int readLength;
+ while (((readLength = inputStream.read(buf)) != -1)) {
+ outputStream.write(buf, 0, readLength);
+ }
+ outputStream.flush();
+ } catch (Exception e1) {
+// e1.printStackTrace();
+// throw new Exception(StringUtils.format("sftp exception,sftp exception。 ", e1.getMessage()));
+ } finally {
+ closeStream(null,outputStream);
+ }
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 移动文件
+ * @param oldpath 原文件路径(文件路径+名称)
+ * @param directory 目的文件路径
+ * @param newname 目的文件名称
+ * @param
+ */
+ public static Map moveFile(SftpConfig sftpConfig, String oldpath, String directory, String newname) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","上传成功");
+ try {
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ try {
+ sftp.cd(sftpConfig.getFullpath());
+ } catch (SftpException e1) {
+ try {
+ mkdirs(sftpConfig.getFullpath());
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败");
+ }
+ }
+ try {
+ directory = getDirectory(sftpConfig.getUploadpath(), directory);
+ sftp.cd(directory);
+ } catch (SftpException e1) {
+ try {
+ mkdirs(directory);
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "ftp创建" + directory + "文件路径失败");
+ }
+ }
+ Channel channel = null;
+ try {
+ if(!oldpath.startsWith("/")){
+ oldpath = "/"+oldpath;
+ }
+ String oldfullpath = sftpConfig.getFullpath().concat(oldpath);
+ String newpath = directory.concat(newname);
+ String newfullpath = sftpConfig.getFullpath().concat(newpath);
+ String moveCommand = "mv " + oldfullpath + " " + newfullpath; // 移动文件的命令
+ channel = sshSession.openChannel("exec");
+ ((ChannelExec) channel).setCommand(moveCommand);
+ channel.setInputStream(null);
+ ((ChannelExec) channel).setErrStream(System.err);
+ InputStream in = channel.getInputStream();
+ channel.connect();
+ byte[] tmp = new byte[1024];
+ while (true) {
+ while (in.available() > 0) {
+ int i = in.read(tmp, 0, 1024);
+ if (i < 0) break;
+ }
+ if (channel.isClosed()) {
+ System.out.println("exit-status: " + channel.getExitStatus());
+ break;
+ }
+ try {
+ Thread.sleep(sleepTime);
+ } catch (Exception ee) {
+ }
+ }
+ channel.disconnect();
+ channel = null;
+ map.put("data",newpath);
+ } catch (Exception e1) {
+ map.put("code","1");
+ map.put("msg",e1.getMessage());
+// throw new RuntimeException("ftp创建文件路径失败" + directory);
+ }finally {
+ if(channel!=null){
+ channel.disconnect();
+ channel = null;
+ }
+ }
+ } catch (Exception e) {
+ map.put("code","1");
+ map.put("msg","sftp异常:" + e.getMessage());
+ }
+ return map;
+ }
+
+ public static Map moveFiles(SftpConfig sftpConfig, String directory, List list) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","上传成功");
+ try {
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ try {
+ sftp.cd(sftpConfig.getFullpath());
+ } catch (SftpException e1) {
+ try {
+ mkdirs(sftpConfig.getFullpath());
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败");
+ }
+ }
+ try {
+ directory = getDirectory(sftpConfig.getUploadpath(), directory);
+ sftp.cd(directory);
+ } catch (SftpException e1) {
+ try {
+ mkdirs(directory);
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + directory + "文件路径失败");
+ }
+ }
+ sftp.cd(sftpConfig.getFullpath());
+ Channel channel = null;
+ try {
+ StringBuffer sb = new StringBuffer();
+ for(int item=0;item 0) {
+ int i = in.read(tmp, 0, 1024);
+ if (i < 0) break;
+ }
+ if (channel.isClosed()) {
+ System.out.println("exit-status: " + channel.getExitStatus());
+ break;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ee) {
+ }
+ }
+ channel.disconnect();
+ channel = null;
+ sb.append(newpath);
+ sb.append("|");
+ }
+ 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());
+// throw new RuntimeException("ftp创建文件路径失败" + directory);
+ }finally {
+ if(channel!=null){
+ channel.disconnect();
+ channel = null;
+ }
+ }
+ } catch (Exception e) {
+ map.put("code","1");
+ map.put("msg","sftp异常:" + e.getMessage());
+ }
+ return map;
+ }
+
+
+ /**
+ * 删除文件
+ * @param directory 要删除文件所在目录
+ * @param deleteFile 要删除的文件
+ */
+ public static Map delete(SftpConfig sftpConfig, String directory, String deleteFile) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","删除成功");
+ try{
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ directory = delDiagonalLines(directory);
+ sftp.cd(directory);
+ sftp.rm(deleteFile);
+ }catch (Exception e) {
+ map.put("code","1");
+ map.put("msg","sftp异常:" + e.getMessage());
+ }
+ return map;
+ }
+
+ private static String getDirectory(String uploadpath, String directory){
+ if(uploadpath.endsWith("/")){
+ return uploadpath + directory;
+ }else{
+ return uploadpath +"/"+ directory;
+ }
+ }
+
+ private static String delDiagonalLines(String directory){
+ if(directory.startsWith("/")){
+ directory = directory.substring(directory.indexOf("/")+1);
+ delDiagonalLines(directory);
+ }
+ return directory;
+ }
+
+ /**
+ * 断掉连接
+ */
+ public static void disChannel() {
+ try {
+ if(sftp!=null){
+ sftp.disconnect();
+ sftp=null;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void disSession() {
+ try {
+ if(sshSession!=null) {
+ sshSession.disconnect();
+ sshSession=null;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 关闭流
+ * @param outputStream
+ */
+ private static void closeStream(InputStream inputStream,OutputStream outputStream) {
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }finally {
+ }
+ }
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }finally {
+ }
+ }
+ }
+
+ public static String[] getDirectoryAndFileName(String fileName) {
+ String[] ss = new String[2];
+ String path = fileName.substring(0,fileName.lastIndexOf("/"));
+ String name = fileName.substring(fileName.lastIndexOf("/")+1);
+ ss[0] = path;
+ ss[1] = name;
+ return ss;
+ }
+
+ /*****************以下为预留方法*******************/
+// /**
+// * 下载远程文件夹下的所有文件
+// * @param remoteFilePath
+// * @param localDirPath
+// * @throws Exception
+// */
+// public void getFileDir(String remoteFilePath, String localDirPath) throws Exception {
+// File localDirFile = new File(localDirPath);
+// // 判断本地目录是否存在,不存在需要新建各级目录
+// if (!localDirFile.exists()) {
+// localDirFile.mkdirs();
+// }
+// if (logger.isInfoEnabled()) {
+// logger.info("sftp文件服务器文件夹[{}],下载到本地目录[{}]", new Object[]{remoteFilePath, localDirFile});
+// }
+// ChannelSftp channelSftp = connect();
+// Vector lsEntries = channelSftp.ls(remoteFilePath);
+// if (logger.isInfoEnabled()) {
+// logger.info("远程目录下的文件为[{}]", lsEntries);
+// }
+// for (LsEntry entry : lsEntries) {
+// String fileName = entry.getFilename();
+// if (checkFileName(fileName)) {
+// continue;
+// }
+// String remoteFileName = getRemoteFilePath(remoteFilePath, fileName);
+// channelSftp.get(remoteFileName, localDirPath);
+// }
+// disConnect(channelSftp);
+// }
+//
+// private boolean checkFileName(String fileName) {
+// if (".".equals(fileName) || "..".equals(fileName)) {
+// return true;
+// }
+// return false;
+// }
+//
+// private String getRemoteFilePath(String remoteFilePath, String fileName) {
+// if (remoteFilePath.endsWith("/")) {
+// return remoteFilePath.concat(fileName);
+// } else {
+// return remoteFilePath.concat("/").concat(fileName);
+// }
+// }
+//
+// /**
+// * 列出目录下的文件
+// * @param directory 要列出的目录
+// * @return
+// * @throws SftpException
+// */
+// public List listFiles(String directory) throws SftpException {
+// ChannelSftp sftp = connect();
+// List fileNameList = new ArrayList();
+// try {
+// sftp.cd(directory);
+// } catch (SftpException e) {
+// return fileNameList;
+// }
+// Vector vector = sftp.ls(directory);
+// for (int i = 0; i < vector.size(); i++) {
+// if (vector.get(i) instanceof LsEntry) {
+// LsEntry lsEntry = (LsEntry) vector.get(i);
+// String fileName = lsEntry.getFilename();
+// if (".".equals(fileName) || "..".equals(fileName)) {
+// continue;
+// }
+// fileNameList.add(fileName);
+// }
+// }
+// disConnect(sftp);
+// return fileNameList;
+// }
+
+
+
+ public static Map upload(SftpConfig sftpConfig, String localFile, String sftpFile) {
+ Map map = new HashMap();
+ map.put("code","0");
+ map.put("msg","上传成功");
+ try{
+ String allPath = sftpConfig.getFullpath() +"/"+sftpConfig.getUploadpath();
+ if(sftp == null){
+ getChannelSftp(sftpConfig);
+ }
+ try {
+ sftp.cd(sftpConfig.getFullpath());
+ } catch (SftpException e1) {
+ try {
+ mkdirs(sftpConfig.getFullpath());
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败");
+ }
+ }
+ try {
+ sftp.cd(sftpConfig.getUploadpath());
+ } catch (SftpException e1) {
+ try {
+ mkdirs(sftpConfig.getUploadpath());
+ } catch (SftpException e2) {
+ map.put("code", "1");
+ map.put("msg", "sftp创建" + sftpConfig.getUploadpath() + "文件路径失败");
+ }
+ }
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(localFile);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ try {
+
+ String aaa[] = sftpFile.split("/");
+ String wwqName = aaa[aaa.length -1];
+ for(int i=0;iflyway-core
7.15.0
+
diff --git a/jeecgboot-vue3/src/views/bl/kckhcl/KckhclMain.vue b/jeecgboot-vue3/src/views/bl/kckhcl/KckhclMain.vue
index 24ee92a..605f720 100644
--- a/jeecgboot-vue3/src/views/bl/kckhcl/KckhclMain.vue
+++ b/jeecgboot-vue3/src/views/bl/kckhcl/KckhclMain.vue
@@ -2,23 +2,29 @@
diff --git a/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizong.data.ts b/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizong.data.ts
index 017d61d..00817da 100644
--- a/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizong.data.ts
+++ b/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizong.data.ts
@@ -8,7 +8,7 @@ export const columns: BasicColumn[] = [
{
title: '学期学年',
align: "center",
- dataIndex: 'xnxq_dictText'
+ dataIndex: 'xnxq'
},
{
title: '学院编号',
diff --git a/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizongList.vue b/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizongList.vue
index 7a7a38b..93c319a 100644
--- a/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizongList.vue
+++ b/jeecgboot-vue3/src/views/bl/zyHuizong/ZyHuizongList.vue
@@ -61,7 +61,7 @@
-
+
@@ -80,6 +80,8 @@
import { useUserStore } from '/@/store/modules/user';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
+const emit = defineEmits(['callback']);
+
const formRef = ref();
const queryParam = reactive({});
const toggleSearchStatus = ref(false);
@@ -113,13 +115,13 @@
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs:24,
- sm:4,
+ sm:6,
xl:6,
- xxl:4
+ xxl:6
});
const wrapperCol = reactive({
xs: 24,
- sm: 20,
+ sm: 18,
});
// 高级查询配置
@@ -155,8 +157,7 @@
* 详情
*/
function handleDetail(record: Recordable) {
- registerModal.value.disableSubmit = true;
- registerModal.value.edit(record);
+ emit('callback',record)
}
/**
@@ -186,32 +187,12 @@
function getTableAction(record) {
return [
{
- label: '编辑',
- onClick: handleEdit.bind(null, record),
- auth: 'zyHuizong:zy_huizong:edit'
+ label: '详情',
+ onClick: handleDetail.bind(null, record),
},
];
}
- /**
- * 下拉操作栏
- */
- function getDropDownAction(record) {
- return [
- {
- label: '详情',
- onClick: handleDetail.bind(null, record),
- }, {
- label: '删除',
- popConfirm: {
- title: '是否确认删除',
- confirm: handleDelete.bind(null, record),
- placement: 'topLeft',
- },
- auth: 'zyHuizong:zy_huizong:delete'
- }
- ]
- }
/**
* 查询
diff --git a/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxi.data.ts b/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxi.data.ts
index 56c88e9..1273db0 100644
--- a/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxi.data.ts
+++ b/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxi.data.ts
@@ -5,53 +5,64 @@ import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
- {
- title: '学年学期',
- align: "center",
- dataIndex: 'xnxq'
- },
- {
- title: '学院编号',
- align: "center",
- dataIndex: 'xybh'
- },
- {
- title: '学院名称',
- align: "center",
- dataIndex: 'xymc'
- },
- {
- title: '任务编号',
- align: "center",
- dataIndex: 'rwbh'
- },
+ // {
+ // title: '学年学期',
+ // align: "center",
+ // dataIndex: 'xnxq',
+ // ifShow: false,
+ // },
+ // {
+ // title: '学院编号',
+ // align: "center",
+ // dataIndex: 'xybh',
+ // ifShow: false,
+ // },
+ // {
+ // title: '学院名称',
+ // align: "center",
+ // dataIndex: 'xymc',
+ // ifShow: false,
+ // },
+ // {
+ // title: '任务编号',
+ // align: "center",
+ // dataIndex: 'rwbh',
+ // ifShow: false,
+ // },
{
title: '课程名称',
align: "center",
dataIndex: 'kcmc'
},
- {
- title: '教工号',
- align: "center",
- dataIndex: 'jgh'
- },
+ // {
+ // title: '教工号',
+ // align: "center",
+ // dataIndex: 'jgh',
+ // ifShow: false,
+ // },
{
title: '授课教师',
align: "center",
dataIndex: 'skjs'
},
- {
- title: '作业编号',
- align: "center",
- dataIndex: 'zybh'
- },
+ // {
+ // title: '作业编号',
+ // align: "center",
+ // dataIndex: 'zybh',
+ // ifShow: false,
+ // },
{
title: '作业名称',
align: "center",
dataIndex: 'zymc'
},
{
- title: '占比',
+ title: '作业类型',
+ align: "center",
+ dataIndex: 'zyLeixing'
+ },
+ {
+ title: '占比(%)',
align: "center",
dataIndex: 'qmzb'
},
@@ -65,61 +76,69 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'xsxm'
},
- {
- title: '维普检测率',
- align: "center",
- dataIndex: 'wpzyk'
- },
- {
- title: '学校检测率',
- align: "center",
- dataIndex: 'xxzyk'
- },
- {
- title: '本次检测率',
- align: "center",
- dataIndex: 'bczyk'
- },
- {
- title: 'aigc检测率',
- align: "center",
- dataIndex: 'aigc'
- },
+ // {
+ // title: '维普检测率',
+ // align: "center",
+ // dataIndex: 'wpzyk',
+ // ifShow: false,
+ // },
+ // {
+ // title: '学校检测率',
+ // align: "center",
+ // dataIndex: 'xxzyk',
+ // ifShow: false,
+ // },
+ // {
+ // title: '本次检测率',
+ // align: "center",
+ // dataIndex: 'bczyk',
+ // ifShow: false,
+ // },
+ // {
+ // title: 'aigc检测率',
+ // align: "center",
+ // dataIndex: 'aigc',
+ // ifShow: false,
+ // },
{
title: '作业分数',
align: "center",
dataIndex: 'zyfs'
},
+ // {
+ // title: '作业',
+ // align: "center",
+ // dataIndex: 'filePath'
+ // },
+ // {
+ // title: 'pdf内容',
+ // align: "center",
+ // dataIndex: 'pdfPath',
+ // ifShow: false,
+ // },
+ // {
+ // title: '发布时间',
+ // align: "center",
+ // dataIndex: 'publishTime',
+ // ifShow: false,
+ // },
+ // {
+ // title: '是否上传考核',
+ // align: "center",
+ // dataIndex: 'sfsckhcl',
+ // ifShow: false,
+ // },
{
- title: '作业',
+ title: '存储路径',
align: "center",
- dataIndex: 'filePath'
- },
- {
- title: 'pdf内容',
- align: "center",
- dataIndex: 'pdfPath'
- },
- {
- title: '发布时间',
- align: "center",
- dataIndex: 'publishTime'
- },
- {
- title: '是否上传考核',
- align: "center",
- dataIndex: 'sfsckhcl'
- },
- {
- title: '服务器附件地址',
- align: "center",
- dataIndex: 'fwqPath'
- },
- {
- title: '考核材料上传时间',
- align: "center",
- dataIndex: 'khclTime'
+ dataIndex: 'fwqPath',
},
+ // {
+ // title: '考核材料上传时间',
+ // align: "center",
+ // dataIndex: 'khclTime',
+ // ifShow: false,
+ // },
];
// 高级查询数据
diff --git a/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxiList.vue b/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxiList.vue
index 8e6020a..20d20a5 100644
--- a/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxiList.vue
+++ b/jeecgboot-vue3/src/views/bl/zyHuizongXiangxi/ZyHuizongXiangxiList.vue
@@ -5,52 +5,26 @@
-
- 学期学年
-
+
+ 学生学号
+
-
- 学院编号
-
+
+ 学生姓名
+
-
-
-
- 学院名称
-
-
-
-
-
- 课程名称
-
-
-
-
-
- 教工号
-
-
-
-
-
- 授课教师
-
-
-
-
查询
重置
-
+
@@ -58,10 +32,10 @@
-
+
-
+
@@ -70,193 +44,197 @@