Commit 5e9579e6bc0578de9c369c69311f34046dfe20b3

Authored by 潘钊
1 parent 70ae995a

update...

src/main/java/com/bsth/controller/oil/YlbController.java
1 1 package com.bsth.controller.oil;
2 2  
3   -import java.text.ParseException;
4   -import java.text.SimpleDateFormat;
5   -import java.util.ArrayList;
6   -import java.util.Calendar;
7   -import java.util.Date;
8   -import java.util.GregorianCalendar;
9   -import java.util.HashMap;
10   -import java.util.Iterator;
11   -import java.util.List;
12   -import java.util.Map;
13   -
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.oil.Ylb;
  5 +import com.bsth.service.oil.YlbService;
  6 +import com.bsth.util.ReportUtils;
  7 +import com.google.common.base.Splitter;
14 8 import org.springframework.beans.factory.annotation.Autowired;
15 9 import org.springframework.data.domain.Page;
16 10 import org.springframework.data.domain.PageRequest;
17 11 import org.springframework.data.domain.Sort;
18 12 import org.springframework.data.domain.Sort.Direction;
19   -import org.springframework.web.bind.annotation.PathVariable;
20 13 import org.springframework.web.bind.annotation.RequestMapping;
21 14 import org.springframework.web.bind.annotation.RequestMethod;
22 15 import org.springframework.web.bind.annotation.RequestParam;
23 16 import org.springframework.web.bind.annotation.RestController;
24 17  
25   -import com.bsth.controller.BaseController;
26   -import com.bsth.entity.oil.Ylb;
27   -import com.bsth.entity.sys.SysUser;
28   -import com.bsth.security.util.SecurityUtils;
29   -import com.bsth.service.oil.YlbService;
30   -import com.bsth.util.ReportUtils;
31   -import com.google.common.base.Splitter;
  18 +import java.text.SimpleDateFormat;
  19 +import java.util.*;
32 20  
33 21 @RestController
34 22 @RequestMapping("ylb")
35 23 public class YlbController extends BaseController<Ylb, Integer>{
36 24 @Autowired
37 25 YlbService yblService;
38   -
  26 +
39 27 @RequestMapping(value = "/saveYlb",method = RequestMethod.POST)
40 28 public Map<String, Object> saveYlb(Ylb t){
41 29 // SysUser user = SecurityUtils.getCurrentUser();
... ... @@ -43,8 +31,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
43 31 // Ylb t=new Ylb();
44 32 return yblService.saveYlb(t);
45 33 }
46   -
47   -
  34 +
  35 +
48 36 /**
49 37 * 把加油(YLXXB)的数据加入
50 38 * @param map
... ... @@ -62,8 +50,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
62 50 System.out.println();
63 51 return list;
64 52 }
65   -
66   -
  53 +
  54 +
67 55 @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST)
68 56 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
69 57 Map<String, Object> list=new HashMap<String, Object>();
... ... @@ -90,7 +78,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
90 78 }
91 79 return list;
92 80 }
93   -
  81 +
94 82 /**
95 83 * 进场油量等于出场油量
96 84 * @param map
... ... @@ -104,10 +92,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
104 92 } catch (Exception e) {
105 93 // TODO: handle exception
106 94 }
107   -
  95 +
108 96 return list;
109 97 }
110   -
  98 +
111 99 /**
112 100 * 核对油量(有加油没里程)
113 101 * @param map
... ... @@ -123,11 +111,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
123 111 }
124 112 return list;
125 113 }
126   -
  114 +
127 115 /**
128   - *
129   - * @Title: list
130   - * @Description: TODO(多条件分页查询)
  116 + *
  117 + * @Title: list
  118 + * @Description: TODO(多条件分页查询)
131 119 * @param @param map 查询条件
132 120 * @param @param page 页码
133 121 * @param @param size 每页显示数量
... ... @@ -135,10 +123,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
135 123 */
136 124 @RequestMapping(method = RequestMethod.GET)
137 125 public Page<Ylb> list(@RequestParam Map<String, Object> map,
138   - @RequestParam(defaultValue = "0") int page,
139   - @RequestParam(defaultValue = "10") int size,
140   - @RequestParam(defaultValue = "id") String order,
141   - @RequestParam(defaultValue = "DESC") String direction){
  126 + @RequestParam(defaultValue = "0") int page,
  127 + @RequestParam(defaultValue = "10") int size,
  128 + @RequestParam(defaultValue = "id") String order,
  129 + @RequestParam(defaultValue = "DESC") String direction){
142 130  
143 131 Direction d;
144 132 map.put("xlbm_like", map.get("xlbm_like").toString().trim());
... ... @@ -150,7 +138,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
150 138 map.get("nbbm_eq").toString(),lx));
151 139 }
152 140 // try {
153   -
  141 +
154 142 if(!(rq=="")){
155 143 //
156 144 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -172,20 +160,20 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
172 160 else
173 161 d = Direction.DESC;
174 162  
175   - // 允许多个字段排序,order可以写单个字段,也可以写多个字段
176   - // 多个字段格式:{col1},{col2},{col3},....,{coln}
177   - // 每个字段的排序方向都是一致,这个以后再看要不要改
178   - List<String> list = Splitter.on(",").trimResults().splitToList(order);
179   - return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
  163 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  164 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  165 + // 每个字段的排序方向都是一致,这个以后再看要不要改
  166 + List<String> list = Splitter.on(",").trimResults().splitToList(order);
  167 + return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
180 168 }
181   -
182   -
183   -
  169 +
  170 +
  171 +
