Commit b3c312bc2f68c6170b4d28d2a63494e2618e18c9
1 parent
b5797004
燃油车日报表(/forms/statement/refuelYc.html)
Showing
5 changed files
with
539 additions
and
5 deletions
src/main/java/com/bsth/controller/RefuelController.java
| @@ -34,7 +34,17 @@ public class RefuelController extends BaseController<Refuel, Long> { | @@ -34,7 +34,17 @@ public class RefuelController extends BaseController<Refuel, Long> { | ||
| 34 | public List<Map<String, Object>> queryDaily(@RequestParam Map<String, Object> map){ | 34 | public List<Map<String, Object>> queryDaily(@RequestParam Map<String, Object> map){ |
| 35 | return refuelService.queryDaily(map); | 35 | return refuelService.queryDaily(map); |
| 36 | } | 36 | } |
| 37 | - | 37 | + |
| 38 | + @RequestMapping(value = "/exportQueryYc", method = RequestMethod.GET) | ||
| 39 | + public List<Map<String, Object>> exportQueryYc(@RequestParam Map<String, Object> map){ | ||
| 40 | + return refuelService.exportQueryYc(map); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @RequestMapping(value = "/queryYc", method = RequestMethod.GET) | ||
| 44 | + public List<Map<String, Object>> queryYc(@RequestParam Map<String, Object> map){ | ||
| 45 | + return refuelService.queryYc(map); | ||
| 46 | + } | ||
| 47 | + | ||
| 38 | @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) | 48 | @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) |
| 39 | public String uploadFile(MultipartFile file) throws Exception{ | 49 | public String uploadFile(MultipartFile file) throws Exception{ |
| 40 | File newFile = new File( | 50 | File newFile = new File( |
src/main/java/com/bsth/service/RefuelService.java
| @@ -15,5 +15,9 @@ public interface RefuelService extends BaseService<Refuel, Long> { | @@ -15,5 +15,9 @@ public interface RefuelService extends BaseService<Refuel, Long> { | ||
| 15 | 15 | ||
| 16 | List<Map<String, Object>> queryDaily(Map<String, Object> map); | 16 | List<Map<String, Object>> queryDaily(Map<String, Object> map); |
| 17 | 17 | ||
| 18 | + List<Map<String, Object>> queryYc(Map<String, Object> map); | ||
| 19 | + | ||
| 20 | + List<Map<String, Object>> exportQueryYc(Map<String, Object> map); | ||
| 21 | + | ||
| 18 | public String importExcel(File file); | 22 | public String importExcel(File file); |
| 19 | } | 23 | } |
src/main/java/com/bsth/service/impl/RefuelServiceImpl.java
| @@ -8,16 +8,21 @@ import com.bsth.repository.RefuelRepository; | @@ -8,16 +8,21 @@ import com.bsth.repository.RefuelRepository; | ||
| 8 | import com.bsth.security.util.SecurityUtils; | 8 | import com.bsth.security.util.SecurityUtils; |
| 9 | import com.bsth.service.RefuelService; | 9 | import com.bsth.service.RefuelService; |
| 10 | import com.bsth.service.report.CulateMileageService; | 10 | import com.bsth.service.report.CulateMileageService; |
| 11 | +import com.bsth.util.Arith; | ||
| 12 | +import com.bsth.util.ReportUtils; | ||
| 11 | 13 | ||
| 12 | import java.io.File; | 14 | import java.io.File; |
| 13 | import java.io.FileInputStream; | 15 | import java.io.FileInputStream; |
| 14 | import java.math.BigDecimal; | 16 | import java.math.BigDecimal; |
| 17 | +import java.sql.ResultSet; | ||
| 18 | +import java.sql.SQLException; | ||
| 15 | import java.text.DecimalFormat; | 19 | import java.text.DecimalFormat; |
| 16 | import java.text.ParseException; | 20 | import java.text.ParseException; |
| 17 | import java.text.SimpleDateFormat; | 21 | import java.text.SimpleDateFormat; |
| 18 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
| 19 | import java.util.Date; | 23 | import java.util.Date; |
| 20 | import java.util.HashMap; | 24 | import java.util.HashMap; |
| 25 | +import java.util.Iterator; | ||
| 21 | import java.util.List; | 26 | import java.util.List; |
| 22 | import java.util.Map; | 27 | import java.util.Map; |
| 23 | import java.util.Set; | 28 | import java.util.Set; |
| @@ -28,6 +33,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet; | @@ -28,6 +33,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
| 28 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; | 33 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| 29 | import org.apache.poi.poifs.filesystem.POIFSFileSystem; | 34 | import org.apache.poi.poifs.filesystem.POIFSFileSystem; |
| 30 | import org.springframework.beans.factory.annotation.Autowired; | 35 | import org.springframework.beans.factory.annotation.Autowired; |
| 36 | +import org.springframework.jdbc.core.RowMapper; | ||
| 31 | import org.springframework.stereotype.Service; | 37 | import org.springframework.stereotype.Service; |
| 32 | 38 | ||
| 33 | /** | 39 | /** |
| @@ -237,6 +243,310 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements | @@ -237,6 +243,310 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements | ||
| 237 | } | 243 | } |
| 238 | 244 | ||
| 239 | @Override | 245 | @Override |
| 246 | + public List<Map<String, Object>> queryYc(Map<String, Object> map) { | ||
| 247 | + // TODO Auto-generated method stub | ||
| 248 | + DecimalFormat df = new DecimalFormat("0.##"); | ||
| 249 | + | ||
| 250 | + String date = "", car = "%%", driver = "%%"; | ||
| 251 | + if(map.get("date") != null){ | ||
| 252 | + date = map.get("date").toString(); | ||
| 253 | + } | ||
| 254 | + if(map.get("car") != null){ | ||
| 255 | + car = "%" + map.get("car").toString() + "%"; | ||
| 256 | + } | ||
| 257 | + if(map.get("driver") != null){ | ||
| 258 | + driver = "%" + map.get("driver").toString() + "%"; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + List<Refuel> list = repository.findByDate(date, car, driver); | ||
| 262 | + | ||
| 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; | ||
| 269 | + } | ||
| 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()); | ||
| 277 | + } | ||
| 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()); | ||
| 284 | + } | ||
| 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())); | ||
| 291 | + } | ||
| 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())); | ||
| 298 | + } | ||
| 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())); | ||
| 305 | + } | ||
| 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())); | ||
| 312 | + } | ||
| 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())); | ||
| 319 | + } | ||
| 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())); | ||
| 326 | + } | ||
| 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())); | ||
| 333 | + } | ||
| 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())); | ||
| 340 | + } | ||
| 341 | + } | ||
| 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 | + } | ||
| 398 | + | ||
| 399 | + if(r.getOutOil() != null && r.getInOil() != null && r.getOutOil().length() > 0 && r.getInOil().length() > 0){ | ||
| 400 | + oil = new BigDecimal(r.getOutOil()).subtract(new BigDecimal(r.getInOil())).toString(); | ||
| 401 | + } | ||
| 402 | + if(r.getInStation0() != null && r.getInStation0().length() > 0){ | ||
| 403 | + oil = add(oil, r.getInStation0()); | ||
| 404 | + } | ||
| 405 | + if(r.getInStation5() != null && r.getInStation5().length() > 0){ | ||
| 406 | + oil = add(oil, r.getInStation5()); | ||
| 407 | + } | ||
| 408 | + if(r.getOilCard0() != null && r.getOilCard0().length() > 0){ | ||
| 409 | + oil = add(oil, r.getOilCard0()); | ||
| 410 | + } | ||
| 411 | + if(r.getOilCard10() != null && r.getOilCard10().length() > 0){ | ||
| 412 | + oil = add(oil, r.getOilCard10()); | ||
| 413 | + } | ||
| 414 | + if(r.getEastStation0() != null && r.getEastStation0().length() > 0){ | ||
| 415 | + oil = add(oil, r.getEastStation0()); | ||
| 416 | + } | ||
| 417 | + if(r.getEastStation10() != null && r.getEastStation10().length() > 0){ | ||
| 418 | + oil = add(oil, r.getEastStation10()); | ||
| 419 | + } | ||
| 420 | + if(r.getOutStation0() != null && r.getOutStation0().length() > 0){ | ||
| 421 | + oil = add(oil, r.getOutStation0()); | ||
| 422 | + } | ||
| 423 | + if(r.getOutStation10() != null && r.getOutStation10().length() > 0){ | ||
| 424 | + oil = add(oil, r.getOutStation10()); | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + if(realMileage.length() > 0 && oil.length() > 0 && !("0".equals(realMileage))){ | ||
| 428 | + consume = df.format(new BigDecimal(oil).divide(new BigDecimal(realMileage), 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100))); | ||
| 429 | + } | ||
| 430 | + | ||
| 431 | + m.put("date", r.getDateStr()); | ||
| 432 | + m.put("line", r.getLineName()); | ||
| 433 | + m.put("car", r.getCar()); | ||
| 434 | + m.put("driver", r.getDriver()); | ||
| 435 | + m.put("outOil", r.getOutOil()); | ||
| 436 | + m.put("inOil", r.getInOil()); | ||
| 437 | + m.put("inStation0", r.getInStation0()); | ||
| 438 | + m.put("inStation5", r.getInStation5()); | ||
| 439 | + m.put("oilCard0", r.getOilCard0()); | ||
| 440 | + m.put("oilCard10", r.getOilCard10()); | ||
| 441 | + m.put("eastStation0", r.getEastStation0()); | ||
| 442 | + m.put("eastStation10", r.getEastStation10()); | ||
| 443 | + m.put("outStation0", r.getOutStation0()); | ||
| 444 | + m.put("outStation10", r.getOutStation10()); | ||
| 445 | + m.put("oil", oil); | ||
| 446 | + m.put("realMileage", realMileage); | ||
| 447 | + m.put("ksMileage", ksMileage); | ||
| 448 | + m.put("ssMileage", ssMileage); | ||
| 449 | + m.put("consume", consume); | ||
| 450 | + m.put("bc", bc); | ||
| 451 | + m.put("jhbc", jhbc); | ||
| 452 | + m.put("sjbc", sjbc); | ||
| 453 | + m.put("ty", ""); //特约 | ||
| 454 | + m.put("yw", ""); //业务 | ||
| 455 | + m.put("cj", ""); //车间 | ||
| 456 | + m.put("cr", cr); | ||
| 457 | + m.put("remark", ""); | ||
| 458 | + | ||
| 459 | + resList.add(m); | ||
| 460 | + | ||
| 461 | + if(r.getOutOil() != null && r.getOutOil().length() > 0){ | ||
| 462 | + outOil_z = new BigDecimal(outOil_z).add(new BigDecimal(r.getOutOil())).toString(); | ||
| 463 | + } | ||
| 464 | + if(r.getInOil() != null && r.getInOil().length() > 0){ | ||
| 465 | + inOil_z = new BigDecimal(inOil_z).add(new BigDecimal(r.getInOil())).toString(); | ||
| 466 | + } | ||
| 467 | + if(r.getInStation0() != null && r.getInStation0().length() > 0){ | ||
| 468 | + inStation0_z = new BigDecimal(inStation0_z).add(new BigDecimal(r.getInStation0())).toString(); | ||
| 469 | + } | ||
| 470 | + if(r.getInStation5() != null && r.getInStation5().length() > 0){ | ||
| 471 | + inStation5_z = new BigDecimal(inStation5_z).add(new BigDecimal(r.getInStation5())).toString(); | ||
| 472 | + } | ||
| 473 | + if(r.getOilCard0() != null && r.getOilCard0().length() > 0){ | ||
| 474 | + oilCard0_z = new BigDecimal(oilCard0_z).add(new BigDecimal(r.getOilCard0())).toString(); | ||
| 475 | + } | ||
| 476 | + if(r.getOilCard10() != null && r.getOilCard10().length() > 0){ | ||
| 477 | + oilCard10_z = new BigDecimal(oilCard10_z).add(new BigDecimal(r.getOilCard10())).toString(); | ||
| 478 | + } | ||
| 479 | + if(r.getEastStation0() != null && r.getEastStation0().length() > 0){ | ||
| 480 | + eastStation0_z = new BigDecimal(eastStation0_z).add(new BigDecimal(r.getEastStation0())).toString(); | ||
| 481 | + } | ||
| 482 | + if(r.getEastStation10() != null && r.getEastStation10().length() > 0){ | ||
| 483 | + eastStation10_z = new BigDecimal(eastStation10_z).add(new BigDecimal(r.getEastStation10())).toString(); | ||
| 484 | + } | ||
| 485 | + if(r.getOutStation0() != null && r.getOutStation0().length() > 0){ | ||
| 486 | + outStation0_z = new BigDecimal(outStation0_z).add(new BigDecimal(r.getOutStation0())).toString(); | ||
| 487 | + } | ||
| 488 | + if(r.getOutStation10() != null && r.getOutStation10().length() > 0){ | ||
| 489 | + outStation10_z = new BigDecimal(outStation10_z).add(new BigDecimal(r.getOutStation10())).toString(); | ||
| 490 | + } | ||
| 491 | + oil_z = new BigDecimal(oil_z).add(new BigDecimal(oil)).toString(); | ||
| 492 | + } | ||
| 493 | + | ||
| 494 | + lastMap.put("date", "合计"); | ||
| 495 | + lastMap.put("line", ""); | ||
| 496 | + lastMap.put("car", ""); | ||
| 497 | + lastMap.put("driver", ""); | ||
| 498 | + lastMap.put("outOil", outOil_z); | ||
| 499 | + lastMap.put("inOil", inOil_z); | ||
| 500 | + lastMap.put("inStation0", inStation0_z); | ||
| 501 | + lastMap.put("inStation5", inStation5_z); | ||
| 502 | + lastMap.put("oilCard0", oilCard0_z); | ||
| 503 | + lastMap.put("oilCard10", oilCard10_z); | ||
| 504 | + lastMap.put("eastStation0", eastStation0_z); | ||
| 505 | + lastMap.put("eastStation10", eastStation10_z); | ||
| 506 | + lastMap.put("outStation0", outStation0_z); | ||
| 507 | + lastMap.put("outStation10", outStation10_z); | ||
| 508 | + lastMap.put("oil", oil_z); | ||
| 509 | + lastMap.put("realMileage", realMileage_z); | ||
| 510 | + lastMap.put("ksMileage", ksMileage_z); | ||
| 511 | + lastMap.put("ssMileage", ssMileage_z); | ||
| 512 | + lastMap.put("consume", consume_z); | ||
| 513 | + lastMap.put("bc", bc_z); | ||
| 514 | + lastMap.put("jhbc", jhbc_z); | ||
| 515 | + lastMap.put("sjbc", sjbc_z); | ||
| 516 | + lastMap.put("ty", ty_z); //特约 | ||
| 517 | + lastMap.put("yw", yw_z); //业务 | ||
| 518 | + lastMap.put("cj", cj_z); //车间 | ||
| 519 | + lastMap.put("cr", cr_z); | ||
| 520 | + lastMap.put("remark", ""); | ||
| 521 | + | ||
| 522 | + resList.add(lastMap); | ||
| 523 | + | ||
| 524 | + return resList; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + @Override | ||
| 528 | + public List<Map<String, Object>> exportQueryYc(Map<String, Object> map) { | ||
| 529 | + // TODO Auto-generated method stub | ||
| 530 | + | ||
| 531 | + List<Map<String, Object>> list = this.queryYc(map); | ||
| 532 | + | ||
| 533 | + String date = map.get("date").toString(); | ||
| 534 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 535 | + Map<String,Object> m = new HashMap<String, Object>(); | ||
| 536 | + ReportUtils ee = new ReportUtils(); | ||
| 537 | + try { | ||
| 538 | + listI.add(list.iterator()); | ||
| 539 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | ||
| 540 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/refuelYc.xls", | ||
| 541 | + path+"export/" + date + "-燃油车日报表.xls"); | ||
| 542 | + } catch (Exception e) { | ||
| 543 | + // TODO: handle exception | ||
| 544 | + e.printStackTrace(); | ||
| 545 | + } | ||
| 546 | + return list; | ||
| 547 | + } | ||
| 548 | + | ||
| 549 | + @Override | ||
| 240 | public String importExcel(File file) { | 550 | public String importExcel(File file) { |
| 241 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 551 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 242 | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 552 | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| @@ -314,9 +624,39 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements | @@ -314,9 +624,39 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements | ||
| 314 | driver = driver.replace(".0", ""); | 624 | driver = driver.replace(".0", ""); |
| 315 | 625 | ||
| 316 | String l = "", obj = ""; | 626 | String l = "", obj = ""; |
| 627 | + | ||
| 317 | try { | 628 | try { |
| 629 | + | ||
| 318 | rq = sdf.format(sdf.parse(rq)); | 630 | rq = sdf.format(sdf.parse(rq)); |
| 319 | 631 | ||
| 632 | + } catch (ParseException e) { | ||
| 633 | + // TODO: handle exception | ||
| 634 | + msg += "\\n"+(i+2)+"行日期格式错误"; | ||
| 635 | + continue; | ||
| 636 | + } | ||
| 637 | + | ||
| 638 | + try { | ||
| 639 | + if(line == null || line.trim().length() == 0){ | ||
| 640 | + throw new Exception(); | ||
| 641 | + } | ||
| 642 | + } catch (Exception e) { | ||
| 643 | + // TODO: handle exception | ||
| 644 | + msg += "\\n"+(i+2)+"行没有‘路别’或无法识别"; | ||
| 645 | + continue; | ||
| 646 | + } | ||
| 647 | + | ||
| 648 | + try { | ||
| 649 | + if(car == null || car.trim().length() == 0){ | ||
| 650 | + throw new Exception(); | ||
| 651 | + } | ||
| 652 | + } catch (Exception e) { | ||
| 653 | + // TODO: handle exception | ||
| 654 | + msg += "\\n"+(i+2)+"行没有‘车号’或无法识别"; | ||
| 655 | + continue; | ||
| 656 | + } | ||
| 657 | + | ||
| 658 | + try { | ||
| 659 | + | ||
| 320 | if(outOil.length() != 0){ | 660 | if(outOil.length() != 0){ |
| 321 | l = "E";obj = outOil; | 661 | l = "E";obj = outOil; |
| 322 | outOil = df.format(new BigDecimal(outOil)); | 662 | outOil = df.format(new BigDecimal(outOil)); |
| @@ -357,10 +697,6 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements | @@ -357,10 +697,6 @@ public class RefuelServiceImpl extends BaseServiceImpl<Refuel, Long> implements | ||
| 357 | l = "N";obj = outStation10; | 697 | l = "N";obj = outStation10; |
| 358 | outStation10 = df.format(new BigDecimal(outStation10)); | 698 | outStation10 = df.format(new BigDecimal(outStation10)); |
| 359 | } | 699 | } |
| 360 | - } catch (ParseException e) { | ||
| 361 | - // TODO: handle exception | ||
| 362 | - msg += "\\n"+(i+2)+"行日期格式错误"; | ||
| 363 | - continue; | ||
| 364 | } catch (NumberFormatException e) { | 700 | } catch (NumberFormatException e) { |
| 365 | // TODO: handle exception | 701 | // TODO: handle exception |
| 366 | msg += "\\n"+(i+2)+"行"+l+"列内容:“"+obj+"”数据异常或有误"; | 702 | msg += "\\n"+(i+2)+"行"+l+"列内容:“"+obj+"”数据异常或有误"; |
src/main/resources/static/pages/forms/mould/refuelYc.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/refuelYc.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;margin-left: 24px;"> | ||
| 34 | + <span class="item-label" style="width: 80px;"> 日期: </span> | ||
| 35 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 36 | + </div> | ||
| 37 | + <div style="display: inline-block;margin-left: 6px;"> | ||
| 38 | + <span class="item-label" style="width: 80px;"> 车号: </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;"> 驾驶员: </span> | ||
| 43 | + <input class="form-control" type="text" id="driver" style="width: 180px;"/> | ||
| 44 | + </div> | ||
| 45 | + <div class="form-group"> | ||
| 46 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 47 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 48 | + </div> | ||
| 49 | + </form> | ||
| 50 | + </div> | ||
| 51 | + <div class="portlet-body"> | ||
| 52 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 53 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 54 | + <thead> | ||
| 55 | + <tr> | ||
| 56 | + <td>序号</td> | ||
| 57 | + <td>日期</td> | ||
| 58 | + <td>路别</td> | ||
| 59 | + <td>车号</td> | ||
| 60 | + <td>驾驶员</td> | ||
| 61 | + <td>出场</td> | ||
| 62 | + <td>进场</td> | ||
| 63 | + <td>场内0号</td> | ||
| 64 | + <td>场内B5#</td> | ||
| 65 | + <td>油卡0号</td> | ||
| 66 | + <td>油卡-10#</td> | ||
| 67 | + <td>东站0#</td> | ||
| 68 | + <td>东站-10#</td> | ||
| 69 | + <td>场外0#</td> | ||
| 70 | + <td>场外-10#</td> | ||
| 71 | + <td>实绩油耗</td> | ||
| 72 | + <td>特约</td> | ||
| 73 | + <td>业务</td> | ||
| 74 | + <td>车间</td> | ||
| 75 | + <td>总公里</td> | ||
| 76 | + <td>其中空驶</td> | ||
| 77 | + <td>损失公里</td> | ||
| 78 | + <td>班次</td> | ||
| 79 | + <td>车日</td> | ||
| 80 | + <td>备注</td> | ||
| 81 | + </tr> | ||
| 82 | + </thead> | ||
| 83 | + <tbody id="tbody"> | ||
| 84 | + | ||
| 85 | + </tbody> | ||
| 86 | + </table> | ||
| 87 | + </div> | ||
| 88 | + </div> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | +</div> | ||
| 92 | + | ||
| 93 | +<script> | ||
| 94 | + $(function(){ | ||
| 95 | + | ||
| 96 | + // 关闭左侧栏 | ||
| 97 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 98 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 99 | + | ||
| 100 | + $("#date").datetimepicker({ | ||
| 101 | + format : 'YYYY-MM-DD', | ||
| 102 | + locale : 'zh-cn' | ||
| 103 | + }); | ||
| 104 | + | ||
| 105 | + var d = new Date(); | ||
| 106 | + var year = d.getFullYear(); | ||
| 107 | + var mon = (d.getMonth()+1)>9?(d.getMonth()+1):("0"+(d.getMonth()+1)); | ||
| 108 | + var day = d.getDate()>9?d.getDate():("0"+d.getDate()); | ||
| 109 | + $("#date").val(year + "-" + mon + "-" + day); | ||
| 110 | + | ||
| 111 | + | ||
| 112 | + var date = "", car = "", driver = ""; | ||
| 113 | + $("#query").on("click",function(){ | ||
| 114 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 115 | + layer.msg("请选择日期"); | ||
| 116 | + return; | ||
| 117 | + } | ||
| 118 | + date = $("#date").val(); | ||
| 119 | + car = $("#car").val(); | ||
| 120 | + driver = $("#driver").val(); | ||
| 121 | + var i = layer.load(2); | ||
| 122 | + $get('/refuel/queryYc',{date:date,car:car,driver:driver,type:'query'},function(result){ | ||
| 123 | + // 把数据填充到模版中 | ||
| 124 | + var tbodyHtml = template('refuel_daily',{list:result}); | ||
| 125 | + // 把渲染好的模版html文本追加到表格中 | ||
| 126 | + $('#tbody').html(tbodyHtml); | ||
| 127 | + layer.close(i); | ||
| 128 | + }); | ||
| 129 | + }); | ||
| 130 | + | ||
| 131 | + $("#export").on("click",function(){ | ||
| 132 | + if(date && date != ""){ | ||
| 133 | + var i = layer.load(2); | ||
| 134 | + var params = {}; | ||
| 135 | + params['date'] = date; | ||
| 136 | + params['car'] = car; | ||
| 137 | + params['driver'] = driver; | ||
| 138 | + $get('/refuel/exportQueryYc', params, function(result){ | ||
| 139 | + layer.close(i); | ||
| 140 | + window.open("/downloadFile/download?fileName=" | ||
| 141 | + +date+"-燃油车日报表"); | ||
| 142 | + layer.close(i); | ||
| 143 | + }); | ||
| 144 | + } | ||
| 145 | + }); | ||
| 146 | + | ||
| 147 | +}); | ||
| 148 | +</script> | ||
| 149 | +<script type="text/html" id="refuel_daily"> | ||
| 150 | + {{each list as obj i}} | ||
| 151 | + <tr> | ||
| 152 | + <td>{{i + 1}}</td> | ||
| 153 | + <td>{{obj.date}}</td> | ||
| 154 | + <td>{{obj.line}}</td> | ||
| 155 | + <td>{{obj.car}}</td> | ||
| 156 | + <td>{{obj.driver}}</td> | ||
| 157 | + <td>{{obj.outOil}}</td> | ||
| 158 | + <td>{{obj.inOil}}</td> | ||
| 159 | + <td>{{obj.inStation0}}</td> | ||
| 160 | + <td>{{obj.inStation5}}</td> | ||
| 161 | + <td>{{obj.oilCard0}}</td> | ||
| 162 | + <td>{{obj.oilCard10}}</td> | ||
| 163 | + <td>{{obj.eastStation0}}</td> | ||
| 164 | + <td>{{obj.eastStation10}}</td> | ||
| 165 | + <td>{{obj.outStation0}}</td> | ||
| 166 | + <td>{{obj.outStation10}}</td> | ||
| 167 | + <td>{{obj.oil}}</td> | ||
| 168 | + <td>{{obj.ty}}</td> | ||
| 169 | + <td>{{obj.yw}}</td> | ||
| 170 | + <td>{{obj.cj}}</td> | ||
| 171 | + <td>{{obj.realMileage}}</td> | ||
| 172 | + <td>{{obj.ksMileage}}</td> | ||
| 173 | + <td>{{obj.ssMileage}}</td> | ||
| 174 | + <td>{{obj.bc}}</td> | ||
| 175 | + <td>{{obj.cr}}</td> | ||
| 176 | + <td>{{obj.remark}}</td> | ||
| 177 | + </tr> | ||
| 178 | + {{/each}} | ||
| 179 | + {{if list.length == 0}} | ||
| 180 | + <tr> | ||
| 181 | + <td colspan="25"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 182 | + </tr> | ||
| 183 | + {{/if}} | ||
| 184 | +</script> | ||
| 0 | \ No newline at end of file | 185 | \ No newline at end of file |