Commit 5e9579e6bc0578de9c369c69311f34046dfe20b3

Authored by 潘钊
1 parent 70ae995a

update...

src/main/java/com/bsth/controller/oil/YlbController.java
1 package com.bsth.controller.oil; 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 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.data.domain.Page; 9 import org.springframework.data.domain.Page;
16 import org.springframework.data.domain.PageRequest; 10 import org.springframework.data.domain.PageRequest;
17 import org.springframework.data.domain.Sort; 11 import org.springframework.data.domain.Sort;
18 import org.springframework.data.domain.Sort.Direction; 12 import org.springframework.data.domain.Sort.Direction;
19 -import org.springframework.web.bind.annotation.PathVariable;  
20 import org.springframework.web.bind.annotation.RequestMapping; 13 import org.springframework.web.bind.annotation.RequestMapping;
21 import org.springframework.web.bind.annotation.RequestMethod; 14 import org.springframework.web.bind.annotation.RequestMethod;
22 import org.springframework.web.bind.annotation.RequestParam; 15 import org.springframework.web.bind.annotation.RequestParam;
23 import org.springframework.web.bind.annotation.RestController; 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 @RestController 21 @RestController
34 @RequestMapping("ylb") 22 @RequestMapping("ylb")
35 public class YlbController extends BaseController<Ylb, Integer>{ 23 public class YlbController extends BaseController<Ylb, Integer>{
36 @Autowired 24 @Autowired
37 YlbService yblService; 25 YlbService yblService;
38 - 26 +
39 @RequestMapping(value = "/saveYlb",method = RequestMethod.POST) 27 @RequestMapping(value = "/saveYlb",method = RequestMethod.POST)
40 public Map<String, Object> saveYlb(Ylb t){ 28 public Map<String, Object> saveYlb(Ylb t){
41 // SysUser user = SecurityUtils.getCurrentUser(); 29 // SysUser user = SecurityUtils.getCurrentUser();
@@ -43,8 +31,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -43,8 +31,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
43 // Ylb t=new Ylb(); 31 // Ylb t=new Ylb();
44 return yblService.saveYlb(t); 32 return yblService.saveYlb(t);
45 } 33 }
46 -  
47 - 34 +
  35 +
48 /** 36 /**
49 * 把加油(YLXXB)的数据加入 37 * 把加油(YLXXB)的数据加入
50 * @param map 38 * @param map
@@ -62,8 +50,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -62,8 +50,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
62 System.out.println(); 50 System.out.println();
63 return list; 51 return list;
64 } 52 }
65 -  
66 - 53 +
  54 +
67 @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST) 55 @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST)
68 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){ 56 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
69 Map<String, Object> list=new HashMap<String, Object>(); 57 Map<String, Object> list=new HashMap<String, Object>();
@@ -90,7 +78,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -90,7 +78,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
90 } 78 }
91 return list; 79 return list;
92 } 80 }
93 - 81 +
94 /** 82 /**
95 * 进场油量等于出场油量 83 * 进场油量等于出场油量
96 * @param map 84 * @param map
@@ -104,10 +92,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -104,10 +92,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
104 } catch (Exception e) { 92 } catch (Exception e) {
105 // TODO: handle exception 93 // TODO: handle exception
106 } 94 }
107 - 95 +
108 return list; 96 return list;
109 } 97 }
110 - 98 +
111 /** 99 /**
112 * 核对油量(有加油没里程) 100 * 核对油量(有加油没里程)
113 * @param map 101 * @param map
@@ -123,11 +111,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -123,11 +111,11 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
123 } 111 }
124 return list; 112 return list;
125 } 113 }
126 - 114 +
127 /** 115 /**
128 - *  
129 - * @Title: list  
130 - * @Description: TODO(多条件分页查询) 116 + *
  117 + * @Title: list
  118 + * @Description: TODO(多条件分页查询)
131 * @param @param map 查询条件 119 * @param @param map 查询条件
132 * @param @param page 页码 120 * @param @param page 页码
133 * @param @param size 每页显示数量 121 * @param @param size 每页显示数量
@@ -135,10 +123,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -135,10 +123,10 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
135 */ 123 */
136 @RequestMapping(method = RequestMethod.GET) 124 @RequestMapping(method = RequestMethod.GET)
137 public Page<Ylb> list(@RequestParam Map<String, Object> map, 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 Direction d; 131 Direction d;
144 map.put("xlbm_like", map.get("xlbm_like").toString().trim()); 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,7 +138,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
150 map.get("nbbm_eq").toString(),lx)); 138 map.get("nbbm_eq").toString(),lx));
151 } 139 }
152 // try { 140 // try {
153 - 141 +
154 if(!(rq=="")){ 142 if(!(rq=="")){
155 // 143 //
156 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 144 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
@@ -172,20 +160,20 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -172,20 +160,20 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
172 else 160 else
173 d = Direction.DESC; 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 * @param @param map 查询条件 177 * @param @param map 查询条件
190 * @param @param page 页码 178 * @param @param page 页码
191 * @param @param size 每页显示数量 179 * @param @param size 每页显示数量
@@ -194,37 +182,37 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -194,37 +182,37 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
194 @RequestMapping(value = "/ylbList",method = RequestMethod.GET) 182 @RequestMapping(value = "/ylbList",method = RequestMethod.GET)
195 public List<Ylb> ylbList(@RequestParam Map<String, Object> map){ 183 public List<Ylb> ylbList(@RequestParam Map<String, Object> map){
196 List<Ylb> ylbList=yblService.listYlb(map); 184 List<Ylb> ylbList=yblService.listYlb(map);
197 - return ylbList; 185 + return ylbList;
198 } 186 }
199 - 187 +
200 @RequestMapping(value = "/deleteIds", method = RequestMethod.POST) 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 Map<String, Object> maps=new HashMap<String, Object>(); 190 Map<String, Object> maps=new HashMap<String, Object>();
203 - try {  
204 - maps= yblService.deleteIds(map); 191 + try {
  192 + maps= yblService.deleteIds(map);
205 } catch (Exception e) { 193 } catch (Exception e) {
206 // TODO Auto-generated catch block 194 // TODO Auto-generated catch block
207 e.printStackTrace(); 195 e.printStackTrace();
208 } 196 }
209 - return maps;  
210 - } 197 + return maps;
  198 + }
