保存进度!
This commit is contained in:
parent
c1ba8fee05
commit
1f988323d4
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-01-22 23:11:26
|
* @Date: 2023-01-22 23:11:26
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-22 23:47:15
|
* @LastEditTime: 2023-01-23 23:22:10
|
||||||
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\FileUpload\FileUpload.java
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\FileUpload\FileUpload.java
|
||||||
* @Description: 用于接受上传文件的Controller。
|
* @Description: 用于接受上传文件的Controller。
|
||||||
*
|
*
|
||||||
@ -11,9 +11,12 @@
|
|||||||
|
|
||||||
package com.cpic.xim.web.controllers.FileUpload;
|
package com.cpic.xim.web.controllers.FileUpload;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@SuppressWarnings( "unused" )
|
@SuppressWarnings( "unused" )
|
||||||
@ -22,11 +25,34 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
public class FileUpload
|
public class FileUpload
|
||||||
{
|
{
|
||||||
@RequestMapping( path = "/file-upload.do" )
|
@RequestMapping( path = "/file-upload.do" )
|
||||||
public void getUploadFile( @RequestParam( "task-name" ) String taskName,
|
@ResponseBody
|
||||||
@RequestParam( "file" ) MultipartFile[] files )
|
public FileUploadResult getUploadFile( @RequestParam( "task-name" ) String taskName,
|
||||||
|
@RequestParam( "file" ) MultipartFile[] files, HttpServletRequest request )
|
||||||
{
|
{
|
||||||
|
// session id用来创建临时目录,避免重复
|
||||||
|
String sessionID = request.getSession().getId();
|
||||||
|
FileUploadResult result = new FileUploadResult();
|
||||||
|
Vector<String> fileNames = new Vector<String>();
|
||||||
int fileCount = files.length;
|
int fileCount = files.length;
|
||||||
|
|
||||||
return;
|
if ( files.length == 0 )
|
||||||
|
{
|
||||||
|
result.setSuccess( false );
|
||||||
|
result.setMessage( "此接口用于上传文件!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setSuccess( true );
|
||||||
|
result.setMessage( "上传成功!" );
|
||||||
|
|
||||||
|
for ( MultipartFile file : files )
|
||||||
|
{
|
||||||
|
String fileName = file.getName();
|
||||||
|
|
||||||
|
fileNames.add( fileName );
|
||||||
|
}
|
||||||
|
|
||||||
|
result.setFileList( fileNames );
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* @Author: Kane
|
||||||
|
* @Date: 2023-01-23 22:56:17
|
||||||
|
* @LastEditors: Kane
|
||||||
|
* @LastEditTime: 2023-01-23 22:56:25
|
||||||
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\FileUpload\FileUploadResult.java
|
||||||
|
* @Description:
|
||||||
|
*
|
||||||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cpic.xim.web.controllers.FileUpload;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
@SuppressWarnings( "unused" )
|
||||||
|
public class FileUploadResult
|
||||||
|
{
|
||||||
|
public FileUploadResult()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public boolean isSuccess()
|
||||||
|
{
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess( boolean success )
|
||||||
|
{
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage()
|
||||||
|
{
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage( String message )
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<String> getFileList()
|
||||||
|
{
|
||||||
|
return fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileList( Vector<String> fileList )
|
||||||
|
{
|
||||||
|
this.fileList = fileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty( "success" )
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
@JsonProperty( "message" )
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@JsonProperty( "file-list" )
|
||||||
|
private Vector<String> fileList;
|
||||||
|
}
|
||||||
|
|
@ -39,7 +39,7 @@ public class P13AccountCheckController
|
|||||||
* @return 返回一个P13AccountCheckResult对象,其中提供验证结果
|
* @return 返回一个P13AccountCheckResult对象,其中提供验证结果
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping( path = "/p13_account_check.do" )
|
@RequestMapping( path = "/p13_account_check" )
|
||||||
public P13AccountCheckResult checkP13Account( @RequestBody P13AccountCheckRequest param,
|
public P13AccountCheckResult checkP13Account( @RequestBody P13AccountCheckRequest param,
|
||||||
HttpServletRequest request, HttpServletResponse response )
|
HttpServletRequest request, HttpServletResponse response )
|
||||||
throws IllegalSelectorException, IOException
|
throws IllegalSelectorException, IOException
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-01-12 15:01:22
|
* @Date: 2023-01-12 15:01:22
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-13 09:23:55
|
* @LastEditTime: 2023-01-24 00:07:36
|
||||||
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\filters\token\TokenFilter.java
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\filters\token\TokenFilter.java
|
||||||
* @Description: 用于检查token的过滤器
|
* @Description: 用于检查token的过滤器
|
||||||
*
|
*
|
||||||
@ -32,7 +32,8 @@ public class TokenFilter implements Filter
|
|||||||
HttpServletRequest request = (HttpServletRequest) req;
|
HttpServletRequest request = (HttpServletRequest) req;
|
||||||
HttpServletResponse response = (HttpServletResponse) resp;
|
HttpServletResponse response = (HttpServletResponse) resp;
|
||||||
|
|
||||||
String URI = request.getRequestURI();
|
// 验证Token
|
||||||
|
String token = request.getHeader( "Token" );
|
||||||
|
|
||||||
chain.doFilter( request, response );
|
chain.doFilter( request, response );
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2022-12-15 19:40:12
|
* @Date: 2022-12-15 19:40:12
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2022-12-16 10:14:54
|
* @LastEditTime: 2023-01-23 23:58:26
|
||||||
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\listener\ContextLoaderListener.java
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\listener\ContextLoaderListener.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -53,5 +53,19 @@ public class ContextLoaderListener implements ServletContextListener
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( configFile != null )
|
||||||
|
{
|
||||||
|
configFile.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( Exception error )
|
||||||
|
{
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,22 @@
|
|||||||
<servlet-name>springmvc</servlet-name>
|
<servlet-name>springmvc</servlet-name>
|
||||||
<url-pattern>*.do</url-pattern>
|
<url-pattern>*.do</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>springmvc</servlet-name>
|
||||||
|
<url-pattern>/account/p13_account_check</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- 用于验证Token的Filter -->
|
||||||
|
<filter>
|
||||||
|
<filter-name>token-filter</filter-name>
|
||||||
|
<filter-class>com.cpic.xim.web.filters.token.TokenFilter</filter-class>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>token-filter</filter-name>
|
||||||
|
<url-pattern>*.do</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
|
<!-- 用于实现跨域访问的Filter -->
|
||||||
<filter>
|
<filter>
|
||||||
<filter-name>cros-filter</filter-name>
|
<filter-name>cros-filter</filter-name>
|
||||||
<filter-class>com.cpic.xim.web.filters.cros.CrosFilter</filter-class>
|
<filter-class>com.cpic.xim.web.filters.cros.CrosFilter</filter-class>
|
||||||
@ -27,14 +42,6 @@
|
|||||||
<url-pattern>*.do</url-pattern>
|
<url-pattern>*.do</url-pattern>
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
<filter>
|
|
||||||
<filter-name>token-filter</filter-name>
|
|
||||||
<filter-class>com.cpic.xim.web.filters.token.TokenFilter</filter-class>
|
|
||||||
</filter>
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>token-filter</filter-name>
|
|
||||||
<url-pattern>*.do</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
<!-- 配置文件路径参数 -->
|
<!-- 配置文件路径参数 -->
|
||||||
<context-param>
|
<context-param>
|
||||||
|
@ -1 +1,2 @@
|
|||||||
VUE_APP_API_URL_LOGIN = "http://222.76.244.118:11001/admin-system/account/p13_account_check.do"
|
VUE_APP_API_URL_LOGIN = "http://222.76.244.118:11001/admin-system/account/p13_account_check"
|
||||||
|
VUR_APPP_API_URL_UPLOAD_FILE= "http://222.76.244.118:11001/admin-system/file/file-upload.do"
|
Loading…
x
Reference in New Issue
Block a user