开始编写数据上传的前后端。
This commit is contained in:
		@@ -0,0 +1,36 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-10-31 10:23:32
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2022-10-31 11:40:21
 | 
			
		||||
 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\data\importer\CarDealerDataImport.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.car_dealer.controllers.data.importer;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.ResponseBody;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
@ResponseBody
 | 
			
		||||
@RequestMapping( path = "data/import/")
 | 
			
		||||
public class CarDealerDataImport
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    public ImportResult importCarDealer( @RequestBody ImportRequest importRequest )
 | 
			
		||||
    {
 | 
			
		||||
        ArrayList<RecordErrorMessage> recordErrorMessages = new ArrayList<RecordErrorMessage>();
 | 
			
		||||
        ImportResult result = new ImportResult();
 | 
			
		||||
 | 
			
		||||
        result.setRecordErrorMessages( recordErrorMessages );
 | 
			
		||||
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,56 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-10-31 11:16:22
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2022-10-31 11:28:00
 | 
			
		||||
 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\data\importer\importRequest.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.car_dealer.controllers.data.importer;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class ImportRequest
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    public ImportRequest( String filePath, String tableName)
 | 
			
		||||
    {
 | 
			
		||||
        this.filePath = filePath;
 | 
			
		||||
        this.tableName = tableName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getFilePath()
 | 
			
		||||
    {
 | 
			
		||||
        return filePath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setFilePath( String filePath )
 | 
			
		||||
    {
 | 
			
		||||
        this.filePath = filePath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getTableName()
 | 
			
		||||
    {
 | 
			
		||||
        return tableName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTableName( String tableName )
 | 
			
		||||
    {
 | 
			
		||||
        this.tableName = tableName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString()
 | 
			
		||||
    {
 | 
			
		||||
        return "{ \"file_path\":\"" + filePath + "\", \"table_name\":\"" + tableName + "\"}";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "file_path")
 | 
			
		||||
    private String filePath;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "table_name")
 | 
			
		||||
    private String tableName;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,86 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-10-31 10:31:35
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2022-10-31 10:43:12
 | 
			
		||||
 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\data\importer\ImportResult.java
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.car_dealer.controllers.data.importer;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
 | 
			
		||||
public class ImportResult
 | 
			
		||||
{
 | 
			
		||||
    ImportResult()
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    public String getFileName()
 | 
			
		||||
    {
 | 
			
		||||
        return fileName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setFileName( String fileName )
 | 
			
		||||
    {
 | 
			
		||||
        this.fileName = fileName;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getFilePath()
 | 
			
		||||
    {
 | 
			
		||||
        return filePath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setFilePath( String filePath )
 | 
			
		||||
    {
 | 
			
		||||
        this.filePath = filePath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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 ArrayList<RecordErrorMessage> getRecordErrorMessages()
 | 
			
		||||
    {
 | 
			
		||||
        return recordErrorMessages;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRecordErrorMessages( ArrayList<RecordErrorMessage> recordErrorMessages )
 | 
			
		||||
    {
 | 
			
		||||
        this.recordErrorMessages = recordErrorMessages;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "file_name")
 | 
			
		||||
    private String fileName;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "file_path")
 | 
			
		||||
    private String filePath;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "success")
 | 
			
		||||
    private boolean success;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "message")
 | 
			
		||||
    private String message;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty( "record_error_messages")
 | 
			
		||||
    private ArrayList<RecordErrorMessage> recordErrorMessages;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,100 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-10-31 10:48:29
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2022-10-31 11:01:28
 | 
			
		||||
 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\data\importer\importRecordErrorMessage.java
 | 
			
		||||
 * @Description: 存放导入数据记录结果的对象.
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
package com.cpic.xim.car_dealer.controllers.data.importer;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.*;;
 | 
			
		||||
 | 
			
		||||
/*****************************************************
 | 
			
		||||
 * 存放导入数据记录结果的对象.
 | 
			
		||||
 *****************************************************/
 | 
			
		||||
public class RecordErrorMessage
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    public RecordErrorMessage( int rowIndex, String message)
 | 
			
		||||
    {
 | 
			
		||||
        this.rowIndex = rowIndex;
 | 
			
		||||
        this.message = message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public int getRowIndex()
 | 
			
		||||
    {
 | 
			
		||||
        return rowIndex;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRowIndex( int rowIndex )
 | 
			
		||||
    {
 | 
			
		||||
        this.rowIndex = rowIndex;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getMessage()
 | 
			
		||||
    {
 | 
			
		||||
        return message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMessage( String message )
 | 
			
		||||
    {
 | 
			
		||||
        this.message = message;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int hashCode()
 | 
			
		||||
    {
 | 
			
		||||
        final int prime = 31;
 | 
			
		||||
        int result = 1;
 | 
			
		||||
        result = prime * result + rowIndex;
 | 
			
		||||
        result = prime * result + ((message == null) ? 0 : message.hashCode());
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean equals( Object obj )
 | 
			
		||||
    {
 | 
			
		||||
        if ( this == obj)
 | 
			
		||||
            return true;
 | 
			
		||||
        if ( obj == null)
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( getClass() != obj.getClass())
 | 
			
		||||
            return false;
 | 
			
		||||
        RecordErrorMessage other = (RecordErrorMessage) obj;
 | 
			
		||||
        if ( rowIndex != other.rowIndex)
 | 
			
		||||
            return false;
 | 
			
		||||
        if ( message == null)
 | 
			
		||||
        {
 | 
			
		||||
            if ( other.message != null)
 | 
			
		||||
                return false;
 | 
			
		||||
        } else if ( !message.equals( other.message ))
 | 
			
		||||
            return false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString()
 | 
			
		||||
    {
 | 
			
		||||
        return "importRecordErrorMessage [rowIndex=" + rowIndex + ", message=" + message + "]";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 数据的行id。
 | 
			
		||||
     */
 | 
			
		||||
    @JsonProperty( "row_index")
 | 
			
		||||
    private int rowIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 导入时的错误信息。
 | 
			
		||||
     */
 | 
			
		||||
    @JsonProperty( "message")
 | 
			
		||||
    private String message;
 | 
			
		||||
}
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-09-28 15:47:02
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2022-10-19 16:19:01
 | 
			
		||||
 * @LastEditTime: 2022-10-31 11:08:29
 | 
			
		||||
 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\fileupload\FileUploadController.java
 | 
			
		||||
 * @Description: 用于实现跨域功能的过滤器对象。
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2723
									
								
								code/web/car_dealer/js/axios/1.1.3/axios.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2723
									
								
								code/web/car_dealer/js/axios/1.1.3/axios.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user