Commit 4453aa59757ed867cf86c223a3442fb6d25f51bc

Authored by 娄高锋
1 parent d407ae71

烂班情况分析表 公里数小数处理

src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -1645,73 +1645,79 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1645 1645 }
1646 1646 for(String key : keyMap.keySet()){
1647 1647 Map<String, Object> tempMap = new HashMap<String, Object>();
1648   - int jhbc = 0;
1649   - int sjbc = 0;
1650   - int jhlc = 0;
1651   - int sjlc = 0;
1652   - int lzbc = 0, lzlc = 0, dmbc = 0, dmlc = 0,
1653   - gzbc = 0, gzlc = 0, jfbc = 0, jflc = 0,
1654   - zsbc = 0, zslc = 0, qrbc = 0, qrlc = 0,
1655   - qcbc = 0, qclc = 0, kxbc = 0, kxlc = 0,
1656   - qhbc = 0, qhlc = 0, wybc = 0, wylc = 0;
1657   - int qtbc = 0, qtlc = 0;
  1648 + int jhbc = 0, sjbc = 0,
  1649 + lzbc = 0, dmbc = 0,
  1650 + gzbc = 0, jfbc = 0, zsbc = 0,
  1651 + qrbc = 0, qcbc = 0, kxbc = 0,
  1652 + qhbc = 0, wybc = 0, qtbc = 0;
  1653 + BigDecimal jhlc = new BigDecimal("0"), sjlc = new BigDecimal("0"),
  1654 + lzlc = new BigDecimal("0"), dmlc = new BigDecimal("0"),
  1655 + gzlc = new BigDecimal("0"), jflc = new BigDecimal("0"),
  1656 + zslc = new BigDecimal("0"), qrlc = new BigDecimal("0"),
  1657 + qclc = new BigDecimal("0"), kxlc = new BigDecimal("0"),
  1658 + qhlc = new BigDecimal("0"), wylc = new BigDecimal("0"),
  1659 + qtlc = new BigDecimal("0");
1658 1660 String companyName = "", subCompanyName = "";
1659 1661 for(ScheduleRealInfo schedule : keyMap.get(key)){
1660 1662 if(schedule.getGsName() != null && companyName.length() == 0)
1661 1663 companyName = schedule.getGsName();
1662 1664 if(schedule.getFgsName() != null && subCompanyName.length() == 0)
1663 1665 subCompanyName = schedule.getFgsName();
1664   - double lc = 0d;
  1666 + BigDecimal lc = new BigDecimal("0");
1665 1667 if(schedule.getJhlcOrig() != null && schedule.getJhlcOrig() > 0.1d){
1666   - lc = schedule.getJhlcOrig();
  1668 + lc = new BigDecimal("0"+schedule.getJhlcOrig());
1667 1669 } else {
1668   - lc = schedule.getJhlc();
  1670 + lc = new BigDecimal("0"+schedule.getJhlc());
1669 1671 }
1670 1672  
1671 1673 if(!schedule.isSflj()){
1672 1674 jhbc++;
1673   - jhlc += lc;
  1675 + jhlc = jhlc.add(lc);
1674 1676 }
1675 1677 if(schedule.getStatus() != -1){
1676 1678 sjbc++;
1677   - sjlc += lc;
  1679 + sjlc = sjlc.add(lc);
1678 1680 } else if(schedule.getStatus() == -1){
1679 1681 if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("路阻") != -1){
1680 1682 lzbc++;
1681   - lzlc += lc;
  1683 + lzlc = lzlc.add(lc);
1682 1684 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("吊慢") != -1){
1683 1685 dmbc++;
1684   - dmlc += lc;
  1686 + dmlc = dmlc.add(lc);
1685 1687 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("故障") != -1){
1686 1688 gzbc++;
1687   - gzlc += lc;
  1689 + gzlc = gzlc.add(lc);
1688 1690 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("纠纷") != -1){
1689 1691 jfbc++;
1690   - jflc += lc;
  1692 + jflc = jflc.add(lc);
1691 1693 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("肇事") != -1){
1692 1694 zsbc++;
1693   - zslc += lc;
  1695 + zslc = zslc.add(lc);
1694 1696 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺人") != -1){
1695 1697 qrbc++;
1696   - qrlc += lc;
  1698 + qrlc = qrlc.add(lc);
1697 1699 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺车") != -1){
1698 1700 qcbc++;
1699   - qclc += lc;
  1701 + qclc = qclc.add(lc);
1700 1702 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("客稀") != -1){
1701 1703 kxbc++;
1702   - kxlc += lc;
  1704 + kxlc = kxlc.add(lc);
1703 1705 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("气候") != -1){
1704 1706 qhbc++;
1705   - qhlc += lc;
  1707 + qhlc = qhlc.add(lc);
1706 1708 }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("外援") != -1){
1707 1709 wybc++;
1708   - wylc += lc;
  1710 + wylc = wylc.add(lc);
1709 1711 } else {
1710 1712 qtbc++;
1711   - qtlc += lc;
  1713 + qtlc = qtlc.add(lc);
1712 1714 }
1713 1715 }
1714 1716 }
  1717 + boolean flag = true;
  1718 + if(jhlc.toString().equals("0")){
  1719 + flag = false;
  1720 + }
