From 8fc5375db933f9c0ceb12b521e755c8c08adfabc Mon Sep 17 00:00:00 2001
From: dearlin <1261008090@qq.com>
Date: Wed, 8 Nov 2023 14:37:24 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=80=E8=88=AC=E9=9A=90=E6=82=A3?=
=?UTF-8?q?=E5=8F=B0=E8=B4=A6=E5=AF=BC=E5=87=BA=EF=BC=8C=E7=9B=91=E7=AE=A1?=
=?UTF-8?q?=E7=AB=AF=E7=9A=84=E5=88=9B=E5=BB=BA=E4=BA=BA=E5=92=8C=E5=8F=91?=
=?UTF-8?q?=E7=8E=B0=E4=BA=BA=20=E6=B2=A1=E6=9C=89=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=20=E6=B3=A8=E6=84=8F=E6=8C=89=E5=88=97?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/mybatis/datasource/bus/HiddenMapper.xml | 10 +++++-----
.../mybatis/datasource/hiddenApi/HiddenApiMapper.xml | 10 ++++++----
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml b/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml
index 816c8706..dc50c415 100644
--- a/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml
+++ b/src/main/resources/mybatis/datasource/bus/HiddenMapper.xml
@@ -875,11 +875,11 @@
(select group_concat(chr.NAME) from BUS_HIDDENCHECK bh left join sys_user chr on chr.USER_ID=bh.USER_ID where bh.HIDDEN_ID=f.HIDDEN_ID ) CHECKNAME
from
f
- left join sys_user cr on cr.USER_ID = f.CREATOR
- left join sys_user re on re.USER_ID = f.RECTIFICATIONOR
- left join sys_user ch on ch.USER_ID = f.CHECKOR
- left join sys_user rev on rev.USER_ID = f.REVIEWOR
- left join sys_user conUser on conUser.USER_ID = f.CONFIRM_USER
+ left join qa-gwj-prevention.`vi_user_all` cr on cr.USER_ID = f.CREATOR
+ left join qa-gwj-prevention.`vi_user_all` re on re.USER_ID = f.RECTIFICATIONOR
+ left join qa-gwj-prevention.`vi_user_all` ch on ch.USER_ID = f.CHECKOR
+ left join qa-gwj-prevention.`vi_user_all` rev on rev.USER_ID = f.REVIEWOR
+ left join qa-gwj-prevention.`vi_user_all` conUser on conUser.USER_ID = f.CONFIRM_USER
left join oa_department crd on crd.DEPARTMENT_ID = f.HIDDENFINDDEPT
left join oa_department red on red.DEPARTMENT_ID = f.RECTIFICATIONDEPT
left join oa_department chd on chd.DEPARTMENT_ID = f.CHECKDEPT
diff --git a/src/main/resources/mybatis/datasource/hiddenApi/HiddenApiMapper.xml b/src/main/resources/mybatis/datasource/hiddenApi/HiddenApiMapper.xml
index 242ee571..6af6dad9 100644
--- a/src/main/resources/mybatis/datasource/hiddenApi/HiddenApiMapper.xml
+++ b/src/main/resources/mybatis/datasource/hiddenApi/HiddenApiMapper.xml
@@ -508,16 +508,18 @@
f.*
FROM
bus_hidden f
- LEFT JOIN sys_user confirmUser on confirmUser.USER_ID = f.CONFIRM_USER
left join bus_hidden_user bhu on bhu.HIDDEN_ID = f.HIDDEN_ID
- left join sys_user bhuUser on bhuUser.user_id = bhu.user_id
- left join oa_department bhuUserDept on bhuUser.DEPARTMENT_ID = bhuUserDept.DEPARTMENT_ID
+
+ left join `qa-gwj-prevention`.vi_user_all zgUser on zgUser.user_id = f.RECTIFICATIONOR
+ LEFT JOIN `qa-gwj-prevention`.vi_user_all confirmUser on confirmUser.USER_ID = f.CONFIRM_USER
+ left join `qa-gwj-prevention`.vi_user_all bhuUser on bhuUser.user_id = bhu.user_id
+ left join `qa-gwj-prevention`.vi_department_all bhuUserDept on bhuUser.DEPARTMENT_ID = bhuUserDept.DEPARTMENT_ID
+
LEFT JOIN bus_hiddencheck hch on hch.HIDDEN_ID = f.HIDDEN_ID
left join sys_dictionaries type1 on type1.bianma = f.HIDDENTYPE
left join oa_department zgUserDept on zgUserDept.DEPARTMENT_ID = f.RECTIFICATIONDEPT
left join bus_hiddenregion hreg on hreg.HIDDENREGION_ID = f.HIDDENPART
- left join sys_user zgUser on zgUser.user_id = f.RECTIFICATIONOR
WHERE f.ISDELETE = '0'
and f.STATE not in ('0','7','8','100','101','102')
From 11971110743d27a6bb62080437914a55e2b18ca9 Mon Sep 17 00:00:00 2001
From: dearlin <1261008090@qq.com>
Date: Wed, 8 Nov 2023 17:15:45 +0800
Subject: [PATCH 2/2] =?UTF-8?q?fix:smb=E7=A9=BA=E6=8C=87=E9=92=88=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/com/zcloud/util/Smb.java | 402 +++++++++++++------------
1 file changed, 211 insertions(+), 191 deletions(-)
diff --git a/src/main/java/com/zcloud/util/Smb.java b/src/main/java/com/zcloud/util/Smb.java
index 9c6819d8..7440c569 100644
--- a/src/main/java/com/zcloud/util/Smb.java
+++ b/src/main/java/com/zcloud/util/Smb.java
@@ -4,7 +4,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.Vector;
+import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
import com.jcraft.jsch.Channel;
@@ -15,18 +17,36 @@ import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException;
+@Configuration
public class Smb {
- @Value("${smb.host}")
- private static String host;
- @Value("${smb.port}")
- private static Integer port ;
- @Value("${smb.user}")
- private static String user;
- @Value("${smb.password}")
- private static String password;
- @Value("${smb.basePath}")
- private static String basePath;
+
+ public static String host;
+ public static Integer port;
+ public static String user;
+ public static String password;
+ public static String basePath;
+
+ @Value("${smb.host}")
+ public void setHostPath(String hostProperties){
+ host = hostProperties;
+ }
+ @Value("${smb.port}")
+ public void setPortPath(Integer portProperties){
+ port = portProperties;
+ }
+ @Value("${smb.user}")
+ public void setUserPath(String userProperties){
+ user = userProperties;
+ }
+ @Value("${smb.password}")
+ public void setPasswordPath(String passwordProperties){
+ password = passwordProperties;
+ }
+ @Value("${smb.basePath}")
+ public void setBasePath(String basePathProperties){
+ basePath = basePathProperties;
+ }
// private static String host = "39.103.224.166";
//
@@ -47,221 +67,221 @@ public class Smb {
//
// private static String basePath = "/mnt/qask/file/";
- public static final String SMBBAES_PATH = basePath;
+ public static final String SMBBAES_PATH = basePath;
+ public static void sshSftp(MultipartFile file, String fileName, String path) throws Exception {
+ Session session = null;
+ Channel channel = null;
+ JSch jsch = new JSch();
+ if (port <= 0) {
+ // 连接服务器,采用默认端口
+ session = jsch.getSession(user, host);
+ } else {
+ // 采用指定的端口连接服务器
+ session = jsch.getSession(user, host, port);
+ }
- public static void sshSftp(MultipartFile file, String fileName, String path) throws Exception {
- Session session = null;
- Channel channel = null;
- JSch jsch = new JSch();
- if (port <= 0) {
- // 连接服务器,采用默认端口
- session = jsch.getSession(user, host);
- } else {
- // 采用指定的端口连接服务器
- session = jsch.getSession(user, host, port);
- }
+ // 如果服务器连接不上,则抛出异常
+ if (session == null) {
+ throw new Exception("session is null");
+ }
+ // 设置登陆主机的密码
+ session.setPassword(password);
+ // 设置第一次登陆的时候提示,可选值:(ask | yes | no)
+ session.setConfig("StrictHostKeyChecking", "no");
+ // 设置登陆超时时间
+ session.connect(30000);
+ OutputStream outstream = null;
- // 如果服务器连接不上,则抛出异常
- if (session == null) {
- throw new Exception("session is null");
- }
- // 设置登陆主机的密码
- session.setPassword(password);
- // 设置第一次登陆的时候提示,可选值:(ask | yes | no)
- session.setConfig("StrictHostKeyChecking", "no");
- // 设置登陆超时时间
- session.connect(30000);
- OutputStream outstream = null;
-
- try {
- // 创建sftp通信通道
- channel = (Channel) session.openChannel("sftp");
- channel.connect(1000);
- ChannelSftp sftp = (ChannelSftp) channel;
- // 进入服务器指定的文件夹
+ try {
+ // 创建sftp通信通道
+ channel = (Channel) session.openChannel("sftp");
+ channel.connect(1000);
+ ChannelSftp sftp = (ChannelSftp) channel;
+ // 进入服务器指定的文件夹
// File dir = new File(basePath+"/"+path);
// dir.setWritable(true, false);
// if(!dir.exists()){
// dir.mkdirs();
// }
- createDir(basePath + path, sftp);
- sftp.cd(basePath + path);
- // 列出服务器指定的文件列表
+ createDir(basePath + path, sftp);
+ sftp.cd(basePath + path);
+ // 列出服务器指定的文件列表
// Vector v = sftp.ls("*");
// for(int i=0;i vector = channelSftp.ls(basePath + directoryFile);
- if (vector.size() == 1) { // 文件,直接删除
- channelSftp.rm(basePath + directoryFile);
- System.out.println("4、" + directoryFile + " 删除的文件.....");
- }
- } catch (Exception e) {
+ // 如果服务器连接不上,则抛出异常
+ if (session == null) {
+ throw new Exception("session is null");
+ }
+ // 设置登陆主机的密码
+ session.setPassword(password);
+ // 设置第一次登陆的时候提示,可选值:(ask | yes | no)
+ session.setConfig("StrictHostKeyChecking", "no");
+ // 设置登陆超时时间
+ session.connect(30000);
+ // 打开openChannel的sftp
+ ChannelSftp channelSftp = (ChannelSftp) session.openChannel("sftp");
+ // 远程连接
+ channelSftp.connect();
+ // 删除文件
+ try {
+ Vector vector = channelSftp.ls(basePath + directoryFile);
+ if (vector.size() == 1) { // 文件,直接删除
+ channelSftp.rm(basePath + directoryFile);
+ System.out.println("4、" + directoryFile + " 删除的文件.....");
+ }
+ } catch (Exception e) {
- }
- // 切断远程连接
- channelSftp.exit();
+ }
+ // 切断远程连接
+ channelSftp.exit();
- }
+ }
}