|
@@ -21,6 +21,7 @@ import com.jeeplus.modules.sys.service.SystemService;
|
|
|
import com.jeeplus.modules.sys.utils.DictUtils;
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
import com.jeeplus.modules.tools.utils.TwoDimensionCode;
|
|
|
+import com.jeeplus.modules.utils.SftpClientUtil;
|
|
|
import com.jeeplus.modules.workclientinfo.entity.WorkClientAttachment;
|
|
|
import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
|
|
|
import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
|
|
@@ -70,6 +71,9 @@ import freemarker.template.Template;
|
|
|
@RequestMapping(value = "${adminPath}/workfullmanage/workFullManage")
|
|
|
public class WorkFullManageController extends BaseController {
|
|
|
|
|
|
+ /** 文件存储方式(0:本地服务器存储。1:云端存储) */
|
|
|
+ private final static String uploadMode = Global.getConfig("remoteServer.uploadMode");
|
|
|
+
|
|
|
@Autowired
|
|
|
private WorkFullManageService workFullManageService;
|
|
|
|
|
@@ -583,35 +587,45 @@ public class WorkFullManageController extends BaseController {
|
|
|
// return null;
|
|
|
OutputStream out = null;
|
|
|
InputStream in = null;
|
|
|
- try {
|
|
|
- file = URLDecoder.decode(file,"UTF-8");
|
|
|
- String path = file.substring(file.indexOf(".com") + 4, file.length());
|
|
|
- String fileName = URLEncoder.encode(file.substring(file.lastIndexOf("/") + 1, file.length()),"UTF-8");
|
|
|
- BOSClientUtil bosClientUtil = new BOSClientUtil();
|
|
|
- in = bosClientUtil.getObject(path);
|
|
|
- response.reset();//重置 响应头
|
|
|
- response.setContentType("application/x-download");
|
|
|
- response.setHeader("Content-disposition", "attachment; filename=" + fileName);
|
|
|
- out = response.getOutputStream();
|
|
|
- byte[] b = new byte[1024];
|
|
|
- int len;
|
|
|
- while ((len = in.read(b)) > 0){
|
|
|
- response.getOutputStream().write(b, 0, len);
|
|
|
- }
|
|
|
- in.close();
|
|
|
- out.close();
|
|
|
- }catch (IOException e){
|
|
|
- e.printStackTrace();
|
|
|
- }finally {
|
|
|
- if (out != null) {
|
|
|
- out.close();
|
|
|
- }
|
|
|
- if (in != null) {
|
|
|
+ if("1".equals(uploadMode)){
|
|
|
+ try {
|
|
|
+ file = URLDecoder.decode(file,"UTF-8");
|
|
|
+ String path = file.substring(file.indexOf(".com") + 4, file.length());
|
|
|
+ String fileName = URLEncoder.encode(file.substring(file.lastIndexOf("/") + 1, file.length()),"UTF-8");
|
|
|
+ BOSClientUtil bosClientUtil = new BOSClientUtil();
|
|
|
+ in = bosClientUtil.getObject(path);
|
|
|
+ response.reset();//重置 响应头
|
|
|
+ response.setContentType("application/x-download");
|
|
|
+ response.setHeader("Content-disposition", "attachment; filename=" + fileName);
|
|
|
+ out = response.getOutputStream();
|
|
|
+ byte[] b = new byte[1024];
|
|
|
+ int len;
|
|
|
+ while ((len = in.read(b)) > 0){
|
|
|
+ response.getOutputStream().write(b, 0, len);
|
|
|
+ }
|
|
|
in.close();
|
|
|
+ out.close();
|
|
|
+ }catch (IOException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ if (out != null) {
|
|
|
+ out.close();
|
|
|
+ }
|
|
|
+ if (in != null) {
|
|
|
+ in.close();
|
|
|
+ }
|
|
|
}
|
|
|
+ }else{
|
|
|
+ file = URLDecoder.decode(file,"UTF-8");
|
|
|
+ String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
|
|
|
+ file = file.substring(0,file.lastIndexOf("/"));
|
|
|
+ file = URLDecoder.decode(file,"UTF-8");
|
|
|
+
|
|
|
+ SftpClientUtil sftpClientUtil=new SftpClientUtil();
|
|
|
+ sftpClientUtil.download(file,fileName,response);
|
|
|
}
|
|
|
- return null;
|
|
|
|
|
|
+ return null;
|
|
|
|
|
|
}
|
|
|
|