Commit 163a5e69ce0de6952325884f4c8a727ee5a823cd

Authored by 游瑞烽
1 parent c2f9e8ab

1.录单明细月年报表修改

2.线路版本修改增加版本名称
src/main/java/com/bsth/XDApplication.java
... ... @@ -71,6 +71,8 @@ public class XDApplication implements CommandLineRunner {
71 71  
72 72 @Autowired
73 73 GpsDataLoaderThread gpsDataLoader;
  74 + @Autowired
  75 + RfidDataLoaderThread rfidDataLoader;
74 76  
75 77 @Autowired
76 78 OfflineMonitorThread offlineMonitorThread;
... ...
src/main/java/com/bsth/repository/LineVersionsRepository.java
... ... @@ -36,9 +36,9 @@ public interface LineVersionsRepository extends BaseRepository<LineVersions, Int
36 36 @Transactional
37 37 @Modifying
38 38 @Query(value = "UPDATE LineVersions lv set lv.line=?2, lv.lineCode=?3, lv.startDate=?4, lv.endDate=?5, "
39   - + "lv.versions=?6, lv.status=?7, lv.remark=?8 where lv.id=?1")
  39 + + "lv.versions=?6, lv.status=?7, lv.remark=?8, lv.name=?9 where lv.id=?1")
40 40 public int update(Integer id, Line line, String lineCode, Date startDate, Date endDate, Integer versions, Integer status,
41   - String remark);
  41 + String remark,String name);