1715 1721 tempMap.put("date", Date);
1716 1722 tempMap.put("company", companyName);
1717 1723 tempMap.put("subCompany", subCompanyName);
... ... @@ -1720,42 +1726,43 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1720 1726 tempMap.put("jhbc", jhbc);
1721 1727 tempMap.put("sjbc", sjbc);
1722 1728 tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%");
1723   - tempMap.put("jhlc", jhlc);
1724   - tempMap.put("sjlc", sjlc);
1725   - tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%");
  1729 + tempMap.put("jhlc", jhlc.doubleValue());
  1730 + tempMap.put("sjlc", sjlc.doubleValue());
  1731 +// tempMap.put("lcbfb", df.format(flag?(double)sjlc/jhlc*100:0)+"%");
  1732 + tempMap.put("lcbfb", df.format(flag?sjlc.divide(jhlc, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%");
1726 1733 tempMap.put("lzbc", lzbc);
1727   - tempMap.put("lzlc", lzlc);
1728   - tempMap.put("lzbfb", df.format(jhlc>0?(double)lzbc/jhbc*100:0)+"%");
  1734 + tempMap.put("lzlc", lzlc.doubleValue());
  1735 + tempMap.put("lzbfb", df.format(flag?(double)lzbc/jhbc*100:0)+"%");
1729 1736 tempMap.put("dmbc", dmbc);
1730   - tempMap.put("dmlc", dmlc);
1731   - tempMap.put("dmbfb", df.format(jhlc>0?(double)dmbc/jhbc*100:0)+"%");
  1737 + tempMap.put("dmlc", dmlc.doubleValue());
  1738 + tempMap.put("dmbfb", df.format(flag?(double)dmbc/jhbc*100:0)+"%");
1732 1739 tempMap.put("gzbc", gzbc);
1733   - tempMap.put("gzlc", gzlc);
1734   - tempMap.put("gzbfb", df.format(jhlc>0?(double)gzbc/jhbc*100:0)+"%");
  1740 + tempMap.put("gzlc", gzlc.doubleValue());
  1741 + tempMap.put("gzbfb", df.format(flag?(double)gzbc/jhbc*100:0)+"%");
1735 1742 tempMap.put("jfbc", jfbc);
1736   - tempMap.put("jflc", jflc);
1737   - tempMap.put("jfbfb", df.format(jhlc>0?(double)jfbc/jhbc*100:0)+"%");
  1743 + tempMap.put("jflc", jflc.doubleValue());
  1744 + tempMap.put("jfbfb", df.format(flag?(double)jfbc/jhbc*100:0)+"%");
1738 1745 tempMap.put("zsbc", zsbc);
1739   - tempMap.put("zslc", zslc);
1740   - tempMap.put("zsbfb", df.format(jhlc>0?(double)zsbc/jhbc*100:0)+"%");
  1746 + tempMap.put("zslc", zslc.doubleValue());
  1747 + tempMap.put("zsbfb", df.format(flag?(double)zsbc/jhbc*100:0)+"%");
1741 1748 tempMap.put("qrbc", qrbc);
1742   - tempMap.put("qrlc", qrlc);
1743   - tempMap.put("qrbfb", df.format(jhlc>0?(double)qrbc/jhbc*100:0)+"%");
  1749 + tempMap.put("qrlc", qrlc.doubleValue());
  1750 + tempMap.put("qrbfb", df.format(flag?(double)qrbc/jhbc*100:0)+"%");
1744 1751 tempMap.put("qcbc", qcbc);
1745   - tempMap.put("qclc", qclc);
1746   - tempMap.put("qcbfb", df.format(jhlc>0?(double)qcbc/jhbc*100:0)+"%");
  1752 + tempMap.put("qclc", qclc.doubleValue());
  1753 + tempMap.put("qcbfb", df.format(flag?(double)qcbc/jhbc*100:0)+"%");
1747 1754 tempMap.put("kxbc", kxbc);
1748   - tempMap.put("kxlc", kxlc);
1749   - tempMap.put("kxbfb", df.format(jhlc>0?(double)kxbc/jhbc*100:0)+"%");
  1755 + tempMap.put("kxlc", kxlc.doubleValue());
  1756 + tempMap.put("kxbfb", df.format(flag?(double)kxbc/jhbc*100:0)+"%");
1750 1757 tempMap.put("qhbc", qhbc);
1751   - tempMap.put("qhlc", qhlc);
1752   - tempMap.put("qhbfb", df.format(jhlc>0?(double)qhbc/jhbc*100:0)+"%");
  1758 + tempMap.put("qhlc", qhlc.doubleValue());
  1759 + tempMap.put("qhbfb", df.format(flag?(double)qhbc/jhbc*100:0)+"%");
1753 1760 tempMap.put("wybc", wybc);
1754   - tempMap.put("wylc", wylc);
1755   - tempMap.put("wybfb", df.format(jhlc>0?(double)wybc/jhbc*100:0)+"%");
  1761 + tempMap.put("wylc", wylc.doubleValue());
  1762 + tempMap.put("wybfb", df.format(flag?(double)wybc/jhbc*100:0)+"%");
1756 1763 tempMap.put("qtbc", qtbc);
1757   - tempMap.put("qtlc", qtlc);
1758   - tempMap.put("qtbfb", df.format(jhlc>0?(double)qtbc/jhbc*100:0)+"%");
  1764 + tempMap.put("qtlc", qtlc.doubleValue());
  1765 + tempMap.put("qtbfb", df.format(flag?(double)qtbc/jhbc*100:0)+"%");
1759 1766  
1760 1767 resList.add(tempMap);
1761 1768 }
... ... @@ -1777,6 +1784,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1777 1784 e.printStackTrace();
1778 1785 }
1779 1786 }
  1787 + System.out.println(map);
1780 1788  
1781 1789 return resList;
1782 1790 }
... ...