YlxxbController.java
3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.bsth.controller.oil;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.io.Files;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.bsth.controller.BaseController;
import com.bsth.entity.oil.Ylxxb;
import com.bsth.service.oil.YlxxbService;
import com.bsth.util.PageObject;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("ylxxb")
public class YlxxbController extends BaseController<Ylxxb, Integer>{
@Autowired
private YlxxbService service;
@RequestMapping(value = "/pagequery",method = RequestMethod.GET)
public PageObject<Ylxxb> pagequery(@RequestParam Map<String, Object> map){
PageObject<Ylxxb> pagequery=null;
map.put("curPage", map.get("page").toString());
map.put("pageData","10");
pagequery=service.Pagequery(map);
return pagequery;
}
@RequestMapping(value = "/listNbbm",method = RequestMethod.GET)
public List<Ylxxb> listNbbm(@RequestParam Map<String, Object> map){
List<Ylxxb> list=service.Pagequery_nbbm(map);
return list;
}
/**
* 核对油量(有加油没里程)
* @param map
* @return
*/
@RequestMapping(value = "/check",method = RequestMethod.POST)
public Map<String, Object> check(@RequestParam Map<String, Object> map){
Map<String, Object> list=new HashMap<>();
try {
list = service.checkJsy(map);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
@RequestMapping(value = "/checkNbbm",method = RequestMethod.POST)
public Map<String, Object> checkNbbm(@RequestParam Map<String, Object> map){
Map<String, Object> list=new HashMap<>();
try {
list = service.checkNbbm(map);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
}
@RequestMapping(value="/saveYlxxb",method = RequestMethod.POST)
public Map<String, Object> savejzl(@RequestParam Map<String, Object> map){
Map<String, Object> maps=new HashMap<>();
try {
maps = service.saveYlxxb(map);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return maps;
}
public String getDataImportClasspath(){
return this.getClass().getResource("/").getPath() + "/static/pages/oil";
}
@RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
public String uploadFile(MultipartFile file) throws Exception{
File newFile = new File(
getDataImportClasspath() + File.separator +
file.getOriginalFilename());
Files.write(file.getBytes(), newFile);
String result = service.importExcel(newFile);
return "{\"result\":" + "\""+result+"\"}";
}
@RequestMapping(value = "/query",method = RequestMethod.GET)
public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{
return service.query(map);
}
}