Commit 508e68eb26d87efd42db2be8386b77b34fd7af13
1 parent
05864725
人车班次里程预统计查询接口;单日每车加油加电查询接口;
Showing
1 changed file
with
107 additions
and
0 deletions
src/main/java/com/bsth/server_rs/bigdata/BigdataService.java
| 1 | package com.bsth.server_rs.bigdata; | 1 | package com.bsth.server_rs.bigdata; |
| 2 | 2 | ||
| 3 | +import java.math.BigDecimal; | ||
| 4 | +import java.math.RoundingMode; | ||
| 3 | import java.sql.ResultSet; | 5 | import java.sql.ResultSet; |
| 4 | import java.sql.SQLException; | 6 | import java.sql.SQLException; |
| 5 | import java.text.DecimalFormat; | 7 | import java.text.DecimalFormat; |
| @@ -1507,4 +1509,109 @@ public class BigdataService { | @@ -1507,4 +1509,109 @@ public class BigdataService { | ||
| 1507 | return resList; | 1509 | return resList; |
| 1508 | } | 1510 | } |
| 1509 | 1511 | ||
| 1512 | + //人车班次里程预统计查询 | ||
| 1513 | + @GET | ||
| 1514 | + @Path("/findWaybill/startDate/{startDate}/endDate/{endDate}") | ||
| 1515 | + public List<Map<String, Object>> findWaybill(@PathParam("startDate") String startDate, | ||
| 1516 | + @PathParam("endDate") String endDate) { | ||
| 1517 | + String sql = "select * from calc_waybill where rq_str >= ? and rq_str <= ?"; | ||
| 1518 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 1519 | + new Object[] {startDate, endDate}, | ||
| 1520 | + new RowMapper<Map<String, Object>>(){ | ||
| 1521 | + @Override | ||
| 1522 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1523 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 1524 | + m.put("gsdm", rs.getString("gsdm")); | ||
| 1525 | + m.put("gsname", rs.getString("gsname")); | ||
| 1526 | + m.put("fgsdm", rs.getString("fgsdm")); | ||
| 1527 | + m.put("fgsname", rs.getString("fgsname")); | ||
| 1528 | + m.put("rqStr", rs.getString("rq_str")); | ||
| 1529 | + m.put("xl", rs.getString("xl")); | ||
| 1530 | + m.put("xlName", rs.getString("xl_name")); | ||
| 1531 | + m.put("cl", rs.getString("cl")); | ||
| 1532 | + m.put("lp", rs.getString("lp")); | ||
| 1533 | + m.put("jGh", rs.getString("j_gh")); | ||
| 1534 | + m.put("jName", rs.getString("j_name")); | ||
| 1535 | + m.put("sGh", rs.getString("s_gh")); | ||
| 1536 | + m.put("sName", rs.getString("s_name")); | ||
| 1537 | + m.put("jhyybc", rs.getInt("jhyybc")); | ||
| 1538 | + m.put("jhyybczgf", rs.getInt("jhyybczgf")); | ||
| 1539 | + m.put("jhyybcwgf", rs.getInt("jhyybcwgf")); | ||
| 1540 | + m.put("jhfyybc", rs.getInt("jhfyybc")); | ||
| 1541 | + m.put("jhyylc", rs.getDouble("jhyylc")); | ||
| 1542 | + m.put("jhfyylc", rs.getDouble("jhfyylc")); | ||
| 1543 | + m.put("sjyybc", rs.getInt("sjyybc")); | ||
| 1544 | + m.put("sjyybczgf", rs.getInt("sjyybczgf")); | ||
| 1545 | + m.put("sjyybcwgf", rs.getInt("sjyybcwgf")); | ||
| 1546 | + m.put("sjfyybc", rs.getInt("sjfyybc")); | ||
| 1547 | + m.put("sjyylc", rs.getDouble("sjyylc")); | ||
| 1548 | + m.put("sjfyylc", rs.getDouble("sjfyylc")); | ||
| 1549 | + m.put("ljbc", rs.getInt("ljbc")); | ||
| 1550 | + m.put("ljbczgf", rs.getInt("ljbczgf")); | ||
| 1551 | + m.put("ljbcwgf", rs.getInt("ljbcwgf")); | ||
| 1552 | + m.put("ljyylc", rs.getDouble("ljyylc")); | ||
| 1553 | + m.put("ljfyylc", rs.getDouble("ljfyylc")); | ||
| 1554 | + m.put("lbbc", rs.getInt("lbbc")); | ||
| 1555 | + m.put("lblc", rs.getDouble("lblc")); | ||
| 1556 | + m.put("lblcLz", rs.getDouble("lblc_lz")); | ||
| 1557 | + m.put("lblcDm", rs.getDouble("lblc_dm")); | ||
| 1558 | + m.put("lblcGz", rs.getDouble("lblc_gz")); | ||
| 1559 | + m.put("lblcJf", rs.getDouble("lblc_jf")); | ||
| 1560 | + m.put("lblcZs", rs.getDouble("lblc_zs")); | ||
| 1561 | + m.put("lblcQr", rs.getDouble("lblc_qr")); | ||
| 1562 | + m.put("lblcQc", rs.getDouble("lblc_qc")); | ||
| 1563 | + m.put("lblcKx", rs.getDouble("lblc_kx")); | ||
| 1564 | + m.put("lblcQh", rs.getDouble("lblc_qh")); | ||
| 1565 | + m.put("lblcYw", rs.getDouble("lblc_yw")); | ||
| 1566 | + m.put("lblcQt", rs.getDouble("lblc_qt")); | ||
| 1567 | + m.put("fzbc", rs.getInt("fzbc")); | ||
| 1568 | + m.put("fzbczgf", rs.getInt("fzbczgf")); | ||
| 1569 | + m.put("fzbcwgf", rs.getInt("fzbcwgf")); | ||
| 1570 | + m.put("dtbc", rs.getInt("dtbc")); | ||
| 1571 | + m.put("dtbczgf", rs.getInt("dtbczgf")); | ||
| 1572 | + m.put("dtbcwgf", rs.getInt("dtbcwgf")); | ||
| 1573 | + return m; | ||
| 1574 | + } | ||
| 1575 | + }); | ||
| 1576 | + | ||
| 1577 | + return list; | ||
| 1578 | + } | ||
| 1579 | + | ||
| 1580 | + //单日每车加油加电 | ||
| 1581 | + @GET | ||
| 1582 | + @Path("/findCarEnergySupplement/{data}") | ||
| 1583 | + public Map<String, Object> findWaybill(@PathParam("date") String date) { | ||
| 1584 | + Map<String, Object> resMap = new HashMap<String, Object>(); | ||
| 1585 | + | ||
| 1586 | + String ylbSql = "select nbbm, sum(jzl) jzl from bsth_c_ylb where rq = ? group by nbbm"; | ||
| 1587 | + List<Map<String, Object>> ylbList=jdbcTemplate.query(ylbSql, | ||
| 1588 | + new Object[] {date}, | ||
| 1589 | + new RowMapper<Map<String, Object>>(){ | ||
| 1590 | + @Override | ||
| 1591 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1592 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 1593 | + m.put("car", rs.getString("nbbm")); | ||
| 1594 | + m.put("liters", new BigDecimal(rs.getDouble("jzl")).setScale(2, RoundingMode.HALF_UP)); | ||
| 1595 | + return m; | ||
| 1596 | + } | ||
| 1597 | + }); | ||
| 1598 | + | ||
| 1599 | + String dlbSql = "select nbbm, sum(cdl) cdl from bsth_c_dlb where rq = ? group by nbbm"; | ||
| 1600 | + List<Map<String, Object>> dlbList=jdbcTemplate.query(ylbSql, | ||
| 1601 | + new Object[] {date}, | ||
| 1602 | + new RowMapper<Map<String, Object>>(){ | ||
| 1603 | + @Override | ||
| 1604 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1605 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 1606 | + m.put("car", rs.getString("nbbm")); | ||
| 1607 | + m.put("degrees", new BigDecimal(rs.getDouble("cdl")).setScale(2, RoundingMode.HALF_UP)); | ||
| 1608 | + return m; | ||
| 1609 | + } | ||
| 1610 | + }); | ||
| 1611 | + | ||
| 1612 | + resMap.put("oilList", ylbList); | ||
| 1613 | + resMap.put("electricList", dlbList); | ||
| 1614 | + return null; | ||
| 1615 | + } | ||
| 1616 | + | ||
| 1510 | } | 1617 | } |