package com.wx.application.nebula.graph.conrtroller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.wx.application.base.BaseController;
import com.wx.application.base.ResponseData;
import com.wx.application.nebula.graph.service.ImportGraphInJsonService;

@RestController
@RequestMapping("/nebula_graph_import")
public class NebulaImportController extends BaseController {
	
	@Autowired
	ImportGraphInJsonService importGraphInJsonService;
	
	/**
	 * 上传zip文件
	 * @param space
	 * @param file
	 * @return
	 */
	@PutMapping(value = "/uploadfile/{space}")
    public ResponseData uploadFile(@PathVariable("space") String space,
    		@RequestParam("file") MultipartFile file) {
		return success(importGraphInJsonService.uploadFile(file, space));
    }
	
	/*@Autowired
	ImportGraphInExcelService importGraphService;
	
	@Autowired
	ImportSchemaService importSchemaService;
	
	*//**
	 * 创建一个任务
	 *//*
	@PutMapping(value = "/createtask/{space}")
    public ResponseData createTask(@PathVariable("space") String space,
    		@RequestParam("file") MultipartFile file
    		,@RequestParam("name") String name) {
		return success(importGraphService.createTask(file, space, name));
    }
	
	
	*//**
	 * 根据任务查看相关的文件信息
	 *//*
	@GetMapping(value = "/findtaskbyid/{taskId}")
    public ResponseData findTaskById(@PathVariable("taskId") Long taskId) {
		return success(importGraphService.findTaskById(taskId));
    }
	
	*//**
	 * 执行导入
	 *//*
	@PostMapping(value = "/graphtaskexecute")
    public ResponseData graphTaskExecute(@RequestBody GraphTaskExecuteQ gtQ) {
		importGraphService.graphTaskExecute(gtQ);
		return success();
    }
	
	*//**
	 * 导入tag和edge
	 *//*
	@PostMapping(value = "/importschema/{space}")
    public ResponseData importModel(@PathVariable("space") String space,
    		@RequestParam("file") MultipartFile file) {
		try {
			importSchemaService.analysisExcel(space,file.getInputStream());
		} catch (IOException e) {
		}
		return success();
    }*/

}
