Commit 5449a8cd886e9e7812d7f295787fd348afaed92d

Authored by 娄高锋
1 parent b3c312bc

青浦 纯电车日报表

src/main/java/com/bsth/controller/RefuelController.java
... ... @@ -35,14 +35,24 @@ public class RefuelController extends BaseController<Refuel, Long> {
35 35 return refuelService.queryDaily(map);
36 36 }
37 37  
  38 + @RequestMapping(value = "/queryYc", method = RequestMethod.GET)
  39 + public List<Map<String, Object>> queryYc(@RequestParam Map<String, Object> map){
  40 + return refuelService.queryYc(map);
  41 + }
  42 +
38 43 @RequestMapping(value = "/exportQueryYc", method = RequestMethod.GET)
39 44 public List<Map<String, Object>> exportQueryYc(@RequestParam Map<String, Object> map){
40 45 return refuelService.exportQueryYc(map);
41 46 }
42 47  
43   - @RequestMapping(value = "/queryYc", method = RequestMethod.GET)
44   - public List<Map<String, Object>> queryYc(@RequestParam Map<String, Object> map){
45   - return refuelService.queryYc(map);
  48 + @RequestMapping(value = "/queryDc", method = RequestMethod.GET)
  49 + public List<Map<String, Object>> queryDc(@RequestParam Map<String, Object> map){
  50 + return refuelService.queryDc(map);
  51 + }
  52 +
  53 + @RequestMapping(value = "/exportQueryDc", method = RequestMethod.GET)
  54 + public List<Map<String, Object>> exportQueryDc(@RequestParam Map<String, Object> map){
  55 + return refuelService.exportQueryDc(map);
46 56 }
47 57  
48 58 @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
... ...
src/main/java/com/bsth/repository/RefuelRepository.java
... ... @@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Modifying;
7 7 import org.springframework.data.jpa.repository.Query;
8 8 import org.springframework.transaction.annotation.Transactional;
9 9  
  10 +import com.bsth.entity.Cars;
10 11 import com.bsth.entity.Refuel;
11 12 import com.bsth.entity.realcontrol.ScheduleRealInfo;
12 13 import com.bsth.repository.BaseRepository;
... ... @@ -22,6 +23,9 @@ public interface RefuelRepository extends BaseRepository&lt;Refuel, Long&gt; {
22 23 +"from bsth_c_refuel r where binary r.date_str = ?1 and r.car like ?2 and r.driver like ?3", nativeQuery=true)
23 24 List<Refuel> findByDate(String date, String car, String driver);
24 25  
  26 + @Query(value="select r from Refuel r where r.dateStr = ?1 and r.car = ?2 and r.driver = ?3")
  27 + List<Refuel> selectByCarAndDriver(String date, String car, String driver);
  28 +
25 29 @Query(value="select r from Refuel r where r.dateStr = ?1 and r.lineName = ?2 and r.car = ?3 and r.driver = ?4")
26 30 List<Refuel> selectByDateAndCar(String date, String line, String car, String driver);
27 31  
... ... @@ -29,6 +33,14 @@ public interface RefuelRepository extends BaseRepository&lt;Refuel, Long&gt; {
29 33 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh = ?2 and s.jGh = ?3")
30 34 List<ScheduleRealInfo> scheduleByDate(String date, String clZbh, String jGh);
31 35  
  36 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  37 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh like ?2 and s.xlBm = ?3 order by s.clZbh asc")
  38 + List<ScheduleRealInfo> scheduleByDateAndLine(String date, String clZbh, String xlBm);
  39 +
  40 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  41 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.clZbh = ?2")
  42 + List<ScheduleRealInfo> scheduleByDateAndCar(String date, String clZbh);
  43 +
32 44 @Transactional
33 45 @Modifying
34 46 @Query(value="INSERT INTO bsth_c_refuel(" +
... ... @@ -46,4 +58,10 @@ public interface RefuelRepository extends BaseRepository&lt;Refuel, Long&gt; {
46 58 public void update(long id, String date, String dateStr, String lineName, String car, String driver, String outOil, String inOil, String inStation0, String inStation5,
47 59 String oilCard0, String oilCard10, String eastStation0, String eastStation10, String outStation0, String outStation10, String updateBy, String updateDate);
48 60  
  61 + @Query(value="select s from Cars s where s.insideCode=?1")
  62 + List<Cars> findCarsByCode(String insideCode);
  63 +
  64 + @Query(value="select s from Cars s where s.sfdc=?1 and insideCode like ?2 order by s.insideCode asc")
  65 + List<Cars> findCarsBySfdc(Boolean sfdc, String insideCode);
  66 +
49 67 }
... ...
src/main/java/com/bsth/service/RefuelService.java
... ... @@ -17,7 +17,11 @@ public interface RefuelService extends BaseService&lt;Refuel, Long&gt; {
17 17  
18 18 List<Map<String, Object>> queryYc(Map<String, Object> map);
19 19  
  20 + List<Map<String, Object>> queryDc(Map<String, Object> map);
  21 +
20 22 List<Map<String, Object>> exportQueryYc(Map<String, Object> map);
21 23  
  24 + List<Map<String, Object>> exportQueryDc(Map<String, Object> map);
  25 +
22 26 public String importExcel(File file);
23 27 }
... ...
src/main/java/com/bsth/service/impl/RefuelServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
  3 +import com.bsth.entity.Cars;
3 4 import com.bsth.entity.Refuel;
4 5 import com.bsth.entity.realcontrol.ChildTaskPlan;
5 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -247,153 +248,150 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
247 248 // TODO Auto-generated method stub
248 249 DecimalFormat df = new DecimalFormat("0.##");
249 250  
250   - String date = "", car = "%%", driver = "%%";
  251 + String date = "", car = "%%", xlbm = "";
251 252 if(map.get("date") != null){
252 253 date = map.get("date").toString();
253 254 }
254 255 if(map.get("car") != null){
255 256 car = "%" + map.get("car").toString() + "%";
256 257 }
257   - if(map.get("driver") != null){
258   - driver = "%" + map.get("driver").toString() + "%";
  258 + if(map.get("line") != null){
  259 + xlbm = map.get("line").toString();
259 260 }
260 261  
261   - List<Refuel> list = repository.findByDate(date, car, driver);
  262 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  263 + Map<String, Object> lastMap = new HashMap<String, Object>();
  264 + String outOil_z = "0", inOil_z = "0", inStation0_z = "0", inStation5_z = "0",
  265 + oilCard0_z = "0", oilCard10_z = "0", eastStation0_z = "0", eastStation10_z = "0",
  266 + outStation0_z = "0", outStation10_z = "0", oil_z = "0", ty_z = "0", yw_z = "0", cj_z = "0",
  267 + realMileage_z = "0", ksMileage_z = "0", ssMileage_z = "0", consume_z = "",
  268 + jhbc_z = "0", sjbc_z = "0", bc_z = "0", cr_z = "0";
262 269  
263   - List<String> keyList = new ArrayList<String>();
264   - Map<String, Refuel> rMap = new HashMap<String, Refuel>();
265   - for(Refuel rf : list){
266   - String key = rf.getCar() + "/" + rf.getDriver();
267   - if("/".equals(key)){
268   - continue;
  270 + List<String> sKeyList = new ArrayList<String>();
  271 + Map<String, List<ScheduleRealInfo>> sMap = new HashMap<String, List<ScheduleRealInfo>>();
  272 + List<ScheduleRealInfo> scheList = repository.scheduleByDateAndLine(date, car, xlbm);
  273 +
  274 + for(ScheduleRealInfo s : scheList){
  275 + if(s.getClZbh() != null && s.getClZbh().length() > 0 && s.getjGh() != null){
  276 + String key = s.getClZbh() + "/" + s.getjGh();
  277 + if(!(sMap.containsKey(key))){
  278 + sMap.put(key, new ArrayList<ScheduleRealInfo>());
  279 + sKeyList.add(key);
  280 + }
  281 + sMap.get(key).add(s);
269 282 }
270   - if(rMap.containsKey(key)){
271   - Refuel r = rMap.get(key);
272   - if(rf.getOutOil().length() > 0){
273   - if(r.getOutOil().length() == 0){
274   - r.setOutOil(rf.getOutOil());
275   - } else if(Double.valueOf(rf.getOutOil()) > Double.valueOf(r.getOutOil())){
276   - r.setOutOil(rf.getOutOil());
  283 + }
  284 +
  285 + for(String key : sKeyList){
  286 + Map<String, Object> m = new HashMap<String, Object>();
  287 + List<ScheduleRealInfo> list2 = sMap.get(key);
  288 + String[] split = key.split("/");
  289 +
  290 + String realMileage = "", oil = "0", consume = "", cr = "";
  291 + String ksMileage = "", ssMileage = "", bc = "", jhbc = "", sjbc = "";
  292 +
  293 + Double sjgl = culateMileageService.culateSjgl(list2);
  294 + Double ksgl = culateMileageService.culateKsgl(list2);
  295 + Double jccgl = culateMileageService.culateJccgl(list2);
  296 + Double ljgl = culateMileageService.culateLjgl(list2);
  297 +
  298 + realMileage = add(add(sjgl, ksgl), add(jccgl, ljgl));
  299 + ksMileage = add(ksgl, jccgl);
  300 +// ssMileage = "" + culateMileageService.culateLbgl(list2); //损失里程?少驶里程?
  301 + jhbc = "" + culateMileageService.culateJhbc(list2, "");
  302 + sjbc = "" + culateMileageService.culateSjbc(list2, "");
  303 + bc = "" + list2.size();
  304 + cr = "1";
  305 +
  306 + realMileage_z = new BigDecimal(realMileage_z).add(new BigDecimal(realMileage)).toString();
  307 + ksMileage_z = new BigDecimal(ksMileage_z).add(new BigDecimal(ksMileage)).toString();
  308 + if(ssMileage.length() > 0){
  309 + ssMileage_z = new BigDecimal(ssMileage_z).add(new BigDecimal(ssMileage)).toString();
  310 + }
  311 + jhbc_z = new BigDecimal(jhbc_z).add(new BigDecimal(jhbc)).toString();
  312 + sjbc_z = new BigDecimal(sjbc_z).add(new BigDecimal(sjbc)).toString();
  313 + bc_z = new BigDecimal(bc_z).add(new BigDecimal(bc)).toString();
  314 + cr_z = new BigDecimal(cr_z).add(new BigDecimal(cr)).toString();
  315 +
  316 + List<Refuel> refuels = repository.selectByCarAndDriver(date, split[0], split[1]);
  317 + Refuel r = new Refuel();
  318 +
  319 + if(refuels.size() > 0){
  320 + r = refuels.get(0);
  321 + for(int i = 1; i < refuels.size(); i++){
  322 + Refuel rf = refuels.get(i);
  323 +
  324 + if(rf.getOutOil().length() > 0){
  325 + if(r.getOutOil().length() == 0){
  326 + r.setOutOil(rf.getOutOil());
  327 + } else if(Double.valueOf(rf.getOutOil()) > Double.valueOf(r.getOutOil())){
  328 + r.setOutOil(rf.getOutOil());
  329 + }
277 330 }
278   - }
279   - if(rf.getInOil().length() > 0){
280   - if(r.getInOil().length() == 0){
281   - r.setInOil(rf.getInOil());
282   - } else if(Double.valueOf(rf.getInOil()) < Double.valueOf(r.getInOil())){
283   - r.setInOil(rf.getInOil());
  331 + if(rf.getInOil().length() > 0){
  332 + if(r.getInOil().length() == 0){
  333 + r.setInOil(rf.getInOil());
  334 + } else if(Double.valueOf(rf.getInOil()) < Double.valueOf(r.getInOil())){
  335 + r.setInOil(rf.getInOil());
  336 + }
284 337 }
285   - }
286   - if(rf.getInStation0().length() > 0){
287   - if(r.getInStation0().length() == 0){
288   - r.setInStation0(rf.getInStation0());
289   - } else {
290   - r.setInStation0(add(r.getInStation0(), rf.getInStation0()));
  338 + if(rf.getInStation0().length() > 0){
  339 + if(r.getInStation0().length() == 0){
  340 + r.setInStation0(rf.getInStation0());
  341 + } else {
  342 + r.setInStation0(add(r.getInStation0(), rf.getInStation0()));
  343 + }
291 344 }
292   - }
293   - if(rf.getInStation5().length() > 0){
294   - if(r.getInStation5().length() == 0){
295   - r.setInStation5(rf.getInStation5());
296   - } else {
297   - r.setInStation5(add(r.getInStation5(), rf.getInStation5()));
  345 + if(rf.getInStation5().length() > 0){
  346 + if(r.getInStation5().length() == 0){
  347 + r.setInStation5(rf.getInStation5());
  348 + } else {
  349 + r.setInStation5(add(r.getInStation5(), rf.getInStation5()));
  350 + }
298 351 }
299   - }
300   - if(rf.getOilCard0().length() > 0){
301   - if(r.getOilCard0().length() == 0){
302   - r.setOilCard0(rf.getOilCard0());
303   - } else {
304   - r.setOilCard0(add(r.getOilCard0(), rf.getOilCard0()));
  352 + if(rf.getOilCard0().length() > 0){
  353 + if(r.getOilCard0().length() == 0){
  354 + r.setOilCard0(rf.getOilCard0());
  355 + } else {
  356 + r.setOilCard0(add(r.getOilCard0(), rf.getOilCard0()));
  357 + }
305 358 }
306   - }
307   - if(rf.getOilCard10().length() > 0){
308   - if(r.getOilCard10().length() == 0){
309   - r.setOilCard10(rf.getOilCard10());
310   - } else {
311   - r.setOilCard10(add(r.getOilCard10(), rf.getOilCard10()));
  359 + if(rf.getOilCard10().length() > 0){
  360 + if(r.getOilCard10().length() == 0){
  361 + r.setOilCard10(rf.getOilCard10());
  362 + } else {
  363 + r.setOilCard10(add(r.getOilCard10(), rf.getOilCard10()));
  364 + }
312 365 }
313   - }
314   - if(rf.getEastStation0().length() > 0){
315   - if(r.getEastStation0().length() == 0){
316   - r.setEastStation0(rf.getEastStation0());
317   - } else {
318   - r.setEastStation0(add(r.getEastStation0(), rf.getEastStation0()));
  366 + if(rf.getEastStation0().length() > 0){
  367 + if(r.getEastStation0().length() == 0){
  368 + r.setEastStation0(rf.getEastStation0());
  369 + } else {
  370 + r.setEastStation0(add(r.getEastStation0(), rf.getEastStation0()));
  371 + }
319 372 }
320   - }
321   - if(rf.getEastStation10().length() > 0){
322   - if(r.getEastStation10().length() == 0){
323   - r.setEastStation10(rf.getEastStation10());
324   - } else {
325   - r.setEastStation10(add(r.getEastStation10(), rf.getEastStation10()));
  373 + if(rf.getEastStation10().length() > 0){
  374 + if(r.getEastStation10().length() == 0){
  375 + r.setEastStation10(rf.getEastStation10());
  376 + } else {
  377 + r.setEastStation10(add(r.getEastStation10(), rf.getEastStation10()));
  378 + }
326 379 }
327   - }
328   - if(rf.getOutStation0().length() > 0){
329   - if(r.getOutStation0().length() == 0){
330   - r.setOutStation0(rf.getOutStation0());
331   - } else {
332   - r.setOutStation0(add(r.getOutStation0(), rf.getOutStation0()));
  380 + if(rf.getOutStation0().length() > 0){
  381 + if(r.getOutStation0().length() == 0){
  382 + r.setOutStation0(rf.getOutStation0());
  383 + } else {
  384 + r.setOutStation0(add(r.getOutStation0(), rf.getOutStation0()));
  385 + }
333 386 }
334   - }
335   - if(rf.getOutStation10().length() > 0){
336   - if(r.getOutStation10().length() == 0){
337   - r.setOutStation10(rf.getOutStation10());
338   - } else {
339   - r.setOutStation10(add(r.getOutStation10(), rf.getOutStation10()));
  387 + if(rf.getOutStation10().length() > 0){
  388 + if(r.getOutStation10().length() == 0){
  389 + r.setOutStation10(rf.getOutStation10());
  390 + } else {
  391 + r.setOutStation10(add(r.getOutStation10(), rf.getOutStation10()));
  392 + }
340 393 }
341 394 }
342   - } else {
343   - keyList.add(key);
344   - rMap.put(key, rf);
345   - }
346   - }
347   -
348   - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
349   - Map<String, Object> lastMap = new HashMap<String, Object>();
350   - String outOil_z = "0", inOil_z = "0", inStation0_z = "0", inStation5_z = "0",
351   - oilCard0_z = "0", oilCard10_z = "0", eastStation0_z = "0", eastStation10_z = "0",
352   - outStation0_z = "0", outStation10_z = "0", oil_z = "0", ty_z = "0", yw_z = "0", cj_z = "0",
353   - realMileage_z = "0", ksMileage_z = "0", ssMileage_z = "0", consume_z = "",
354   - jhbc_z = "0", sjbc_z = "0", bc_z = "0", cr_z = "0";
355   - for(String key : keyList){
356   - Refuel r = rMap.get(key);
357   - Map<String, Object> m = new HashMap<String, Object>();
358   -
359   - String realMileage = "", oil = "0", consume = "", cr = "";
360   - String ksMileage = "", ssMileage = "", bc = "", jhbc = "", sjbc = "";
361   - List<ScheduleRealInfo> temp = repository.scheduleByDate(date, r.getCar(), r.getDriver());
362   - List<ScheduleRealInfo> temp2 = new ArrayList<ScheduleRealInfo>();
363   - if(temp.size() > 0){
364   - for(ScheduleRealInfo s : temp){
365   - Set<ChildTaskPlan> cts = s.getcTasks();
366   - if(cts != null && cts.size() > 0){
367   - temp2.add(s);
368   - }else{
369   - if(s.getZdsjActual()!=null
370   - && s.getFcsjActual()!=null){
371   - temp2.add(s);
372   - }
373   - }
374   - }
375   - Double sjgl = culateMileageService.culateSjgl(temp2);
376   - Double ksgl = culateMileageService.culateKsgl(temp);
377   - Double jccgl = culateMileageService.culateJccgl(temp2);
378   - Double ljgl = culateMileageService.culateLjgl(temp2);
379   -
380   - realMileage = add(add(sjgl, ksgl), add(jccgl, ljgl));
381   - ksMileage = add(ksgl, jccgl);
382   -// ssMileage = "" + culateMileageService.culateLbgl(temp2); //损失里程?少驶里程?
383   - jhbc = "" + culateMileageService.culateJhbc(temp2, "");
384   - sjbc = "" + culateMileageService.culateSjbc(temp2, "");
385   - bc = "" + temp2.size();
386   - cr = "1";
387   -
388   - realMileage_z = new BigDecimal(realMileage_z).add(new BigDecimal(realMileage)).toString();
389   - ksMileage_z = new BigDecimal(ksMileage_z).add(new BigDecimal(ksMileage)).toString();
390   - if(ssMileage.length() > 0){
391   - ssMileage_z = new BigDecimal(ssMileage_z).add(new BigDecimal(ssMileage)).toString();
392   - }
393   - jhbc_z = new BigDecimal(jhbc_z).add(new BigDecimal(jhbc)).toString();
394   - sjbc_z = new BigDecimal(sjbc_z).add(new BigDecimal(sjbc)).toString();
395   - bc_z = new BigDecimal(bc_z).add(new BigDecimal(bc)).toString();
396   - cr_z = new BigDecimal(cr_z).add(new BigDecimal(cr)).toString();
397 395 }
398 396  
399 397 if(r.getOutOil() != null && r.getInOil() != null && r.getOutOil().length() > 0 && r.getInOil().length() > 0){
... ... @@ -424,14 +422,14 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
424 422 oil = add(oil, r.getOutStation10());
425 423 }
426 424  
427   - if(realMileage.length() > 0 && oil.length() > 0 && !("0".equals(realMileage))){
  425 + if(realMileage.length() > 0 && oil.length() > 0 && new BigDecimal(realMileage).doubleValue() > 0d){
428 426 consume = df.format(new BigDecimal(oil).divide(new BigDecimal(realMileage), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
429 427 }
430 428  
431   - m.put("date", r.getDateStr());
432   - m.put("line", r.getLineName());
433   - m.put("car", r.getCar());
434   - m.put("driver", r.getDriver());
  429 + m.put("date", scheList.get(0).getScheduleDateStr());
  430 + m.put("line", scheList.get(0).getXlName());
  431 + m.put("car", split[0]);
  432 + m.put("driver", split[1]);
435 433 m.put("outOil", r.getOutOil());
436 434 m.put("inOil", r.getInOil());
437 435 m.put("inStation0", r.getInStation0());
... ... @@ -489,6 +487,7 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
489 487 outStation10_z = new BigDecimal(outStation10_z).add(new BigDecimal(r.getOutStation10())).toString();
490 488 }
491 489 oil_z = new BigDecimal(oil_z).add(new BigDecimal(oil)).toString();
  490 +
492 491 }
493 492  
494 493 lastMap.put("date", "合计");
... ... @@ -547,6 +546,135 @@ public class RefuelServiceImpl extends BaseServiceImpl&lt;Refuel, Long&gt; implements
547 546 }
548 547  
549 548 @Override
  549 + public List<Map<String, Object>> queryDc(Map<String, Object> map) {
  550 + // TODO Auto-generated method stub
  551 + DecimalFormat df = new DecimalFormat("0.##");
  552 +
  553 + String date = "", car = "%%", xlbm = "";
  554 + if(map.get("date") != null){
  555 + date = map.get("date").toString();
  556 + }
  557 + if(map.get("car") != null){
  558 + car = "%" + map.get("car").toString() + "%";
  559 + }
  560 + if(map.get("line") != null){
  561 + xlbm = map.get("line").toString();
  562 + }
  563 +
  564 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  565 + Map<String, Object> lastMap = new HashMap<String, Object>();
  566 + String realMileage_z = "0", ksMileage_z = "0", ssMileage_z = "0",
  567 + jhbc_z = "0", sjbc_z = "0", bc_z = "0", cr_z = "0";
  568 +
  569 + List<String> sKeyList = new ArrayList<String>();
  570 + Map<String, List<ScheduleRealInfo>> sMap = new HashMap<String, List<ScheduleRealInfo>>();
  571 + List<ScheduleRealInfo> scheList = repository.scheduleByDateAndLine(date, car, xlbm);
  572 +
  573 + for(ScheduleRealInfo s : scheList){
  574 + if(s.getClZbh() != null && s.getClZbh().length() > 0 && s.getjGh() != null){
  575 + String key = s.getClZbh() + "/" + s.getjGh();
  576 + if(!(sMap.containsKey(key))){
  577 + sMap.put(key, new ArrayList<ScheduleRealInfo>());
  578 + sKeyList.add(key);
  579 + }
  580 + sMap.get(key).add(s);
  581 + }
  582 + }
  583 +
  584 + for(String key : sKeyList){
  585 + Map<String, Object> m = new HashMap<String, Object>();
  586 + List<ScheduleRealInfo> list2 = sMap.get(key);
  587 + String[] split = key.split("/");
  588 +
  589 + String realMileage = "", ksMileage = "", ssMileage = "",
  590 + bc = "", jhbc = "", sjbc = "", cr = "";
  591 +
  592 + Double sjgl = culateMileageService.culateSjgl(list2);
  593 + Double ksgl = culateMileageService.culateKsgl(list2);
  594 + Double jccgl = culateMileageService.culateJccgl(list2);
  595 + Double ljgl = culateMileageService.culateLjgl(list2);
  596 +
  597 + realMileage = add(add(sjgl, ksgl), add(jccgl, ljgl));
  598 + ksMileage = add(ksgl, jccgl);
  599 +// ssMileage = "" + culateMileageService.culateLbgl(list2); //损失里程?少驶里程?
  600 + jhbc = "" + culateMileageService.culateJhbc(list2, "");
  601 + sjbc = "" + culateMileageService.culateSjbc(list2, "");
  602 + bc = "" + list2.size();
  603 + cr = "1";
  604 +
  605 + realMileage_z = new BigDecimal(realMileage_z).add(new BigDecimal(realMileage)).toString();
  606 + ksMileage_z = new BigDecimal(ksMileage_z).add(new BigDecimal(ksMileage)).toString();
  607 + if(ssMileage.length() > 0){
  608 + ssMileage_z = new BigDecimal(ssMileage_z).add(new BigDecimal(ssMileage)).toString();
  609 + }
  610 + jhbc_z = new BigDecimal(jhbc_z).add(new BigDecimal(jhbc)).toString();
  611 + sjbc_z = new BigDecimal(sjbc_z).add(new BigDecimal(sjbc)).toString();
  612 + bc_z = new BigDecimal(bc_z).add(new BigDecimal(bc)).toString();
  613 + cr_z = new BigDecimal(cr_z).add(new BigDecimal(cr)).toString();
  614 +
  615 + m.put("date", scheList.get(0).getScheduleDateStr());
  616 + m.put("line", scheList.get(0).getXlName());
  617 + m.put("car", split[0]);
  618 + m.put("driver", split[1]);
  619 + m.put("jdl", "");
  620 + m.put("hdl", "");
  621 + m.put("realMileage", realMileage);
  622 + m.put("ksMileage", ksMileage);
  623 + m.put("ssMileage", ssMileage);
  624 + m.put("consume", "");
  625 + m.put("bc", bc);
  626 + m.put("jhbc", jhbc);
  627 + m.put("sjbc", sjbc);
  628 + m.put("cr", cr);
  629 + m.put("remark", "");
  630 +
  631 + resList.add(m);
  632 + }
  633 +
  634 + lastMap.put("date", "合计");
  635 + lastMap.put("line", "");
  636 + lastMap.put("car", "");
  637 + lastMap.put("driver", "");
  638 + lastMap.put("jdl", "");
  639 + lastMap.put("hdl", "");
  640 + lastMap.put("realMileage", realMileage_z);
  641 + lastMap.put("ksMileage", ksMileage_z);
  642 + lastMap.put("ssMileage", ssMileage_z);
  643 + lastMap.put("consume", "");
  644 + lastMap.put("bc", bc_z);
  645 + lastMap.put("jhbc", jhbc_z);
  646 + lastMap.put("sjbc", sjbc_z);
  647 + lastMap.put("cr", cr_z);
  648 + lastMap.put("remark", "");
  649 +
  650 + resList.add(lastMap);
  651 +
  652 + return resList;
  653 + }
  654 +
  655 + @Override
  656 + public List<Map<String, Object>> exportQueryDc(Map<String, Object> map) {
  657 + // TODO Auto-generated method stub
  658 +
  659 + List<Map<String, Object>> list = this.queryDc(map);
  660 +
  661 + String date = map.get("date").toString();
  662 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  663 + Map<String,Object> m = new HashMap<String, Object>();
  664 + ReportUtils ee = new ReportUtils();
  665 + try {
  666 + listI.add(list.iterator());
  667 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  668 + ee.excelReplace(listI, new Object[] { m }, path+"mould/refuelDc.xls",
  669 + path+"export/" + date + "-纯电车日报表.xls");
  670 + } catch (Exception e) {
  671 + // TODO: handle exception
  672 + e.printStackTrace();
  673 + }
  674 + return list;
  675 + }
  676 +
  677 + @Override
550 678 public String importExcel(File file) {
551 679 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
552 680 SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
... ...
src/main/resources/static/pages/forms/mould/refuelDc.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/refuelDc.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 + .btn-default{
  18 + margin-left: 5px;
  19 + }
  20 +</style>
  21 +
  22 +<div class="page-head">
  23 + <div class="page-title">
  24 + <h1>纯电车日报表</h1>
  25 + </div>
  26 +</div>
  27 +
  28 +<div class="row">
  29 + <div class="col-md-12">
  30 + <div class="portlet light porttlet-fit bordered">
  31 + <div class="portlet-title">
  32 + <form class="form-inline" action="">
  33 + <div style="display: inline-block;">
  34 + <span class="item-label" style="width: 80px;">线路: </span>
  35 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  36 + </div>
  37 + <div style="display: inline-block;margin-left: 15px">
  38 + <span class="item-label" style="width: 140px;">内部编码: </span>
  39 + <select class="form-control" name="code" id="code" style="width: 180px;"></select>
  40 + <input class="btn btn-default" type="button" id="czcl" value="X"/>
  41 + </div>
  42 + <div style="display: inline-block;margin-left: 24px;">
  43 + <span class="item-label" style="width: 80px;">&nbsp;日期: </span>
  44 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  45 + </div>
  46 + <div class="form-group">
  47 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  48 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  49 + </div>
  50 + </form>
  51 + </div>
  52 + <div class="portlet-body">
  53 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  54 + <table class="table table-bordered table-hover table-checkable" id="forms">
  55 + <thead>
  56 + <tr>
  57 + <td>序号</td>
  58 + <td>日期</td>
  59 + <td>路别</td>
  60 + <td>车号</td>
  61 + <td>驾驶员</td>
  62 + <td>充电量</td>
  63 + <td>电量消耗</td>
  64 + <td>路单公里</td>
  65 + <td>空驶公里</td>
  66 + <td>损失公里</td>
  67 + <td>班次</td>
  68 + <td>车日</td>
  69 + <td>备注</td>
  70 + </tr>
  71 + </thead>
  72 + <tbody id="tbody">
  73 +
  74 + </tbody>
  75 + </table>
  76 + </div>
  77 + </div>
  78 + </div>
  79 + </div>
  80 +</div>
  81 +
  82 +<script>
  83 + $(function(){
  84 +
  85 + // 关闭左侧栏
  86 + if (!$('body').hasClass('page-sidebar-closed'))
  87 + $('.menu-toggler.sidebar-toggler').click();
  88 +
  89 + $("#date").datetimepicker({
  90 + format : 'YYYY-MM-DD',
  91 + locale : 'zh-cn'
  92 + });
  93 +
  94 + $.get('/report/lineList',function(xlList){
  95 + var data = [];
  96 +// data.push({id: " ", text: "全部线路"});
  97 + $.get('/user/companyData', function(result){
  98 + for(var i = 0; i < result.length; i++){
  99 + var companyCode = result[i].companyCode;
  100 + var children = result[i].children;
  101 + for(var j = 0; j < children.length; j++){
  102 + var code = children[j].code;
  103 + for(var k=0;k < xlList.length;k++ ){
  104 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  105 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  106 +// tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  107 + }
  108 + }
  109 + }
  110 + }
  111 + initPinYinSelect2('#line',data,'');
  112 + initCl();
  113 + });
  114 + });
  115 + //重置
  116 + $('#czcl').on('click', function () {
  117 + $('#code').val('').change();
  118 + });
  119 + $("#line").on("change",initCl);
  120 + function initCl(){
  121 + $('#code').select2({
  122 + ajax: {
  123 + url: '/report/carList',
  124 + dataType: 'json',
  125 + delay: 150,
  126 + data: function(params){
  127 + return{nbbm: params.term,xlbm:$('#line').val()};
  128 + },
  129 + processResults: function (data) {
  130 + return {
  131 + results: data
  132 + };
  133 + },
  134 + cache: true
  135 + },
  136 + templateResult: function(repo){
  137 + if (repo.loading) return repo.text;
  138 + var h = '<span>'+repo.text+'</span>';
  139 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  140 + return h;
  141 + },
  142 + escapeMarkup: function (markup) { return markup; },
  143 + minimumInputLength: 1,
  144 + templateSelection: function(repo){
  145 + return repo.text;
  146 + },
  147 + language: {
  148 + noResults: function(){
  149 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  150 + },
  151 + inputTooShort : function(e) {
  152 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  153 + },
  154 + searching : function() {
  155 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  156 + }
  157 + }
  158 + });
  159 + }
  160 +
  161 +
  162 + var d = new Date();
  163 + var year = d.getFullYear();
  164 + var mon = (d.getMonth()+1)>9?(d.getMonth()+1):("0"+(d.getMonth()+1));
  165 + var day = d.getDate()>9?d.getDate():("0"+d.getDate());
  166 + $("#date").val(year + "-" + mon + "-" + day);
  167 +
  168 +
  169 + var line = "", date = "", car = "";
  170 + $("#query").on("click",function(){
  171 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  172 + layer.msg("请选择日期");
  173 + return;
  174 + }
  175 + line = $("#line").val();
  176 + date = $("#date").val();
  177 + car = $("#code").val();
  178 + var i = layer.load(2);
  179 + $get('/refuel/queryDc',{line:line,date:date,car:car,type:'query'},function(result){
  180 + // 把数据填充到模版中
  181 + var tbodyHtml = template('refuel_daily',{list:result});
  182 + // 把渲染好的模版html文本追加到表格中
  183 + $('#tbody').html(tbodyHtml);
  184 + layer.close(i);
  185 + });
  186 + });
  187 +
  188 + $("#export").on("click",function(){
  189 + if(date && date != ""){
  190 + var i = layer.load(2);
  191 + var params = {};
  192 + params['line'] = line;
  193 + params['date'] = date;
  194 + params['car'] = car;
  195 + $get('/refuel/exportQueryDc', params, function(result){
  196 + layer.close(i);
  197 + window.open("/downloadFile/download?fileName="
  198 + +date+"-纯电车日报表");
  199 + layer.close(i);
  200 + });
  201 + }
  202 + });
  203 +
  204 +});
  205 +</script>
  206 +<script type="text/html" id="refuel_daily">
  207 + {{each list as obj i}}
  208 + <tr>
  209 + <td>{{i + 1}}</td>
  210 + <td>{{obj.date}}</td>
  211 + <td>{{obj.line}}</td>
  212 + <td>{{obj.car}}</td>
  213 + <td>{{obj.driver}}</td>
  214 + <td>{{obj.jdl}}</td>
  215 + <td>{{obj.hdl}}</td>
  216 + <td>{{obj.realMileage}}</td>
  217 + <td>{{obj.ksMileage}}</td>
  218 + <td>{{obj.ssMileage}}</td>
  219 + <td>{{obj.bc}}</td>
  220 + <td>{{obj.cr}}</td>
  221 + <td>{{obj.remark}}</td>
  222 + </tr>
  223 + {{/each}}
  224 + {{if list.length == 0}}
  225 + <tr>
  226 + <td colspan="13"><h6 class="muted">没有找到相关数据</h6></td>
  227 + </tr>
  228 + {{/if}}
  229 +</script>
0 230 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/refuelYc.html
... ... @@ -24,31 +24,32 @@
24 24 <h1>燃油车日报表</h1>
25 25 </div>
26 26 </div>
27   -
28   -<div class="row">
29   - <div class="col-md-12">
30   - <div class="portlet light porttlet-fit bordered">
31   - <div class="portlet-title">
  27 +
  28 +<div class="row">
  29 + <div class="col-md-12">
  30 + <div class="portlet light porttlet-fit bordered">
  31 + <div class="portlet-title">
32 32 <form class="form-inline" action="">
  33 + <div style="display: inline-block;">
  34 + <span class="item-label" style="width: 80px;">线路: </span>
  35 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  36 + </div>
  37 + <div style="display: inline-block;margin-left: 15px">
  38 + <span class="item-label" style="width: 140px;">内部编码: </span>
  39 + <select class="form-control" name="code" id="code" style="width: 180px;"></select>
  40 + <input class="btn btn-default" type="button" id="czcl" value="X"/>
  41 + </div>
33 42 <div style="display: inline-block;margin-left: 24px;">
34 43 <span class="item-label" style="width: 80px;">&nbsp;日期: </span>
35 44 <input class="form-control" type="text" id="date" style="width: 180px;"/>
36 45 </div>
37   - <div style="display: inline-block;margin-left: 6px;">
38   - <span class="item-label" style="width: 80px;">&nbsp;车号: </span>
39   - <input class="form-control" type="text" id="car" style="width: 180px;"/>
40   - </div>
41   - <div style="display: inline-block;margin-left: 6px;">
42   - <span class="item-label" style="width: 80px;">&nbsp;驾驶员: </span>
43   - <input class="form-control" type="text" id="driver" style="width: 180px;"/>
44   - </div>
45 46 <div class="form-group">
46 47 <input class="btn btn-default" type="button" id="query" value="筛选"/>
47 48 <input class="btn btn-default" type="button" id="export" value="导出"/>
48   - </div>
49   - </form>
50   - </div>
51   - <div class="portlet-body">
  49 + </div>
  50 + </form>
  51 + </div>
  52 + <div class="portlet-body">
52 53 <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
53 54 <table class="table table-bordered table-hover table-checkable" id="forms">
54 55 <thead>
... ... @@ -84,23 +85,91 @@
84 85  
85 86 </tbody>
86 87 </table>
87   - </div>
88   - </div>
89   - </div>
90   - </div>
91   -</div>
92   -
93   -<script>
  88 + </div>
  89 + </div>
  90 + </div>
  91 + </div>
  92 +</div>
  93 +
  94 +<script>
94 95 $(function(){
95   -
96   - // 关闭左侧栏
97   - if (!$('body').hasClass('page-sidebar-closed'))
  96 +
  97 + // 关闭左侧栏
  98 + if (!$('body').hasClass('page-sidebar-closed'))
98 99 $('.menu-toggler.sidebar-toggler').click();
99   -
100   - $("#date").datetimepicker({
101   - format : 'YYYY-MM-DD',
102   - locale : 'zh-cn'
  100 +
  101 + $("#date").datetimepicker({
  102 + format : 'YYYY-MM-DD',
  103 + locale : 'zh-cn'
  104 + });
  105 +
  106 + $.get('/report/lineList',function(xlList){
  107 + var data = [];
  108 +// data.push({id: " ", text: "全部线路"});
  109 + $.get('/user/companyData', function(result){
  110 + for(var i = 0; i < result.length; i++){
  111 + var companyCode = result[i].companyCode;
  112 + var children = result[i].children;
  113 + for(var j = 0; j < children.length; j++){
  114 + var code = children[j].code;
  115 + for(var k=0;k < xlList.length;k++ ){
  116 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  117 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  118 +// tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  119 + }
  120 + }
  121 + }
  122 + }
  123 + initPinYinSelect2('#line',data,'');
  124 + initCl();
  125 + });
103 126 });
  127 + //重置
  128 + $('#czcl').on('click', function () {
  129 + $('#code').val('').change();
  130 + });
  131 + $("#line").on("change",initCl);
  132 + function initCl(){
  133 + $('#code').select2({
  134 + ajax: {
  135 + url: '/report/carList',
  136 + dataType: 'json',
  137 + delay: 150,
  138 + data: function(params){
  139 + return{nbbm: params.term,xlbm:$('#line').val()};
  140 + },
  141 + processResults: function (data) {
  142 + return {
  143 + results: data
  144 + };
  145 + },
  146 + cache: true
  147 + },
  148 + templateResult: function(repo){
  149 + if (repo.loading) return repo.text;
  150 + var h = '<span>'+repo.text+'</span>';
  151 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  152 + return h;
  153 + },
  154 + escapeMarkup: function (markup) { return markup; },
  155 + minimumInputLength: 1,
  156 + templateSelection: function(repo){
  157 + return repo.text;
  158 + },
  159 + language: {
  160 + noResults: function(){
  161 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  162 + },
  163 + inputTooShort : function(e) {
  164 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  165 + },
  166 + searching : function() {
  167 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  168 + }
  169 + }
  170 + });
  171 + }
  172 +
104 173  
105 174 var d = new Date();
106 175 var year = d.getFullYear();
... ... @@ -109,17 +178,17 @@
109 178 $("#date").val(year + "-" + mon + "-" + day);
110 179  
111 180  
112   - var date = "", car = "", driver = "";
  181 + var line = "", date = "", car = "";
113 182 $("#query").on("click",function(){
114 183 if($("#date").val() == null || $("#date").val().trim().length == 0){
115 184 layer.msg("请选择日期");
116 185 return;
117 186 }
  187 + line = $("#line").val();
118 188 date = $("#date").val();
119   - car = $("#car").val();
120   - driver = $("#driver").val();
  189 + car = $("#code").val();
121 190 var i = layer.load(2);
122   - $get('/refuel/queryYc',{date:date,car:car,driver:driver,type:'query'},function(result){
  191 + $get('/refuel/queryYc',{line:line,date:date,car:car,type:'query'},function(result){
123 192 // 把数据填充到模版中
124 193 var tbodyHtml = template('refuel_daily',{list:result});
125 194 // 把渲染好的模版html文本追加到表格中
... ... @@ -132,9 +201,9 @@
132 201 if(date && date != ""){
133 202 var i = layer.load(2);
134 203 var params = {};
  204 + params['line'] = line;
135 205 params['date'] = date;
136 206 params['car'] = car;
137   - params['driver'] = driver;
138 207 $get('/refuel/exportQueryYc', params, function(result){
139 208 layer.close(i);
140 209 window.open("/downloadFile/download?fileName="
... ... @@ -144,12 +213,12 @@
144 213 }
145 214 });
146 215  
147   -});
148   -</script>
149   -<script type="text/html" id="refuel_daily">
150   - {{each list as obj i}}
  216 +});
  217 +</script>
  218 +<script type="text/html" id="refuel_daily">
  219 + {{each list as obj i}}
151 220 <tr>
152   - <td>{{i + 1}}</td>
  221 + <td>{{i + 1}}</td>
153 222 <td>{{obj.date}}</td>
154 223 <td>{{obj.line}}</td>
155 224 <td>{{obj.car}}</td>
... ... @@ -174,11 +243,11 @@
174 243 <td>{{obj.bc}}</td>
175 244 <td>{{obj.cr}}</td>
176 245 <td>{{obj.remark}}</td>
177   - </tr>
  246 + </tr>
178 247 {{/each}}
179 248 {{if list.length == 0}}
180 249 <tr>
181 250 <td colspan="25"><h6 class="muted">没有找到相关数据</h6></td>
182 251 </tr>
183   - {{/if}}
  252 + {{/if}}
184 253 </script>
185 254 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/waybillQp.html
... ... @@ -332,9 +332,10 @@
332 332 <td title="{{obj.remarks}}">
333 333 {{if obj.remarks !=""}}
334 334 <div class="caption">
335   - <i class="fa fa-search"></i>
336   -
337   - </div>
  335 +
  336 + <font style="font-size: 24px;font-weight: bold;">!</font>
  337 +
  338 + </div>
338 339 {{/if}}
339 340 </td>
340 341 </tr>
... ...