|
|
|
@ -6,11 +6,12 @@ import com.markma.leave_manager_spb.entity.UserDetail;
|
|
|
|
|
import com.markma.leave_manager_spb.repository.UserDetailRepository;
|
|
|
|
|
import com.markma.leave_manager_spb.repository.UserRepository;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -57,4 +58,21 @@ public class UserDetailHandler {
|
|
|
|
|
return UADs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/import")
|
|
|
|
|
public String importData(MultipartFile file, HttpServletRequest req) throws IOException {
|
|
|
|
|
|
|
|
|
|
//保存上传的文件//
|
|
|
|
|
String realPath = "D:\\vue\\leave_manager\\src\\excel\\importExcels";
|
|
|
|
|
File folder = new File(realPath);
|
|
|
|
|
if (!folder.exists()) {
|
|
|
|
|
folder.mkdirs();
|
|
|
|
|
}
|
|
|
|
|
file.transferTo(new File(folder, file.getOriginalFilename()));
|
|
|
|
|
|
|
|
|
|
String absolutePath = realPath + "\\" + file.getOriginalFilename();
|
|
|
|
|
System.out.println("上传的文件的绝对路径:" + absolutePath);
|
|
|
|
|
//保存上传的文件//
|
|
|
|
|
|
|
|
|
|
return "success";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|