42 42  
43 43 /**
44 44 * 查询待更新线路的线路版本
... ...
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
... ... @@ -74,17 +74,17 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ
74 74  
75 75  
76 76 //按照时间段统计,公司下线路 (驾驶员)
77   - @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% order by c.jGh,c.xl,c.rq")
78   - List<CalcWaybill> scheduleByJsy2(String line,String date,String date2,String gsdm,String fgsdm);
  77 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) order by c.jGh,c.fgsdm,c.xl,c.rq")
  78 + List<CalcWaybill> scheduleByJsy2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
79 79 //按照时间段统计,公司下线路 (售票员) coalesce(c.sGh,'')
80   - @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 c.sGh <> null and c.sGh <> '' order by c.sGh,c.xl,c.rq")
81   - List<CalcWaybill> scheduleBySpy2(String line,String date,String date2,String gsdm,String fgsdm);
  80 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) and c.sGh <> null and c.sGh <> '' order by c.sGh,c.fgsdm,c.xl,c.rq")
  81 + List<CalcWaybill> scheduleBySpy2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
82 82 //按照时间段统计,公司下线路 (车辆自编号)
83   - @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% order by c.cl,c.xl,c.rq")
84   - List<CalcWaybill> scheduleByZbh2(String line,String date,String date2,String gsdm,String fgsdm);
  83 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) order by c.cl,c.fgsdm,c.xl,c.rq")
  84 + List<CalcWaybill> scheduleByZbh2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
85 85 //按照时间段统计,公司下线路 排序不同
86   - @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% order by c.xl,c.rq")
87   - List<CalcWaybill> scheduleByDateAndLineTjPx(String line,String date,String date2,String gsdm,String fgsdm);
  86 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) order by c.fgsdm,c.xl,c.rq")
  87 + List<CalcWaybill> scheduleByDateAndLineTjPx(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
88 88 //按照时间段统计,单条线路 排序不同
89 89 @Query(value="select DISTINCT c from CalcWaybill c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl,c.rq")
90 90 List<CalcWaybill> scheduleByDateAndLineTjPx2(String line,String date,String date2);
... ...
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
1 1 package com.bsth.service.calc.impl;
2 2  
3   -import java.sql.ResultSet;
4   -import java.sql.SQLException;
5   -import java.text.DecimalFormat;
6   -import java.text.ParseException;
7   -import java.text.SimpleDateFormat;
8   -import java.util.*;
9   -import java.util.Map.Entry;
10   -
11   -import javax.transaction.Transactional;
12   -
13 3 import com.alibaba.fastjson.JSON;
14 4 import com.alibaba.fastjson.JSONArray;
15 5 import com.bsth.common.ResponseCode;
... ... @@ -21,7 +11,6 @@ import com.bsth.entity.calc.CalcLineMileage;
21 11 import com.bsth.entity.calc.CalcStatistics;
22 12 import com.bsth.entity.calc.CalcWaybill;
23 13 import com.bsth.entity.calc.CalcWaybillDetail;
24   -import com.bsth.entity.mcy_forms.Singledata;
25 14 import com.bsth.entity.oil.Dlb;
26 15 import com.bsth.entity.oil.Ylb;
27 16 import com.bsth.entity.realcontrol.ChildTaskPlan;
... ... @@ -42,12 +31,10 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService;
42 31 import com.bsth.service.report.CulateMileageService;
43 32 import com.bsth.service.report.ReportService;
44 33 import com.bsth.util.Arith;
45   -import com.bsth.util.BatchSaveUtils;
46 34 import com.bsth.util.ReportUtils;
47 35 import com.github.stuxuhai.jpinyin.PinyinException;
48 36 import com.github.stuxuhai.jpinyin.PinyinFormat;
49 37 import com.github.stuxuhai.jpinyin.PinyinHelper;
50   -
51 38 import org.apache.commons.lang3.StringUtils;
52 39 import org.slf4j.Logger;
53 40 import org.slf4j.LoggerFactory;
... ... @@ -57,6 +44,14 @@ import org.springframework.jdbc.core.JdbcTemplate;
57 44 import org.springframework.jdbc.core.RowMapper;
58 45 import org.springframework.stereotype.Service;
59 46  
  47 +import javax.transaction.Transactional;
  48 +import java.sql.ResultSet;
  49 +import java.sql.SQLException;
  50 +import java.text.DecimalFormat;
  51 +import java.text.ParseException;
  52 +import java.text.SimpleDateFormat;
  53 +import java.util.*;
  54 +
60 55 /**
61 56 * Created by 17/11/16.
62 57 */
... ... @@ -1810,17 +1805,41 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1810 1805  
1811 1806 @Override
1812 1807 public List<List<String>> calcDetailMonthly(Map<String, Object> map) {
1813   - String gsdm="";
  1808 +// String gsdm="";
  1809 +// if(map.get("gsdm")!=null){
  1810 +// gsdm=map.get("gsdm").toString().trim();
  1811 +// }
  1812 +// String fgsdm="";
  1813 +// if(map.get("fgsdm")!=null){
  1814 +// fgsdm=map.get("fgsdm").toString().trim();
  1815 +// }
  1816 + List<String> gsdm= new ArrayList<>();
  1817 + String gsdmStr = "";
1814 1818 if(map.get("gsdm")!=null){
1815   - gsdm=map.get("gsdm").toString().trim();
  1819 + gsdmStr = map.get("gsdm").toString().trim();
  1820 + String[] gsdms = gsdmStr.split(",");
  1821 + for (int i = 0; i < gsdms.length; i++){
  1822 + gsdm.add(gsdms[i]);
  1823 + }
1816 1824 }
1817   - String fgsdm="";
  1825 + List<String> fgsdm= new ArrayList<>();
  1826 + String fgsdmStr = "";
1818 1827 if(map.get("fgsdm")!=null){
1819   - fgsdm=map.get("fgsdm").toString().trim();
  1828 + fgsdmStr = map.get("fgsdm").toString().trim();
  1829 + String[] fgsdms = fgsdmStr.split(",");
  1830 + for (int i = 0; i < fgsdms.length; i++){
  1831 + fgsdm.add(fgsdms[i]);
  1832 + }
1820 1833 }
1821   - String line="";
  1834 +// String line= null;
  1835 + List<String> line= new ArrayList<>();
  1836 + String lineStr = "";
1822 1837 if(map.get("lineCode")!=null){
1823   - line=map.get("lineCode").toString().trim();
  1838 + lineStr = map.get("lineCode").toString().trim();
  1839 + String[] lines = lineStr.split(",");
  1840 + for (int i = 0; i < lines.length; i++){
  1841 + line.add(lines[i]);
  1842 + }
1824 1843 }
1825 1844 String startDate="";
1826 1845 if(map.get("startDate")!=null){
... ... @@ -1830,10 +1849,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1830 1849 if(map.get("endDate")!=null){
1831 1850 endDate=map.get("endDate").toString().trim();
1832 1851 }
1833   - String xlName="";
1834   - if(map.get("xlName")!=null){
1835   - xlName=map.get("xlName").toString().trim();
1836   - }
1837 1852 String type="";
1838 1853 if(map.get("type")!=null){
1839 1854 type=map.get("type").toString().trim();
... ... @@ -1846,6 +1861,18 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1846 1861 if(map.get("itemDetails")!=null){
1847 1862 itemDetails=map.get("itemDetails").toString().trim();
1848 1863 }
  1864 +// Boolean item=false;
  1865 + /*String item="";
  1866 + if(map.get("item")!=null){
  1867 + if("dh".equals(map.get("item").toString().trim()))
  1868 + item=" where c.sfdc = 1";
  1869 +// item=false;
  1870 + else if ("dh".equals(map.get("item").toString().trim()))
  1871 + item=" where c.sfdc = 0";
  1872 +// item=true;
  1873 + else
  1874 + item="";
  1875 + }*/
1849 1876 String timeType=map.get("timeType").toString().trim();
1850 1877  
1851 1878 List<List<String>> resList = new ArrayList<>();
... ... @@ -1871,7 +1898,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1871 1898 day2 = Integer.parseInt(endDate.substring(5,7));
1872 1899 for(int i=day; i<=day2; i++){
1873 1900 Map<String, CalcWaybillDetail> daym = new HashMap<>();
1874   - daym.put(startDate.substring(0,7),this.initCalcWaybillDetail());
  1901 + daym.put(startDate.substring(0,5)+(i<10?"0"+i:i),this.initCalcWaybillDetail());
1875 1902 dayList.add(daym);
1876 1903 }
1877 1904 startDate += "-01";
... ... @@ -1917,14 +1944,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1917 1944 // 把油量和电量数据查出来,封装成Map,计算时直接取
1918 1945 if(flag != 2 ){
1919 1946 String linesql="";
1920   - if(!line.equals("")){
1921   - linesql +=" and xlbm ='"+line+"' ";
  1947 + if(!lineStr.equals("")){
  1948 + linesql +=" and xlbm in("+lineStr+") ";
1922 1949 }
1923   - if(!gsdm.equals("")){
1924   - linesql +=" and ssgsdm ='"+gsdm+"' ";
  1950 + if(!gsdmStr.equals("")){
  1951 + linesql +=" and ssgsdm in("+gsdmStr+") ";
1925 1952 }
1926   - if(!fgsdm.equals("")){
1927   - linesql +=" and fgsdm ='"+fgsdm+"' ";
  1953 + if(!fgsdmStr.equals("")){
  1954 + linesql +=" and fgsdm in("+fgsdmStr+") ";
1928 1955 }
1929 1956 String ylsql="SELECT * FROM bsth_c_ylb"
1930 1957 // String ylsql="SELECT id,xlbm,nbbm,jsy,jzl,czyl,jzyl,yh,sh,fgsdm FROM bsth_c_ylb"
... ... @@ -2021,11 +2048,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2021 2048 // 横向数据的第几天下标
2022 2049 int dayIndex = 0;
2023 2050 int dayIndexPrev = -1;
2024   - CalcWaybillDetail cwNext = null;
2025 2051 // 报表纵向列数据生成
2026 2052 for (int i = 0; listNew.size() > i; i++) {
2027 2053 CalcWaybillDetail cw = listNew.get(i);
2028 2054  
  2055 + CalcWaybillDetail cwNext = new CalcWaybillDetail();
2029 2056 if(i<listNew.size()-1){
2030 2057 cwNext = listNew.get(i+1);
2031 2058 }
... ... @@ -2034,53 +2061,16 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2034 2061 String cwy = cw.getsGh();
2035 2062 String cl = cw.getCl();
2036 2063  
2037   - String key = "",keyNext = "";
2038   - if(flag == 1){
2039   - if(cw.getjGh() != null && cw.getjName() != null)
2040   - key += cw.getjGh() + "/" + cw.getjName();
2041   - if(cwNext.getjGh() != null && cwNext.getjName() != null)
2042   - keyNext += cwNext.getjGh() + "/" + cwNext.getjName();
2043   - } else if(flag == 2){
2044   - if(cw.getsGh() != null && cw.getsName() != null)
2045   - key += cw.getsGh() + "/" + cw.getsName();
2046   - if(cwNext.getsGh() != null && cwNext.getsName() != null)
2047   - keyNext += cwNext.getsGh() + "/" + cwNext.getsName();
2048   - } else if(flag == 3){
2049   - if(cw.getCl() != null)
2050   - key += cw.getCl();
2051   - if(cwNext.getCl() != null)
2052   - keyNext += cwNext.getCl();
2053   - }
2054   - key = cw.getXl() + "/" + key;
2055   - keyNext = cwNext.getXl() + "/" + keyNext;
2056   - CalcWaybillDetail calc = new CalcWaybillDetail();
2057   - List<CalcWaybillDetail> calcList = new ArrayList<>();
2058   - // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加
2059   - boolean ifFirst = false;
2060   - if(keyMapList.containsKey(key)){
2061   - calc = keyMap.get(key);
2062   - calcList = keyMapList.get(key);
2063   - } else {
2064   -// calc = this.initCalcWaybillDetail();
2065   - // 深度拷贝对象
2066   - BeanUtils.copyProperties(cw,calc);
2067   - keyMap.put(key, calc);
2068   - dayIndex = 0;
2069   - ifFirst = true;
2070   - }
2071   -
2072   -
2073 2064 Ylb y = new Ylb();
2074 2065 Dlb d = new Dlb();
2075 2066 // 统计类型不同统计的左边列不同
  2067 + // 赋值油、电量
2076 2068 if(flag != 2){
2077 2069 // 取了之后删除,防止重复取,应为添加的时候已经合并了
2078 2070 y = ylbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2079 2071 ylbMap.remove(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2080 2072 d = dlbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2081 2073 dlbMap.remove(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2082   -// y = ylbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getjName()+"_"+cw.getCl());
2083   -// d = dlbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getjName()+"_"+cw.getCl());
2084 2074 if(y != null){
2085 2075 cw.setZlc(y.getZlc());
2086 2076 cw.setYh(y.getYh());
... ... @@ -2103,11 +2093,41 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2103 2093 cw.setCdl(d.getCdl());
2104 2094 cw.setBglyh((d.getZlc()==0? 0:100*d.getHd()/d.getZlc()));
2105 2095 }
  2096 + }
2106 2097  
2107   - }/* else if(flag == 3){
2108   - y = ylbCLMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getCl());
2109   - d = dlbCLMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getCl());
2110   - }*/
  2098 + String key = "",keyNext = "";
  2099 + if(flag == 1){
  2100 + if(cw.getjGh() != null && cw.getjName() != null)
  2101 + key += cw.getjGh() + "/" + cw.getjName();
  2102 + if(cwNext.getjGh() != null && cwNext.getjName() != null)
  2103 + keyNext += cwNext.getjGh() + "/" + cwNext.getjName();
  2104 + } else if(flag == 2){
  2105 + if(cw.getsGh() != null && cw.getsName() != null)
  2106 + key += cw.getsGh() + "/" + cw.getsName();
  2107 + if(cwNext.getsGh() != null && cwNext.getsName() != null)
  2108 + keyNext += cwNext.getsGh() + "/" + cwNext.getsName();
  2109 + } else if(flag == 3){
  2110 + if(cw.getCl() != null)
  2111 + key += cw.getCl();
  2112 + if(cwNext.getCl() != null)
  2113 + keyNext += cwNext.getCl();
  2114 + }
  2115 + key = cw.getFgsdm()+"/"+cw.getXl() + "/" + key;
  2116 + keyNext = cw.getFgsdm()+"/"+cwNext.getXl() + "/" + keyNext;
  2117 + CalcWaybillDetail calc = new CalcWaybillDetail();
  2118 + List<CalcWaybillDetail> calcList = new ArrayList<>();
  2119 + // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加
  2120 + boolean ifFirst = false;
  2121 + if(keyMapList.containsKey(key)){
  2122 + calc = keyMap.get(key);
  2123 + calcList = keyMapList.get(key);
  2124 + } else {
  2125 + // 深度拷贝对象
  2126 + BeanUtils.copyProperties(cw,calc);
  2127 + keyMap.put(key, calc);
  2128 + dayIndex = 0;
  2129 + ifFirst = true;
  2130 + }
2111 2131  
2112 2132 CalcWaybillDetail dayc = null;
2113 2133 if("m".equals(timeType)){
... ... @@ -2148,13 +2168,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2148 2168  
2149 2169 // 把下标
2150 2170 dayIndexPrev = dayIndex;
2151   -
2152   -// if(cw.getjGh().equals("007951") && cw.getXlName().equals("浦东40路")){
2153   -// System.out.println();
2154   -// }
2155   - /*if(cw.getCl().equals("W0F-058") || cw.getCl().equals("W2F-051") || cw.getCl().equals("S2E-029") || cw.getCl().equals("W1G-058")){
2156   - System.out.println();
2157   - }*/
2158 2171 // timeType 为m 月报表时,日期不一样就换列,为y 年报表是,月份不一样换列
2159 2172 if("m".equals(timeType) && cwNext != null && key.equals(keyNext) && !cw.getRqStr().equals(cwNext.getRqStr())){
2160 2173 dayIndex++;
... ... @@ -2166,8 +2179,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2166 2179 calcList.add(new CalcWaybillDetail());
2167 2180 dayIndex++;
2168 2181 }
  2182 + // 换列了从头开始,上一个下标赋值为初始
2169 2183 dayIndexPrev = -1;
2170   -// dayIndexPrev = dayIndex = 0;
2171 2184 }
2172 2185 // 右边可变列添加数据
2173 2186 keyMapList.put(key,calcList);
... ... @@ -2196,14 +2209,17 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2196 2209 for(int i=day; i<=day2; i++){
2197 2210 list1.add((i<10?"0"+i:i)+("m".equals(timeType)?"日":"月"));
2198 2211 }
  2212 + if("bgldh".equals(itemDetails) || "bglyh".equals(itemDetails)){
  2213 + list1.add("平均");
  2214 + } else
  2215 + list1.add("合计");
2199 2216 resList.add(list1);
2200 2217  
2201 2218 int i=1;
2202 2219  
2203 2220 DecimalFormat df = new DecimalFormat("0.00");//格式化小数
  2221 + double allNum = 0.0;
2204 2222 while (iter.hasNext()) {
2205   -// List list = new ArrayList();
2206   -
2207 2223 Map.Entry entry = (Map.Entry) iter.next();
2208 2224 // 获取key
2209 2225 String key = (String) entry.getKey();
... ... @@ -2236,6 +2252,10 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2236 2252 listStr.add(df.format(c.getLjyylc()+c.getLjfyylc()));
2237 2253 listStr.add(df.format(c.getLblc()));
2238 2254 listStr.add(c.getTs()+"");
  2255 + c.setBglhd(c.getBglhd()/c.getTs());
  2256 + c.setBglyh(c.getBglyh()/c.getTs());
  2257 + // 把列合计的数添加到最后一个
  2258 + cList.add(c);
2239 2259 // DecimalFormat df = new DecimalFormat("0.00");//格式化小数
2240 2260 for (CalcWaybillDetail c1:cList) {
2241 2261 if(StringUtils.isEmpty(c1.getXl())) {
... ... @@ -2254,7 +2274,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2254 2274 } else if("cccy".equals(itemDetails)){
2255 2275 listStr.add(df.format(c1.getCzyl()));
2256 2276 } else if("bglyh".equals(itemDetails)){
2257   - listStr.add(df.format(c1.getBglyh()));
  2277 +// listStr.add(df.format(c1.getBglyh()));
  2278 + listStr.add(df.format(c1.getZlc()==0? 0:100*c1.getYh()/c1.getZlc()));
2258 2279 } else if("dh".equals(itemDetails)){
2259 2280 listStr.add(df.format(c1.getHd()));
2260 2281 } else if("cdl".equals(itemDetails)){
... ... @@ -2264,7 +2285,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2264 2285 } else if("jccd".equals(itemDetails)){
2265 2286 listStr.add(df.format(c1.getJzcd()));
2266 2287 } else if("bgldh".equals(itemDetails)){
2267   - listStr.add(df.format(c1.getBglhd()));
  2288 + listStr.add(df.format(c1.getZlc()==0? 0:100*c1.getHd()/c1.getZlc()));
  2289 +// listStr.add(df.format(c1.getBglhd()));
2268 2290 } else if("zgl".equals(itemDetails)){
2269 2291 listStr.add(df.format((c1.getSjyylc()+c1.getSjfyylc()+c1.getLjfyylc()+c1.getLjyylc())));
2270 2292 } else if("jhgl".equals(itemDetails)){
... ... @@ -2276,6 +2298,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2276 2298 }
2277 2299 }
2278 2300 }
  2301 + allNum = allNum + Double.parseDouble(listStr.get(listStr.size()-1));
2279 2302 resList.add(listStr);
2280 2303 }
2281 2304  
... ... @@ -2289,6 +2312,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2289 2312 listEnd.add(df.format(zjCalc.getLjfyylc()+zjCalc.getLjyylc()));
2290 2313 listEnd.add(df.format(zjCalc.getLblc()));
2291 2314 listEnd.add(zjCalc.getTs()+"");
  2315 + double all = 0.0;
2292 2316 for (Map<String, CalcWaybillDetail> cmap:dayList) {
2293 2317 for (Map.Entry<String, CalcWaybillDetail> cw : cmap.entrySet()) {
2294 2318 // System.out.println("key = " + cw.getKey() + ", value = " + cw.getValue());
... ... @@ -2306,7 +2330,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2306 2330 } else if("cccy".equals(itemDetails)){
2307 2331 listEnd.add(df.format(c1.getCzyl()));
2308 2332 } else if("bglyh".equals(itemDetails)){
2309   - listEnd.add(df.format(c1.getBglyh()));
  2333 +// listEnd.add(df.format(c1.getBglyh()));
  2334 + listEnd.add(df.format(c1.getZlc()==0? 0:100*c1.getYh()/c1.getZlc()));
2310 2335 } else if("dh".equals(itemDetails)){
2311 2336 listEnd.add(df.format(c1.getHd()));
2312 2337 } else if("cdl".equals(itemDetails)){
... ... @@ -2316,7 +2341,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2316 2341 } else if("jccd".equals(itemDetails)){
2317 2342 listEnd.add(df.format(c1.getJzcd()));
2318 2343 } else if("bgldh".equals(itemDetails)){
2319   - listEnd.add(df.format(c1.getBglhd()));
  2344 +// listEnd.add(df.format(c1.getBglhd()));
  2345 + listEnd.add(df.format(c1.getZlc()==0? 0:100*c1.getHd()/c1.getZlc()));
2320 2346 } else if("zgl".equals(itemDetails)){
2321 2347 listEnd.add((df.format(c1.getSjyylc()+c1.getSjfyylc()+c1.getLjfyylc()+c1.getLjyylc())));
2322 2348 } else if("jhgl".equals(itemDetails)){
... ... @@ -2325,10 +2351,18 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2325 2351 listEnd.add(c1.getSjyybc()+c1.getSjfyybc()+"");
2326 2352 } else if("jhbc".equals(itemDetails)){
2327 2353 listEnd.add((c1.getJhyybc()+c1.getJhfyybc())+"");
2328   -
2329 2354 }
2330 2355 }
  2356 + all = all + Double.parseDouble(listEnd.get(listEnd.size()-1));
  2357 + }
  2358 +
  2359 + // 百公里电油耗时为平均数
  2360 + if("bgldh".equals(itemDetails) || "bglyh".equals(itemDetails)){
  2361 + allNum = allNum/keyMap.size();
  2362 + all = all/dayList.size();
2331 2363 }
  2364 +// listEnd.add(df.format(allNum)+"/"+df.format(all));
  2365 + listEnd.add(df.format(all));
2332 2366 resList.add(listEnd);
2333 2367  
2334 2368 return resList;
... ...
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
... ... @@ -89,12 +89,13 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
89 89 String lineCode = map.get("lineCode").toString();
90 90 Integer versions = Integer.valueOf(map.get("versions").toString());
91 91 Integer status = Integer.valueOf(map.get("status").toString());
  92 + String name = map.get("name").toString();
92 93 String remark = map.get("remark").toString();
93   -
  94 +
94 95 Line line = lineRepository.findOne(lineid);
95 96  
96 97 int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()),
97   - new java.sql.Date(endDate.getTime()),versions,status,remark);
  98 + new java.sql.Date(endDate.getTime()),versions,status,remark,name);
98 99 LineVersions upLineVersions = repository.findBylineIdAndVersions(line.getId(),versions);
99 100 if(upLineVersions != null){
100 101 upLineVersions.setEndDate(new java.sql.Date(startDate.getTime()));
... ...
src/main/resources/static/pages/base/lineversions/edit.html
... ... @@ -47,7 +47,16 @@
47 47 <input type="hidden" name="status" id="statusInput" />
48 48 <input type="hidden" name="Id" id="IdInput" />
49 49 <!-- 表单分组组件 form-group END -->
50   -
  50 +
  51 + <div class="form-group">
  52 + <label class="control-label col-md-5">
  53 + <span class="required"> * </span>线路版本名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  54 + </label>
  55 + <div class="col-md-4">
  56 + <input name="name" class="form-control" style="width:100%" id="nameInput" placeholder="请填写更换版本原因,方便排班人员操作!" />
  57 + </div>
  58 + </div>
  59 +
51 60 <!-- 表单分组组件 form-group START -->
52 61 <div class="form-group">
53 62 <label class="control-label col-md-5">
... ... @@ -110,7 +119,7 @@
110 119 <div class="form-group">
111 120 <label class="control-label col-md-5"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
112 121 <div class="col-md-4">
113   - <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" placeholder="请填写更换版本原因,方便排班人员操作!"></textarea>
  122 + <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" ></textarea>
114 123 </div>
115 124 </div>
116 125 <!-- 表单分组组件 form-group END -->
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-edit-from.js
... ... @@ -90,6 +90,7 @@
90 90 $("#endDateInput").val(moment(result.endDate).format('YYYY-MM-DD HH:mm:ss'));
91 91 $("#versionsInput").val(result.versions);
92 92 $("#statusInput").val(result.status);
  93 + $("#nameInput").val(result.name);
93 94 $("#remarkTextarea").val(result.remark);
94 95 }
95 96  
... ... @@ -144,6 +145,7 @@
144 145 'line' : {required : true,maxlength: 30},// 线路名称 必填项、最大长度.
145 146 'startDate' : {required : true},// 启用时间 不为空.
146 147 'endDate' : {required : true},// 结束时间.
  148 + 'name' : {required : true},// 版本名称.
147 149 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
148 150 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
149 151 },
... ...
src/main/resources/static/pages/forms/calc/calcDetailMonthly.html
... ... @@ -76,10 +76,10 @@
76 76  
77 77 <div style="display: inline-block;margin-left: 33px;" class="date-picker">
78 78 <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>
79   - <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" /> - -->
80   - <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" />-->
81   - <input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> -
82   - <input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>
  79 + <input class="form-control" type="text" id="startDate" style="width: 180px;" /> -
  80 + <input class="form-control" type="text" id="endDate" style="width: 180px;" />
  81 + <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
  82 + <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
83 83 </div>
84 84 <div style="margin-top: 2px"></div>
85 85  
... ... @@ -130,6 +130,7 @@
130 130 </div>
131 131 <script >
132 132 $(function(){
  133 + $('#export').attr('disabled', "true");
133 134 // 关闭左侧栏
134 135 if (!$('body').hasClass('page-sidebar-closed'))
135 136 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -150,72 +151,45 @@
150 151 day = "0" + day;
151 152 //时间
152 153 var dateTime=year + "-" + month + "-" + day;
153   - // $("#startDate").val(dateTime);
154   - // $("#endDate").val(dateTime);
  154 + $("#startDate").val(dateTime);
  155 + $("#endDate").val(dateTime);
155 156  
156   - // $("#endDate").datetimepicker({
157   - // format : 'YYYY-MM-DD',
158   - // locale : 'zh-cn',
159   - // maxDate : dateTime
160   - // });
161   - // $("#startDate").datetimepicker({
162   - // format : 'YYYY-MM-DD',
163   - // locale : 'zh-cn',
164   - // maxDate : dateTime
165   - // });
  157 + $("#endDate").datetimepicker({
  158 + format : 'YYYY-MM-DD',
  159 + locale : 'zh-cn',
  160 + maxDate : dateTime
  161 + });
  162 + $("#startDate").datetimepicker({
  163 + format : 'YYYY-MM-DD',
  164 + locale : 'zh-cn',
  165 + maxDate : dateTime
  166 + });
166 167  
167   - var fage=false;
168   - var xlList;
169   - var obj = [];
  168 + var lineAll="";
170 169 var datas = {}; //查询条件
171 170  
172   - var tempData = {};
173   -
174   - $.get('/report/lineList',function(result){
175   - xlList=result;
176   - $.get('/user/companyData', function(result){
177   - obj = result;
178   - var options = '<option value="">所有分公司</option>';
179   - for(var i = 0; i < obj.length; i++){
180   - if(obj[i].companyCode == "26"){
181   - var children = obj[i].children;
182   - for(var j = 0; j < children.length; j++){
183   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
184   - }
185   - }
186   - }
187   - $('#fgsdm').html(options);
188   - });
  171 + /**用户分配的线路*/
  172 + $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  173 + lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
189 174 });
190 175  
  176 + var tempData = {};
191 177  
192   - // $("#gsdm").on("change",updateCompany);
193   - function updateCompany(){
194   - // var company = $('#gsdm').val();
195   - var options = '<option value="">所有分公司</option>';
196   - for(var i = 0; i < obj.length; i++){
197   - if(obj[i].companyCode == "26"){
  178 + $.get('/user/companyData', function(obj) {
  179 + var option = '';
  180 + var allC = "";
  181 + for (var i = 0; i < obj.length; i++) {
  182 + if (obj[i].companyCode == "26") {
198 183 var children = obj[i].children;
199   - for(var j = 0; j < children.length; j++){
200   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  184 + for (var j = 0; j < children.length; j++) {
  185 + allC += children[j].code+",";
  186 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
201 187 }
202 188 }
203 189 }
204   - $('#fgsdm').html(options);
205   - }
206 190  
207   - $("#line").on("change", function(){
208   - if($("#line").val() == " "){
209   - $("#gsdm").attr("disabled", false);
210   - $("#fgsdm").attr("disabled", false);
211   - } else {
212   - var temp = tempData[$("#line").val()].split(":");
213   - $("#gsdm").val(temp[0]);
214   - updateCompany();
215   - $("#fgsdm").val(temp[1]);
216   - $("#gsdm").attr("disabled", true);
217   - $("#fgsdm").attr("disabled", true);
218   - }
  191 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  192 + $('#fgsdm').html(options);
219 193 });
220 194  
221 195 // 项目明细选项列
... ... @@ -256,11 +230,9 @@
256 230 $("#query").on("click",function(){
257 231 var gsdm = "26";
258 232 var fgsdm = $("#fgsdm").val();
259   - var lineCode = $("#line").val();
260 233 var startDate = $("#startDate").val();
261 234 var endDate = $("#endDate").val();
262 235 var statisticalObj = $("#statisticalObj").val();
263   - lineName=$("#line option:selected").text();
264 236 //开始和结束时间
265 237 var startTime = Date.parse(new Date(startDate));
266 238 var endTime = Date.parse(new Date(endDate));
... ... @@ -268,16 +240,12 @@
268 240 datas = {}; // 清空之前数据
269 241 datas.gsdm = gsdm;
270 242 datas.fgsdm = fgsdm;
271   - datas.lineCode = lineCode;
272   - datas.lineName = lineName;
273   - datas.startDate = startDate;
  243 + datas.lineCode = lineAll;
274 244 datas.timeType = "m";
275   - // datas.startDate = "2020-10-01";
  245 + datas.startDate = startDate;
276 246 datas.endDate = endDate;
277   - // datas.endDate = "2020-10-10";
278 247 datas.statisticalObj = $("#statisticalObj").val();
279 248 datas.itemDetails = $("#itemDetails").val();
280   -
281 249 if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
282 250 layer.msg('请选择时间段!');
283 251 }else if(endTime<startTime){
... ... @@ -295,8 +263,10 @@
295 263 title: '提示'
296 264 , content: '没有您要查询的数据,请重新选择参数!'
297 265 });
  266 + $("#export").attr('disabled',"true");
298 267 return;
299   - }
  268 + }else
  269 + $("#export").removeAttr("disabled");
300 270 var htmlHead = "", htmlBody = "";
301 271 var rsLength = rs.length;
302 272 rs.forEach(function (o, i) {
... ... @@ -323,7 +293,6 @@
323 293 });
324 294  
325 295 $("#export").on("click",function(){
326   - datas.timeType = "m";
327 296 var itemDetails = datas.itemDetails,
328 297 type = "加注量[全部]";
329 298 if(itemDetails=="jzl0"){
... ...
src/main/resources/static/pages/forms/calc/calcDetailYear.html
... ... @@ -130,6 +130,7 @@
130 130 </div>
131 131 <script >
132 132 $(function(){
  133 + $('#export').attr('disabled', "true");
133 134 // 关闭左侧栏
134 135 if (!$('body').hasClass('page-sidebar-closed'))
135 136 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -161,66 +162,42 @@
161 162 maxDate : dateTime
162 163 });
163 164  
164   - var fage=false;
165   - var xlList;
166   - var obj = [];
  165 +
  166 + var lineAll="";
167 167 var datas = {}; //查询条件
168 168  
169   - var tempData = {};
170 169  
171   - $.get('/report/lineList',function(result){
172   - xlList=result;
173   - $.get('/user/companyData', function(result){
174   - obj = result;
175   - var options = '<option value="">所有分公司</option>';
176   - for(var i = 0; i < obj.length; i++){
177   - if(obj[i].companyCode == "26"){
178   - var children = obj[i].children;
179   - for(var j = 0; j < children.length; j++){
180   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
181   - }
182   - }
183   - }
184   - $('#fgsdm').html(options);
185   - });
  170 + /**用户分配的线路*/
  171 + $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  172 + lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
186 173 });
187 174  
  175 + var tempData = {};
188 176  
189   - // $("#gsdm").on("change",updateCompany);
190   - function updateCompany(){
191   - // var company = $('#gsdm').val();
192   - var options = '<option value="">所有分公司</option>';
193   - for(var i = 0; i < obj.length; i++){
194   - if(obj[i].companyCode == "26"){
  177 + $.get('/user/companyData', function(obj) {
  178 + var option = '';
  179 + var allC = "";
  180 + for (var i = 0; i < obj.length; i++) {
  181 + if (obj[i].companyCode == "26") {
195 182 var children = obj[i].children;
196   - for(var j = 0; j < children.length; j++){
197   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  183 + for (var j = 0; j < children.length; j++) {
  184 + allC += children[j].code+",";
  185 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
198 186 }
199 187 }
200 188 }
201   - $('#fgsdm').html(options);
202   - }
203 189  
204   - $("#line").on("change", function(){
205   - if($("#line").val() == " "){
206   - $("#gsdm").attr("disabled", false);
207   - $("#fgsdm").attr("disabled", false);
208   - } else {
209   - var temp = tempData[$("#line").val()].split(":");
210   - $("#gsdm").val(temp[0]);
211   - updateCompany();
212   - $("#fgsdm").val(temp[1]);
213   - $("#gsdm").attr("disabled", true);
214   - $("#fgsdm").attr("disabled", true);
215   - }
  190 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  191 + $('#fgsdm').html(options);
216 192 });
217 193  
218 194 // 项目明细选项列
219 195 // 触发默认选项
220 196 updateItem();
221 197 $("#statisticalItem").on("change",updateItem);
  198 + var item ="";
222 199 function updateItem() {
223   - var item = $('#statisticalItem').val();
  200 + item = $('#statisticalItem').val();
224 201 var options = '';
225 202 if(item == "yh"){
226 203 options += '<option value="jzlAll">加注量[全部]</option>' +
... ... @@ -253,11 +230,9 @@
253 230 $("#query").on("click",function(){
254 231 var gsdm = "26";
255 232 var fgsdm = $("#fgsdm").val();
256   - var lineCode = $("#line").val();
257 233 var startDate = $("#startDate").val();
258 234 var endDate = $("#endDate").val();
259 235 var statisticalObj = $("#statisticalObj").val();
260   - lineName=$("#line option:selected").text();
261 236 //开始和结束时间
262 237 var startTime = Date.parse(new Date(startDate));
263 238 var endTime = Date.parse(new Date(endDate));
... ... @@ -266,14 +241,12 @@
266 241 datas.timeType = "y";
267 242 datas.gsdm = gsdm;
268 243 datas.fgsdm = fgsdm;
269   - datas.lineCode = lineCode;
270   - datas.lineName = lineName;
  244 + datas.lineCode = lineAll;
271 245 datas.startDate = startDate;
272   - // datas.startDate = "2020-10-01";
273 246 datas.endDate = endDate;
274   - // datas.endDate = "2020-10-10";
275 247 datas.statisticalObj = $("#statisticalObj").val();
276 248 datas.itemDetails = $("#itemDetails").val();
  249 + datas.item = item;
277 250  
278 251 if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
279 252 layer.msg('请选择时间段!');
... ... @@ -292,8 +265,10 @@
292 265 title: '提示'
293 266 , content: '没有您要查询的数据,请重新选择参数!'
294 267 });
  268 + $("#export").attr('disabled',"true");
295 269 return;
296   - }
  270 + }else
  271 + $("#export").removeAttr("disabled");
297 272 var htmlHead = "", htmlBody = "";
298 273 var rsLength = rs.length;
299 274 rs.forEach(function (o, i) {
... ... @@ -320,7 +295,6 @@
320 295 });
321 296  
322 297 $("#export").on("click",function(){
323   - datas.timeType = "y";
324 298 var itemDetails = datas.itemDetails,
325 299 type = "加注量[全部]";
326 300 if(itemDetails=="jzl0"){
... ...