211 @RequestMapping(value="/oilListMonth") 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 @RequestMapping(value = "/checkJsy",method = RequestMethod.GET) 204 @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
217 public String checkJsy(@RequestParam Map<String, Object> map){ 205 public String checkJsy(@RequestParam Map<String, Object> map){
218 String list=yblService.checkJsy(map); 206 String list=yblService.checkJsy(map);
219 return list; 207 return list;
220 } 208 }
221 - 209 +
222 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) 210 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
223 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ 211 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
224 Map<String, Object> list=yblService.sumYlb(map); 212 Map<String, Object> list=yblService.sumYlb(map);
225 return list; 213 return list;
226 } 214 }
227 - 215 +
228 @RequestMapping(value = "/listExport",method = RequestMethod.POST) 216 @RequestMapping(value = "/listExport",method = RequestMethod.POST)
229 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ 217 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
230 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 218 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
@@ -259,15 +247,15 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -259,15 +247,15 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
259 String shyy ="无"; 247 String shyy ="无";
260 if(y.getShyy()!=null){ 248 if(y.getShyy()!=null){
261 shyy=y.getShyy(); 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 m.put("shyy", shyy); 260 m.put("shyy", shyy);
273 m.put("sh", y.getSh()<=0?"0":y.getSh()); 261 m.put("sh", y.getSh()<=0?"0":y.getSh());
@@ -280,12 +268,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -280,12 +268,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
280 listI.add(resList.iterator()); 268 listI.add(resList.iterator());
281 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; 269 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
282 ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls", 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 return resList; 276 return resList;
289 - 277 +
290 } 278 }
291 -} 279 +}
292 \ No newline at end of file 280 \ No newline at end of file
src/main/java/com/bsth/service/oil/YlbService.java
1 package com.bsth.service.oil; 1 package com.bsth.service.oil;
2 2
3 -import java.util.List;  
4 -import java.util.Map;  
5 -  
6 import com.bsth.entity.oil.Ylb; 3 import com.bsth.entity.oil.Ylb;
7 import com.bsth.service.BaseService; 4 import com.bsth.service.BaseService;
8 5
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
9 public interface YlbService extends BaseService<Ylb, Integer>{ 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 Map<String, Object> obtain(Map<String, Object> map) throws Exception; 10 Map<String, Object> obtain(Map<String, Object> map) throws Exception;
11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception; 11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception;
12 Map<String, Object> saveYlb(Ylb t); 12 Map<String, Object> saveYlb(Ylb t);
13 String obtainDsq() throws Exception; 13 String obtainDsq() throws Exception;
14 Map<String, Object> sort(Map<String, Object> map) throws Exception; 14 Map<String, Object> sort(Map<String, Object> map) throws Exception;
15 - 15 +
16 Map<String, Object> outAndIn(Map<String, Object> map) throws Exception; 16 Map<String, Object> outAndIn(Map<String, Object> map) throws Exception;
17 - 17 +
18 Map<String, Object> checkYl(Map<String, Object> map) throws Exception; 18 Map<String, Object> checkYl(Map<String, Object> map) throws Exception;
19 - 19 +
20 Map<String, Object> sumYlb(Map<String, Object> map); 20 Map<String, Object> sumYlb(Map<String, Object> map);
21 String checkJsy(Map<String, Object> map); 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 List<Ylb> listYlb(Map<String, Object> map); 23 List<Ylb> listYlb(Map<String, Object> map);
24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx); 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
25 - 25 +
26 Map<String, Object> deleteIds(Map<String, Object> map) throws Exception; 26 Map<String, Object> deleteIds(Map<String, Object> map) throws Exception;
27 -  
28 -} 27 +
  28 +}
29 \ No newline at end of file 29 \ No newline at end of file