Merge remote-tracking branch 'origin/czks1.0' into czks1.0
commit
6de19888a1
|
@ -64,8 +64,7 @@ public class AppEightWorkCfdController extends BaseController {
|
|||
public Object list(Page page) throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
PageData pd = this.getPageData();
|
||||
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
||||
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
|
||||
// pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.controller.filemanager;
|
||||
|
||||
import com.zcloud.aspect.DockAnnotation;
|
||||
import net.sf.json.JSONArray;
|
||||
|
||||
import java.io.Console;
|
||||
|
@ -34,18 +35,18 @@ import com.zcloud.util.Tools;
|
|||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 说明:文件管理
|
||||
* 作者:zCloud
|
||||
* 作者:zCloud
|
||||
* 官网:
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/mfolder")
|
||||
public class MfolderController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private MfolderService mfolderService;
|
||||
|
||||
|
||||
/**创建目录
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -53,6 +54,7 @@ public class MfolderController extends BaseController {
|
|||
@RequestMapping(value="/add")
|
||||
@RequiresPermissions("mfolder:add")
|
||||
@ResponseBody
|
||||
@DockAnnotation(isAdd = true)
|
||||
public Object add() throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
|
@ -64,13 +66,14 @@ public class MfolderController extends BaseController {
|
|||
pd.put("UNAME", Jurisdiction.getName()); //上传者
|
||||
pd.put("MASTER", Jurisdiction.getUsername()); //所属人
|
||||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
|
||||
pd.put("FILESIZE", "");
|
||||
pd.put("SHARE", "no");
|
||||
pd.put("FILESIZE", "");
|
||||
pd.put("SHARE", "no");
|
||||
mfolderService.save(pd);
|
||||
map.put("result", errInfo);
|
||||
map.put("pd", pd);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**上传文件
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -120,11 +123,11 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -186,7 +189,7 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo); // 返回结果
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**上传文件
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -212,7 +215,7 @@ public class MfolderController extends BaseController {
|
|||
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
|
||||
// fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
|
||||
fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile);
|
||||
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile);
|
||||
pd.put("FILEPATH", Const.FILEPATHFILE + Jurisdiction.getCORPINFO_ID() + "/" + ffile + "/" + fileName); //文件路径
|
||||
String realName = file.getOriginalFilename();
|
||||
String[] fileFullNames = realName.split("\\.");//上传文件全名
|
||||
|
@ -235,7 +238,7 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**删除
|
||||
* @param out
|
||||
* @throws Exception
|
||||
|
@ -263,7 +266,7 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**修改
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -280,7 +283,7 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**列表
|
||||
* @param page
|
||||
* @throws Exception
|
||||
|
@ -300,7 +303,7 @@ public class MfolderController extends BaseController {
|
|||
MFOLDER_ID = null == pd.get("MFOLDER_ID")?"":pd.get("MFOLDER_ID").toString();
|
||||
pd.put("MFOLDER_ID", MFOLDER_ID); //当作上级ID
|
||||
}
|
||||
|
||||
|
||||
// if(Tools.notEmpty(SHARE) && "yes".equals(SHARE)) {
|
||||
// pd.put("SHARE", "yes");
|
||||
// }else {
|
||||
|
@ -351,7 +354,7 @@ public class MfolderController extends BaseController {
|
|||
fileType = "video"; //视频文件类型
|
||||
}
|
||||
varList.get(i).put("extension_name", extension_name); //文件拓展名
|
||||
varList.get(i).put("fileType", fileType); //用于文件图标
|
||||
varList.get(i).put("fileType", fileType); //用于文件图标
|
||||
}
|
||||
map.put("varList", varList);
|
||||
map.put("page", page);
|
||||
|
@ -385,9 +388,9 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**预览txt,java,php,等文本文件
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/viewTxt")
|
||||
@ResponseBody
|
||||
|
@ -403,7 +406,7 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**批量操作
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -414,7 +417,7 @@ public class MfolderController extends BaseController {
|
|||
public Object deleteAll() throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
String DATA_IDS = pd.getString("DATA_IDS");
|
||||
if(Tools.notEmpty(DATA_IDS)){
|
||||
|
@ -428,7 +431,7 @@ public class MfolderController extends BaseController {
|
|||
map.put("result", errInfo); //返回结果
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**下载
|
||||
* @param response
|
||||
* @throws Exception
|
||||
|
@ -447,11 +450,11 @@ public class MfolderController extends BaseController {
|
|||
throw new NofileException("=========要下载的文件已经没有了=========");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化标签
|
||||
* 较大及以上等级风险管控方案
|
||||
* @throws Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public void initialize () throws Exception {
|
||||
PageData pData = new PageData();
|
||||
|
@ -469,12 +472,12 @@ public class MfolderController extends BaseController {
|
|||
pd.put("UNAME", "init"); //上传者
|
||||
pd.put("MASTER", Jurisdiction.getUsername()); //所属人
|
||||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); //企业
|
||||
pd.put("FILESIZE", "");
|
||||
pd.put("SHARE", "no");
|
||||
pd.put("FILESIZE", "");
|
||||
pd.put("SHARE", "no");
|
||||
mfolderService.save(pd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -483,7 +486,7 @@ public class MfolderController extends BaseController {
|
|||
class NofileException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public NofileException() {
|
||||
super();
|
||||
}
|
||||
|
@ -499,5 +502,5 @@ class NofileException extends Exception {
|
|||
public NofileException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,7 @@ import org.springframework.stereotype.Component;
|
|||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
@Component
|
||||
@RocketMQMessageListener(consumerGroup = "${mq.group.info}",
|
||||
topic = "${mq.topic.info}",
|
||||
selectorType = SelectorType.TAG)
|
||||
@RocketMQMessageListener(consumerGroup = "${mq.group.info}", topic = "${mq.topic.info}", selectorType = SelectorType.TAG)
|
||||
public class MqListener implements RocketMQListener<String> {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,10 +32,10 @@ import com.zcloud.util.Tools;
|
|||
@Controller
|
||||
@RequestMapping("/photo")
|
||||
public class PhotoController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PhotoService photoService;
|
||||
|
||||
|
||||
/**保存
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -85,7 +85,7 @@ public class PhotoController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**保存
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -98,7 +98,7 @@ public class PhotoController extends BaseController {
|
|||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
pd.put("USERNAME", Jurisdiction.getUsername()); //用户名
|
||||
|
||||
|
||||
if (null != file && !file.isEmpty()) {
|
||||
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1).toLowerCase();
|
||||
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
|
||||
|
@ -137,7 +137,7 @@ public class PhotoController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**保存用户头像(手机端)
|
||||
* @param
|
||||
* @throws Exception
|
||||
|
@ -150,11 +150,11 @@ public class PhotoController extends BaseController {
|
|||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
String USERNAME = Jurisdiction.getUsername();//用户名
|
||||
String userphoto = "uploadFiles/photo/"+USERNAME+"_photo.jpg";
|
||||
String userphoto = "/uploadFiles/photo/"+USERNAME+"_photo.jpg";
|
||||
String imgData = pd.getString("PHOTODATA").replace("data:image/jpeg;base64,", "");
|
||||
String pathimg = PathUtil.getProjectpath()+userphoto;
|
||||
ImageAnd64Binary.generateImage(imgData, pathimg);
|
||||
pd.put("USERNAME", USERNAME);
|
||||
pd.put("USERNAME", USERNAME);
|
||||
pd.put("PHOTO0", ""); //原图
|
||||
pd.put("PHOTO1", userphoto); //头像1
|
||||
pd.put("PHOTO2", userphoto); //头像2
|
||||
|
|
|
@ -23,15 +23,15 @@ public class Const {
|
|||
public static final String SHOWCOUNT = "showCount"; //每页条数
|
||||
|
||||
public static final String basePath = "/mnt/qask/file/";
|
||||
public static final String FILEPATHFILE = "/uploadFiles/file/"; //文件上传路径
|
||||
public static final String FILEPATHHEADPHONE = "/uploadFiles/headPhone/"; //用户头像
|
||||
public static final String BIFILEPATHFILE = "/uploadFiles/Bfile/"; //文件上传路径
|
||||
public static final String FILEPATHIMG = "/uploadFiles/imgs/"; //图片上传路径
|
||||
public static final String FILEPATHDZJM = "/uploadFiles/dzjm/"; //图片上传路径
|
||||
public static final String FILEPATHYHTP = "/uploadFiles/yhtp/"; //图片上传路径
|
||||
public static final String FILEPATHAITP = "/uploadFiles/aitp/"; //图片上传路径
|
||||
public static final String FILEPATHFXSST = "/uploadFiles/fxsst/"; //图片上传路径 风险四色图
|
||||
public static final String FILEPATHSTUDYVIDEO = "/uploadFiles/studyVideo/"; //学习园地-学习视频文件
|
||||
public static final String FILEPATHFILE = "/uploadFiles/czks/file/"; //文件上传路径
|
||||
public static final String FILEPATHHEADPHONE = "/uploadFiles/czks/headPhone/"; //用户头像
|
||||
public static final String BIFILEPATHFILE = "/uploadFiles/czks/Bfile/"; //文件上传路径
|
||||
public static final String FILEPATHIMG = "/uploadFiles/czks/imgs/"; //图片上传路径
|
||||
public static final String FILEPATHDZJM = "/uploadFiles/czks/dzjm/"; //图片上传路径
|
||||
public static final String FILEPATHYHTP = "/uploadFiles/czks/yhtp/"; //图片上传路径
|
||||
public static final String FILEPATHAITP = "/uploadFiles/czks/aitp/"; //图片上传路径
|
||||
public static final String FILEPATHFXSST = "/uploadFiles/czks/fxsst/"; //图片上传路径 风险四色图
|
||||
public static final String FILEPATHSTUDYVIDEO = "/uploadFiles/czks/studyVideo/"; //学习园地-学习视频文件
|
||||
|
||||
public static final String FILEACTIVITI = "/uploadFiles/activitiFile/"; //工作流生成XML和PNG目录
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.springframework.beans.factory.annotation.Configurable;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -17,6 +18,8 @@ import com.jcraft.jsch.Session;
|
|||
import com.jcraft.jsch.SftpATTRS;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Configuration
|
||||
public class Smb {
|
||||
|
||||
|
@ -27,24 +30,30 @@ public class Smb {
|
|||
public static String password;
|
||||
public static String basePath;
|
||||
|
||||
@Resource
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
@Value("${smb.host}")
|
||||
public void setHostPath(String hostProperties){
|
||||
public void setHostPath(String hostProperties) {
|
||||
host = hostProperties;
|
||||
}
|
||||
|
||||
@Value("${smb.port}")
|
||||
public void setPortPath(Integer portProperties){
|
||||
public void setPortPath(Integer portProperties) {
|
||||
port = portProperties;
|
||||
}
|
||||
|
||||
@Value("${smb.user}")
|
||||
public void setUserPath(String userProperties){
|
||||
public void setUserPath(String userProperties) {
|
||||
user = userProperties;
|
||||
}
|
||||
|
||||
@Value("${smb.password}")
|
||||
public void setPasswordPath(String passwordProperties){
|
||||
public void setPasswordPath(String passwordProperties) {
|
||||
password = passwordProperties;
|
||||
}
|
||||
|
||||
@Value("${smb.basePath}")
|
||||
public void setBasePath(String basePathProperties){
|
||||
public void setBasePath(String basePathProperties) {
|
||||
basePath = basePathProperties;
|
||||
}
|
||||
|
||||
|
@ -132,6 +141,141 @@ public class Smb {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* bus_imgfiles表
|
||||
* IMGFILES_ID,FOREIGN_KEY,TYPE
|
||||
* 这三个值必须要传,所以用到Smb.sshSftp
|
||||
* */
|
||||
public static void sshSftp(MultipartFile file, String fileName, String path,String IMGFILES_ID,String FOREIGN_KEY,String TYPE) 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;
|
||||
|
||||
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);
|
||||
// 列出服务器指定的文件列表
|
||||
// Vector v = sftp.ls("*");
|
||||
// for(int i=0;i<v.size();i++){
|
||||
// System.out.println(v.get(i));
|
||||
// }
|
||||
// 以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换以下流就可以了
|
||||
|
||||
sftp.put(file.getInputStream(), fileName);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关流操作
|
||||
if (outstream != null) {
|
||||
outstream.flush();
|
||||
outstream.close();
|
||||
}
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
}
|
||||
if (channel != null) {
|
||||
channel.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* bus_imgfiles表
|
||||
* IMGFILES_ID,FOREIGN_KEY,TYPE
|
||||
* 这三个值必须要传,所以用到Smb.sshSftp
|
||||
* */
|
||||
public static void sshSftpForInput(InputStream fileI, String fileName, String path,String IMGFILES_ID,String FOREIGN_KEY,String TYPE) 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;
|
||||
|
||||
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);
|
||||
// 列出服务器指定的文件列表
|
||||
// Vector v = sftp.ls("*");
|
||||
// for(int i=0;i<v.size();i++){
|
||||
// System.out.println(v.get(i));
|
||||
// }
|
||||
// 以下代码实现从本地上传一个文件到服务器,如果要实现下载,对换以下流就可以了
|
||||
|
||||
sftp.put(fileI, fileName);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关流操作
|
||||
if (outstream != null) {
|
||||
outstream.flush();
|
||||
outstream.close();
|
||||
}
|
||||
if (session != null) {
|
||||
session.disconnect();
|
||||
}
|
||||
if (channel != null) {
|
||||
channel.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void sshSftpForInput(InputStream fileI, String fileName, String path) throws Exception {
|
||||
Session session = null;
|
||||
|
@ -196,6 +340,7 @@ public class Smb {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static void createDir(String createpath, ChannelSftp sftp) {
|
||||
try {
|
||||
if (isDirExist(createpath, sftp)) {
|
||||
|
@ -278,7 +423,7 @@ public class Smb {
|
|||
System.out.println("4、" + directoryFile + " 删除的文件.....");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 切断远程连接
|
||||
channelSftp.exit();
|
||||
|
|
|
@ -60,7 +60,7 @@ gwj-baseimgpath=https://qgqy.qhdsafety.com/file/
|
|||
gwj-backendaddr=http://192.168.0.31:8991/qa-prevention-gwj/
|
||||
|
||||
#mq ???????????
|
||||
rocketmq.name-server=192.168.0.31:9876
|
||||
rocketmq.name-server=192.168.0.79:9876
|
||||
rocketmq.producer.group=libmiddle
|
||||
rocketmq.producer.send-message-timeout=3000
|
||||
rocketmq.producer.compress-message-body-threshold=4096
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
spring.application.name=qa-prevention-gwj
|
||||
spring.application.name=qa-prevention-czks
|
||||
server.port=8191
|
||||
|
||||
#??
|
||||
|
|
Loading…
Reference in New Issue