Commit f0d4bcfaaa686d28b21be68476e2ac2c40c4505a
1 parent
b5dba7cb
路单线路明细月报表、年报表,营运线路选项无效的问题。
Showing
4 changed files
with
64 additions
and
47 deletions
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
| ... | ... | @@ -5,6 +5,7 @@ import java.util.List; |
| 5 | 5 | |
| 6 | 6 | import javax.transaction.Transactional; |
| 7 | 7 | |
| 8 | +import com.bsth.entity.Line; | |
| 8 | 9 | import com.bsth.entity.calc.CalcWaybill; |
| 9 | 10 | import com.bsth.entity.oil.Dlb; |
| 10 | 11 | import com.bsth.entity.oil.Ylb; |
| ... | ... | @@ -61,6 +62,18 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ |
| 61 | 62 | @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1") |
| 62 | 63 | List<ScheduleRealInfo> findAllScheduleByDate(String schDate); |
| 63 | 64 | |
| 65 | + /** 全部线路性质 */ | |
| 66 | + @Query("select DISTINCT l.nature from Line l") | |
| 67 | + List<String> allLineNature(); | |
| 68 | + | |
| 69 | + /** 营运线路性质 */ | |
| 70 | + @Query("select DISTINCT l.nature from Line l where nature in ('yxl','cgxl','gjxl','csbs','cctxl')") | |
| 71 | + List<String> serviceLineNature(); | |
| 72 | + | |
| 73 | + /** 非营运线路性质 */ | |
| 74 | + @Query("select DISTINCT l.nature from Line l where nature not in ('yxl','cgxl','gjxl','csbs','cctxl')") | |
| 75 | + List<String> notServiceLineNature(); | |
| 76 | + | |
| 64 | 77 | |
| 65 | 78 | //按照时间段统计,公司下线路 (驾驶员) |
| 66 | 79 | @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(jGh,'/',jName) like %?6% order by c.xl") |
| ... | ... | @@ -78,40 +91,42 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ |
| 78 | 91 | |
| 79 | 92 | //按照时间段统计,公司下线路 (驾驶员) |
| 80 | 93 | @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr >= ?1 and c.rqStr <= ?2 and c.gsdm in(?3) and c.fgsdm in(?4) " + |
| 81 | - "and c.xl in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by c.jGh,c.fgsdm,c.xl,c.rqStr") | |
| 82 | - List<CalcWaybill> scheduleByJsy2(String date, String date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroym, List<String> line); | |
| 94 | + "and c.xl in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by c.jGh,c.fgsdm,c.xl,c.rqStr") | |
| 95 | + List<CalcWaybill> scheduleByJsy2(String date, String date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 83 | 96 | //按照时间段统计,公司下线路 (售票员) coalesce(c.sGh,'') |
| 84 | 97 | @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr >= ?1 and c.rqStr <= ?2 and c.gsdm in(?3) and c.fgsdm in(?4) and c.sGh <> null and c.sGh <> '' " + |
| 85 | - "and c.xl in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by c.sGh,c.fgsdm,c.xl,c.rqStr") | |
| 86 | - List<CalcWaybill> scheduleBySpy2(String date, String date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 98 | + "and c.xl in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by c.sGh,c.fgsdm,c.xl,c.rqStr") | |
| 99 | + List<CalcWaybill> scheduleBySpy2(String date, String date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 87 | 100 | //按照时间段统计,公司下线路 (车辆自编号) |
| 88 | 101 | @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr >= ?1 and c.rqStr <= ?2 and c.gsdm in(?3) and c.fgsdm in(?4) " + |
| 89 | - "and c.xl in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by c.cl,c.fgsdm,c.xl,c.rqStr") | |
| 90 | - List<CalcWaybill> scheduleByZbh2(String date, String date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 102 | + "and c.xl in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by c.cl,c.fgsdm,c.xl,c.rqStr") | |
| 103 | + List<CalcWaybill> scheduleByZbh2(String date, String date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 91 | 104 | //按照时间段统计,公司下线路 排序不同 |
| 92 | 105 | @Query(value="select DISTINCT c from CalcWaybill c where c.rqStr >= ?1 and c.rqStr <= ?2 and c.gsdm in(?3) and c.fgsdm in(?4) " + |
| 93 | - "and c.xl in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by c.fgsdm,c.xl,c.rqStr") | |
| 94 | - List<CalcWaybill> scheduleByDateAndLineTjPx(String date, String date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 106 | + "and c.xl in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by c.fgsdm,c.xl,c.rqStr") | |
| 107 | + List<CalcWaybill> scheduleByDateAndLineTjPx(String date, String date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 95 | 108 | |
| 96 | 109 | //路单没有的加油 |
| 97 | 110 | @Query(value="select DISTINCT y from Ylb y left join CalcWaybill c on y.rq = c.rq and y.xlbm = c.xl and y.jsy = c.jGh and y.nbbm = c.cl " + |
| 98 | 111 | "where y.rq >= ?1 and y.rq <= ?2 and y.ssgsdm in(?3) and y.fgsdm in(?4) and c.id is null " + |
| 99 | - "and y.xlbm in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by y.rq desc") //按日期倒序,方便插入list | |
| 100 | - List<Ylb> ylbNotSchedule(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 112 | + "and y.xlbm in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by y.rq desc") //按日期倒序,方便插入list | |
| 113 | + List<Ylb> ylbNotSchedule(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 101 | 114 | |
| 102 | - //路单没有的加油 | |
| 115 | + //路单没有的加电 | |
| 103 | 116 | @Query(value="select DISTINCT d from Dlb d left join CalcWaybill c on d.rq = c.rq and d.xlbm = c.xl and d.jsy = c.jGh and d.nbbm = c.cl " + |
| 104 | 117 | "where d.rq >= ?1 and d.rq <= ?2 and d.ssgsdm in(?3) and d.fgsdm in(?4) and c.id is null " + |
| 105 | - "and d.xlbm in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by d.rq desc") //按日期倒序,方便插入list | |
| 106 | - List<Dlb> dlbNotSchedule(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 118 | + "and d.xlbm in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by d.rq desc") //按日期倒序,方便插入list | |
| 119 | + List<Dlb> dlbNotSchedule(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 107 | 120 | |
| 121 | + //所有的加油,包含没有路单的 | |
| 108 | 122 | @Query(value="select DISTINCT y from Ylb y left join CalcWaybill c on y.rq = c.rq and y.xlbm = c.xl and y.jsy = c.jGh and y.nbbm = c.cl " + |
| 109 | 123 | "where y.rq >= ?1 and y.rq <= ?2 and y.ssgsdm in(?3) and y.fgsdm in(?4) " + |
| 110 | - "and y.xlbm in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by y.rq desc") //按日期倒序,方便插入list | |
| 111 | - List<Ylb> ylb(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 124 | + "and y.xlbm in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by y.rq desc") //按日期倒序,方便插入list | |
| 125 | + List<Ylb> ylb(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 112 | 126 | |
| 127 | + //所有的加电,包含没有路单的 | |
| 113 | 128 | @Query(value="select DISTINCT d from Dlb d left join CalcWaybill c on d.rq = c.rq and d.xlbm = c.xl and d.jsy = c.jGh and d.nbbm = c.cl " + |
| 114 | 129 | "where d.rq >= ?1 and d.rq <= ?2 and d.ssgsdm in(?3) and d.fgsdm in(?4) " + |
| 115 | - "and d.xlbm in (select l.lineCode from Line l where l.destroy in (?5) and l.lineCode in (?6)) order by d.rq desc") //按日期倒序,方便插入list | |
| 116 | - List<Dlb> dlb(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<Integer> destroy, List<String> line); | |
| 130 | + "and d.xlbm in (select l.lineCode from Line l where l.nature in (?5) and l.lineCode in (?6)) order by d.rq desc") //按日期倒序,方便插入list | |
| 131 | + List<Dlb> dlb(Date date, Date date2, List<String> gsdm, List<String> fgsdm, List<String> nature, List<String> line); | |
| 117 | 132 | } | ... | ... |
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
| ... | ... | @@ -1930,13 +1930,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 1930 | 1930 | @Override |
| 1931 | 1931 | public List<List<String>> calcDetailMonthly(Map<String, Object> map) { |
| 1932 | 1932 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| 1933 | - List<Integer> destroy= new ArrayList<>(); | |
| 1934 | - String destroyStr = ""; | |
| 1933 | + | |
| 1934 | + List<String> nature = calcRepository.allLineNature(); | |
| 1935 | 1935 | if(map.get("destroy")!=null){ |
| 1936 | - destroyStr = map.get("destroy").toString().trim(); | |
| 1937 | - String[] destroys = destroyStr.split(","); | |
| 1938 | - for (int i = 0; i < destroys.length; i++){ | |
| 1939 | - destroy.add(Integer.parseInt(destroys[i])); | |
| 1936 | + if("1".equals(map.get("destroy").toString())){ | |
| 1937 | + nature = calcRepository.serviceLineNature(); | |
| 1938 | + } else if("2".equals(map.get("destroy").toString())){ | |
| 1939 | + nature = calcRepository.notServiceLineNature(); | |
| 1940 | 1940 | } |
| 1941 | 1941 | } |
| 1942 | 1942 | List<String> gsdm= new ArrayList<>(); |
| ... | ... | @@ -2035,16 +2035,16 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 2035 | 2035 | int flag = 0; |
| 2036 | 2036 | if("jsy".equals(statisticalObj)){ |
| 2037 | 2037 | flag = 1; |
| 2038 | - list = calcRepository.scheduleByJsy2(startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2038 | + list = calcRepository.scheduleByJsy2(startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2039 | 2039 | } else if("cwy".equals(statisticalObj)){ |
| 2040 | 2040 | flag = 2; |
| 2041 | - list = calcRepository.scheduleBySpy2(startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2041 | + list = calcRepository.scheduleBySpy2(startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2042 | 2042 | } else if("cl".equals(statisticalObj)){ |
| 2043 | 2043 | flag = 3; |
| 2044 | - list = calcRepository.scheduleByZbh2( startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2044 | + list = calcRepository.scheduleByZbh2( startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2045 | 2045 | } else if("xl".equals(statisticalObj)){ |
| 2046 | 2046 | flag = 4; |
| 2047 | - list = calcRepository.scheduleByDateAndLineTjPx(startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2047 | + list = calcRepository.scheduleByDateAndLineTjPx(startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2048 | 2048 | } |
| 2049 | 2049 | |
| 2050 | 2050 | |
| ... | ... | @@ -2054,8 +2054,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 2054 | 2054 | if(flag != 2) |
| 2055 | 2055 | try { |
| 2056 | 2056 | //查询出没有路单的加油充电,插入到上面查询的结果集中汇总计算。 |
| 2057 | - List<Ylb> ylbNotSchedule = calcRepository.ylbNotSchedule(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, destroy, line); | |
| 2058 | - List<Dlb> dlbNotSchedule = calcRepository.dlbNotSchedule(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, destroy, line); | |
| 2057 | + List<Ylb> ylbNotSchedule = calcRepository.ylbNotSchedule(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, nature, line); | |
| 2058 | + List<Dlb> dlbNotSchedule = calcRepository.dlbNotSchedule(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, nature, line); | |
| 2059 | 2059 | for(Ylb y : ylbNotSchedule){ |
| 2060 | 2060 | Date ylbrq = y.getRq(); |
| 2061 | 2061 | String ylbxl = y.getXlbm(); |
| ... | ... | @@ -2773,13 +2773,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 2773 | 2773 | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| 2774 | 2774 | SimpleDateFormat dateFormatMon = new SimpleDateFormat("yyyy-MM"); |
| 2775 | 2775 | DecimalFormat df = new DecimalFormat("0.000");//格式化小数 |
| 2776 | - List<Integer> destroy= new ArrayList<>(); | |
| 2777 | - String destroyStr = ""; | |
| 2776 | + | |
| 2777 | + List<String> nature = calcRepository.allLineNature(); | |
| 2778 | 2778 | if(map.get("destroy")!=null){ |
| 2779 | - destroyStr = map.get("destroy").toString().trim(); | |
| 2780 | - String[] destroys = destroyStr.split(","); | |
| 2781 | - for (int i = 0; i < destroys.length; i++){ | |
| 2782 | - destroy.add(Integer.parseInt(destroys[i])); | |
| 2779 | + if("1".equals(map.get("destroy").toString())){ | |
| 2780 | + nature = calcRepository.serviceLineNature(); | |
| 2781 | + } else if("2".equals(map.get("destroy").toString())){ | |
| 2782 | + nature = calcRepository.notServiceLineNature(); | |
| 2783 | 2783 | } |
| 2784 | 2784 | } |
| 2785 | 2785 | List<String> gsdm= new ArrayList<>(); |
| ... | ... | @@ -2876,16 +2876,16 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 2876 | 2876 | int flag = 0; |
| 2877 | 2877 | if("jsy".equals(statisticalObj)){ |
| 2878 | 2878 | flag = 1; |
| 2879 | - list = calcRepository.scheduleByJsy2(startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2879 | + list = calcRepository.scheduleByJsy2(startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2880 | 2880 | } else if("cwy".equals(statisticalObj)){ |
| 2881 | 2881 | flag = 2; |
| 2882 | - list = calcRepository.scheduleBySpy2(startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2882 | + list = calcRepository.scheduleBySpy2(startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2883 | 2883 | } else if("cl".equals(statisticalObj)){ |
| 2884 | 2884 | flag = 3; |
| 2885 | - list = calcRepository.scheduleByZbh2( startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2885 | + list = calcRepository.scheduleByZbh2( startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2886 | 2886 | } else if("xl".equals(statisticalObj)){ |
| 2887 | 2887 | flag = 4; |
| 2888 | - list = calcRepository.scheduleByDateAndLineTjPx(startDate, endDate, gsdm, fgsdm, destroy, line); | |
| 2888 | + list = calcRepository.scheduleByDateAndLineTjPx(startDate, endDate, gsdm, fgsdm, nature, line); | |
| 2889 | 2889 | } |
| 2890 | 2890 | |
| 2891 | 2891 | // List类转换 |
| ... | ... | @@ -2909,8 +2909,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 2909 | 2909 | |
| 2910 | 2910 | if(flag != 2){ |
| 2911 | 2911 | try { |
| 2912 | - List<Ylb> ylb = calcRepository.ylb(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, destroy, line); | |
| 2913 | - List<Dlb> dlb = calcRepository.dlb(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, destroy, line); | |
| 2912 | + List<Ylb> ylb = calcRepository.ylb(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, nature, line); | |
| 2913 | + List<Dlb> dlb = calcRepository.dlb(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, nature, line); | |
| 2914 | 2914 | |
| 2915 | 2915 | for(Ylb y : ylb){ |
| 2916 | 2916 | String key = y.getSsgsdm() + "_" + y.getFgsdm() + "_" + y.getXlbm(); |
| ... | ... | @@ -2925,6 +2925,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer |
| 2925 | 2925 | cNew.setXl(y.getXlbm()); |
| 2926 | 2926 | cNew.setXlName(BasicData.lineCodeAllNameMap.get(y.getXlbm())); |
| 2927 | 2927 | cNew.setGsdm(y.getSsgsdm()); |
| 2928 | + System.out.println("map:" + BasicData.businessCodeNameMap); | |
| 2929 | + System.out.println(y.getSsgsdm()); | |
| 2928 | 2930 | cNew.setGsname(BasicData.businessCodeNameMap.get(y.getSsgsdm())); |
| 2929 | 2931 | cNew.setFgsdm(y.getFgsdm()); |
| 2930 | 2932 | cNew.setFgsname(BasicData.businessFgsCodeNameMap.get(y.getFgsdm()+"_"+y.getSsgsdm())); | ... | ... |
src/main/resources/static/pages/forms/calc/calcDetailMonthly.html
| ... | ... | @@ -86,9 +86,9 @@ |
| 86 | 86 | <div style="display: inline-block; margin-left: 13px;"> |
| 87 | 87 | <span class="item-label" style="width: 80px;">线路性质: </span> |
| 88 | 88 | <select class="form-control" name="destroy" id="destroy" style="width: 150px;"> |
| 89 | - <option value="0,1">全部线路</option> | |
| 90 | - <option value="0">营运线路</option> | |
| 91 | - <option value="1">非营运线路</option> | |
| 89 | + <option value="0">全部线路</option> | |
| 90 | + <option value="1">营运线路</option> | |
| 91 | + <option value="2">非营运线路</option> | |
| 92 | 92 | </select> |
| 93 | 93 | </div> |
| 94 | 94 | <div style="display: inline-block;margin-left: 13px;"> | ... | ... |
src/main/resources/static/pages/forms/calc/calcDetailYear.html
| ... | ... | @@ -86,9 +86,9 @@ |
| 86 | 86 | <div style="display: inline-block; margin-left: 13px;"> |
| 87 | 87 | <span class="item-label" style="width: 80px;">线路性质: </span> |
| 88 | 88 | <select class="form-control" name="destroy" id="destroy" style="width: 150px;"> |
| 89 | - <option value="0,1">全部线路</option> | |
| 90 | - <option value="0">营运线路</option> | |
| 91 | - <option value="1">非营运线路</option> | |
| 89 | + <option value="0">全部线路</option> | |
| 90 | + <option value="1">营运线路</option> | |
| 91 | + <option value="2">非营运线路</option> | |
| 92 | 92 | </select> |
| 93 | 93 | </div> |
| 94 | 94 | <div style="display: inline-block;margin-left: 13px;"> | ... | ... |