184 172  
185 173 /**
186   - *
187   - * @Title: list
188   - * @Description: TODO(多条件分页查询)
  174 + *
  175 + * @Title: list
  176 + * @Description: TODO(多条件分页查询)
189 177 * @param @param map 查询条件
190 178 * @param @param page 页码
191 179 * @param @param size 每页显示数量
... ... @@ -194,37 +182,37 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
194 182 @RequestMapping(value = "/ylbList",method = RequestMethod.GET)
195 183 public List<Ylb> ylbList(@RequestParam Map<String, Object> map){
196 184 List<Ylb> ylbList=yblService.listYlb(map);
197   - return ylbList;
  185 + return ylbList;
198 186 }
199   -
  187 +
200 188 @RequestMapping(value = "/deleteIds", method = RequestMethod.POST)
201   - public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) {
  189 + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) {
202 190 Map<String, Object> maps=new HashMap<String, Object>();
203   - try {
204   - maps= yblService.deleteIds(map);
  191 + try {
  192 + maps= yblService.deleteIds(map);
205 193 } catch (Exception e) {
206 194 // TODO Auto-generated catch block
207 195 e.printStackTrace();
208 196 }
209   - return maps;
210   - }
  197 + return maps;
  198 + }
211 199 @RequestMapping(value="/oilListMonth")
212   - public List<Ylb> oilListMonth(@RequestParam Map<String, Object> map){
213   - return yblService.oilListMonth(map);
  200 + public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date,@RequestParam String type){
  201 + return yblService.oilListMonth(line, date, type);
214 202 }
215   -
  203 +
216 204 @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
217 205 public String checkJsy(@RequestParam Map<String, Object> map){
218 206 String list=yblService.checkJsy(map);
219 207 return list;
220 208 }
221   -
  209 +
222 210 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
223 211 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
224 212 Map<String, Object> list=yblService.sumYlb(map);
225 213 return list;
226 214 }
227   -
  215 +
228 216 @RequestMapping(value = "/listExport",method = RequestMethod.POST)
229 217 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
230 218 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
... ... @@ -259,15 +247,15 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
259 247 String shyy ="无";
260 248 if(y.getShyy()!=null){
261 249 shyy=y.getShyy();
262   - if(shyy.equals("1")){shyy="票务用油";}
263   - else if(shyy.equals("2")){shyy="保养用油";}
264   - else if(shyy.equals("3")){shyy="报废车用油";}
265   - else if(shyy.equals("4")){shyy="其它用油";}
266   - else if(shyy.equals("5")){shyy="人保部";}
267   - else if(shyy.equals("6")){shyy="车队";}
268   - else if(shyy.equals("7")){shyy="车间(高保)";}
269   - else if(shyy.equals("8")){shyy="车间(小修)";}
270   - else{shyy ="无";}
  250 + if(shyy.equals("1")){shyy="票务用油";}
  251 + else if(shyy.equals("2")){shyy="保养用油";}
  252 + else if(shyy.equals("3")){shyy="报废车用油";}
  253 + else if(shyy.equals("4")){shyy="其它用油";}
  254 + else if(shyy.equals("5")){shyy="人保部";}
  255 + else if(shyy.equals("6")){shyy="车队";}
  256 + else if(shyy.equals("7")){shyy="车间(高保)";}
  257 + else if(shyy.equals("8")){shyy="车间(小修)";}
  258 + else{shyy ="无";}
271 259 }
272 260 m.put("shyy", shyy);
273 261 m.put("sh", y.getSh()<=0?"0":y.getSh());
... ... @@ -280,12 +268,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
280 268 listI.add(resList.iterator());
281 269 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
282 270 ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls",
283   - path+"export/"+map.get("rq").toString()+ "进出场存油量.xls");
284   - } catch (Exception e) {
285   - e.printStackTrace();
286   - }
287   -
  271 + path+"export/"+map.get("rq").toString()+ "进出场存油量.xls");
  272 + } catch (Exception e) {
  273 + e.printStackTrace();
  274 + }
  275 +
288 276 return resList;
289   -
  277 +
290 278 }
291   -}
  279 +}
292 280 \ No newline at end of file
... ...
src/main/java/com/bsth/service/oil/YlbService.java
1 1 package com.bsth.service.oil;
2 2  
3   -import java.util.List;
4   -import java.util.Map;
5   -
6 3 import com.bsth.entity.oil.Ylb;
7 4 import com.bsth.service.BaseService;
8 5  
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
9 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 10 Map<String, Object> obtain(Map<String, Object> map) throws Exception;
11 11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception;
12 12 Map<String, Object> saveYlb(Ylb t);
13 13 String obtainDsq() throws Exception;
14 14 Map<String, Object> sort(Map<String, Object> map) throws Exception;
15   -
  15 +
16 16 Map<String, Object> outAndIn(Map<String, Object> map) throws Exception;
17   -
  17 +
18 18 Map<String, Object> checkYl(Map<String, Object> map) throws Exception;
19   -
  19 +
20 20 Map<String, Object> sumYlb(Map<String, Object> map);
21 21 String checkJsy(Map<String, Object> map);
22   - List<Ylb> oilListMonth(Map<String, Object> map);
  22 + List<Ylb> oilListMonth(String line,String date,String type);
23 23 List<Ylb> listYlb(Map<String, Object> map);
24 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
25   -
  25 +
26 26 Map<String, Object> deleteIds(Map<String, Object> map) throws Exception;
27   -
28   -}
  27 +
  28 +}
29 29 \ No newline at end of file
... ...