Commit b648109b571e56cf4158719acfdc9e1696825036
1 parent
1ea61b02
新车路单批量导出和烂班情况分析表
Showing
7 changed files
with
595 additions
and
50 deletions
src/main/java/com/bsth/controller/BusIntervalController.java
| @@ -52,5 +52,10 @@ public class BusIntervalController { | @@ -52,5 +52,10 @@ public class BusIntervalController { | ||
| 52 | public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ | 52 | public List<Map<String,Object>> correctStatis(@RequestParam Map<String, Object> map){ |
| 53 | return busIntervalService.correctStatis(map); | 53 | return busIntervalService.correctStatis(map); |
| 54 | } | 54 | } |
| 55 | - | 55 | + |
| 56 | + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | ||
| 57 | + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | ||
| 58 | + return busIntervalService.exportWaybillMore(map); | ||
| 59 | + } | ||
| 60 | + | ||
| 56 | } | 61 | } |
src/main/java/com/bsth/repository/oil/DlbRepository.java
| @@ -95,4 +95,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | @@ -95,4 +95,8 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ | ||
| 95 | 95 | ||
| 96 | @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) | 96 | @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) |
| 97 | List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm); | 97 | List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm); |
| 98 | + | ||
| 99 | + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true) | ||
| 100 | + List<Dlb> queryDlbByRqXlbm(String rq, String xlbm); | ||
| 101 | + | ||
| 98 | } | 102 | } |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| @@ -81,6 +81,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -81,6 +81,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 81 | 81 | ||
| 82 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) | 82 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true) |
| 83 | List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm); | 83 | List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm); |
| 84 | + | ||
| 85 | + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and xlbm=?2",nativeQuery=true) | ||
| 86 | + List<Ylb> queryYlbByRqXlbm(String rq,String xlbm); | ||
| 84 | 87 | ||
| 85 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true) | 88 | @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true) |
| 86 | List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px); | 89 | List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px); |
src/main/java/com/bsth/service/BusIntervalService.java
| @@ -19,4 +19,6 @@ public interface BusIntervalService { | @@ -19,4 +19,6 @@ public interface BusIntervalService { | ||
| 19 | List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map); | 19 | List<Map<String, Object>> lbStatuAnaly(Map<String, Object> map); |
| 20 | 20 | ||
| 21 | List<Map<String, Object>> correctStatis(Map<String, Object> map); | 21 | List<Map<String, Object>> correctStatis(Map<String, Object> map); |
| 22 | + | ||
| 23 | + Map<String, Object> exportWaybillMore(Map<String, Object> map); | ||
| 22 | } | 24 | } |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | +import java.io.File; | ||
| 3 | import java.math.BigDecimal; | 4 | import java.math.BigDecimal; |
| 4 | import java.math.RoundingMode; | 5 | import java.math.RoundingMode; |
| 5 | import java.sql.ResultSet; | 6 | import java.sql.ResultSet; |
| 6 | import java.sql.SQLException; | 7 | import java.sql.SQLException; |
| 7 | import java.text.DecimalFormat; | 8 | import java.text.DecimalFormat; |
| 9 | +import java.text.ParseException; | ||
| 8 | import java.text.SimpleDateFormat; | 10 | import java.text.SimpleDateFormat; |
| 9 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
| 12 | +import java.util.Calendar; | ||
| 10 | import java.util.Collections; | 13 | import java.util.Collections; |
| 11 | import java.util.Comparator; | 14 | import java.util.Comparator; |
| 12 | import java.util.Date; | 15 | import java.util.Date; |
| 16 | +import java.util.GregorianCalendar; | ||
| 13 | import java.util.HashMap; | 17 | import java.util.HashMap; |
| 14 | import java.util.HashSet; | 18 | import java.util.HashSet; |
| 15 | import java.util.Iterator; | 19 | import java.util.Iterator; |
| @@ -23,27 +27,62 @@ import org.springframework.jdbc.core.JdbcTemplate; | @@ -23,27 +27,62 @@ import org.springframework.jdbc.core.JdbcTemplate; | ||
| 23 | import org.springframework.jdbc.core.RowMapper; | 27 | import org.springframework.jdbc.core.RowMapper; |
| 24 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
| 25 | 29 | ||
| 30 | +import com.alibaba.fastjson.JSON; | ||
| 26 | import com.alibaba.fastjson.JSONArray; | 31 | import com.alibaba.fastjson.JSONArray; |
| 27 | import com.bsth.data.BasicData; | 32 | import com.bsth.data.BasicData; |
| 28 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | 33 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; |
| 34 | +import com.bsth.entity.Cars; | ||
| 35 | +import com.bsth.entity.Line; | ||
| 36 | +import com.bsth.entity.oil.Dlb; | ||
| 37 | +import com.bsth.entity.oil.Ylb; | ||
| 29 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 38 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 30 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 39 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 40 | +import com.bsth.entity.sys.DutyEmployee; | ||
| 41 | +import com.bsth.repository.CarsRepository; | ||
| 42 | +import com.bsth.repository.LineRepository; | ||
| 43 | +import com.bsth.repository.oil.DlbRepository; | ||
| 44 | +import com.bsth.repository.oil.YlbRepository; | ||
| 31 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 45 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 32 | import com.bsth.service.BusIntervalService; | 46 | import com.bsth.service.BusIntervalService; |
| 47 | +import com.bsth.service.report.CulateMileageService; | ||
| 33 | import com.bsth.service.schedule.PeopleCarPlanService; | 48 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 49 | +import com.bsth.service.sys.DutyEmployeeService; | ||
| 50 | +import com.bsth.util.Arith; | ||
| 51 | +import com.bsth.util.ComparableChild; | ||
| 52 | +import com.bsth.util.ComparableReal; | ||
| 53 | +import com.bsth.util.ReportRelatedUtils; | ||
| 34 | import com.bsth.util.ReportUtils; | 54 | import com.bsth.util.ReportUtils; |
| 55 | +import com.bsth.util.TimeUtils; | ||
| 35 | import com.google.gson.Gson; | 56 | import com.google.gson.Gson; |
| 36 | 57 | ||
| 37 | 58 | ||
| 38 | @Service | 59 | @Service |
| 39 | public class BusIntervalServiceImpl implements BusIntervalService { | 60 | public class BusIntervalServiceImpl implements BusIntervalService { |
| 40 | 61 | ||
| 62 | + @Autowired | ||
| 63 | + CulateMileageService culateService; | ||
| 64 | + | ||
| 41 | @Autowired | 65 | @Autowired |
| 42 | private PeopleCarPlanService peopleCarPlanService; | 66 | private PeopleCarPlanService peopleCarPlanService; |
| 43 | 67 | ||
| 44 | @Autowired | 68 | @Autowired |
| 45 | private ScheduleRealInfoRepository scheduleRealInfoRepository; | 69 | private ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 46 | - | 70 | + |
| 71 | + @Autowired | ||
| 72 | + DutyEmployeeService dutyEmployeeService; | ||
| 73 | + | ||
| 74 | + @Autowired | ||
| 75 | + LineRepository lineRepository; | ||
| 76 | + | ||
| 77 | + @Autowired | ||
| 78 | + YlbRepository ylbRepository; | ||
| 79 | + | ||
| 80 | + @Autowired | ||
| 81 | + DlbRepository dlbRepository; | ||
| 82 | + | ||
| 83 | + @Autowired | ||
| 84 | + CarsRepository carsRepository; | ||
| 85 | + | ||
| 47 | @Autowired | 86 | @Autowired |
| 48 | private JdbcTemplate jdbcTemplate; | 87 | private JdbcTemplate jdbcTemplate; |
| 49 | 88 | ||
| @@ -241,7 +280,55 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -241,7 +280,55 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 241 | 280 | ||
| 242 | return list; | 281 | return list; |
| 243 | } | 282 | } |
| 244 | - | 283 | + |
| 284 | + public Map<Long, Set<ChildTaskPlan>> getChildTaskPlans(Long schedule1, Long schedule2){ | ||
| 285 | + | ||
| 286 | + Map<Long, Set<ChildTaskPlan>> schMap = new HashMap<Long, Set<ChildTaskPlan>>(); | ||
| 287 | + List<ChildTaskPlan> list = new ArrayList<ChildTaskPlan>(); | ||
| 288 | + | ||
| 289 | + String sql = "select id,cc_id,mileage_type,destroy,destroy_reason," + | ||
| 290 | + " mileage,type1,type2,schedule from bsth_c_s_child_task" + | ||
| 291 | + " where 1=1"; | ||
| 292 | + if(schedule1 != null && schedule1 > 0){ | ||
| 293 | + sql += " and schedule >= '"+schedule1+"'"; | ||
| 294 | + } | ||
| 295 | + if(schedule2 != null && schedule2 > 0){ | ||
| 296 | + sql += " and schedule <= '"+schedule2+"'"; | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + list = jdbcTemplate.query(sql, | ||
| 300 | + new RowMapper<ChildTaskPlan>(){ | ||
| 301 | + @Override | ||
| 302 | + public ChildTaskPlan mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 303 | + ChildTaskPlan ct = new ChildTaskPlan(); | ||
| 304 | + ct.setId(rs.getLong("id")); | ||
| 305 | + ct.setCcId(rs.getLong("cc_id")); | ||
| 306 | + ct.setMileageType(rs.getString("mileage_type")); | ||
| 307 | + ct.setDestroy(rs.getBoolean("destroy")); | ||
| 308 | + ct.setDestroyReason(rs.getString("destroy_reason")); | ||
| 309 | + ct.setMileage(rs.getFloat("mileage")); | ||
| 310 | + ct.setType1(rs.getString("type1")); | ||
| 311 | + ct.setType2(rs.getString("type2")); | ||
| 312 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | ||
| 313 | + schedule.setId(rs.getLong("schedule")); | ||
| 314 | + ct.setSchedule(schedule); | ||
| 315 | + if(ct.getCcId() == 0l){ | ||
| 316 | + ct.setCcId(null); | ||
| 317 | + } | ||
| 318 | + return ct; | ||
| 319 | + } | ||
| 320 | + }); | ||
| 321 | + | ||
| 322 | + for(ChildTaskPlan ct : list){ | ||
| 323 | + Long id = ct.getSchedule().getId(); | ||
| 324 | + if(!schMap.containsKey(id)) | ||
| 325 | + schMap.put(id, new HashSet<ChildTaskPlan>()); | ||
| 326 | + schMap.get(id).add(ct); | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + return schMap; | ||
| 330 | + } | ||
| 331 | + | ||
| 245 | @Override | 332 | @Override |
| 246 | public List<Map<String, Object>> getDir(Map<String, Object> map) { | 333 | public List<Map<String, Object>> getDir(Map<String, Object> map) { |
| 247 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 334 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| @@ -1630,6 +1717,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1630,6 +1717,15 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1630 | } | 1717 | } |
| 1631 | 1718 | ||
| 1632 | list = getSchedule(company, subCompany, line, startDate, endDate, model, sfqr==1?times:"", true); | 1719 | list = getSchedule(company, subCompany, line, startDate, endDate, model, sfqr==1?times:"", true); |
| 1720 | + long schedule1 = 0l, schedule2 = 0l; | ||
| 1721 | + for(ScheduleRealInfo schedule : list){ | ||
| 1722 | + long id = schedule.getId(); | ||
| 1723 | + if(schedule1 == 0l || schedule1 > id) | ||
| 1724 | + schedule1 = id; | ||
| 1725 | + if(schedule2 == 0l || schedule1 < id) | ||
| 1726 | + schedule2 = id; | ||
| 1727 | + } | ||
| 1728 | + Map<Long, Set<ChildTaskPlan>> cts = getChildTaskPlans(schedule1, schedule2); | ||
| 1633 | 1729 | ||
| 1634 | String[] date1 = startDate.split("-"); | 1730 | String[] date1 = startDate.split("-"); |
| 1635 | String[] date2 = endDate.split("-"); | 1731 | String[] date2 = endDate.split("-"); |
| @@ -1702,46 +1798,67 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1702,46 +1798,67 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1702 | jhlc = jhlc.add(lc); | 1798 | jhlc = jhlc.add(lc); |
| 1703 | } | 1799 | } |
| 1704 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null | 1800 | if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null |
| 1705 | - && schedule.getStatus() != -1 && !schedule.isCcService()){ | ||
| 1706 | - sjbc++; | ||
| 1707 | - sjlc = sjlc.add(lc); | ||
| 1708 | - } else if(schedule.getStatus() == -1 && !schedule.isCcService()){ | 1801 | + && schedule.getStatus() != -1){ |
| 1802 | + if(!schedule.isCcService()) | ||
| 1803 | + sjbc++; | ||
| 1804 | +// sjlc = sjlc.add(lc); | ||
| 1805 | + } else if(schedule.getStatus() == -1){ | ||
| 1709 | if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("路阻") != -1){ | 1806 | if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("路阻") != -1){ |
| 1710 | lzbc++; | 1807 | lzbc++; |
| 1711 | - lzlc = lzlc.add(lc); | 1808 | +// lzlc = lzlc.add(lc); |
| 1712 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("吊慢") != -1){ | 1809 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("吊慢") != -1){ |
| 1713 | dmbc++; | 1810 | dmbc++; |
| 1714 | - dmlc = dmlc.add(lc); | 1811 | +// dmlc = dmlc.add(lc); |
| 1715 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("故障") != -1){ | 1812 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("故障") != -1){ |
| 1716 | gzbc++; | 1813 | gzbc++; |
| 1717 | - gzlc = gzlc.add(lc); | 1814 | +// gzlc = gzlc.add(lc); |
| 1718 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("纠纷") != -1){ | 1815 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("纠纷") != -1){ |
| 1719 | jfbc++; | 1816 | jfbc++; |
| 1720 | - jflc = jflc.add(lc); | 1817 | +// jflc = jflc.add(lc); |
| 1721 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("肇事") != -1){ | 1818 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("肇事") != -1){ |
| 1722 | zsbc++; | 1819 | zsbc++; |
| 1723 | - zslc = zslc.add(lc); | 1820 | +// zslc = zslc.add(lc); |
| 1724 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺人") != -1){ | 1821 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺人") != -1){ |
| 1725 | qrbc++; | 1822 | qrbc++; |
| 1726 | - qrlc = qrlc.add(lc); | 1823 | +// qrlc = qrlc.add(lc); |
| 1727 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺车") != -1){ | 1824 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("缺车") != -1){ |
| 1728 | qcbc++; | 1825 | qcbc++; |
| 1729 | - qclc = qclc.add(lc); | 1826 | +// qclc = qclc.add(lc); |
| 1730 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("客稀") != -1){ | 1827 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("客稀") != -1){ |
| 1731 | kxbc++; | 1828 | kxbc++; |
| 1732 | - kxlc = kxlc.add(lc); | 1829 | +// kxlc = kxlc.add(lc); |
| 1733 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("气候") != -1){ | 1830 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("气候") != -1){ |
| 1734 | qhbc++; | 1831 | qhbc++; |
| 1735 | - qhlc = qhlc.add(lc); | 1832 | +// qhlc = qhlc.add(lc); |
| 1736 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("外援") != -1){ | 1833 | }else if(schedule.getAdjustExps() != null && schedule.getAdjustExps().indexOf("外援") != -1){ |
| 1737 | wybc++; | 1834 | wybc++; |
| 1738 | - wylc = wylc.add(lc); | 1835 | +// wylc = wylc.add(lc); |
| 1739 | } else { | 1836 | } else { |
| 1740 | qtbc++; | 1837 | qtbc++; |
| 1741 | - qtlc = qtlc.add(lc); | 1838 | +// qtlc = qtlc.add(lc); |
| 1742 | } | 1839 | } |
| 1743 | } | 1840 | } |
| 1841 | + if(cts.containsKey(schedule.getId())){ | ||
| 1842 | + schedule.setcTasks(cts.get(schedule.getId())); | ||
| 1843 | + } | ||
| 1744 | } | 1844 | } |
| 1845 | + | ||
| 1846 | + sjlc = new BigDecimal(culateService.culateSjgl(keyMap.get(key)) + culateService.culateLjgl(keyMap.get(key))); | ||
| 1847 | + lzlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "路阻")); | ||
| 1848 | + dmlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "吊慢")); | ||
| 1849 | + gzlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "故障")); | ||
| 1850 | + jflc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "纠纷")); | ||
| 1851 | + zslc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "肇事")); | ||
| 1852 | + qrlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "缺人")); | ||
| 1853 | + qclc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "缺车")); | ||
| 1854 | + kxlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "客稀")); | ||
| 1855 | + qhlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "气候")); | ||
| 1856 | + wylc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "援外")); | ||
| 1857 | + qtlc = new BigDecimal(culateService.culateCJLC(keyMap.get(key), "配车")).add( | ||
| 1858 | + new BigDecimal(culateService.culateCJLC(keyMap.get(key), "保养"))).add( | ||
| 1859 | + new BigDecimal(culateService.culateCJLC(keyMap.get(key), "抽减"))).add( | ||
| 1860 | + new BigDecimal(culateService.culateCJLC(keyMap.get(key), "其他"))); | ||
| 1861 | + | ||
| 1745 | boolean flag = true; | 1862 | boolean flag = true; |
| 1746 | if(jhlc.doubleValue() == 0d){ | 1863 | if(jhlc.doubleValue() == 0d){ |
| 1747 | flag = false; | 1864 | flag = false; |
| @@ -1754,42 +1871,42 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1754,42 +1871,42 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1754 | tempMap.put("jhbc", jhbc); | 1871 | tempMap.put("jhbc", jhbc); |
| 1755 | tempMap.put("sjbc", sjbc); | 1872 | tempMap.put("sjbc", sjbc); |
| 1756 | tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); | 1873 | tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); |
| 1757 | - tempMap.put("jhlc", jhlc.doubleValue()); | ||
| 1758 | - tempMap.put("sjlc", sjlc.doubleValue()); | 1874 | + tempMap.put("jhlc", df.format(jhlc.doubleValue())); |
| 1875 | + tempMap.put("sjlc", df.format(sjlc.doubleValue())); | ||
| 1759 | // tempMap.put("lcbfb", df.format(flag?(double)sjlc/jhlc*100:0)+"%"); | 1876 | // tempMap.put("lcbfb", df.format(flag?(double)sjlc/jhlc*100:0)+"%"); |
| 1760 | tempMap.put("lcbfb", df.format(flag?sjlc.divide(jhlc, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); | 1877 | tempMap.put("lcbfb", df.format(flag?sjlc.divide(jhlc, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); |
| 1761 | tempMap.put("lzbc", lzbc); | 1878 | tempMap.put("lzbc", lzbc); |
| 1762 | - tempMap.put("lzlc", lzlc.doubleValue()); | 1879 | + tempMap.put("lzlc", df.format(lzlc.doubleValue())); |
| 1763 | tempMap.put("lzbfb", df.format(jhbc>0?(double)lzbc/jhbc*100:0)+"%"); | 1880 | tempMap.put("lzbfb", df.format(jhbc>0?(double)lzbc/jhbc*100:0)+"%"); |
| 1764 | tempMap.put("dmbc", dmbc); | 1881 | tempMap.put("dmbc", dmbc); |
| 1765 | - tempMap.put("dmlc", dmlc.doubleValue()); | 1882 | + tempMap.put("dmlc", df.format(dmlc.doubleValue())); |
| 1766 | tempMap.put("dmbfb", df.format(jhbc>0?(double)dmbc/jhbc*100:0)+"%"); | 1883 | tempMap.put("dmbfb", df.format(jhbc>0?(double)dmbc/jhbc*100:0)+"%"); |
| 1767 | tempMap.put("gzbc", gzbc); | 1884 | tempMap.put("gzbc", gzbc); |
| 1768 | - tempMap.put("gzlc", gzlc.doubleValue()); | 1885 | + tempMap.put("gzlc", df.format(gzlc.doubleValue())); |
| 1769 | tempMap.put("gzbfb", df.format(jhbc>0?(double)gzbc/jhbc*100:0)+"%"); | 1886 | tempMap.put("gzbfb", df.format(jhbc>0?(double)gzbc/jhbc*100:0)+"%"); |
| 1770 | tempMap.put("jfbc", jfbc); | 1887 | tempMap.put("jfbc", jfbc); |
| 1771 | - tempMap.put("jflc", jflc.doubleValue()); | 1888 | + tempMap.put("jflc", df.format(jflc.doubleValue())); |
| 1772 | tempMap.put("jfbfb", df.format(jhbc>0?(double)jfbc/jhbc*100:0)+"%"); | 1889 | tempMap.put("jfbfb", df.format(jhbc>0?(double)jfbc/jhbc*100:0)+"%"); |
| 1773 | tempMap.put("zsbc", zsbc); | 1890 | tempMap.put("zsbc", zsbc); |
| 1774 | - tempMap.put("zslc", zslc.doubleValue()); | 1891 | + tempMap.put("zslc", df.format(zslc.doubleValue())); |
| 1775 | tempMap.put("zsbfb", df.format(jhbc>0?(double)zsbc/jhbc*100:0)+"%"); | 1892 | tempMap.put("zsbfb", df.format(jhbc>0?(double)zsbc/jhbc*100:0)+"%"); |
| 1776 | tempMap.put("qrbc", qrbc); | 1893 | tempMap.put("qrbc", qrbc); |
| 1777 | - tempMap.put("qrlc", qrlc.doubleValue()); | 1894 | + tempMap.put("qrlc", df.format(qrlc.doubleValue())); |
| 1778 | tempMap.put("qrbfb", df.format(jhbc>0?(double)qrbc/jhbc*100:0)+"%"); | 1895 | tempMap.put("qrbfb", df.format(jhbc>0?(double)qrbc/jhbc*100:0)+"%"); |
| 1779 | tempMap.put("qcbc", qcbc); | 1896 | tempMap.put("qcbc", qcbc); |
| 1780 | - tempMap.put("qclc", qclc.doubleValue()); | 1897 | + tempMap.put("qclc", df.format(qclc.doubleValue())); |
| 1781 | tempMap.put("qcbfb", df.format(jhbc>0?(double)qcbc/jhbc*100:0)+"%"); | 1898 | tempMap.put("qcbfb", df.format(jhbc>0?(double)qcbc/jhbc*100:0)+"%"); |
| 1782 | tempMap.put("kxbc", kxbc); | 1899 | tempMap.put("kxbc", kxbc); |
| 1783 | - tempMap.put("kxlc", kxlc.doubleValue()); | 1900 | + tempMap.put("kxlc", df.format(kxlc.doubleValue())); |
| 1784 | tempMap.put("kxbfb", df.format(jhbc>0?(double)kxbc/jhbc*100:0)+"%"); | 1901 | tempMap.put("kxbfb", df.format(jhbc>0?(double)kxbc/jhbc*100:0)+"%"); |
| 1785 | tempMap.put("qhbc", qhbc); | 1902 | tempMap.put("qhbc", qhbc); |
| 1786 | - tempMap.put("qhlc", qhlc.doubleValue()); | 1903 | + tempMap.put("qhlc", df.format(qhlc.doubleValue())); |
| 1787 | tempMap.put("qhbfb", df.format(jhbc>0?(double)qhbc/jhbc*100:0)+"%"); | 1904 | tempMap.put("qhbfb", df.format(jhbc>0?(double)qhbc/jhbc*100:0)+"%"); |
| 1788 | tempMap.put("wybc", wybc); | 1905 | tempMap.put("wybc", wybc); |
| 1789 | - tempMap.put("wylc", wylc.doubleValue()); | 1906 | + tempMap.put("wylc", df.format(wylc.doubleValue())); |
| 1790 | tempMap.put("wybfb", df.format(jhbc>0?(double)wybc/jhbc*100:0)+"%"); | 1907 | tempMap.put("wybfb", df.format(jhbc>0?(double)wybc/jhbc*100:0)+"%"); |
| 1791 | tempMap.put("qtbc", qtbc); | 1908 | tempMap.put("qtbc", qtbc); |
| 1792 | - tempMap.put("qtlc", qtlc.doubleValue()); | 1909 | + tempMap.put("qtlc", df.format(qtlc.doubleValue())); |
| 1793 | tempMap.put("qtbfb", df.format(jhbc>0?(double)qtbc/jhbc*100:0)+"%"); | 1910 | tempMap.put("qtbfb", df.format(jhbc>0?(double)qtbc/jhbc*100:0)+"%"); |
| 1794 | 1911 | ||
| 1795 | resList.add(tempMap); | 1912 | resList.add(tempMap); |
| @@ -1822,41 +1939,41 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1822,41 +1939,41 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1822 | temp.put("jhbc", jhbc_); | 1939 | temp.put("jhbc", jhbc_); |
| 1823 | temp.put("sjbc", sjbc_); | 1940 | temp.put("sjbc", sjbc_); |
| 1824 | temp.put("bcbfb", df.format(jhbc_>0?(double)sjbc_/jhbc_*100:0)+"%"); | 1941 | temp.put("bcbfb", df.format(jhbc_>0?(double)sjbc_/jhbc_*100:0)+"%"); |
| 1825 | - temp.put("jhlc", jhlc_.doubleValue()); | ||
| 1826 | - temp.put("sjlc", sjlc_.doubleValue()); | 1942 | + temp.put("jhlc", df.format(jhlc_.doubleValue())); |
| 1943 | + temp.put("sjlc", df.format(sjlc_.doubleValue())); | ||
| 1827 | temp.put("lcbfb", df.format(flag?sjlc_.divide(jhlc_, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); | 1944 | temp.put("lcbfb", df.format(flag?sjlc_.divide(jhlc_, 4, BigDecimal.ROUND_HALF_UP).doubleValue()*100:0)+"%"); |
| 1828 | temp.put("lzbc", lzbc_); | 1945 | temp.put("lzbc", lzbc_); |
| 1829 | - temp.put("lzlc", lzlc_.doubleValue()); | 1946 | + temp.put("lzlc", df.format(lzlc_.doubleValue())); |
| 1830 | temp.put("lzbfb", df.format(jhbc_>0?(double)lzbc_/jhbc_*100:0)+"%"); | 1947 | temp.put("lzbfb", df.format(jhbc_>0?(double)lzbc_/jhbc_*100:0)+"%"); |
| 1831 | temp.put("dmbc", dmbc_); | 1948 | temp.put("dmbc", dmbc_); |
| 1832 | - temp.put("dmlc", dmlc_.doubleValue()); | 1949 | + temp.put("dmlc", df.format(dmlc_.doubleValue())); |
| 1833 | temp.put("dmbfb", df.format(jhbc_>0?(double)dmbc_/jhbc_*100:0)+"%"); | 1950 | temp.put("dmbfb", df.format(jhbc_>0?(double)dmbc_/jhbc_*100:0)+"%"); |
| 1834 | temp.put("gzbc", gzbc_); | 1951 | temp.put("gzbc", gzbc_); |
| 1835 | - temp.put("gzlc", gzlc_.doubleValue()); | 1952 | + temp.put("gzlc", df.format(gzlc_.doubleValue())); |
| 1836 | temp.put("gzbfb", df.format(jhbc_>0?(double)gzbc_/jhbc_*100:0)+"%"); | 1953 | temp.put("gzbfb", df.format(jhbc_>0?(double)gzbc_/jhbc_*100:0)+"%"); |
| 1837 | temp.put("jfbc", jfbc_); | 1954 | temp.put("jfbc", jfbc_); |
| 1838 | - temp.put("jflc", jflc_.doubleValue()); | 1955 | + temp.put("jflc", df.format(jflc_.doubleValue())); |
| 1839 | temp.put("jfbfb", df.format(jhbc_>0?(double)jfbc_/jhbc_*100:0)+"%"); | 1956 | temp.put("jfbfb", df.format(jhbc_>0?(double)jfbc_/jhbc_*100:0)+"%"); |
| 1840 | temp.put("zsbc", zsbc_); | 1957 | temp.put("zsbc", zsbc_); |
| 1841 | - temp.put("zslc", zslc_.doubleValue()); | 1958 | + temp.put("zslc", df.format(zslc_.doubleValue())); |
| 1842 | temp.put("zsbfb", df.format(jhbc_>0?(double)zsbc_/jhbc_*100:0)+"%"); | 1959 | temp.put("zsbfb", df.format(jhbc_>0?(double)zsbc_/jhbc_*100:0)+"%"); |
| 1843 | temp.put("qrbc", qrbc_); | 1960 | temp.put("qrbc", qrbc_); |
| 1844 | - temp.put("qrlc", qrlc_.doubleValue()); | 1961 | + temp.put("qrlc", df.format(qrlc_.doubleValue())); |
| 1845 | temp.put("qrbfb", df.format(jhbc_>0?(double)qrbc_/jhbc_*100:0)+"%"); | 1962 | temp.put("qrbfb", df.format(jhbc_>0?(double)qrbc_/jhbc_*100:0)+"%"); |
| 1846 | temp.put("qcbc", qcbc_); | 1963 | temp.put("qcbc", qcbc_); |
| 1847 | - temp.put("qclc", qclc_.doubleValue()); | 1964 | + temp.put("qclc", df.format(qclc_.doubleValue())); |
| 1848 | temp.put("qcbfb", df.format(jhbc_>0?(double)qcbc_/jhbc_*100:0)+"%"); | 1965 | temp.put("qcbfb", df.format(jhbc_>0?(double)qcbc_/jhbc_*100:0)+"%"); |
| 1849 | temp.put("kxbc", kxbc_); | 1966 | temp.put("kxbc", kxbc_); |
| 1850 | - temp.put("kxlc", kxlc_.doubleValue()); | 1967 | + temp.put("kxlc", df.format(kxlc_.doubleValue())); |
| 1851 | temp.put("kxbfb", df.format(jhbc_>0?(double)kxbc_/jhbc_*100:0)+"%"); | 1968 | temp.put("kxbfb", df.format(jhbc_>0?(double)kxbc_/jhbc_*100:0)+"%"); |
| 1852 | temp.put("qhbc", qhbc_); | 1969 | temp.put("qhbc", qhbc_); |
| 1853 | - temp.put("qhlc", qhlc_.doubleValue()); | 1970 | + temp.put("qhlc", df.format(qhlc_.doubleValue())); |
| 1854 | temp.put("qhbfb", df.format(jhbc_>0?(double)qhbc_/jhbc_*100:0)+"%"); | 1971 | temp.put("qhbfb", df.format(jhbc_>0?(double)qhbc_/jhbc_*100:0)+"%"); |
| 1855 | temp.put("wybc", wybc_); | 1972 | temp.put("wybc", wybc_); |
| 1856 | - temp.put("wylc", wylc_.doubleValue()); | 1973 | + temp.put("wylc", df.format(wylc_.doubleValue())); |
| 1857 | temp.put("wybfb", df.format(jhbc_>0?(double)wybc_/jhbc_*100:0)+"%"); | 1974 | temp.put("wybfb", df.format(jhbc_>0?(double)wybc_/jhbc_*100:0)+"%"); |
| 1858 | temp.put("qtbc", qtbc_); | 1975 | temp.put("qtbc", qtbc_); |
| 1859 | - temp.put("qtlc", qtlc_.doubleValue()); | 1976 | + temp.put("qtlc", df.format(qtlc_.doubleValue())); |
| 1860 | temp.put("qtbfb", df.format(jhbc_>0?(double)qtbc_/jhbc_*100:0)+"%"); | 1977 | temp.put("qtbfb", df.format(jhbc_>0?(double)qtbc_/jhbc_*100:0)+"%"); |
| 1861 | 1978 | ||
| 1862 | resList.add(temp); | 1979 | resList.add(temp); |
| @@ -2257,10 +2374,422 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2257,10 +2374,422 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2257 | resMap.put("xlname",BasicData.lineCode2NameMap.get(xlbm)); | 2374 | resMap.put("xlname",BasicData.lineCode2NameMap.get(xlbm)); |
| 2258 | } | 2375 | } |
| 2259 | } | 2376 | } |
| 2260 | - | 2377 | + |
| 2261 | return resList; | 2378 | return resList; |
| 2262 | } | 2379 | } |
| 2263 | 2380 | ||
| 2264 | - | ||
| 2265 | - | 2381 | + @Override |
| 2382 | + public Map<String, Object> exportWaybillMore(Map<String, Object> map) { | ||
| 2383 | + String date = map.get("date").toString(); | ||
| 2384 | + String line = map.get("line").toString(); | ||
| 2385 | + ReportUtils ee = new ReportUtils(); | ||
| 2386 | + List<List> strs = JSON.parseArray(map.get("strs").toString(), List.class); | ||
| 2387 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; | ||
| 2388 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 2389 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 2390 | + int num = 0; | ||
| 2391 | + File file = null; | ||
| 2392 | + try { | ||
| 2393 | + while (true) { | ||
| 2394 | + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); | ||
| 2395 | +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 | ||
| 2396 | + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 | ||
| 2397 | + if (file.exists()) { //判断是否已存在重名 | ||
| 2398 | + num++; | ||
| 2399 | + } else { | ||
| 2400 | + break; | ||
| 2401 | + } | ||
| 2402 | + } | ||
| 2403 | +// file.mkdirs(); //创建 | ||
| 2404 | + | ||
| 2405 | + Map<String, List<Ylb>> ylbMap = new HashMap<String, List<Ylb>>(); | ||
| 2406 | + Map<String, List<Dlb>> dlbMap = new HashMap<String, List<Dlb>>(); | ||
| 2407 | + Map<String, List<Cars>> carMap = new HashMap<String, List<Cars>>(); | ||
| 2408 | + List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | ||
| 2409 | + List<DutyEmployee> list2 = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | ||
| 2410 | + List<Ylb> queryYlbByRqXlbm = ylbRepository.queryYlbByRqXlbm(date, line); | ||
| 2411 | + List<Dlb> queryDlbByRqXlbm = dlbRepository.queryDlbByRqXlbm(date, line); | ||
| 2412 | + List<Cars> findCars = carsRepository.findCars(); | ||
| 2413 | + String minfcsj="02:00"; | ||
| 2414 | + List<Line> lineList=lineRepository.findLineByCode(line); | ||
| 2415 | + if(lineList.size()>0){ | ||
| 2416 | + String sqlMinYysj="select start_opt from bsth_c_line_config where " | ||
| 2417 | + + " id = (" | ||
| 2418 | + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'" | ||
| 2419 | + + ")"; | ||
| 2420 | + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); | ||
| 2421 | + } | ||
| 2422 | + | ||
| 2423 | + for(Ylb ylb : queryYlbByRqXlbm){ | ||
| 2424 | + String key = sdfMonth.format(ylb.getRq()) + ylb.getXlbm(); | ||
| 2425 | + if(!ylbMap.containsKey(key)) | ||
| 2426 | + ylbMap.put(key, new ArrayList<Ylb>()); | ||
| 2427 | + ylbMap.get(key).add(ylb); | ||
| 2428 | + } | ||
| 2429 | + for(Dlb dlb : queryDlbByRqXlbm){ | ||
| 2430 | + String key = sdfMonth.format(dlb.getRq()) + dlb.getXlbm(); | ||
| 2431 | + if(!dlbMap.containsKey(key)) | ||
| 2432 | + dlbMap.put(key, new ArrayList<Dlb>()); | ||
| 2433 | + dlbMap.get(key).add(dlb); | ||
| 2434 | + } | ||
| 2435 | + for(Cars car : findCars){ | ||
| 2436 | + String key = car.getInsideCode(); | ||
| 2437 | + if(!carMap.containsKey(key)) | ||
| 2438 | + carMap.put(key, new ArrayList<Cars>()); | ||
| 2439 | + carMap.get(key).add(car); | ||
| 2440 | + } | ||
| 2441 | + | ||
| 2442 | + List<File> files = new ArrayList<File>(); | ||
| 2443 | + for (List<String> list : strs){ | ||
| 2444 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 2445 | + String jName = list.get(0); | ||
| 2446 | + String clZbh = list.get(1); | ||
| 2447 | + String lpName = list.get(2); | ||
| 2448 | + String jGh =list.get(3); | ||
| 2449 | + for (int i = 0; i < lists_line.size(); i++) { | ||
| 2450 | + ScheduleRealInfo s=lists_line.get(i); | ||
| 2451 | + if(s.getjGh().equals(jGh) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)){ | ||
| 2452 | + newList.add(s); | ||
| 2453 | + } | ||
| 2454 | + } | ||
| 2455 | + //—————————————————————————————————————————————————————— | ||
| 2456 | + | ||
| 2457 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | ||
| 2458 | + List<Iterator<?>> list1 = new ArrayList<Iterator<?>>(); | ||
| 2459 | + List<ScheduleRealInfo> scheduleRealInfos = newList; | ||
| 2460 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | ||
| 2461 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | ||
| 2462 | + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); | ||
| 2463 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | ||
| 2464 | + ScheduleRealInfo s=scheduleRealInfos.get(i); | ||
| 2465 | + Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 2466 | + if(cts != null && cts.size() > 0){ | ||
| 2467 | + lists.add(s); | ||
| 2468 | + }else{ | ||
| 2469 | + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | ||
| 2470 | + lists.add(s); | ||
| 2471 | + } | ||
| 2472 | + } | ||
| 2473 | + } | ||
| 2474 | + DecimalFormat format = new DecimalFormat("0.00"); | ||
| 2475 | + //计算里程和班次数,并放入Map里 | ||
| 2476 | +// Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | ||
| 2477 | + | ||
| 2478 | + //----------------------------------------------------- | ||
| 2479 | + Map<String, Object> Map = new HashMap<String, Object>(); | ||
| 2480 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 2481 | +// ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(scheduleRealInfos.get(0).getId()); | ||
| 2482 | + ScheduleRealInfo s = scheduleRealInfos.get(0); | ||
| 2483 | + String xlbm = s.getXlBm(); | ||
| 2484 | + String fcrq = s.getScheduleDateStr(); | ||
| 2485 | + | ||
| 2486 | + int type = 0; | ||
| 2487 | + Double ccyl = 0.0; | ||
| 2488 | + Double jcyl = 0.0; | ||
| 2489 | + Double yh = 0.0; | ||
| 2490 | + Double jzl = 0.0; | ||
| 2491 | + Double zlc = 0.0; | ||
| 2492 | +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | ||
| 2493 | +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | ||
| 2494 | + List<Ylb> listYlb = ylbMap.get(fcrq + xlbm); | ||
| 2495 | + List<Dlb> listDlb = dlbMap.get(fcrq + xlbm); | ||
| 2496 | + | ||
| 2497 | +// List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); | ||
| 2498 | + List<Cars> listCars = carMap.get(s.getClZbh()); | ||
| 2499 | + if (listCars != null && listCars.size() > 0) { | ||
| 2500 | + if(listCars.get(0).getSfdc()!=null){ | ||
| 2501 | + if (listCars.get(0).getSfdc()) { | ||
| 2502 | + type = 1; | ||
| 2503 | + if(listDlb != null) | ||
| 2504 | + for (int i = 0; i < listDlb.size(); i++) { | ||
| 2505 | + Dlb d = listDlb.get(i); | ||
| 2506 | + if (d.getLp() == null) { | ||
| 2507 | + ccyl = Arith.add(ccyl, d.getCzcd()); | ||
| 2508 | + jcyl = Arith.add(jcyl, d.getJzcd()); | ||
| 2509 | + yh = Arith.add(yh, d.getHd()); | ||
| 2510 | + jzl = Arith.add(jzl, d.getCdl()); | ||
| 2511 | + zlc = Arith.add(zlc, d.getZlc()); | ||
| 2512 | + } else { | ||
| 2513 | + if (d.getLp().equals(s.getLpName())) { | ||
| 2514 | + ccyl = Arith.add(ccyl, d.getCzcd()); | ||
| 2515 | + jcyl = Arith.add(jcyl, d.getJzcd()); | ||
| 2516 | + yh = Arith.add(yh, d.getHd()); | ||
| 2517 | + jzl = Arith.add(jzl, d.getCdl()); | ||
| 2518 | + zlc = Arith.add(zlc, d.getZlc()); | ||
| 2519 | + } | ||
| 2520 | + } | ||
| 2521 | + | ||
| 2522 | + } | ||
| 2523 | + } else { | ||
| 2524 | + type = 0; | ||
| 2525 | + if(listYlb != null) | ||
| 2526 | + for (int i = 0; i < listYlb.size(); i++) { | ||
| 2527 | + Ylb y = listYlb.get(i); | ||
| 2528 | + if (y.getLp() == null) { | ||
| 2529 | + ccyl = Arith.add(ccyl, y.getCzyl()); | ||
| 2530 | + jcyl = Arith.add(jcyl, y.getJzyl()); | ||
| 2531 | + yh = Arith.add(yh, y.getYh()); | ||
| 2532 | + jzl = Arith.add(jzl, y.getJzl()); | ||
| 2533 | + zlc = Arith.add(zlc, y.getZlc()); | ||
| 2534 | + } else { | ||
| 2535 | + if (y.getLp().equals(s.getLpName())) { | ||
| 2536 | + ccyl = Arith.add(ccyl, y.getCzyl()); | ||
| 2537 | + jcyl = Arith.add(jcyl, y.getJzyl()); | ||
| 2538 | + yh = Arith.add(yh, y.getYh()); | ||
| 2539 | + jzl = Arith.add(jzl, y.getJzl()); | ||
| 2540 | + zlc = Arith.add(zlc, y.getZlc()); | ||
| 2541 | + } | ||
| 2542 | + } | ||
| 2543 | + } | ||
| 2544 | + } | ||
| 2545 | + } | ||
| 2546 | + } | ||
| 2547 | + | ||
| 2548 | + Map.put("jzl", jzl); | ||
| 2549 | + Map.put("yh", yh); | ||
| 2550 | + Map.put("ccyl", ccyl); | ||
| 2551 | + Map.put("jcyl", jcyl); | ||
| 2552 | + Map.put("type", type); | ||
| 2553 | + Map.put("zlc", zlc); | ||
| 2554 | + Map.put("xlName", s.getXlName()); | ||
| 2555 | + Map.put("clZbh", s.getClZbh()); | ||
| 2556 | + Map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | ||
| 2557 | + Map.put("fcsjActual", s.getFcsjActual()); | ||
| 2558 | + Map.put("zdzName", s.getZdzName()); | ||
| 2559 | + Map.put("scheduleDate", s.getScheduleDateStr()); | ||
| 2560 | + Map.put("lpName", s.getLpName()); | ||
| 2561 | + String zdp = "", zwdp = "", wdp = ""; | ||
| 2562 | + String zdpT = "", zwdpT = "", wdpT = ""; | ||
| 2563 | + String dbdp=""; | ||
| 2564 | +// List<DutyEmployee> list2 = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | ||
| 2565 | + try { | ||
| 2566 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | ||
| 2567 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | ||
| 2568 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | ||
| 2569 | + for (int i = 0; i < list2.size(); i++) { | ||
| 2570 | + DutyEmployee t = list2.get(i); | ||
| 2571 | + if(dbdp.indexOf(t.getuName()) == -1){ | ||
| 2572 | + if(!(dbdp.length()>0)){ | ||
| 2573 | + dbdp =t.getuName(); | ||
| 2574 | + }else{ | ||
| 2575 | + dbdp +=","+t.getuName(); | ||
| 2576 | + } | ||
| 2577 | + } | ||
| 2578 | + Long ts = t.getTs(); | ||
| 2579 | + if (ts > fcsj1 && ts < fcsj2) { | ||
| 2580 | + if (zdp.indexOf(t.getuName()) == -1) { | ||
| 2581 | + if (!(zdp.length() > 0)) { | ||
| 2582 | + zdpT = t.getuName() + "..."; | ||
| 2583 | + } | ||
| 2584 | + zdp += t.getuName() + ","; | ||
| 2585 | + | ||
| 2586 | + } | ||
| 2587 | + } else if (ts > fcsj2 && ts < fcsj3) { | ||
| 2588 | + if (zwdp.indexOf(t.getuName()) == -1) { | ||
| 2589 | + if (!(zwdp.length() > 0)) { | ||
| 2590 | + zwdpT = t.getuName() + "..."; | ||
| 2591 | + } | ||
| 2592 | + zwdp += t.getuName() + ","; | ||
| 2593 | + } | ||
| 2594 | + } else { | ||
| 2595 | + if (wdp.indexOf(t.getuName()) == -1) { | ||
| 2596 | + if (!(wdp.length() > 0)) { | ||
| 2597 | + wdpT = t.getuName() + "..."; | ||
| 2598 | + } | ||
| 2599 | + wdp += t.getuName() + ","; | ||
| 2600 | + } | ||
| 2601 | + } | ||
| 2602 | + } | ||
| 2603 | + } catch (ParseException e) { | ||
| 2604 | + // TODO Auto-generated catch block | ||
| 2605 | + e.printStackTrace(); | ||
| 2606 | + } | ||
| 2607 | + Map.put("zdp", zdp); | ||
| 2608 | + Map.put("zwdp", zwdp); | ||
| 2609 | + Map.put("wdp", wdp); | ||
| 2610 | + Map.put("zdpT", zdpT); | ||
| 2611 | + Map.put("zwdpT", zwdpT); | ||
| 2612 | + Map.put("wdpT", wdpT); | ||
| 2613 | + Map.put("dbdp", dbdp); | ||
| 2614 | + //----------------------------------------------------- | ||
| 2615 | + | ||
| 2616 | + Map.put("jhlc",Arith.add(culateService.culateJhgl(scheduleRealInfos),culateService.culateJhJccgl(scheduleRealInfos))); | ||
| 2617 | + Map.put("remMileage",culateService.culateLbgl(scheduleRealInfos)); | ||
| 2618 | + Map.put("addMileage", culateService.culateLjgl(lists)); | ||
| 2619 | + double yygl=Arith.add(culateService.culateSjgl(lists),culateService.culateLjgl(lists)); | ||
| 2620 | + Map.put("yygl", yygl); | ||
| 2621 | + double ksgl=Arith.add(culateService.culateKsgl(scheduleRealInfos),culateService.culateJccgl(lists)); | ||
| 2622 | + Map.put("ksgl",ksgl); | ||
| 2623 | + Map.put("realMileage", Arith.add(yygl ,ksgl)); | ||
| 2624 | + Map.put("jhbc", culateService.culateJhbc(scheduleRealInfos,"")); | ||
| 2625 | + Map.put("cjbc", culateService.culateLbbc(scheduleRealInfos)); | ||
| 2626 | + Map.put("ljbc", culateService.culateLjbc(lists, "")); | ||
| 2627 | + int sjbc =culateService.culateLjbc(lists, "")+culateService.culateSjbc(lists, ""); | ||
| 2628 | + Map.put("sjbc", sjbc); | ||
| 2629 | +// map=new HashMap<String,Object>(); | ||
| 2630 | + | ||
| 2631 | + SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 2632 | +// String minfcsj="02:00"; | ||
| 2633 | +// List<Line> lineList=lineRepository.findLineByCode(newList.get(0).getXlBm()); | ||
| 2634 | +// if(lineList.size()>0){ | ||
| 2635 | +// String sqlMinYysj="select start_opt from bsth_c_line_config where " | ||
| 2636 | +// + " id = (" | ||
| 2637 | +// + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'" | ||
| 2638 | +// + ")"; | ||
| 2639 | +// minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); | ||
| 2640 | +// } | ||
| 2641 | + String[] minSjs = minfcsj.split(":"); | ||
| 2642 | + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]); | ||
| 2643 | + | ||
| 2644 | + | ||
| 2645 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | ||
| 2646 | + ScheduleRealInfo ss=scheduleRealInfos.get(i); | ||
| 2647 | + String[] fcsj= ss.getFcsj().split(":"); | ||
| 2648 | + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]); | ||
| 2649 | + | ||
| 2650 | + Long fscjT=0L; | ||
| 2651 | + if(fcsjL<minSj){ | ||
| 2652 | + Calendar calendar = new GregorianCalendar(); | ||
| 2653 | + calendar.setTime(ss.getScheduleDate()); | ||
| 2654 | + calendar.add(calendar.DATE,1); | ||
| 2655 | + ss.setScheduleDate(calendar.getTime()); | ||
| 2656 | + try { | ||
| 2657 | + fscjT = sdf2.parse(sdf2.format(ss.getScheduleDate())+" "+ss.getFcsj()).getTime(); | ||
| 2658 | + } catch (ParseException e) { | ||
| 2659 | + // TODO Auto-generated catch block | ||
| 2660 | + e.printStackTrace(); | ||
| 2661 | + } | ||
| 2662 | + | ||
| 2663 | + }else{ | ||
| 2664 | + try { | ||
| 2665 | + fscjT =sdf2.parse(ss.getScheduleDateStr()+" "+ss.getFcsj()).getTime(); | ||
| 2666 | + } catch (ParseException e) { | ||
| 2667 | + // TODO Auto-generated catch block | ||
| 2668 | + e.printStackTrace(); | ||
| 2669 | + }; | ||
| 2670 | + } | ||
| 2671 | + ss.setFcsjT(fscjT); | ||
| 2672 | + } | ||
| 2673 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | ||
| 2674 | + Collections.sort(scheduleRealInfos, new ComparableReal()); | ||
| 2675 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | ||
| 2676 | + ScheduleRealInfo ss = scheduleRealInfos.get(i); | ||
| 2677 | + ss.setAdjustExps(i + 1 + ""); | ||
| 2678 | + String remarks = ""; | ||
| 2679 | + if (ss.getRemarks() != null) { | ||
| 2680 | + remarks += ss.getRemarks(); | ||
| 2681 | + } | ||
| 2682 | + | ||
| 2683 | + Set<ChildTaskPlan> childTaskPlans = ss.getcTasks(); | ||
| 2684 | + if (!childTaskPlans.isEmpty()) { | ||
| 2685 | + ss.setFcsjActual(""); | ||
| 2686 | + ss.setZdsjActual(""); | ||
| 2687 | + ss.setJhlc(0.0); | ||
| 2688 | + } | ||
| 2689 | + | ||
| 2690 | + if (ss.isDestroy()) { | ||
| 2691 | + ss.setFcsjActual(""); | ||
| 2692 | + ss.setZdsjActual(""); | ||
| 2693 | + ss.setJhlc(0.0); | ||
| 2694 | + remarks += "(烂班)"; | ||
| 2695 | + ss.setRemarks(remarks); | ||
| 2696 | + } | ||
| 2697 | + | ||
| 2698 | + listSchedule.add(ss); | ||
| 2699 | + //计算营运里程,空驶里程 | ||
| 2700 | + if (!childTaskPlans.isEmpty()) { | ||
| 2701 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 2702 | + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans); | ||
| 2703 | + Collections.sort(listit, new ComparableChild()); | ||
| 2704 | + for (int j = 0; j < listit.size(); j++) { | ||
| 2705 | + ScheduleRealInfo t = new ScheduleRealInfo(); | ||
| 2706 | + ChildTaskPlan childTaskPlan = listit.get(j); | ||
| 2707 | + if (childTaskPlan.isDestroy()) { | ||
| 2708 | + t.setFcsjActual(""); | ||
| 2709 | + t.setZdsjActual(""); | ||
| 2710 | + t.setJhlc(0.0); | ||
| 2711 | + } else { | ||
| 2712 | + t.setFcsjActual(childTaskPlan.getStartDate()); | ||
| 2713 | + t.setZdsjActual(childTaskPlan.getEndDate()); | ||
| 2714 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | ||
| 2715 | + } | ||
| 2716 | + t.setQdzName(childTaskPlan.getStartStationName()); | ||
| 2717 | + t.setZdzName(childTaskPlan.getEndStationName()); | ||
| 2718 | + t.setRemarks(childTaskPlan.getRemarks()); | ||
| 2719 | + t.setAdjustExps("子"); | ||
| 2720 | + t.setjGh(""); | ||
| 2721 | + t.setjName(""); | ||
| 2722 | + t.setsGh(""); | ||
| 2723 | + t.setsName(""); | ||
| 2724 | + listSchedule.add(t); | ||
| 2725 | + } | ||
| 2726 | + } | ||
| 2727 | + } | ||
| 2728 | + Map<String, Object> maps; | ||
| 2729 | + for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | ||
| 2730 | + maps = new HashMap<String, Object>(); | ||
| 2731 | + try { | ||
| 2732 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | ||
| 2733 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | ||
| 2734 | + maps = rru.getMapValue(scheduleRealInfo); | ||
| 2735 | + maps.put("bcs", scheduleRealInfo.getAdjustExps()); | ||
| 2736 | + String zdsj = scheduleRealInfo.getZdsj(); | ||
| 2737 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | ||
| 2738 | + if (zdsj != null && zdsjActual != null && | ||
| 2739 | + !zdsj.equals(zdsjActual) && | ||
| 2740 | + !zdsj.equals("")&& | ||
| 2741 | + !zdsjActual.equals("")) { | ||
| 2742 | + if (zdsj.compareTo(zdsjActual) > 0) { | ||
| 2743 | + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | ||
| 2744 | + maps.put("slow", ""); | ||
| 2745 | + } else { | ||
| 2746 | + maps.put("fast", ""); | ||
| 2747 | + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | ||
| 2748 | + } | ||
| 2749 | + } else { | ||
| 2750 | + maps.put("fast", ""); | ||
| 2751 | + maps.put("slow", ""); | ||
| 2752 | + } | ||
| 2753 | + listMap.add(maps); | ||
| 2754 | + } catch (Exception e) { | ||
| 2755 | + e.printStackTrace(); | ||
| 2756 | + } | ||
| 2757 | + } | ||
| 2758 | + | ||
| 2759 | + String path1 = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 2760 | + list1.add(listMap.iterator()); | ||
| 2761 | + String xls=""; | ||
| 2762 | + if(Map.get("type").toString().equals("0")){ | ||
| 2763 | + xls="waybill_minhang.xls"; | ||
| 2764 | + }else{ | ||
| 2765 | + xls="waybill_minhang_dl.xls"; | ||
| 2766 | + } | ||
| 2767 | + Map.put("sheetName", jName + "-" + clZbh + "-" + lpName); | ||
| 2768 | + ee.excelReplace(list1, new Object[]{Map}, path1 + "mould/"+xls, | ||
| 2769 | + path1 + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | ||
| 2770 | + | ||
| 2771 | + | ||
| 2772 | + //———————————————————————————————————————————————— | ||
| 2773 | + | ||
| 2774 | + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | ||
| 2775 | + String fileName = file.getName(); | ||
| 2776 | + files.add(temp); | ||
| 2777 | + } | ||
| 2778 | + for(int i = 1; i < files.size(); i++){ | ||
| 2779 | + File file1 = files.get(0); | ||
| 2780 | + File file2 = files.get(i); | ||
| 2781 | + ee.copySheetByFile(file2, file1, 0, 145); | ||
| 2782 | + } | ||
| 2783 | + File newFile = files.get(0); | ||
| 2784 | + newFile.renameTo(file); | ||
| 2785 | + | ||
| 2786 | + } catch (Exception e) { | ||
| 2787 | + // TODO: handle exception | ||
| 2788 | + e.printStackTrace(); | ||
| 2789 | + } | ||
| 2790 | + | ||
| 2791 | + map.put("fileName", file.getName()); | ||
| 2792 | + return map; | ||
| 2793 | + } | ||
| 2794 | + | ||
| 2266 | } | 2795 | } |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| @@ -1746,7 +1746,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1746,7 +1746,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1746 | tempMap.put("line", xlName); | 1746 | tempMap.put("line", xlName); |
| 1747 | tempMap.put("jhbc", jhbc); | 1747 | tempMap.put("jhbc", jhbc); |
| 1748 | tempMap.put("sjbc", sjbc); | 1748 | tempMap.put("sjbc", sjbc); |
| 1749 | - tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%"); | 1749 | + tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc *100)) + "%"); |
| 1750 | + | ||
| 1750 | resList.add(tempMap); | 1751 | resList.add(tempMap); |
| 1751 | } | 1752 | } |
| 1752 | 1753 | ||
| @@ -1760,7 +1761,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1760,7 +1761,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1760 | } | 1761 | } |
| 1761 | tempMap.put("jhbc", jhbc); | 1762 | tempMap.put("jhbc", jhbc); |
| 1762 | tempMap.put("sjbc", sjbc); | 1763 | tempMap.put("sjbc", sjbc); |
| 1763 | - tempMap.put("zdl", nf.format((float) sjbc / jhbc * 100) + "%"); | 1764 | + tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%"); |
| 1764 | for(Map<String, Object> m : mapList){ | 1765 | for(Map<String, Object> m : mapList){ |
| 1765 | m.put("no", ++i); | 1766 | m.put("no", ++i); |
| 1766 | m.put("company", companyName); | 1767 | m.put("company", companyName); |
src/main/resources/static/pages/forms/statement/waybill.html
| @@ -361,8 +361,9 @@ | @@ -361,8 +361,9 @@ | ||
| 361 | } | 361 | } |
| 362 | }); | 362 | }); |
| 363 | }); | 363 | }); |
| 364 | - $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | 364 | +// $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ |
| 365 | // window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包 | 365 | // window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包 |
| 366 | + $get('/busInterval/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | ||
| 366 | window.open("/downloadFile/download?fileName="+result.fileName); | 367 | window.open("/downloadFile/download?fileName="+result.fileName); |
| 367 | layer.close(i); | 368 | layer.close(i); |
| 368 | }); | 369 | }); |