Commit aab40b9bcfc3426a36cf882ffd67232912790943
1 parent
4ccd76ef
电量管理和报表中出现的电量都改为保留三位小数;到离站查询历史GPS设备号无法关联到车辆的问题修复;SQL注入漏洞;
Showing
20 changed files
with
1560 additions
and
1562 deletions
src/main/java/com/bsth/controller/forms/ExportController.java
| @@ -780,9 +780,9 @@ public class ExportController { | @@ -780,9 +780,9 @@ public class ExportController { | ||
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | m=new HashMap<String,Object>(); | 782 | m=new HashMap<String,Object>(); |
| 783 | - m.put("total_zgl", zgl); | ||
| 784 | - m.put("total_ks", ks); | ||
| 785 | - m.put("total_yh", yh); | 783 | + m.put("total_zgl", Arith.round(zgl, 3)); |
| 784 | + m.put("total_ks", Arith.round(ks, 3)); | ||
| 785 | + m.put("total_yh", Arith.round(yh, 3)); | ||
| 786 | m.put("total_bc", bc); | 786 | m.put("total_bc", bc); |
| 787 | 787 | ||
| 788 | m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString())); | 788 | m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString())); |
src/main/java/com/bsth/repository/CarDeviceRepository.java
| @@ -21,4 +21,21 @@ public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { | @@ -21,4 +21,21 @@ public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { | ||
| 21 | 21 | ||
| 22 | @Query(value="select s from CarDevice s where s.clZbh=?1 and s.qyrq>=?2 ") | 22 | @Query(value="select s from CarDevice s where s.clZbh=?1 and s.qyrq>=?2 ") |
| 23 | List<CarDevice> findCarCode(String code,Date date ); | 23 | List<CarDevice> findCarCode(String code,Date date ); |
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 查询车编号关联的历史设备号 | ||
| 27 | + * | ||
| 28 | + * @return 车辆自编号、牌照号、设备编号、设备编号的启用时间/停用时间、on启用/off停用 | ||
| 29 | + */ | ||
| 30 | + @Query(value="select * from( " | ||
| 31 | + +"select * from(select c.inside_code, c.car_plate, d.new_device_no device_no, d.qyrq, 'on' state " | ||
| 32 | + +"from bsth_c_cars c left join bsth_c_car_device d on c.inside_code = d.cl_zbh " | ||
| 33 | + +"where qyrq is not null)a " | ||
| 34 | + +"UNION " | ||
| 35 | + +"select * from(select c.inside_code, c.car_plate, d.old_device_no device_no, d.qyrq, 'off' state " | ||
| 36 | + +"from bsth_c_cars c left join bsth_c_car_device d on c.inside_code = d.cl_zbh " | ||
| 37 | + +"where qyrq is not null)b " | ||
| 38 | + +")c order by device_no, qyrq, state ",nativeQuery=true) | ||
| 39 | + List<Object[]> selectCarHistoryDeviceNo(); | ||
| 40 | + | ||
| 24 | } | 41 | } |
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java
| 1 | -package com.bsth.service.calc.impl; | ||
| 2 | - | ||
| 3 | -import java.sql.ResultSet; | ||
| 4 | -import java.sql.SQLException; | ||
| 5 | -import java.text.SimpleDateFormat; | ||
| 6 | -import java.util.ArrayList; | ||
| 7 | -import java.util.HashMap; | ||
| 8 | -import java.util.Iterator; | ||
| 9 | -import java.util.List; | ||
| 10 | -import java.util.Map; | ||
| 11 | - | ||
| 12 | -import com.bsth.data.BasicData; | ||
| 13 | -import com.bsth.entity.calc.CalcWaybill; | ||
| 14 | -import com.bsth.entity.calc.CalcInvestigateMonth; | ||
| 15 | -import com.bsth.entity.mcy_forms.Singledata; | ||
| 16 | -import com.bsth.repository.calc.CalcInvestigateMonthRepository; | ||
| 17 | -import com.bsth.repository.calc.CalcWaybillRepository; | ||
| 18 | -import com.bsth.service.LineService; | ||
| 19 | -import com.bsth.service.calc.CalcMixService; | ||
| 20 | -import com.bsth.util.Arith; | ||
| 21 | -import com.bsth.util.ReportUtils; | ||
| 22 | - | ||
| 23 | -import org.slf4j.Logger; | ||
| 24 | -import org.slf4j.LoggerFactory; | ||
| 25 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 26 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 27 | -import org.springframework.jdbc.core.RowMapper; | ||
| 28 | -import org.springframework.stereotype.Service; | ||
| 29 | - | ||
| 30 | -/** | ||
| 31 | - * Created by 19/02/28. | ||
| 32 | - */ | ||
| 33 | -@Service | ||
| 34 | -public class CalcMixServiceImpl implements CalcMixService { | ||
| 35 | - | ||
| 36 | - @Autowired | ||
| 37 | - private CalcWaybillRepository calcRepository; | ||
| 38 | - | ||
| 39 | - @Autowired | ||
| 40 | - private CalcInvestigateMonthRepository calcInvestigateMonthRepository; | ||
| 41 | - | ||
| 42 | - @Autowired | ||
| 43 | - private LineService lineService; | ||
| 44 | - | ||
| 45 | - @Autowired | ||
| 46 | - JdbcTemplate jdbcTemplate; | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 50 | - | ||
| 51 | - | ||
| 52 | - @Override | ||
| 53 | - public List<Map<String, Object>> calcjsyspy(String line, String date, String date2, | ||
| 54 | - String empnames, String cont, String gsdm, String fgsdm) { | ||
| 55 | - | ||
| 56 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 57 | - List<CalcWaybill> list = null; | ||
| 58 | - | ||
| 59 | - int flag = 0; | ||
| 60 | - if("驾驶员".equals(empnames)){ | ||
| 61 | - flag = 1; | ||
| 62 | - list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont); | ||
| 63 | - } else if("售票员".equals(empnames)){ | ||
| 64 | - flag = 2; | ||
| 65 | - list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont); | ||
| 66 | - } else if("车辆自编号".equals(empnames)){ | ||
| 67 | - flag = 3; | ||
| 68 | - list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - List<CalcWaybill> calcList = new ArrayList<CalcWaybill>(); | ||
| 72 | - Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>(); | ||
| 73 | - | ||
| 74 | - CalcWaybill zjCalc = this.initCalcWaybill(); | ||
| 75 | - zjCalc.setjName("合计"); | ||
| 76 | - for(CalcWaybill c : list){ | ||
| 77 | - String key = ""; | ||
| 78 | - if(flag == 1){ | ||
| 79 | - if(c.getjGh() != null && c.getjName() != null) | ||
| 80 | - key = c.getjGh() + "/" + c.getjName(); | ||
| 81 | - } else if(flag == 2){ | ||
| 82 | - if(c.getsGh() != null && c.getsName() != null) | ||
| 83 | - key = c.getsGh() + "/" + c.getsName(); | ||
| 84 | - } else if(flag == 3){ | ||
| 85 | - if(c.getCl() != null) | ||
| 86 | - key = c.getCl(); | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - if(key.trim().length() == 0 || "/".equals(key)) | ||
| 90 | - continue; | ||
| 91 | - | ||
| 92 | - CalcWaybill calc = null; | ||
| 93 | - if(calcMap.containsKey(key)){ | ||
| 94 | - calc = calcMap.get(key); | ||
| 95 | - } else { | ||
| 96 | - calc = this.initCalcWaybill(); | ||
| 97 | - calc.setjName(key); | ||
| 98 | - calcList.add(calc); | ||
| 99 | - calcMap.put(key, calc); | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | - this.summation(calc, c); | ||
| 103 | - | ||
| 104 | - this.summation(zjCalc, c); | ||
| 105 | - | ||
| 106 | - } | ||
| 107 | - calcList.add(zjCalc); | ||
| 108 | - calcMap.put("合计", zjCalc); | ||
| 109 | - | ||
| 110 | - for(CalcWaybill c : calcList){ | ||
| 111 | - Map<String, Object> m = new HashMap<String, Object>(); | ||
| 112 | - m.put("jName", c.getjName()); | ||
| 113 | - m.put("jhyybc", c.getJhyybc()); | ||
| 114 | - m.put("jhfyybc", c.getJhfyybc()); | ||
| 115 | - m.put("sjyybc", c.getSjyybc()); | ||
| 116 | - m.put("sjfyybc", c.getSjfyybc()); | ||
| 117 | - m.put("lbbc", c.getLbbc()); | ||
| 118 | - m.put("ljbc", c.getLjbc()); | ||
| 119 | - m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); | ||
| 120 | - m.put("jhyylc", c.getJhyylc()); | ||
| 121 | - m.put("jhfyylc", c.getJhfyylc()); | ||
| 122 | - m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc())); | ||
| 123 | - m.put("sjyylc", c.getSjyylc()); | ||
| 124 | - m.put("sjfyylc", c.getSjfyylc()); | ||
| 125 | - m.put("lblc", c.getLblc()); | ||
| 126 | - m.put("ljyylc", c.getLjyylc()); | ||
| 127 | - m.put("ljfyylc", c.getLjfyylc()); | ||
| 128 | - resList.add(m); | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - return resList; | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - public CalcWaybill initCalcWaybill(){ | ||
| 135 | - CalcWaybill calc = new CalcWaybill(); | ||
| 136 | - calc.setJhyybc(0); | ||
| 137 | - calc.setJhyylc(0d); | ||
| 138 | - calc.setJhfyybc(0); | ||
| 139 | - calc.setJhfyylc(0d); | ||
| 140 | - calc.setSjyybc(0); | ||
| 141 | - calc.setSjyylc(0d); | ||
| 142 | - calc.setSjfyybc(0); | ||
| 143 | - calc.setSjfyylc(0d); | ||
| 144 | - calc.setLbbc(0); | ||
| 145 | - calc.setLblc(0d); | ||
| 146 | - calc.setLjbc(0); | ||
| 147 | - calc.setLjyylc(0d); | ||
| 148 | - calc.setLjfyylc(0d); | ||
| 149 | - return calc; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - public CalcWaybill summation(CalcWaybill c1, CalcWaybill c2){ | ||
| 153 | - c1.setJhyybc(c1.getJhyybc() + c2.getJhyybc()); | ||
| 154 | - c1.setJhyylc(Arith.add(c1.getJhyylc(), c2.getJhyylc())); | ||
| 155 | - c1.setJhfyybc(c1.getJhfyybc() + c2.getJhfyybc()); | ||
| 156 | - c1.setJhfyylc(Arith.add(c1.getJhfyylc(), c2.getJhfyylc())); | ||
| 157 | - c1.setSjyybc(c1.getSjyybc() + c2.getSjyybc()); | ||
| 158 | - c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getSjyylc())); | ||
| 159 | - c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getLjyylc())); | ||
| 160 | - c1.setSjfyybc(c1.getSjfyybc() + c2.getSjfyybc()); | ||
| 161 | - c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getSjfyylc())); | ||
| 162 | - c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getLjfyylc())); | ||
| 163 | - c1.setLbbc(c1.getLbbc() + c2.getLbbc()); | ||
| 164 | - c1.setLblc(Arith.add(c1.getLblc(), c2.getLblc())); | ||
| 165 | - c1.setLjbc(c1.getLjbc() + c2.getLjbc()); | ||
| 166 | - c1.setLjyylc(Arith.add(c1.getLjyylc(), c2.getLjyylc())); | ||
| 167 | - c1.setLjfyylc(Arith.add(c1.getLjfyylc(), c2.getLjfyylc())); | ||
| 168 | - return c1; | ||
| 169 | - } | ||
| 170 | - | ||
| 171 | - @Override | ||
| 172 | - public List<Map<String, Object>> singledatatj(String line, | ||
| 173 | - String date, String date2, | ||
| 174 | - String tjtype, String cont, | ||
| 175 | - String gsdm, String fgsdm, String sfdc) { | ||
| 176 | - | ||
| 177 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 178 | - List<CalcWaybill> list = null; | ||
| 179 | - | ||
| 180 | - int flag = 0; | ||
| 181 | - if("驾驶员".equals(tjtype)){ | ||
| 182 | - flag = 1; | ||
| 183 | - list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont); | ||
| 184 | - } else if("售票员".equals(tjtype)){ | ||
| 185 | - flag = 2; | ||
| 186 | - list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont); | ||
| 187 | - } else if("车辆自编号".equals(tjtype)){ | ||
| 188 | - flag = 3; | ||
| 189 | - if("1".equals(sfdc)){ | ||
| 190 | - list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont, true); | ||
| 191 | - } else if("0".equals(sfdc)){ | ||
| 192 | - list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont, false); | ||
| 193 | - } else { | ||
| 194 | - list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont); | ||
| 195 | - } | ||
| 196 | - } | ||
| 197 | - | ||
| 198 | - List<CalcWaybill> calcList = new ArrayList<CalcWaybill>(); | ||
| 199 | - Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>(); | ||
| 200 | - | ||
| 201 | - CalcWaybill zjCalc = this.initCalcWaybill(); | ||
| 202 | - zjCalc.setjName("合计"); | ||
| 203 | - for(CalcWaybill c : list){ | ||
| 204 | - String key = ""; | ||
| 205 | - if(flag == 1){ | ||
| 206 | - if(c.getjGh() != null && c.getjName() != null) | ||
| 207 | - key += c.getjGh() + "/" + c.getjName(); | ||
| 208 | - } else if(flag == 2){ | ||
| 209 | - if(c.getsGh() != null && c.getsName() != null) | ||
| 210 | - key += c.getsGh() + "/" + c.getsName(); | ||
| 211 | - } else if(flag == 3){ | ||
| 212 | - if(c.getCl() != null) | ||
| 213 | - key += c.getCl(); | ||
| 214 | - } | ||
| 215 | - | ||
| 216 | - if(key.trim().length() == 0 || "/".equals(key)) | ||
| 217 | - continue; | ||
| 218 | - | ||
| 219 | - String jName = key; | ||
| 220 | - key = c.getXl() + "/" + key; | ||
| 221 | - | ||
| 222 | - CalcWaybill calc = null; | ||
| 223 | - if(calcMap.containsKey(key)){ | ||
| 224 | - calc = calcMap.get(key); | ||
| 225 | - } else { | ||
| 226 | - calc = this.initCalcWaybill(); | ||
| 227 | - calc.setXlName(c.getXlName()); | ||
| 228 | - calc.setXl(c.getXl()); | ||
| 229 | - calc.setjName(jName); | ||
| 230 | - calcList.add(calc); | ||
| 231 | - calcMap.put(key, calc); | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - this.summation(calc, c); | ||
| 235 | - | ||
| 236 | - this.summation(zjCalc, c); | ||
| 237 | - | ||
| 238 | - } | ||
| 239 | - calcList.add(zjCalc); | ||
| 240 | - calcMap.put("合计", zjCalc); | ||
| 241 | - | ||
| 242 | - Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | ||
| 243 | - for(CalcWaybill c : calcList){ | ||
| 244 | - Map<String, Object> m = new HashMap<String, Object>(); | ||
| 245 | - m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 246 | - m.put("xl", c.getXl()); | ||
| 247 | - m.put("xlName", c.getXlName()); | ||
| 248 | - m.put("jName", c.getjName()); | ||
| 249 | - m.put("jhyybc", c.getJhyybc()); | ||
| 250 | - m.put("jhfyybc", c.getJhfyybc()); | ||
| 251 | - m.put("sjyybc", c.getSjyybc()); | ||
| 252 | - m.put("sjfyybc", c.getSjfyybc()); | ||
| 253 | - m.put("lbbc", c.getLbbc()); | ||
| 254 | - m.put("ljbc", c.getLjbc()); | ||
| 255 | - m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); | ||
| 256 | - m.put("jhyylc", c.getJhyylc()); | ||
| 257 | - m.put("jhfyylc", c.getJhfyylc()); | ||
| 258 | - m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc())); | ||
| 259 | - m.put("sjyylc", c.getSjyylc()); | ||
| 260 | - m.put("sjfyylc", c.getSjfyylc()); | ||
| 261 | - m.put("lblc", c.getLblc()); | ||
| 262 | - m.put("ljyylc", c.getLjyylc()); | ||
| 263 | - m.put("ljfyylc", c.getLjfyylc()); | ||
| 264 | - if(flag != 2){ | ||
| 265 | - m.put("hyl", 0); | ||
| 266 | - m.put("jzl", 0); | ||
| 267 | - m.put("sh", 0); | ||
| 268 | - } | ||
| 269 | - resList.add(m); | ||
| 270 | - keyMap.put(c.getXl() + "/" + c.getjName(), m); | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - String linesql=""; | ||
| 274 | - if(!line.equals("")){ | ||
| 275 | - linesql +=" and xlbm ='"+line+"' "; | ||
| 276 | - } | ||
| 277 | - if(!gsdm.equals("")){ | ||
| 278 | - linesql +=" and ssgsdm ='"+gsdm+"' "; | ||
| 279 | - } | ||
| 280 | - if(!fgsdm.equals("")){ | ||
| 281 | - linesql +=" and fgsdm ='"+fgsdm+"' "; | ||
| 282 | - } | ||
| 283 | - String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb" | ||
| 284 | - + " WHERE rq >= '"+date+"' and rq <= '"+date2+"'" | ||
| 285 | - + linesql | ||
| 286 | - + " union" | ||
| 287 | - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" | ||
| 288 | - + " WHERE rq >= '"+date+"' and rq <= '"+date2+"'" | ||
| 289 | - + linesql; | ||
| 290 | - List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | ||
| 291 | - @Override | ||
| 292 | - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 293 | - Singledata sin = new Singledata(); | ||
| 294 | - sin.setxL(arg0.getString("xlbm")); | ||
| 295 | - sin.setJsy(arg0.getString("jsy")); | ||
| 296 | - sin.setClzbh(arg0.getString("nbbm")); | ||
| 297 | - sin.setJzl(arg0.getString("jzl")); | ||
| 298 | - sin.setHyl(arg0.getString("yh")); | ||
| 299 | - sin.setUnyyyl(arg0.getString("sh")); | ||
| 300 | - sin.setgS(arg0.getString("fgsdm")); | ||
| 301 | - return sin; | ||
| 302 | - } | ||
| 303 | - }); | ||
| 304 | - | ||
| 305 | - if(flag != 2){ | ||
| 306 | - Map<String, Object> last = resList.get(resList.size()-1); | ||
| 307 | - last.put("hyl", 0); | ||
| 308 | - last.put("jzl", 0); | ||
| 309 | - last.put("sh", 0); | ||
| 310 | - | ||
| 311 | - //统计油,电表中手动添加的或者有加注没里程的数据 | ||
| 312 | - for (int i = 0; i < listNy.size(); i++) { | ||
| 313 | - Singledata sin_=listNy.get(i); | ||
| 314 | - String xl=sin_.getxL(); | ||
| 315 | - String str = ""; | ||
| 316 | - if(flag == 1){ | ||
| 317 | - str = sin_.getJsy() + "/" + BasicData.allPerson.get(gsdm+"-"+sin_.getJsy()); | ||
| 318 | - } else { | ||
| 319 | - str = sin_.getClzbh(); | ||
| 320 | - } | ||
| 321 | -// boolean fages=true; | ||
| 322 | - if(keyMap.containsKey(xl + "/" + str)){ | ||
| 323 | - Map<String, Object> m = keyMap.get(xl + "/" + str); | ||
| 324 | - m.put("hyl", Arith.add(m.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0)); | ||
| 325 | - m.put("jzl", Arith.add(m.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0)); | ||
| 326 | - m.put("sh", Arith.add(m.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0)); | ||
| 327 | - last.put("hyl", Arith.add(last.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0)); | ||
| 328 | - last.put("jzl", Arith.add(last.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0)); | ||
| 329 | - last.put("sh", Arith.add(last.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0)); | ||
| 330 | - } else { | ||
| 331 | - Map<String, Object> m = new HashMap<String, Object>(); | ||
| 332 | - m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 333 | - m.put("xl", xl); | ||
| 334 | - m.put("xlName", BasicData.lineCodeAllNameMap.get(xl)); | ||
| 335 | - m.put("jName", str); | ||
| 336 | - m.put("jhzlc", 0); | ||
| 337 | - m.put("sjzlc", 0); | ||
| 338 | - m.put("sjfyylc", 0); | ||
| 339 | - m.put("hyl", sin_.getHyl()!=null?sin_.getHyl():0); | ||
| 340 | - m.put("jzl", sin_.getJzl()!=null?sin_.getJzl():0); | ||
| 341 | - m.put("sh", sin_.getUnyyyl()!=null?sin_.getUnyyyl():0); | ||
| 342 | - last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl"))); | ||
| 343 | - last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl"))); | ||
| 344 | - last.put("sh", Arith.add(last.get("sh"), m.get("sh"))); | ||
| 345 | - | ||
| 346 | - keyMap.put(xl + "/" + str, m); | ||
| 347 | - } | ||
| 348 | - } | ||
| 349 | - resList.remove(last); | ||
| 350 | - resList.add(last); | ||
| 351 | - } | ||
| 352 | - | ||
| 353 | - return resList; | ||
| 354 | - } | ||
| 355 | - | ||
| 356 | - //浦东公交线路调查表 | ||
| 357 | - @Override | ||
| 358 | - public List<CalcInvestigateMonth> calcInvestigateMonth(String gsbm, String fgsbm, String month, String line, | ||
| 359 | - String xlName, String nature, String type) { | ||
| 360 | - List<CalcInvestigateMonth> resList = new ArrayList<CalcInvestigateMonth>(); | ||
| 361 | - | ||
| 362 | - Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 363 | - | ||
| 364 | - List<CalcInvestigateMonth> list = new ArrayList<CalcInvestigateMonth>(); | ||
| 365 | - if(line != null && line.length() > 0){ | ||
| 366 | - list = calcInvestigateMonthRepository.findByMonthAndLine(month, line); | ||
| 367 | - } else if(gsbm != null && gsbm.length() > 0){ | ||
| 368 | - list = calcInvestigateMonthRepository.findByMonth(month, gsbm, fgsbm); | ||
| 369 | - } else { | ||
| 370 | - list = calcInvestigateMonthRepository.findByMonth(month); | ||
| 371 | - } | ||
| 372 | - | ||
| 373 | - for(CalcInvestigateMonth c : list){ | ||
| 374 | - c.setGsName(BasicData.businessCodeNameMap.get(c.getGsbm())); | ||
| 375 | - c.setFgsName(BasicData.businessFgsCodeNameMap.get(String.format("%s_%s", c.getGsbm(), c.getFgsbm()))); | ||
| 376 | - if("1".equals(nature)){ | ||
| 377 | - if(lineNature.containsKey(c.getXl()) && lineNature.get(c.getXl())){ | ||
| 378 | - resList.add(c); | ||
| 379 | - } | ||
| 380 | - } else if("2".equals(nature)){ | ||
| 381 | - if(!lineNature.containsKey(c.getXl()) || !lineNature.get(c.getXl())){ | ||
| 382 | - resList.add(c); | ||
| 383 | - } | ||
| 384 | - } else { | ||
| 385 | - resList.add(c); | ||
| 386 | - } | ||
| 387 | - } | ||
| 388 | - | ||
| 389 | - if (type != null && type.length() != 0 && type.equals("export")) { | ||
| 390 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 391 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"), | ||
| 392 | - monSimple = new SimpleDateFormat("yyyy-MM"); | ||
| 393 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 394 | - Map<String, Object> m = new HashMap<String, Object>(); | ||
| 395 | - m.put("date", month); | ||
| 396 | - m.put("currMonth", "(" + month + ")"); | ||
| 397 | - ReportUtils ee = new ReportUtils(); | ||
| 398 | - try { | ||
| 399 | - List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | ||
| 400 | - int row = 0; | ||
| 401 | - for(CalcInvestigateMonth c : resList){ | ||
| 402 | - Map<String, Object> map = new HashMap<String, Object>(); | ||
| 403 | - map.put("row", ++row); | ||
| 404 | - map.put("xlmc", c.getXlmc()!=null?c.getXlmc():""); | ||
| 405 | - map.put("qzpcs", c.getQzpcs()!=null?c.getQzpcs():""); | ||
| 406 | - map.put("xlsx", c.getXlsx()!=null?c.getXlsx():""); | ||
| 407 | - map.put("xllx", c.getXllx()!=null?c.getXllx():""); | ||
| 408 | - map.put("xlcd", c.getXlcd()!=null?c.getXlcd():""); | ||
| 409 | - map.put("sfgp", c.getSfgp()!=null?c.getSfgp():""); | ||
| 410 | - map.put("sflpxl", c.getSflpxl()!=null?c.getSflpxl():""); | ||
| 411 | - map.put("smbsj", c.getSmbsj()!=null?c.getSmbsj():""); | ||
| 412 | - if("常规".equals(c.getDdfs())){ | ||
| 413 | - map.put("ddfsCg", "√"); | ||
| 414 | - map.put("ddfsDyh", ""); | ||
| 415 | - } else if("多样化".equals(c.getDdfs())){ | ||
| 416 | - map.put("ddfsCg", ""); | ||
| 417 | - map.put("ddfsDyh", "√"); | ||
| 418 | - } else { | ||
| 419 | - map.put("ddfsCg", ""); | ||
| 420 | - map.put("ddfsDyh", ""); | ||
| 421 | - } | ||
| 422 | - map.put("gfjgsj", c.getGfjgsj()!=null?c.getGfjgsj():""); | ||
| 423 | - map.put("dgjgsj", c.getDgjgsj()!=null?c.getDgjgsj():""); | ||
| 424 | - map.put("sfxjgj", c.getSfxjgj()!=null?c.getSfxjgj():""); | ||
| 425 | - map.put("rjlc", c.getRjlc()!=null?c.getRjlc():""); | ||
| 426 | - map.put("rjbc", c.getRjbc()!=null?c.getRjbc():""); | ||
| 427 | - map.put("rjrc", c.getRjrc()!=null?c.getRjrc():""); | ||
| 428 | - map.put("rjdcrc", c.getRjdcrc()!=null?c.getRjdcrc():""); | ||
| 429 | - map.put("mbcrc", c.getMbcrc()!=null?c.getMbcrc():""); | ||
| 430 | - map.put("jhzgl", c.getJhzgl()!=null?c.getJhzgl():""); | ||
| 431 | - map.put("sjzgl", c.getSjzgl()!=null?c.getSjzgl():""); | ||
| 432 | - map.put("sjyylc", c.getSjyylc()!=null?c.getSjyylc():""); | ||
| 433 | - map.put("lclyl", c.getLclyl()!=null?c.getLclyl():""); | ||
| 434 | - map.put("bglrc", c.getBglrc()!=null?c.getBglrc():""); | ||
| 435 | - map.put("yrc", c.getYrc()!=null?c.getYrc():""); | ||
| 436 | - map.put("yys", c.getYys()!=null?c.getYys():""); | ||
| 437 | - map.put("pj", c.getPj()!=null?c.getPj():""); | ||
| 438 | - map.put("bglys", c.getBglys()!=null?c.getBglys():""); | ||
| 439 | - map.put("tjgjz", c.getTjgjz()!=null?c.getTjgjz():""); | ||
| 440 | - map.put("tjsjyy", c.getTjsjyy()!=null?c.getTjsjyy():""); | ||
| 441 | - map.put("wyx", c.getWyx()!=null?c.getWyx():""); | ||
| 442 | - map.put("xlzx", c.getXlzx()!=null?c.getXlzx():""); | ||
| 443 | - map.put("xlzd", c.getXlzd()!=null?c.getXlzd():""); | ||
| 444 | - map.put("bz", c.getBz()!=null?c.getBz():""); | ||
| 445 | - map.put("qqz", c.getQqz()!=null?c.getQqz():""); | ||
| 446 | - map.put("gsName", BasicData.businessCodeNameMap.get(c.getGsbm())); | ||
| 447 | - map.put("fgsName", BasicData.businessFgsCodeNameMap.get(String.format("%s_%s", c.getGsbm(), c.getFgsbm()))); | ||
| 448 | - mapList.add(map); | ||
| 449 | - } | ||
| 450 | - listI.add(mapList.iterator()); | ||
| 451 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 452 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/calcInvestigateMonth.xls", | ||
| 453 | - path + "export/" + "浦东公交线路调查表"+month+".xls"); | ||
| 454 | - } catch (Exception e) { | ||
| 455 | - // TODO: handle exception | ||
| 456 | - e.printStackTrace(); | ||
| 457 | - logger.info("" , e); | ||
| 458 | - } | ||
| 459 | - } | ||
| 460 | - return resList; | ||
| 461 | - } | ||
| 462 | - | ||
| 463 | -} | 1 | +package com.bsth.service.calc.impl; |
| 2 | + | ||
| 3 | +import java.sql.ResultSet; | ||
| 4 | +import java.sql.SQLException; | ||
| 5 | +import java.text.SimpleDateFormat; | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.HashMap; | ||
| 8 | +import java.util.Iterator; | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Map; | ||
| 11 | + | ||
| 12 | +import com.bsth.data.BasicData; | ||
| 13 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 14 | +import com.bsth.entity.calc.CalcInvestigateMonth; | ||
| 15 | +import com.bsth.entity.mcy_forms.Singledata; | ||
| 16 | +import com.bsth.repository.calc.CalcInvestigateMonthRepository; | ||
| 17 | +import com.bsth.repository.calc.CalcWaybillRepository; | ||
| 18 | +import com.bsth.service.LineService; | ||
| 19 | +import com.bsth.service.calc.CalcMixService; | ||
| 20 | +import com.bsth.util.Arith; | ||
| 21 | +import com.bsth.util.ReportUtils; | ||
| 22 | + | ||
| 23 | +import org.slf4j.Logger; | ||
| 24 | +import org.slf4j.LoggerFactory; | ||
| 25 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 26 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 27 | +import org.springframework.jdbc.core.RowMapper; | ||
| 28 | +import org.springframework.stereotype.Service; | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * Created by 19/02/28. | ||
| 32 | + */ | ||
| 33 | +@Service | ||
| 34 | +public class CalcMixServiceImpl implements CalcMixService { | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private CalcWaybillRepository calcRepository; | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + private CalcInvestigateMonthRepository calcInvestigateMonthRepository; | ||
| 41 | + | ||
| 42 | + @Autowired | ||
| 43 | + private LineService lineService; | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + JdbcTemplate jdbcTemplate; | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public List<Map<String, Object>> calcjsyspy(String line, String date, String date2, | ||
| 54 | + String empnames, String cont, String gsdm, String fgsdm) { | ||
| 55 | + | ||
| 56 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 57 | + List<CalcWaybill> list = null; | ||
| 58 | + | ||
| 59 | + int flag = 0; | ||
| 60 | + if("驾驶员".equals(empnames)){ | ||
| 61 | + flag = 1; | ||
| 62 | + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont); | ||
| 63 | + } else if("售票员".equals(empnames)){ | ||
| 64 | + flag = 2; | ||
| 65 | + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont); | ||
| 66 | + } else if("车辆自编号".equals(empnames)){ | ||
| 67 | + flag = 3; | ||
| 68 | + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>(); | ||
| 72 | + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>(); | ||
| 73 | + | ||
| 74 | + CalcWaybill zjCalc = this.initCalcWaybill(); | ||
| 75 | + zjCalc.setjName("合计"); | ||
| 76 | + for(CalcWaybill c : list){ | ||
| 77 | + String key = ""; | ||
| 78 | + if(flag == 1){ | ||
| 79 | + if(c.getjGh() != null && c.getjName() != null) | ||
| 80 | + key = c.getjGh() + "/" + c.getjName(); | ||
| 81 | + } else if(flag == 2){ | ||
| 82 | + if(c.getsGh() != null && c.getsName() != null) | ||
| 83 | + key = c.getsGh() + "/" + c.getsName(); | ||
| 84 | + } else if(flag == 3){ | ||
| 85 | + if(c.getCl() != null) | ||
| 86 | + key = c.getCl(); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + if(key.trim().length() == 0 || "/".equals(key)) | ||
| 90 | + continue; | ||
| 91 | + | ||
| 92 | + CalcWaybill calc = null; | ||
| 93 | + if(calcMap.containsKey(key)){ | ||
| 94 | + calc = calcMap.get(key); | ||
| 95 | + } else { | ||
| 96 | + calc = this.initCalcWaybill(); | ||
| 97 | + calc.setjName(key); | ||
| 98 | + calcList.add(calc); | ||
| 99 | + calcMap.put(key, calc); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + this.summation(calc, c); | ||
| 103 | + | ||
| 104 | + this.summation(zjCalc, c); | ||
| 105 | + | ||
| 106 | + } | ||
| 107 | + calcList.add(zjCalc); | ||
| 108 | + calcMap.put("合计", zjCalc); | ||
| 109 | + | ||
| 110 | + for(CalcWaybill c : calcList){ | ||
| 111 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 112 | + m.put("jName", c.getjName()); | ||
| 113 | + m.put("jhyybc", c.getJhyybc()); | ||
| 114 | + m.put("jhfyybc", c.getJhfyybc()); | ||
| 115 | + m.put("sjyybc", c.getSjyybc()); | ||
| 116 | + m.put("sjfyybc", c.getSjfyybc()); | ||
| 117 | + m.put("lbbc", c.getLbbc()); | ||
| 118 | + m.put("ljbc", c.getLjbc()); | ||
| 119 | + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); | ||
| 120 | + m.put("jhyylc", c.getJhyylc()); | ||
| 121 | + m.put("jhfyylc", c.getJhfyylc()); | ||
| 122 | + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc())); | ||
| 123 | + m.put("sjyylc", c.getSjyylc()); | ||
| 124 | + m.put("sjfyylc", c.getSjfyylc()); | ||
| 125 | + m.put("lblc", c.getLblc()); | ||
| 126 | + m.put("ljyylc", c.getLjyylc()); | ||
| 127 | + m.put("ljfyylc", c.getLjfyylc()); | ||
| 128 | + resList.add(m); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + return resList; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + public CalcWaybill initCalcWaybill(){ | ||
| 135 | + CalcWaybill calc = new CalcWaybill(); | ||
| 136 | + calc.setJhyybc(0); | ||
| 137 | + calc.setJhyylc(0d); | ||
| 138 | + calc.setJhfyybc(0); | ||
| 139 | + calc.setJhfyylc(0d); | ||
| 140 | + calc.setSjyybc(0); | ||
| 141 | + calc.setSjyylc(0d); | ||
| 142 | + calc.setSjfyybc(0); | ||
| 143 | + calc.setSjfyylc(0d); | ||
| 144 | + calc.setLbbc(0); | ||
| 145 | + calc.setLblc(0d); | ||
| 146 | + calc.setLjbc(0); | ||
| 147 | + calc.setLjyylc(0d); | ||
| 148 | + calc.setLjfyylc(0d); | ||
| 149 | + return calc; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public CalcWaybill summation(CalcWaybill c1, CalcWaybill c2){ | ||
| 153 | + c1.setJhyybc(c1.getJhyybc() + c2.getJhyybc()); | ||
| 154 | + c1.setJhyylc(Arith.add(c1.getJhyylc(), c2.getJhyylc())); | ||
| 155 | + c1.setJhfyybc(c1.getJhfyybc() + c2.getJhfyybc()); | ||
| 156 | + c1.setJhfyylc(Arith.add(c1.getJhfyylc(), c2.getJhfyylc())); | ||
| 157 | + c1.setSjyybc(c1.getSjyybc() + c2.getSjyybc()); | ||
| 158 | + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getSjyylc())); | ||
| 159 | + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getLjyylc())); | ||
| 160 | + c1.setSjfyybc(c1.getSjfyybc() + c2.getSjfyybc()); | ||
| 161 | + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getSjfyylc())); | ||
| 162 | + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getLjfyylc())); | ||
| 163 | + c1.setLbbc(c1.getLbbc() + c2.getLbbc()); | ||
| 164 | + c1.setLblc(Arith.add(c1.getLblc(), c2.getLblc())); | ||
| 165 | + c1.setLjbc(c1.getLjbc() + c2.getLjbc()); | ||
| 166 | + c1.setLjyylc(Arith.add(c1.getLjyylc(), c2.getLjyylc())); | ||
| 167 | + c1.setLjfyylc(Arith.add(c1.getLjfyylc(), c2.getLjfyylc())); | ||
| 168 | + return c1; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @Override | ||
| 172 | + public List<Map<String, Object>> singledatatj(String line, | ||
| 173 | + String date, String date2, | ||
| 174 | + String tjtype, String cont, | ||
| 175 | + String gsdm, String fgsdm, String sfdc) { | ||
| 176 | + | ||
| 177 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 178 | + List<CalcWaybill> list = null; | ||
| 179 | + | ||
| 180 | + int flag = 0; | ||
| 181 | + if("驾驶员".equals(tjtype)){ | ||
| 182 | + flag = 1; | ||
| 183 | + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont); | ||
| 184 | + } else if("售票员".equals(tjtype)){ | ||
| 185 | + flag = 2; | ||
| 186 | + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont); | ||
| 187 | + } else if("车辆自编号".equals(tjtype)){ | ||
| 188 | + flag = 3; | ||
| 189 | + if("1".equals(sfdc)){ | ||
| 190 | + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont, true); | ||
| 191 | + } else if("0".equals(sfdc)){ | ||
| 192 | + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont, false); | ||
| 193 | + } else { | ||
| 194 | + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont); | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>(); | ||
| 199 | + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>(); | ||
| 200 | + | ||
| 201 | + CalcWaybill zjCalc = this.initCalcWaybill(); | ||
| 202 | + zjCalc.setjName("合计"); | ||
| 203 | + for(CalcWaybill c : list){ | ||
| 204 | + String key = ""; | ||
| 205 | + if(flag == 1){ | ||
| 206 | + if(c.getjGh() != null && c.getjName() != null) | ||
| 207 | + key += c.getjGh() + "/" + c.getjName(); | ||
| 208 | + } else if(flag == 2){ | ||
| 209 | + if(c.getsGh() != null && c.getsName() != null) | ||
| 210 | + key += c.getsGh() + "/" + c.getsName(); | ||
| 211 | + } else if(flag == 3){ | ||
| 212 | + if(c.getCl() != null) | ||
| 213 | + key += c.getCl(); | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + if(key.trim().length() == 0 || "/".equals(key)) | ||
| 217 | + continue; | ||
| 218 | + | ||
| 219 | + String jName = key; | ||
| 220 | + key = c.getXl() + "/" + key; | ||
| 221 | + | ||
| 222 | + CalcWaybill calc = null; | ||
| 223 | + if(calcMap.containsKey(key)){ | ||
| 224 | + calc = calcMap.get(key); | ||
| 225 | + } else { | ||
| 226 | + calc = this.initCalcWaybill(); | ||
| 227 | + calc.setXlName(c.getXlName()); | ||
| 228 | + calc.setXl(c.getXl()); | ||
| 229 | + calc.setjName(jName); | ||
| 230 | + calcList.add(calc); | ||
| 231 | + calcMap.put(key, calc); | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + this.summation(calc, c); | ||
| 235 | + | ||
| 236 | + this.summation(zjCalc, c); | ||
| 237 | + | ||
| 238 | + } | ||
| 239 | + calcList.add(zjCalc); | ||
| 240 | + calcMap.put("合计", zjCalc); | ||
| 241 | + | ||
| 242 | + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | ||
| 243 | + for(CalcWaybill c : calcList){ | ||
| 244 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 245 | + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 246 | + m.put("xl", c.getXl()); | ||
| 247 | + m.put("xlName", c.getXlName()); | ||
| 248 | + m.put("jName", c.getjName()); | ||
| 249 | + m.put("jhyybc", c.getJhyybc()); | ||
| 250 | + m.put("jhfyybc", c.getJhfyybc()); | ||
| 251 | + m.put("sjyybc", c.getSjyybc()); | ||
| 252 | + m.put("sjfyybc", c.getSjfyybc()); | ||
| 253 | + m.put("lbbc", c.getLbbc()); | ||
| 254 | + m.put("ljbc", c.getLjbc()); | ||
| 255 | + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); | ||
| 256 | + m.put("jhyylc", c.getJhyylc()); | ||
| 257 | + m.put("jhfyylc", c.getJhfyylc()); | ||
| 258 | + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc())); | ||
| 259 | + m.put("sjyylc", c.getSjyylc()); | ||
| 260 | + m.put("sjfyylc", c.getSjfyylc()); | ||
| 261 | + m.put("lblc", c.getLblc()); | ||
| 262 | + m.put("ljyylc", c.getLjyylc()); | ||
| 263 | + m.put("ljfyylc", c.getLjfyylc()); | ||
| 264 | + if(flag != 2){ | ||
| 265 | + m.put("hyl", 0); | ||
| 266 | + m.put("jzl", 0); | ||
| 267 | + m.put("sh", 0); | ||
| 268 | + } | ||
| 269 | + resList.add(m); | ||
| 270 | + keyMap.put(c.getXl() + "/" + c.getjName(), m); | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + List<String> objList = new ArrayList<String>(); | ||
| 274 | + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb" | ||
| 275 | + + " WHERE rq >= ? and rq <= ? "; | ||
| 276 | + objList.add(date); | ||
| 277 | + objList.add(date2); | ||
| 278 | + if(!line.equals("")){ | ||
| 279 | + nysql += " and xlbm = ? "; | ||
| 280 | + objList.add(line); | ||
| 281 | + } | ||
| 282 | + if(!gsdm.equals("")){ | ||
| 283 | + nysql += " and ssgsdm = ? "; | ||
| 284 | + objList.add(gsdm); | ||
| 285 | + } | ||
| 286 | + if(!fgsdm.equals("")){ | ||
| 287 | + nysql += " and fgsdm = ? "; | ||
| 288 | + objList.add(fgsdm); | ||
| 289 | + } | ||
| 290 | + nysql += " union " | ||
| 291 | + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" | ||
| 292 | + + " WHERE rq >= ? and rq <= ? "; | ||
| 293 | + objList.add(date); | ||
| 294 | + objList.add(date2); | ||
| 295 | + if(!line.equals("")){ | ||
| 296 | + nysql += " and xlbm = ? "; | ||
| 297 | + objList.add(line); | ||
| 298 | + } | ||
| 299 | + if(!gsdm.equals("")){ | ||
| 300 | + nysql += " and ssgsdm = ? "; | ||
| 301 | + objList.add(gsdm); | ||
| 302 | + } | ||
| 303 | + if(!fgsdm.equals("")){ | ||
| 304 | + nysql += " and fgsdm = ? "; | ||
| 305 | + objList.add(fgsdm); | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + List<Singledata> listNy = jdbcTemplate.query(nysql, objList.toArray(), new RowMapper<Singledata>() { | ||
| 309 | + @Override | ||
| 310 | + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 311 | + Singledata sin = new Singledata(); | ||
| 312 | + sin.setxL(arg0.getString("xlbm")); | ||
| 313 | + sin.setJsy(arg0.getString("jsy")); | ||
| 314 | + sin.setClzbh(arg0.getString("nbbm")); | ||
| 315 | + sin.setJzl(arg0.getString("jzl")); | ||
| 316 | + sin.setHyl(arg0.getString("yh")); | ||
| 317 | + sin.setUnyyyl(arg0.getString("sh")); | ||
| 318 | + sin.setgS(arg0.getString("fgsdm")); | ||
| 319 | + return sin; | ||
| 320 | + } | ||
| 321 | + }); | ||
| 322 | + | ||
| 323 | + if(flag != 2){ | ||
| 324 | + Map<String, Object> last = resList.get(resList.size()-1); | ||
| 325 | + last.put("hyl", 0); | ||
| 326 | + last.put("jzl", 0); | ||
| 327 | + last.put("sh", 0); | ||
| 328 | + | ||
| 329 | + //统计油,电表中手动添加的或者有加注没里程的数据 | ||
| 330 | + for (int i = 0; i < listNy.size(); i++) { | ||
| 331 | + Singledata sin_=listNy.get(i); | ||
| 332 | + String xl=sin_.getxL(); | ||
| 333 | + String str = ""; | ||
| 334 | + if(flag == 1){ | ||
| 335 | + if(sin_.getjName() != null && sin_.getjName().length() > 0){ | ||
| 336 | + str = sin_.getJsy() + "/" + sin_.getjName(); | ||
| 337 | + } else { | ||
| 338 | + str = sin_.getJsy() + "/" + BasicData.allPerson.get(gsdm+"-"+sin_.getJsy()); | ||
| 339 | + } | ||
| 340 | + } else { | ||
| 341 | + str = sin_.getClzbh(); | ||
| 342 | + } | ||
| 343 | +// boolean fages=true; | ||
| 344 | + if(keyMap.containsKey(xl + "/" + str)){ | ||
| 345 | + Map<String, Object> m = keyMap.get(xl + "/" + str); | ||
| 346 | + m.put("hyl", Arith.add(m.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0)); | ||
| 347 | + m.put("jzl", Arith.add(m.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0)); | ||
| 348 | + m.put("sh", Arith.add(m.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0)); | ||
| 349 | + last.put("hyl", Arith.add(last.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0)); | ||
| 350 | + last.put("jzl", Arith.add(last.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0)); | ||
| 351 | + last.put("sh", Arith.add(last.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0)); | ||
| 352 | + } else { | ||
| 353 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 354 | + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 355 | + m.put("xl", xl); | ||
| 356 | + m.put("xlName", BasicData.lineCodeAllNameMap.get(xl)); | ||
| 357 | + m.put("jName", str); | ||
| 358 | + m.put("jhzlc", 0); | ||
| 359 | + m.put("sjzlc", 0); | ||
| 360 | + m.put("sjfyylc", 0); | ||
| 361 | + m.put("hyl", sin_.getHyl()!=null?sin_.getHyl():0); | ||
| 362 | + m.put("jzl", sin_.getJzl()!=null?sin_.getJzl():0); | ||
| 363 | + m.put("sh", sin_.getUnyyyl()!=null?sin_.getUnyyyl():0); | ||
| 364 | + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl"))); | ||
| 365 | + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl"))); | ||
| 366 | + last.put("sh", Arith.add(last.get("sh"), m.get("sh"))); | ||
| 367 | + | ||
| 368 | + keyMap.put(xl + "/" + str, m); | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + resList.remove(last); | ||
| 372 | + resList.add(last); | ||
| 373 | + | ||
| 374 | + for(Map<String, Object> m : resList){ | ||
| 375 | + if(m.containsKey("hyl") && m.get("hyl").toString().length() > 0){ | ||
| 376 | + m.put("hyl", Arith.round(m.get("hyl"), 3)); | ||
| 377 | + } | ||
| 378 | + if(m.containsKey("jzl") && m.get("jzl").toString().length() > 0){ | ||
| 379 | + m.put("jzl", Arith.round(m.get("jzl"), 3)); | ||
| 380 | + } | ||
| 381 | + if(m.containsKey("sh") && m.get("sh").toString().length() > 0){ | ||
| 382 | + m.put("sh", Arith.round(m.get("sh"), 3)); | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + return resList; | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + //浦东公交线路调查表 | ||
| 391 | + @Override | ||
| 392 | + public List<CalcInvestigateMonth> calcInvestigateMonth(String gsbm, String fgsbm, String month, String line, | ||
| 393 | + String xlName, String nature, String type) { | ||
| 394 | + List<CalcInvestigateMonth> resList = new ArrayList<CalcInvestigateMonth>(); | ||
| 395 | + | ||
| 396 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 397 | + | ||
| 398 | + List<CalcInvestigateMonth> list = new ArrayList<CalcInvestigateMonth>(); | ||
| 399 | + if(line != null && line.length() > 0){ | ||
| 400 | + list = calcInvestigateMonthRepository.findByMonthAndLine(month, line); | ||
| 401 | + } else if(gsbm != null && gsbm.length() > 0){ | ||
| 402 | + list = calcInvestigateMonthRepository.findByMonth(month, gsbm, fgsbm); | ||
| 403 | + } else { | ||
| 404 | + list = calcInvestigateMonthRepository.findByMonth(month); | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + for(CalcInvestigateMonth c : list){ | ||
| 408 | + c.setGsName(BasicData.businessCodeNameMap.get(c.getGsbm())); | ||
| 409 | + c.setFgsName(BasicData.businessFgsCodeNameMap.get(String.format("%s_%s", c.getGsbm(), c.getFgsbm()))); | ||
| 410 | + if("1".equals(nature)){ | ||
| 411 | + if(lineNature.containsKey(c.getXl()) && lineNature.get(c.getXl())){ | ||
| 412 | + resList.add(c); | ||
| 413 | + } | ||
| 414 | + } else if("2".equals(nature)){ | ||
| 415 | + if(!lineNature.containsKey(c.getXl()) || !lineNature.get(c.getXl())){ | ||
| 416 | + resList.add(c); | ||
| 417 | + } | ||
| 418 | + } else { | ||
| 419 | + resList.add(c); | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + if (type != null && type.length() != 0 && type.equals("export")) { | ||
| 424 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 425 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"), | ||
| 426 | + monSimple = new SimpleDateFormat("yyyy-MM"); | ||
| 427 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 428 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 429 | + m.put("date", month); | ||
| 430 | + m.put("currMonth", "(" + month + ")"); | ||
| 431 | + ReportUtils ee = new ReportUtils(); | ||
| 432 | + try { | ||
| 433 | + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | ||
| 434 | + int row = 0; | ||
| 435 | + for(CalcInvestigateMonth c : resList){ | ||
| 436 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 437 | + map.put("row", ++row); | ||
| 438 | + map.put("xlmc", c.getXlmc()!=null?c.getXlmc():""); | ||
| 439 | + map.put("qzpcs", c.getQzpcs()!=null?c.getQzpcs():""); | ||
| 440 | + map.put("xlsx", c.getXlsx()!=null?c.getXlsx():""); | ||
| 441 | + map.put("xllx", c.getXllx()!=null?c.getXllx():""); | ||
| 442 | + map.put("xlcd", c.getXlcd()!=null?c.getXlcd():""); | ||
| 443 | + map.put("sfgp", c.getSfgp()!=null?c.getSfgp():""); | ||
| 444 | + map.put("sflpxl", c.getSflpxl()!=null?c.getSflpxl():""); | ||
| 445 | + map.put("smbsj", c.getSmbsj()!=null?c.getSmbsj():""); | ||
| 446 | + if("常规".equals(c.getDdfs())){ | ||
| 447 | + map.put("ddfsCg", "√"); | ||
| 448 | + map.put("ddfsDyh", ""); | ||
| 449 | + } else if("多样化".equals(c.getDdfs())){ | ||
| 450 | + map.put("ddfsCg", ""); | ||
| 451 | + map.put("ddfsDyh", "√"); | ||
| 452 | + } else { | ||
| 453 | + map.put("ddfsCg", ""); | ||
| 454 | + map.put("ddfsDyh", ""); | ||
| 455 | + } | ||
| 456 | + map.put("gfjgsj", c.getGfjgsj()!=null?c.getGfjgsj():""); | ||
| 457 | + map.put("dgjgsj", c.getDgjgsj()!=null?c.getDgjgsj():""); | ||
| 458 | + map.put("sfxjgj", c.getSfxjgj()!=null?c.getSfxjgj():""); | ||
| 459 | + map.put("rjlc", c.getRjlc()!=null?c.getRjlc():""); | ||
| 460 | + map.put("rjbc", c.getRjbc()!=null?c.getRjbc():""); | ||
| 461 | + map.put("rjrc", c.getRjrc()!=null?c.getRjrc():""); | ||
| 462 | + map.put("rjdcrc", c.getRjdcrc()!=null?c.getRjdcrc():""); | ||
| 463 | + map.put("mbcrc", c.getMbcrc()!=null?c.getMbcrc():""); | ||
| 464 | + map.put("jhzgl", c.getJhzgl()!=null?c.getJhzgl():""); | ||
| 465 | + map.put("sjzgl", c.getSjzgl()!=null?c.getSjzgl():""); | ||
| 466 | + map.put("sjyylc", c.getSjyylc()!=null?c.getSjyylc():""); | ||
| 467 | + map.put("lclyl", c.getLclyl()!=null?c.getLclyl():""); | ||
| 468 | + map.put("bglrc", c.getBglrc()!=null?c.getBglrc():""); | ||
| 469 | + map.put("yrc", c.getYrc()!=null?c.getYrc():""); | ||
| 470 | + map.put("yys", c.getYys()!=null?c.getYys():""); | ||
| 471 | + map.put("pj", c.getPj()!=null?c.getPj():""); | ||
| 472 | + map.put("bglys", c.getBglys()!=null?c.getBglys():""); | ||
| 473 | + map.put("tjgjz", c.getTjgjz()!=null?c.getTjgjz():""); | ||
| 474 | + map.put("tjsjyy", c.getTjsjyy()!=null?c.getTjsjyy():""); | ||
| 475 | + map.put("wyx", c.getWyx()!=null?c.getWyx():""); | ||
| 476 | + map.put("xlzx", c.getXlzx()!=null?c.getXlzx():""); | ||
| 477 | + map.put("xlzd", c.getXlzd()!=null?c.getXlzd():""); | ||
| 478 | + map.put("bz", c.getBz()!=null?c.getBz():""); | ||
| 479 | + map.put("qqz", c.getQqz()!=null?c.getQqz():""); | ||
| 480 | + map.put("gsName", BasicData.businessCodeNameMap.get(c.getGsbm())); | ||
| 481 | + map.put("fgsName", BasicData.businessFgsCodeNameMap.get(String.format("%s_%s", c.getGsbm(), c.getFgsbm()))); | ||
| 482 | + mapList.add(map); | ||
| 483 | + } | ||
| 484 | + listI.add(mapList.iterator()); | ||
| 485 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | ||
| 486 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/calcInvestigateMonth.xls", | ||
| 487 | + path + "export/" + "浦东公交线路调查表"+month+".xls"); | ||
| 488 | + } catch (Exception e) { | ||
| 489 | + // TODO: handle exception | ||
| 490 | + e.printStackTrace(); | ||
| 491 | + logger.info("" , e); | ||
| 492 | + } | ||
| 493 | + } | ||
| 494 | + return resList; | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | +} |
src/main/java/com/bsth/service/forms/impl/CommonServiceImpl.java
| 1 | -package com.bsth.service.forms.impl; | ||
| 2 | - | ||
| 3 | -import java.text.DecimalFormat; | ||
| 4 | -import java.util.HashMap; | ||
| 5 | -import java.util.Iterator; | ||
| 6 | -import java.util.List; | ||
| 7 | -import java.util.Map; | ||
| 8 | -import java.util.Set; | ||
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | -import org.springframework.stereotype.Service; | ||
| 11 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 12 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 13 | -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 14 | -import com.bsth.service.forms.CommonService; | ||
| 15 | - | ||
| 16 | -@Service | ||
| 17 | -public class CommonServiceImpl implements CommonService{ | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - @Autowired | ||
| 21 | - ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 22 | - | ||
| 23 | - @Override | ||
| 24 | - public Map<String, Object> findKMBC1(String jName, String clZbh, | ||
| 25 | - String date, String enddate) { | ||
| 26 | - | ||
| 27 | - String sql=" select s from s " | ||
| 28 | - + " where s.j_gh ='" + jName + "' and s.cl_zbh ='" + clZbh + "' and " | ||
| 29 | - + " to_days(s.schedule_date) BETWEEN to_days('" + date + "') and to_days('" + enddate + "')" | ||
| 30 | - + " order by bcs"; | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate); | ||
| 34 | - DecimalFormat format = new DecimalFormat("0.00"); | ||
| 35 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | ||
| 36 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | ||
| 37 | - int jhbc = 0,cjbc = 0,ljbc = 0; | ||
| 38 | - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0; | ||
| 39 | - float addMileage = 0l,remMileage = 0l; | ||
| 40 | - Map<String,Object> map = new HashMap<String, Object>(); | ||
| 41 | - for(ScheduleRealInfo scheduleRealInfo : list){ | ||
| 42 | - if(scheduleRealInfo != null){ | ||
| 43 | - //计划里程(主任务过滤掉临加班次), | ||
| 44 | - //烂班里程(主任务烂班), | ||
| 45 | - //临加里程(主任务临加), | ||
| 46 | - //计划班次,烂班班次,增加班次 | ||
| 47 | - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 48 | - if(scheduleRealInfo.isSflj()){ | ||
| 49 | - addMileage += tempJhlc; | ||
| 50 | - ljbc++; | ||
| 51 | - }else{ | ||
| 52 | - jhlc += tempJhlc; | ||
| 53 | - jhbc++; | ||
| 54 | - if(scheduleRealInfo.getStatus() == -1){ | ||
| 55 | - remMileage += tempJhlc; | ||
| 56 | - cjbc++; | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 60 | - //计算营运里程,空驶里程 | ||
| 61 | - if(childTaskPlans.isEmpty()){ | ||
| 62 | - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 63 | - || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 64 | - ksgl += tempJhlc; | ||
| 65 | - }else{ | ||
| 66 | - yygl += tempJhlc; | ||
| 67 | - } | ||
| 68 | - }else{ | ||
| 69 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 70 | - while(it.hasNext()){ | ||
| 71 | - ChildTaskPlan childTaskPlan = it.next(); | ||
| 72 | - if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 73 | - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 74 | - }else{ | ||
| 75 | - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 76 | - } | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - map.put("jhlc", format.format(jhlc)); | ||
| 82 | - map.put("remMileage", format.format(remMileage)); | ||
| 83 | - map.put("addMileage", format.format(addMileage)); | ||
| 84 | - map.put("yygl", format.format(yygl)); | ||
| 85 | - map.put("ksgl", format.format(ksgl)); | ||
| 86 | - map.put("realMileage", format.format(yygl+ksgl)); | ||
| 87 | - map.put("jhbc", jhbc); | ||
| 88 | - map.put("cjbc", cjbc); | ||
| 89 | - map.put("ljbc", ljbc); | ||
| 90 | - map.put("sjbc", jhbc-cjbc+ljbc); | ||
| 91 | - return map; | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - | ||
| 95 | - @Override | ||
| 96 | - public Map<String, Object> findKMBC2(String jName, String clZbh,String date) { | ||
| 97 | - | ||
| 98 | - String sql=" select s from bsth_c_s_sp_info_real s " | ||
| 99 | - + " where s.j_gh ='" + jName + "' and s.cl_zbh ='" + clZbh + "' and " | ||
| 100 | - + " to_days(s.schedule_date) =to_days('" + date + "')" | ||
| 101 | - + " order by bcs"; | ||
| 102 | - | ||
| 103 | - | ||
| 104 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date,"",""); | ||
| 105 | - | ||
| 106 | - DecimalFormat format = new DecimalFormat("0.00"); | ||
| 107 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | ||
| 108 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | ||
| 109 | - int jhbc = 0,cjbc = 0,ljbc = 0; | ||
| 110 | - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0; | ||
| 111 | - float addMileage = 0l,remMileage = 0l; | ||
| 112 | - String j_Name=""; | ||
| 113 | - Map<String,Object> map = new HashMap<String, Object>(); | ||
| 114 | - for(ScheduleRealInfo scheduleRealInfo : list){ | ||
| 115 | - if(scheduleRealInfo != null){ | ||
| 116 | - j_Name=scheduleRealInfo.getjName(); | ||
| 117 | - //计划里程(主任务过滤掉临加班次), | ||
| 118 | - //烂班里程(主任务烂班), | ||
| 119 | - //临加里程(主任务临加), | ||
| 120 | - //计划班次,烂班班次,增加班次 | ||
| 121 | - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 122 | - if(scheduleRealInfo.isSflj()){ | ||
| 123 | - addMileage += tempJhlc; | ||
| 124 | - ljbc++; | ||
| 125 | - }else{ | ||
| 126 | - jhlc += tempJhlc; | ||
| 127 | - jhbc++; | ||
| 128 | - if(scheduleRealInfo.getStatus() == -1){ | ||
| 129 | - remMileage += tempJhlc; | ||
| 130 | - cjbc++; | ||
| 131 | - } | ||
| 132 | - } | ||
| 133 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 134 | - //计算营运里程,空驶里程 | ||
| 135 | - if(childTaskPlans.isEmpty()){ | ||
| 136 | - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 137 | - || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 138 | - ksgl += tempJhlc; | ||
| 139 | - }else{ | ||
| 140 | - yygl += tempJhlc; | ||
| 141 | - } | ||
| 142 | - }else{ | ||
| 143 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 144 | - while(it.hasNext()){ | ||
| 145 | - ChildTaskPlan childTaskPlan = it.next(); | ||
| 146 | - if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 147 | - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 148 | - }else{ | ||
| 149 | - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 150 | - } | ||
| 151 | - } | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | - } | ||
| 155 | - map.put("j_name", j_Name); | ||
| 156 | - map.put("jhlc", format.format(jhlc)); | ||
| 157 | - map.put("remMileage", format.format(remMileage)); | ||
| 158 | - map.put("addMileage", format.format(addMileage)); | ||
| 159 | - map.put("yygl", format.format(yygl)); | ||
| 160 | - map.put("ksgl", format.format(ksgl)); | ||
| 161 | - map.put("realMileage", format.format(yygl+ksgl)); | ||
| 162 | - map.put("jhbc", jhbc); | ||
| 163 | - map.put("cjbc", cjbc); | ||
| 164 | - map.put("ljbc", ljbc); | ||
| 165 | - map.put("sjbc", jhbc-cjbc+ljbc); | ||
| 166 | - return map; | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - | ||
| 170 | - | ||
| 171 | - | ||
| 172 | -} | 1 | +package com.bsth.service.forms.impl; |
| 2 | + | ||
| 3 | +import java.text.DecimalFormat; | ||
| 4 | +import java.util.HashMap; | ||
| 5 | +import java.util.Iterator; | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | +import java.util.Set; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 12 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 13 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 14 | +import com.bsth.service.forms.CommonService; | ||
| 15 | + | ||
| 16 | +@Service | ||
| 17 | +public class CommonServiceImpl implements CommonService{ | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + @Autowired | ||
| 21 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public Map<String, Object> findKMBC1(String jName, String clZbh, | ||
| 25 | + String date, String enddate) { | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate); | ||
| 29 | + DecimalFormat format = new DecimalFormat("0.00"); | ||
| 30 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | ||
| 31 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | ||
| 32 | + int jhbc = 0,cjbc = 0,ljbc = 0; | ||
| 33 | + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0; | ||
| 34 | + float addMileage = 0l,remMileage = 0l; | ||
| 35 | + Map<String,Object> map = new HashMap<String, Object>(); | ||
| 36 | + for(ScheduleRealInfo scheduleRealInfo : list){ | ||
| 37 | + if(scheduleRealInfo != null){ | ||
| 38 | + //计划里程(主任务过滤掉临加班次), | ||
| 39 | + //烂班里程(主任务烂班), | ||
| 40 | + //临加里程(主任务临加), | ||
| 41 | + //计划班次,烂班班次,增加班次 | ||
| 42 | + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 43 | + if(scheduleRealInfo.isSflj()){ | ||
| 44 | + addMileage += tempJhlc; | ||
| 45 | + ljbc++; | ||
| 46 | + }else{ | ||
| 47 | + jhlc += tempJhlc; | ||
| 48 | + jhbc++; | ||
| 49 | + if(scheduleRealInfo.getStatus() == -1){ | ||
| 50 | + remMileage += tempJhlc; | ||
| 51 | + cjbc++; | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 55 | + //计算营运里程,空驶里程 | ||
| 56 | + if(childTaskPlans.isEmpty()){ | ||
| 57 | + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 58 | + || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 59 | + ksgl += tempJhlc; | ||
| 60 | + }else{ | ||
| 61 | + yygl += tempJhlc; | ||
| 62 | + } | ||
| 63 | + }else{ | ||
| 64 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 65 | + while(it.hasNext()){ | ||
| 66 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 67 | + if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 68 | + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 69 | + }else{ | ||
| 70 | + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + map.put("jhlc", format.format(jhlc)); | ||
| 77 | + map.put("remMileage", format.format(remMileage)); | ||
| 78 | + map.put("addMileage", format.format(addMileage)); | ||
| 79 | + map.put("yygl", format.format(yygl)); | ||
| 80 | + map.put("ksgl", format.format(ksgl)); | ||
| 81 | + map.put("realMileage", format.format(yygl+ksgl)); | ||
| 82 | + map.put("jhbc", jhbc); | ||
| 83 | + map.put("cjbc", cjbc); | ||
| 84 | + map.put("ljbc", ljbc); | ||
| 85 | + map.put("sjbc", jhbc-cjbc+ljbc); | ||
| 86 | + return map; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public Map<String, Object> findKMBC2(String jName, String clZbh,String date) { | ||
| 92 | + | ||
| 93 | + | ||
| 94 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date,"",""); | ||
| 95 | + | ||
| 96 | + DecimalFormat format = new DecimalFormat("0.00"); | ||
| 97 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | ||
| 98 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | ||
| 99 | + int jhbc = 0,cjbc = 0,ljbc = 0; | ||
| 100 | + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0; | ||
| 101 | + float addMileage = 0l,remMileage = 0l; | ||
| 102 | + String j_Name=""; | ||
| 103 | + Map<String,Object> map = new HashMap<String, Object>(); | ||
| 104 | + for(ScheduleRealInfo scheduleRealInfo : list){ | ||
| 105 | + if(scheduleRealInfo != null){ | ||
| 106 | + j_Name=scheduleRealInfo.getjName(); | ||
| 107 | + //计划里程(主任务过滤掉临加班次), | ||
| 108 | + //烂班里程(主任务烂班), | ||
| 109 | + //临加里程(主任务临加), | ||
| 110 | + //计划班次,烂班班次,增加班次 | ||
| 111 | + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 112 | + if(scheduleRealInfo.isSflj()){ | ||
| 113 | + addMileage += tempJhlc; | ||
| 114 | + ljbc++; | ||
| 115 | + }else{ | ||
| 116 | + jhlc += tempJhlc; | ||
| 117 | + jhbc++; | ||
| 118 | + if(scheduleRealInfo.getStatus() == -1){ | ||
| 119 | + remMileage += tempJhlc; | ||
| 120 | + cjbc++; | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 124 | + //计算营运里程,空驶里程 | ||
| 125 | + if(childTaskPlans.isEmpty()){ | ||
| 126 | + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 127 | + || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 128 | + ksgl += tempJhlc; | ||
| 129 | + }else{ | ||
| 130 | + yygl += tempJhlc; | ||
| 131 | + } | ||
| 132 | + }else{ | ||
| 133 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 134 | + while(it.hasNext()){ | ||
| 135 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 136 | + if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 137 | + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 138 | + }else{ | ||
| 139 | + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + map.put("j_name", j_Name); | ||
| 146 | + map.put("jhlc", format.format(jhlc)); | ||
| 147 | + map.put("remMileage", format.format(remMileage)); | ||
| 148 | + map.put("addMileage", format.format(addMileage)); | ||
| 149 | + map.put("yygl", format.format(yygl)); | ||
| 150 | + map.put("ksgl", format.format(ksgl)); | ||
| 151 | + map.put("realMileage", format.format(yygl+ksgl)); | ||
| 152 | + map.put("jhbc", jhbc); | ||
| 153 | + map.put("cjbc", cjbc); | ||
| 154 | + map.put("ljbc", ljbc); | ||
| 155 | + map.put("sjbc", jhbc-cjbc+ljbc); | ||
| 156 | + return map; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + | ||
| 161 | + | ||
| 162 | +} |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -17,6 +17,7 @@ import java.util.List; | @@ -17,6 +17,7 @@ import java.util.List; | ||
| 17 | import java.util.Map; | 17 | import java.util.Map; |
| 18 | import java.util.Set; | 18 | import java.util.Set; |
| 19 | 19 | ||
| 20 | +import org.apache.tomcat.jni.Shm; | ||
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | import org.springframework.jdbc.core.JdbcTemplate; | 22 | import org.springframework.jdbc.core.JdbcTemplate; |
| 22 | import org.springframework.jdbc.core.RowMapper; | 23 | import org.springframework.jdbc.core.RowMapper; |
| @@ -88,15 +89,18 @@ public class FormsServiceImpl implements FormsService { | @@ -88,15 +89,18 @@ public class FormsServiceImpl implements FormsService { | ||
| 88 | String line=map.get("line").toString(); | 89 | String line=map.get("line").toString(); |
| 89 | String date=map.get("date").toString(); | 90 | String date=map.get("date").toString(); |
| 90 | 91 | ||
| 92 | + List<String> objList = new ArrayList<String>(); | ||
| 91 | String sql="select " | 93 | String sql="select " |
| 92 | + " r.cl_zbh,r.j_gh" | 94 | + " r.cl_zbh,r.j_gh" |
| 93 | + " from bsth_c_s_sp_info_real r where " | 95 | + " from bsth_c_s_sp_info_real r where " |
| 94 | - + " r.schedule_date_str = '"+date+"'" | ||
| 95 | - + " and r.xl_bm = '"+line+"' " | 96 | + + " r.schedule_date_str = ? " |
| 97 | + + " and r.xl_bm = ? " | ||
| 96 | + " group by " | 98 | + " group by " |
| 97 | + " r.cl_zbh,r.j_gh"; | 99 | + " r.cl_zbh,r.j_gh"; |
| 100 | + objList.add(date); | ||
| 101 | + objList.add(line); | ||
| 98 | 102 | ||
| 99 | - List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() { | 103 | + List<Waybillday> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Waybillday>() { |
| 100 | 104 | ||
| 101 | @Override | 105 | @Override |
| 102 | public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { | 106 | public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -166,8 +170,8 @@ public class FormsServiceImpl implements FormsService { | @@ -166,8 +170,8 @@ public class FormsServiceImpl implements FormsService { | ||
| 166 | } | 170 | } |
| 167 | } | 171 | } |
| 168 | w.setJzl(String.valueOf(jzl)); | 172 | w.setJzl(String.valueOf(jzl)); |
| 169 | - w.setYh(String.valueOf(yh)); | ||
| 170 | - w.setSh(String.valueOf(sh)); | 173 | + w.setYh(Arith.round(yh, 3)+""); |
| 174 | + w.setSh(Arith.round(sh, 3)+""); | ||
| 171 | 175 | ||
| 172 | } | 176 | } |
| 173 | 177 | ||
| @@ -198,9 +202,9 @@ public class FormsServiceImpl implements FormsService { | @@ -198,9 +202,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 198 | way.setJzl1(ksgl.toString()); | 202 | way.setJzl1(ksgl.toString()); |
| 199 | way.setJzl(jzl_.toString()); | 203 | way.setJzl(jzl_.toString()); |
| 200 | way.setjName(""); | 204 | way.setjName(""); |
| 201 | - way.setSh(sh_.toString()); | 205 | + way.setSh(Arith.round(sh_, 3)+""); |
| 202 | way.setZlc(lc_.toString()); | 206 | way.setZlc(lc_.toString()); |
| 203 | - way.setYh(yh_.toString()); | 207 | + way.setYh(Arith.round(yh_, 3)+""); |
| 204 | if(list.size() > 0) | 208 | if(list.size() > 0) |
| 205 | list.add(way); | 209 | list.add(way); |
| 206 | 210 | ||
| @@ -210,26 +214,31 @@ public class FormsServiceImpl implements FormsService { | @@ -210,26 +214,31 @@ public class FormsServiceImpl implements FormsService { | ||
| 210 | // 线路客流量报表 | 214 | // 线路客流量报表 |
| 211 | @Override | 215 | @Override |
| 212 | public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) { | 216 | public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) { |
| 217 | + List<String> objList = new ArrayList<String>(); | ||
| 213 | String sql = " SELECT r.schedule_date,s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name" | 218 | String sql = " SELECT r.schedule_date,s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name" |
| 214 | + " from bsth_c_stationroute s " | 219 | + " from bsth_c_stationroute s " |
| 215 | + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code " | 220 | + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code " |
| 216 | + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code" | 221 | + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code" |
| 217 | - + " where 1=1 "; | 222 | + + " where 1=1 "; |
| 218 | if(map.get("date").toString()!=""){ | 223 | if(map.get("date").toString()!=""){ |
| 219 | - sql+="and r.schedule_date_str='"+map.get("date").toString() + "'"; | 224 | + sql+=" and r.schedule_date_str = ? "; |
| 225 | + objList.add(map.get("date").toString()); | ||
| 220 | } | 226 | } |
| 221 | if( map.get("line").toString()!=""){ | 227 | if( map.get("line").toString()!=""){ |
| 222 | - sql+=" and l.line_code=" + map.get("line").toString(); | 228 | + sql+=" and l.line_code = ? "; |
| 229 | + objList.add(map.get("line").toString()); | ||
| 223 | } | 230 | } |
| 224 | - sql+= " AND r.gs_bm is not null"; | 231 | + sql+=" AND r.gs_bm is not null"; |
| 225 | if(map.get("gsdmLine") != null && map.get("gsdmLine").toString()!=""){ | 232 | if(map.get("gsdmLine") != null && map.get("gsdmLine").toString()!=""){ |
| 226 | - sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' "; | 233 | + sql+=" and r.gs_bm = ? "; |
| 234 | + objList.add(map.get("gsdmLine").toString()); | ||
| 227 | } | 235 | } |
| 228 | if(map.get("fgsdmLine") != null && map.get("fgsdmLine").toString()!=""){ | 236 | if(map.get("fgsdmLine") != null && map.get("fgsdmLine").toString()!=""){ |
| 229 | - sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"' "; | 237 | + sql+=" and r.fgs_bm = ? "; |
| 238 | + objList.add(map.get("fgsdmLine").toString()); | ||
| 230 | } | 239 | } |
| 231 | sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; | 240 | sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; |
| 232 | - List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { | 241 | + List<Linepasswengerflow> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Linepasswengerflow>() { |
| 233 | 242 | ||
| 234 | @Override | 243 | @Override |
| 235 | public Linepasswengerflow mapRow(ResultSet arg0, int arg1) throws SQLException { | 244 | public Linepasswengerflow mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -258,6 +267,7 @@ public class FormsServiceImpl implements FormsService { | @@ -258,6 +267,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 258 | if(map.get("fgsdmManth") != null){ | 267 | if(map.get("fgsdmManth") != null){ |
| 259 | fgsdmManth=map.get("fgsdmManth").toString(); | 268 | fgsdmManth=map.get("fgsdmManth").toString(); |
| 260 | } | 269 | } |
| 270 | + List<String> objList = new ArrayList<String>(); | ||
| 261 | String sql ="select "; | 271 | String sql ="select "; |
| 262 | if(empnames.equals("驾驶员")){ | 272 | if(empnames.equals("驾驶员")){ |
| 263 | sql += " r.j_gh "; | 273 | sql += " r.j_gh "; |
| @@ -267,12 +277,22 @@ public class FormsServiceImpl implements FormsService { | @@ -267,12 +277,22 @@ public class FormsServiceImpl implements FormsService { | ||
| 267 | sql += " r.cl_zbh "; | 277 | sql += " r.cl_zbh "; |
| 268 | } | 278 | } |
| 269 | sql += " from bsth_c_s_sp_info_real r where " | 279 | sql += " from bsth_c_s_sp_info_real r where " |
| 270 | - + " r.schedule_date_str >= '" + map.get("startDate").toString() + "' " | ||
| 271 | - + " and r.schedule_date_str <='" + map.get("endDate").toString() + "' "; | 280 | + + " r.schedule_date_str >= ? " |
| 281 | + + " and r.schedule_date_str <= ? "; | ||
| 282 | + objList.add(map.get("startDate").toString()); | ||
| 283 | + objList.add(map.get("endDate").toString()); | ||
| 272 | if(map.get("line")!=null&&!map.get("line").equals("")){ | 284 | if(map.get("line")!=null&&!map.get("line").equals("")){ |
| 273 | - sql+=" and r.xl_bm='"+ map.get("line").toString() + "' "; | 285 | + sql += " and r.xl_bm = ? "; |
| 286 | + objList.add(map.get("line").toString()); | ||
| 287 | + } | ||
| 288 | + if(gsdmManth.length() > 0){ | ||
| 289 | + sql+=" and r.gs_bm = ? "; | ||
| 290 | + objList.add(gsdmManth); | ||
| 291 | + if(fgsdmManth.length() > 0){ | ||
| 292 | + sql+=" and r.fgs_bm = ? "; | ||
| 293 | + objList.add(fgsdmManth); | ||
| 294 | + } | ||
| 274 | } | 295 | } |
| 275 | - sql+=" and r.gs_bm like'%"+gsdmManth+"%' and r.fgs_bm like'%"+fgsdmManth+"%'"; | ||
| 276 | 296 | ||
| 277 | if(empnames.equals("驾驶员")){ | 297 | if(empnames.equals("驾驶员")){ |
| 278 | sql += " GROUP BY " | 298 | sql += " GROUP BY " |
| @@ -283,7 +303,7 @@ public class FormsServiceImpl implements FormsService { | @@ -283,7 +303,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 283 | sql += " GROUP BY r.cl_zbh"; | 303 | sql += " GROUP BY r.cl_zbh"; |
| 284 | } | 304 | } |
| 285 | 305 | ||
| 286 | - List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { | 306 | + List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Shiftuehiclemanth>() { |
| 287 | 307 | ||
| 288 | @Override | 308 | @Override |
| 289 | public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { | 309 | public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -430,6 +450,7 @@ public class FormsServiceImpl implements FormsService { | @@ -430,6 +450,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 430 | if(map.get("fgsdmManth") != null){ | 450 | if(map.get("fgsdmManth") != null){ |
| 431 | fgsdmManth=map.get("fgsdmManth").toString(); | 451 | fgsdmManth=map.get("fgsdmManth").toString(); |
| 432 | } | 452 | } |
| 453 | + List<String> objList = new ArrayList<String>(); | ||
| 433 | String sql ="select "; | 454 | String sql ="select "; |
| 434 | if(empnames.equals("驾驶员")){ | 455 | if(empnames.equals("驾驶员")){ |
| 435 | sql += " r.j_gh "; | 456 | sql += " r.j_gh "; |
| @@ -439,12 +460,22 @@ public class FormsServiceImpl implements FormsService { | @@ -439,12 +460,22 @@ public class FormsServiceImpl implements FormsService { | ||
| 439 | sql += " r.cl_zbh "; | 460 | sql += " r.cl_zbh "; |
| 440 | } | 461 | } |
| 441 | sql += " from bsth_c_s_sp_info_real r where " | 462 | sql += " from bsth_c_s_sp_info_real r where " |
| 442 | - + " r.schedule_date_str >= '" + map.get("startDate").toString() + "' " | ||
| 443 | - + " and r.schedule_date_str <='" + map.get("endDate").toString() + "' "; | 463 | + + " r.schedule_date_str >= ? " |
| 464 | + + " and r.schedule_date_str <= ? "; | ||
| 465 | + objList.add(map.get("startDate").toString()); | ||
| 466 | + objList.add(map.get("endDate").toString()); | ||
| 444 | if(map.get("line")!=null&&!map.get("line").equals("")){ | 467 | if(map.get("line")!=null&&!map.get("line").equals("")){ |
| 445 | - sql+=" and r.xl_bm='"+ map.get("line").toString() + "' "; | 468 | + sql+=" and r.xl_bm = ? "; |
| 469 | + objList.add(map.get("line").toString()); | ||
| 470 | + } | ||
| 471 | + if(gsdmManth.length() > 0){ | ||
| 472 | + sql+=" and r.gs_bm = ? "; | ||
| 473 | + objList.add(gsdmManth); | ||
| 474 | + if(fgsdmManth.length() > 0){ | ||
| 475 | + sql+=" and r.fgs_bm = ? "; | ||
| 476 | + objList.add(fgsdmManth); | ||
| 477 | + } | ||
| 446 | } | 478 | } |
| 447 | - sql+=" and r.gs_bm like'%"+gsdmManth+"%' and r.fgs_bm like'%"+fgsdmManth+"%'"; | ||
| 448 | 479 | ||
| 449 | if(empnames.equals("驾驶员")){ | 480 | if(empnames.equals("驾驶员")){ |
| 450 | sql += " GROUP BY " | 481 | sql += " GROUP BY " |
| @@ -455,7 +486,7 @@ public class FormsServiceImpl implements FormsService { | @@ -455,7 +486,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 455 | sql += " GROUP BY r.cl_zbh"; | 486 | sql += " GROUP BY r.cl_zbh"; |
| 456 | } | 487 | } |
| 457 | 488 | ||
| 458 | - List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { | 489 | + List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Shiftuehiclemanth>() { |
| 459 | 490 | ||
| 460 | @Override | 491 | @Override |
| 461 | public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { | 492 | public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -637,23 +668,60 @@ public class FormsServiceImpl implements FormsService { | @@ -637,23 +668,60 @@ public class FormsServiceImpl implements FormsService { | ||
| 637 | if(map.get("type") !=null){ | 668 | if(map.get("type") !=null){ |
| 638 | type =map.get("type").toString(); | 669 | type =map.get("type").toString(); |
| 639 | } | 670 | } |
| 640 | - String sql_ =""; | ||
| 641 | - if(!type.equals("") && !statue.equals("")){ | ||
| 642 | - sql_ +=" order by "+statue+" "+type; | ||
| 643 | - } | 671 | + List<String> objList = new ArrayList<String>(); |
| 644 | String sql ="select t.* from (select r.schedule_date," | 672 | String sql ="select t.* from (select r.schedule_date," |
| 645 | + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh," | 673 | + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh," |
| 646 | + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name" | 674 | + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name" |
| 647 | + " FROM bsth_c_s_sp_info_real r where 1=1 " | 675 | + " FROM bsth_c_s_sp_info_real r where 1=1 " |
| 648 | - + " and r.schedule_date_str='"+date + "' " | ||
| 649 | - + " and r.xl_bm = '"+line+"' " | ||
| 650 | - + " and r.gs_bm like '%"+gsdmShif+"%' " | ||
| 651 | - + " and r.fgs_bm like '%"+fgsdmShif+"%' "+sql_+") t" | ||
| 652 | - + " GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name," | 676 | + + " and r.schedule_date_str = ? " |
| 677 | + + " and r.xl_bm = ? "; | ||
| 678 | + objList.add(date); | ||
| 679 | + objList.add(line); | ||
| 680 | + if(gsdmShif.length() > 0){ | ||
| 681 | + sql += " and r.gs_bm = ? "; | ||
| 682 | + objList.add(gsdmShif); | ||
| 683 | + if(fgsdmShif.length() > 0){ | ||
| 684 | + sql += " and r.fgs_bm = ? "; | ||
| 685 | + objList.add(fgsdmShif); | ||
| 686 | + } | ||
| 687 | + } | ||
| 688 | + if(statue.length() > 0){ | ||
| 689 | + switch (statue) { | ||
| 690 | + case "j_name": | ||
| 691 | + sql += " order by j_name "; | ||
| 692 | + switch (type) { | ||
| 693 | + case "asc": | ||
| 694 | + sql += "asc "; | ||
| 695 | + break; | ||
| 696 | + case "desc": | ||
| 697 | + sql += "desc "; | ||
| 698 | + break; | ||
| 699 | + default: | ||
| 700 | + break; | ||
| 701 | + } | ||
| 702 | + break; | ||
| 703 | + case "cl_zbh": | ||
| 704 | + sql += " order by cl_zbh "; | ||
| 705 | + switch (type) { | ||
| 706 | + case "asc": | ||
| 707 | + sql += "asc "; | ||
| 708 | + break; | ||
| 709 | + case "desc": | ||
| 710 | + sql += "desc "; | ||
| 711 | + break; | ||
| 712 | + default: | ||
| 713 | + break; | ||
| 714 | + } | ||
| 715 | + break; | ||
| 716 | + default: | ||
| 717 | + break; | ||
| 718 | + } | ||
| 719 | + } | ||
| 720 | + sql += ") t GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name," | ||
| 653 | + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm "; | 721 | + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm "; |
| 654 | 722 | ||
| 655 | 723 | ||
| 656 | - List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { | 724 | + List<Shifday> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Shifday>() { |
| 657 | 725 | ||
| 658 | @Override | 726 | @Override |
| 659 | public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { | 727 | public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -807,21 +875,26 @@ public class FormsServiceImpl implements FormsService { | @@ -807,21 +875,26 @@ public class FormsServiceImpl implements FormsService { | ||
| 807 | fgs =map.get("fgsdm").toString(); | 875 | fgs =map.get("fgsdm").toString(); |
| 808 | } | 876 | } |
| 809 | 877 | ||
| 810 | - String sql="select * from bsth_c_chtoch where rq BETWEEN '"+ map.get("startDate").toString()+"' " | ||
| 811 | - + " and '"+map.get("endDate").toString() +"'"; | 878 | + List<String> objList = new ArrayList<String>(); |
| 879 | + String sql="select * from bsth_c_chtoch where rq BETWEEN ? and ? "; | ||
| 880 | + objList.add(map.get("startDate").toString()); | ||
| 881 | + objList.add(map.get("endDate").toString()); | ||
| 812 | 882 | ||
| 813 | if(!line.equals("")){ | 883 | if(!line.equals("")){ |
| 814 | - sql +=" and xl= '"+line+"'"; | 884 | + sql +=" and xl = ? "; |
| 885 | + objList.add(line); | ||
| 815 | } | 886 | } |
| 816 | if(!gs.equals("")){ | 887 | if(!gs.equals("")){ |
| 817 | - sql += " and gs= '"+gs+"'"; | 888 | + sql += " and gs = ? "; |
| 889 | + objList.add(gs); | ||
| 818 | } | 890 | } |
| 819 | if(!fgs.equals("")){ | 891 | if(!fgs.equals("")){ |
| 820 | - sql += " and fgs= '"+fgs+"'"; | 892 | + sql += " and fgs = ? "; |
| 893 | + objList.add(fgs); | ||
| 821 | } | 894 | } |
| 822 | 895 | ||
| 823 | sql +=" order by rq"; | 896 | sql +=" order by rq"; |
| 824 | - List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() { | 897 | + List<Changetochange> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Changetochange>() { |
| 825 | @Override | 898 | @Override |
| 826 | public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { | 899 | public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 827 | Changetochange chan = new Changetochange(); | 900 | Changetochange chan = new Changetochange(); |
| @@ -902,23 +975,28 @@ public class FormsServiceImpl implements FormsService { | @@ -902,23 +975,28 @@ public class FormsServiceImpl implements FormsService { | ||
| 902 | List<Singledata> list_=new ArrayList<Singledata>(); | 975 | List<Singledata> list_=new ArrayList<Singledata>(); |
| 903 | if(tjtype.equals("jsy")){ | 976 | if(tjtype.equals("jsy")){ |
| 904 | //油统计 | 977 | //油统计 |
| 978 | + List<String> objList = new ArrayList<String>(); | ||
| 905 | String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.fgs_bm" | 979 | String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.fgs_bm" |
| 906 | + " from bsth_c_s_sp_info_real r where " | 980 | + " from bsth_c_s_sp_info_real r where " |
| 907 | - + " r.schedule_date_str = '"+startDate+"'"; | 981 | + + " r.schedule_date_str = ? "; |
| 982 | + objList.add(startDate); | ||
| 908 | if(xlbm.length() != 0){ | 983 | if(xlbm.length() != 0){ |
| 909 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 984 | + sql += " and r.xl_bm = ? "; |
| 985 | + objList.add(xlbm); | ||
| 910 | } | 986 | } |
| 911 | if(gsdm.length() != 0){ | 987 | if(gsdm.length() != 0){ |
| 912 | - sql += " and r.gs_bm ='"+gsdm+"'"; | 988 | + sql += " and r.gs_bm = ? "; |
| 989 | + objList.add(gsdm); | ||
| 913 | } | 990 | } |
| 914 | if(fgsdm.length() != 0){ | 991 | if(fgsdm.length() != 0){ |
| 915 | - sql += " and r.fgs_bm ='"+fgsdm+"'"; | 992 | + sql += " and r.fgs_bm = ? "; |
| 993 | + objList.add(fgsdm); | ||
| 916 | } | 994 | } |
| 917 | - sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh " + | ||
| 918 | - "order by r.xl_bm,r.cl_zbh"; | ||
| 919 | - | ||
| 920 | - | ||
| 921 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 995 | + sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh " + |
| 996 | + "order by r.xl_bm,r.cl_zbh"; | ||
| 997 | + | ||
| 998 | + | ||
| 999 | + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { | ||
| 922 | @Override | 1000 | @Override |
| 923 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1001 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 924 | Singledata sin = new Singledata(); | 1002 | Singledata sin = new Singledata(); |
| @@ -933,24 +1011,39 @@ public class FormsServiceImpl implements FormsService { | @@ -933,24 +1011,39 @@ public class FormsServiceImpl implements FormsService { | ||
| 933 | 1011 | ||
| 934 | Collections.sort(list,new SingledataByXlbm()); | 1012 | Collections.sort(list,new SingledataByXlbm()); |
| 935 | 1013 | ||
| 936 | - String linesql=""; | 1014 | + List<String> nyObjList = new ArrayList<String>(); |
| 1015 | + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb" | ||
| 1016 | + + " WHERE rq = ? "; | ||
| 1017 | + nyObjList.add(startDate); | ||
| 937 | if(!xlbm.equals("")){ | 1018 | if(!xlbm.equals("")){ |
| 938 | - linesql +=" and xlbm ='"+xlbm+"' "; | 1019 | + nysql +=" and xlbm = ? "; |
| 1020 | + nyObjList.add(xlbm); | ||
| 939 | } | 1021 | } |
| 940 | if(!gsdm.equals("")){ | 1022 | if(!gsdm.equals("")){ |
| 941 | - linesql +=" and ssgsdm ='"+gsdm+"' "; | 1023 | + nysql +=" and ssgsdm = ? "; |
| 1024 | + nyObjList.add(gsdm); | ||
| 942 | } | 1025 | } |
| 943 | if(!fgsdm.equals("")){ | 1026 | if(!fgsdm.equals("")){ |
| 944 | - linesql +=" and fgsdm ='"+fgsdm+"' "; | 1027 | + nysql +=" and fgsdm = ? "; |
| 1028 | + nyObjList.add(fgsdm); | ||
| 945 | } | 1029 | } |
| 946 | - String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb" | ||
| 947 | - + " WHERE rq = '"+startDate+"'" | ||
| 948 | - + linesql | ||
| 949 | - + " union" | 1030 | + nysql += " union" |
| 950 | + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" | 1031 | + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" |
| 951 | - + " WHERE rq = '"+startDate+"'" | ||
| 952 | - + linesql; | ||
| 953 | - List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | 1032 | + + " WHERE rq = ? "; |
| 1033 | + nyObjList.add(startDate); | ||
| 1034 | + if(!xlbm.equals("")){ | ||
| 1035 | + nysql +=" and xlbm = ? "; | ||
| 1036 | + nyObjList.add(xlbm); | ||
| 1037 | + } | ||
| 1038 | + if(!gsdm.equals("")){ | ||
| 1039 | + nysql +=" and ssgsdm = ? "; | ||
| 1040 | + nyObjList.add(gsdm); | ||
| 1041 | + } | ||
| 1042 | + if(!fgsdm.equals("")){ | ||
| 1043 | + nysql +=" and fgsdm = ? "; | ||
| 1044 | + nyObjList.add(fgsdm); | ||
| 1045 | + } | ||
| 1046 | + List<Singledata> listNy = jdbcTemplate.query(nysql, nyObjList.toArray(), new RowMapper<Singledata>() { | ||
| 954 | @Override | 1047 | @Override |
| 955 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1048 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 956 | Singledata sin = new Singledata(); | 1049 | Singledata sin = new Singledata(); |
| @@ -985,7 +1078,6 @@ public class FormsServiceImpl implements FormsService { | @@ -985,7 +1078,6 @@ public class FormsServiceImpl implements FormsService { | ||
| 985 | if(fages){ | 1078 | if(fages){ |
| 986 | Singledata s=new Singledata(); | 1079 | Singledata s=new Singledata(); |
| 987 | s.setJsy(jsy); | 1080 | s.setJsy(jsy); |
| 988 | -// s.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | ||
| 989 | s.setClzbh(clzbh); | 1081 | s.setClzbh(clzbh); |
| 990 | s.setSgh(""); | 1082 | s.setSgh(""); |
| 991 | s.setsName(""); | 1083 | s.setsName(""); |
| @@ -1020,9 +1112,9 @@ public class FormsServiceImpl implements FormsService { | @@ -1020,9 +1112,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 1020 | sh=Arith.add(sh, y.getUnyyyl()); | 1112 | sh=Arith.add(sh, y.getUnyyyl()); |
| 1021 | } | 1113 | } |
| 1022 | } | 1114 | } |
| 1023 | - sin.setHyl(String.valueOf(yh)); | ||
| 1024 | - sin.setJzl(String.valueOf(jzl)); | ||
| 1025 | - sin.setUnyyyl(String.valueOf(sh)); | 1115 | + sin.setHyl(Arith.round(yh, 3) + ""); |
| 1116 | + sin.setJzl(Arith.round(jzl, 3) + ""); | ||
| 1117 | + sin.setUnyyyl(Arith.round(sh, 3) + ""); | ||
| 1026 | 1118 | ||
| 1027 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | 1119 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| 1028 | List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); | 1120 | List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); |
| @@ -1072,24 +1164,29 @@ public class FormsServiceImpl implements FormsService { | @@ -1072,24 +1164,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 1072 | 1164 | ||
| 1073 | } | 1165 | } |
| 1074 | }else{ | 1166 | }else{ |
| 1167 | + List<String> objList = new ArrayList<String>(); | ||
| 1075 | String sql="select r.s_gh,r.s_name, " | 1168 | String sql="select r.s_gh,r.s_name, " |
| 1076 | - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" | 1169 | + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm " |
| 1077 | + " from bsth_c_s_sp_info_real r where " | 1170 | + " from bsth_c_s_sp_info_real r where " |
| 1078 | - + " r.schedule_date_str = '"+startDate+"'" | ||
| 1079 | - + " and r.s_gh !='' and r.s_gh is not null "; | 1171 | + + " r.schedule_date_str = ? " |
| 1172 | + + " and r.s_gh !='' and r.s_gh is not null "; | ||
| 1173 | + objList.add(startDate); | ||
| 1080 | if(!xlbm.equals("")){ | 1174 | if(!xlbm.equals("")){ |
| 1081 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 1175 | + sql += " and r.xl_bm = ? "; |
| 1176 | + objList.add(xlbm); | ||
| 1082 | } | 1177 | } |
| 1083 | if(!gsdm.equals("")){ | 1178 | if(!gsdm.equals("")){ |
| 1084 | - sql += " and r.gs_bm = '"+gsdm+"'"; | 1179 | + sql += " and r.gs_bm = ? "; |
| 1180 | + objList.add(gsdm); | ||
| 1085 | } | 1181 | } |
| 1086 | if(!fgsdm.equals("")){ | 1182 | if(!fgsdm.equals("")){ |
| 1087 | - sql += " and r.fgs_bm = '"+fgsdm+"'"; | 1183 | + sql += " and r.fgs_bm = ? "; |
| 1184 | + objList.add(fgsdm); | ||
| 1088 | } | 1185 | } |
| 1089 | sql += " group by r.s_gh,r.s_name," | 1186 | sql += " group by r.s_gh,r.s_name," |
| 1090 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 1187 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; |
| 1091 | 1188 | ||
| 1092 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1189 | + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { |
| 1093 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1190 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1094 | @Override | 1191 | @Override |
| 1095 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1192 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -1205,20 +1302,25 @@ public class FormsServiceImpl implements FormsService { | @@ -1205,20 +1302,25 @@ public class FormsServiceImpl implements FormsService { | ||
| 1205 | List<Singledata> list_=new ArrayList<Singledata>(); | 1302 | List<Singledata> list_=new ArrayList<Singledata>(); |
| 1206 | if(tjtype.equals("jsy")){ | 1303 | if(tjtype.equals("jsy")){ |
| 1207 | //油统计 | 1304 | //油统计 |
| 1305 | + List<String> objList = new ArrayList<String>(); | ||
| 1208 | String sql="select r.j_gh, r.xl_bm,r.cl_zbh" | 1306 | String sql="select r.j_gh, r.xl_bm,r.cl_zbh" |
| 1209 | + " from bsth_c_s_sp_info_real r where " | 1307 | + " from bsth_c_s_sp_info_real r where " |
| 1210 | - + " r.schedule_date_str = '"+startDate+"'"; | 1308 | + + " r.schedule_date_str = ? "; |
| 1309 | + objList.add(startDate); | ||
| 1211 | if(!xlbm.equals("")){ | 1310 | if(!xlbm.equals("")){ |
| 1212 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 1311 | + sql += " and r.xl_bm = ? "; |
| 1312 | + objList.add(xlbm); | ||
| 1213 | } | 1313 | } |
| 1214 | if(!gsdm.equals("")){ | 1314 | if(!gsdm.equals("")){ |
| 1215 | - sql += " and r.gs_bm='"+gsdm+"'"; | 1315 | + sql += " and r.gs_bm= ? "; |
| 1316 | + objList.add(gsdm); | ||
| 1216 | } | 1317 | } |
| 1217 | if(!fgsdm.equals("")){ | 1318 | if(!fgsdm.equals("")){ |
| 1218 | - sql += " and r.fgs_bm='"+fgsdm+"'"; | 1319 | + sql += " and r.fgs_bm = ? "; |
| 1320 | + objList.add(fgsdm); | ||
| 1219 | } | 1321 | } |
| 1220 | - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh"; | ||
| 1221 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1322 | + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh"; |
| 1323 | + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { | ||
| 1222 | @Override | 1324 | @Override |
| 1223 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1325 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 1224 | Singledata sin = new Singledata(); | 1326 | Singledata sin = new Singledata(); |
| @@ -1229,24 +1331,39 @@ public class FormsServiceImpl implements FormsService { | @@ -1229,24 +1331,39 @@ public class FormsServiceImpl implements FormsService { | ||
| 1229 | return sin; | 1331 | return sin; |
| 1230 | } | 1332 | } |
| 1231 | }); | 1333 | }); |
| 1232 | - String linesql=""; | 1334 | + List<String> nyObjList = new ArrayList<String>(); |
| 1335 | + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " | ||
| 1336 | + + " WHERE rq = ? "; | ||
| 1337 | + nyObjList.add(startDate); | ||
| 1233 | if(!xlbm.equals("")){ | 1338 | if(!xlbm.equals("")){ |
| 1234 | - linesql += " and xlbm ='"+xlbm+"' "; | 1339 | + nysql +=" and xlbm = ? "; |
| 1340 | + nyObjList.add(xlbm); | ||
| 1235 | } | 1341 | } |
| 1236 | - if(!gsdm.equals("")){ | ||
| 1237 | - linesql += " and ssgsdm ='"+gsdm+"'"; | ||
| 1238 | - } | ||
| 1239 | - if(!fgsdm.equals("")){ | ||
| 1240 | - linesql += " and fgsdm ='"+fgsdm+"'"; | ||
| 1241 | - } | ||
| 1242 | - String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " | ||
| 1243 | - + " WHERE rq = '"+startDate+"'" | ||
| 1244 | - + linesql | ||
| 1245 | - + " union" | ||
| 1246 | - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb" | ||
| 1247 | - + " WHERE rq = '"+startDate+"'" | ||
| 1248 | - + linesql; | ||
| 1249 | - List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | 1342 | + if(!gsdm.equals("")){ |
| 1343 | + nysql +=" and ssgsdm = ? "; | ||
| 1344 | + nyObjList.add(gsdm); | ||
| 1345 | + } | ||
| 1346 | + if(!fgsdm.equals("")){ | ||
| 1347 | + nysql +=" and fgsdm = ? "; | ||
| 1348 | + nyObjList.add(fgsdm); | ||
| 1349 | + } | ||
| 1350 | + nysql += " union" | ||
| 1351 | + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb " | ||
| 1352 | + + " WHERE rq = ? "; | ||
| 1353 | + nyObjList.add(startDate); | ||
| 1354 | + if(!xlbm.equals("")){ | ||
| 1355 | + nysql +=" and xlbm = ? "; | ||
| 1356 | + nyObjList.add(xlbm); | ||
| 1357 | + } | ||
| 1358 | + if(!gsdm.equals("")){ | ||
| 1359 | + nysql +=" and ssgsdm = ? "; | ||
| 1360 | + nyObjList.add(gsdm); | ||
| 1361 | + } | ||
| 1362 | + if(!fgsdm.equals("")){ | ||
| 1363 | + nysql +=" and fgsdm = ? "; | ||
| 1364 | + nyObjList.add(fgsdm); | ||
| 1365 | + } | ||
| 1366 | + List<Singledata> listNy = jdbcTemplate.query(nysql, nyObjList.toArray(), new RowMapper<Singledata>() { | ||
| 1250 | @Override | 1367 | @Override |
| 1251 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1368 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 1252 | Singledata sin = new Singledata(); | 1369 | Singledata sin = new Singledata(); |
| @@ -1315,9 +1432,9 @@ public class FormsServiceImpl implements FormsService { | @@ -1315,9 +1432,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 1315 | sh=Arith.add(sh, y.getUnyyyl()); | 1432 | sh=Arith.add(sh, y.getUnyyyl()); |
| 1316 | } | 1433 | } |
| 1317 | } | 1434 | } |
| 1318 | - sin.setHyl(String.valueOf(yh)); | ||
| 1319 | - sin.setJzl(String.valueOf(jzl)); | ||
| 1320 | - sin.setUnyyyl(String.valueOf(sh)); | 1435 | + sin.setHyl(Arith.round(yh, 3) + ""); |
| 1436 | + sin.setJzl(Arith.round(jzl, 3) + ""); | ||
| 1437 | + sin.setUnyyyl(Arith.round(sh, 3) + ""); | ||
| 1321 | 1438 | ||
| 1322 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | 1439 | List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); |
| 1323 | List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); | 1440 | List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); |
| @@ -1367,24 +1484,29 @@ public class FormsServiceImpl implements FormsService { | @@ -1367,24 +1484,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 1367 | } | 1484 | } |
| 1368 | Collections.sort(list_,new SingledataByXlbm()); | 1485 | Collections.sort(list_,new SingledataByXlbm()); |
| 1369 | }else{ | 1486 | }else{ |
| 1487 | + List<String> objList = new ArrayList<String>(); | ||
| 1370 | String sql="select r.s_gh, " | 1488 | String sql="select r.s_gh, " |
| 1371 | - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" | 1489 | + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm " |
| 1372 | + " from bsth_c_s_sp_info_real r where " | 1490 | + " from bsth_c_s_sp_info_real r where " |
| 1373 | - + " r.schedule_date_str = '"+startDate+"'" | ||
| 1374 | - + " and r.s_gh !='' and r.s_gh is not null "; | 1491 | + + " r.schedule_date_str = ? " |
| 1492 | + + " and r.s_gh !='' and r.s_gh is not null "; | ||
| 1493 | + objList.add(startDate); | ||
| 1375 | if(!xlbm.equals("")){ | 1494 | if(!xlbm.equals("")){ |
| 1376 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 1495 | + sql += " and r.xl_bm = ? "; |
| 1496 | + objList.add(xlbm); | ||
| 1377 | } | 1497 | } |
| 1378 | if(!gsdm.equals("")){ | 1498 | if(!gsdm.equals("")){ |
| 1379 | - sql += " and r.gs_bm='"+gsdm+"'"; | 1499 | + sql += " and r.gs_bm = ? "; |
| 1500 | + objList.add(gsdm); | ||
| 1380 | } | 1501 | } |
| 1381 | if(!fgsdm.equals("")){ | 1502 | if(!fgsdm.equals("")){ |
| 1382 | - sql += " and r.fgs_bm='"+fgsdm+"'"; | 1503 | + sql += " and r.fgs_bm = ? "; |
| 1504 | + objList.add(fgsdm); | ||
| 1383 | } | 1505 | } |
| 1384 | sql += " group by r.s_gh," | 1506 | sql += " group by r.s_gh," |
| 1385 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 1507 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; |
| 1386 | - | ||
| 1387 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1508 | + |
| 1509 | + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { | ||
| 1388 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1510 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1389 | @Override | 1511 | @Override |
| 1390 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1512 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -1461,281 +1583,6 @@ public class FormsServiceImpl implements FormsService { | @@ -1461,281 +1583,6 @@ public class FormsServiceImpl implements FormsService { | ||
| 1461 | return list_; | 1583 | return list_; |
| 1462 | } | 1584 | } |
| 1463 | 1585 | ||
| 1464 | - /*// 路单数据 | ||
| 1465 | - @Override | ||
| 1466 | - public List<Singledata> singledatatj(Map<String, Object> map) { | ||
| 1467 | - | ||
| 1468 | - String gsdm=""; | ||
| 1469 | - if(map.get("gsdmSing")!=null){ | ||
| 1470 | - gsdm=map.get("gsdmSing").toString(); | ||
| 1471 | - } | ||
| 1472 | - String fgsdm=""; | ||
| 1473 | - if(map.get("fgsdmSing")!=null){ | ||
| 1474 | - fgsdm=map.get("fgsdmSing").toString(); | ||
| 1475 | - } | ||
| 1476 | - | ||
| 1477 | - String tjtype=map.get("tjtype").toString(); | ||
| 1478 | - String xlbm=map.get("line").toString().trim(); | ||
| 1479 | - startDate = map.get("startDate").toString(); | ||
| 1480 | - | ||
| 1481 | - List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>(); | ||
| 1482 | - if(xlbm.equals("")){ | ||
| 1483 | - listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate); | ||
| 1484 | - }else{ | ||
| 1485 | - listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate); | ||
| 1486 | - } | ||
| 1487 | - List<Singledata> list=new ArrayList<Singledata>(); | ||
| 1488 | - List<Singledata> listY=new ArrayList<Singledata>(); | ||
| 1489 | - List<Singledata> listD=new ArrayList<Singledata>(); | ||
| 1490 | - | ||
| 1491 | - if(tjtype.equals("jsy")){ | ||
| 1492 | - //油统计 | ||
| 1493 | - String sql="select xlbm,nbbm,jsy from bsth_c_ylb where rq='"+startDate+"'"; | ||
| 1494 | - if(xlbm.equals("")){ | ||
| 1495 | - sql += " and ssgsdm= '"+gsdm+"' and fgsdm= '"+fgsdm+"'"; | ||
| 1496 | - }else{ | ||
| 1497 | - sql +=" and xlbm= '"+xlbm+"'"; | ||
| 1498 | - } | ||
| 1499 | - sql += " group by xlbm,nbbm,jsy"; | ||
| 1500 | - listY = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | ||
| 1501 | - @Override | ||
| 1502 | - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 1503 | - Singledata sin = new Singledata(); | ||
| 1504 | - sin.setxL(arg0.getString("xlbm")); | ||
| 1505 | - sin.setJsy(arg0.getString("jsy")); | ||
| 1506 | - sin.setClzbh(arg0.getString("nbbm")); | ||
| 1507 | - return sin; | ||
| 1508 | - } | ||
| 1509 | - }); | ||
| 1510 | - | ||
| 1511 | - List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | ||
| 1512 | - for (int i = 0; i < listY.size(); i++) { | ||
| 1513 | - Singledata sin=listY.get(i); | ||
| 1514 | - String jsy=sin.getJsy(); | ||
| 1515 | - String line=sin.getxL(); | ||
| 1516 | - String clzbh=sin.getClzbh(); | ||
| 1517 | - | ||
| 1518 | - double jzl=0.0; | ||
| 1519 | - double yh=0.0; | ||
| 1520 | - double sh=0.0; | ||
| 1521 | - for (int j = 0; j < listYlb.size(); j++) { | ||
| 1522 | - Ylb y=listYlb.get(j); | ||
| 1523 | - if(y.getJsy().equals(jsy) | ||
| 1524 | - &&y.getNbbm().equals(clzbh) | ||
| 1525 | - &&y.getXlbm().equals(line)){ | ||
| 1526 | - jzl=Arith.add(jzl, y.getJzl()); | ||
| 1527 | - yh=Arith.add(yh, y.getYh()); | ||
| 1528 | - sh=Arith.add(sh, y.getSh()); | ||
| 1529 | - } | ||
| 1530 | - } | ||
| 1531 | - sin.setHyl(String.valueOf(yh)); | ||
| 1532 | - sin.setJzl(String.valueOf(jzl)); | ||
| 1533 | - sin.setUnyyyl(String.valueOf(sh)); | ||
| 1534 | - | ||
| 1535 | - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 1536 | - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); | ||
| 1537 | - for (int j = 0; j < listReal.size(); j++) { | ||
| 1538 | - ScheduleRealInfo s=listReal.get(j); | ||
| 1539 | - if(s.getjGh().equals(jsy) | ||
| 1540 | - && s.getClZbh().equals(clzbh) | ||
| 1541 | - &&s.getXlBm().equals(line)){ | ||
| 1542 | - newList.add(s); | ||
| 1543 | - Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 1544 | - if(cts != null && cts.size() > 0){ | ||
| 1545 | - newList_.add(s); | ||
| 1546 | - }else{ | ||
| 1547 | - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | ||
| 1548 | - newList_.add(s); | ||
| 1549 | - } | ||
| 1550 | - } | ||
| 1551 | - } | ||
| 1552 | - } | ||
| 1553 | - double jhgl=culateMileageService.culateJhgl(newList); | ||
| 1554 | - double jhjcc=culateMileageService.culateJhJccgl(newList); | ||
| 1555 | - double yygl=culateMileageService.culateSjgl(newList_); | ||
| 1556 | - double ljgl=culateMileageService.culateLjgl(newList_); | ||
| 1557 | - double ksgl=culateMileageService.culateKsgl(newList_); | ||
| 1558 | - double jcgl=culateMileageService.culateJccgl(newList_); | ||
| 1559 | - | ||
| 1560 | - double zyygl=Arith.add(yygl, ljgl); | ||
| 1561 | - double zksgl=Arith.add(ksgl, jcgl); | ||
| 1562 | - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); | ||
| 1563 | - sin.setEmptMileage(String.valueOf(zksgl)); | ||
| 1564 | - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); | ||
| 1565 | - sin.setXlmc(BasicData.lineCode2NameMap.get(line)); | ||
| 1566 | - sin.setrQ(startDate); | ||
| 1567 | - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | ||
| 1568 | - sin.setSgh(""); | ||
| 1569 | - sin.setsName(""); | ||
| 1570 | - } | ||
| 1571 | - | ||
| 1572 | - | ||
| 1573 | - //电量计算 | ||
| 1574 | - String sqldl="select xlbm,nbbm,jsy from bsth_c_dlb where rq='"+startDate+"'"; | ||
| 1575 | - if(xlbm.equals("")){ | ||
| 1576 | - sqldl += " and ssgsdm= '"+gsdm+"' and fgsdm= '"+fgsdm+"'"; | ||
| 1577 | - }else{ | ||
| 1578 | - sqldl +=" and xlbm= '"+xlbm+"'"; | ||
| 1579 | - } | ||
| 1580 | - sqldl += " group by xlbm,nbbm,jsy"; | ||
| 1581 | - listD = jdbcTemplate.query(sqldl, new RowMapper<Singledata>() { | ||
| 1582 | - @Override | ||
| 1583 | - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 1584 | - Singledata sin = new Singledata(); | ||
| 1585 | - sin.setxL(arg0.getString("xlbm")); | ||
| 1586 | - sin.setJsy(arg0.getString("jsy")); | ||
| 1587 | - sin.setClzbh(arg0.getString("nbbm")); | ||
| 1588 | - return sin; | ||
| 1589 | - } | ||
| 1590 | - }); | ||
| 1591 | - List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | ||
| 1592 | - | ||
| 1593 | - for (int i = 0; i < listD.size(); i++) { | ||
| 1594 | - Singledata sin=listD.get(i); | ||
| 1595 | - String jsy=sin.getJsy(); | ||
| 1596 | - String line=sin.getxL(); | ||
| 1597 | - String clzbh=sin.getClzbh(); | ||
| 1598 | - | ||
| 1599 | - double jzl=0.0; | ||
| 1600 | - double yh=0.0; | ||
| 1601 | - double sh=0.0; | ||
| 1602 | - for (int j = 0; j < listDlb.size(); j++) { | ||
| 1603 | - Dlb d=listDlb.get(j); | ||
| 1604 | - if(d.getJsy().equals(jsy) | ||
| 1605 | - &&d.getNbbm().equals(clzbh) | ||
| 1606 | - &&d.getXlbm().equals(line)){ | ||
| 1607 | - jzl=Arith.add(jzl, d.getCdl()); | ||
| 1608 | - yh=Arith.add(yh, d.getHd()); | ||
| 1609 | - sh=Arith.add(sh, d.getSh()); | ||
| 1610 | - } | ||
| 1611 | - } | ||
| 1612 | - sin.setHyl(String.valueOf(yh)); | ||
| 1613 | - sin.setJzl(String.valueOf(jzl)); | ||
| 1614 | - sin.setUnyyyl(String.valueOf(sh)); | ||
| 1615 | - | ||
| 1616 | - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 1617 | - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); | ||
| 1618 | - for (int j = 0; j < listReal.size(); j++) { | ||
| 1619 | - ScheduleRealInfo s=listReal.get(j); | ||
| 1620 | - if(s.getjGh().equals(jsy) | ||
| 1621 | - && s.getClZbh().equals(clzbh) | ||
| 1622 | - &&s.getXlBm().equals(line)){ | ||
| 1623 | - newList.add(s); | ||
| 1624 | - Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 1625 | - if(cts != null && cts.size() > 0){ | ||
| 1626 | - newList_.add(s); | ||
| 1627 | - }else{ | ||
| 1628 | - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | ||
| 1629 | - newList_.add(s); | ||
| 1630 | - } | ||
| 1631 | - } | ||
| 1632 | - } | ||
| 1633 | - } | ||
| 1634 | - double jhgl=culateMileageService.culateJhgl(newList); | ||
| 1635 | - double jhjcc=culateMileageService.culateJhJccgl(newList); | ||
| 1636 | - double yygl=culateMileageService.culateSjgl(newList_); | ||
| 1637 | - double ljgl=culateMileageService.culateLjgl(newList_); | ||
| 1638 | - double ksgl=culateMileageService.culateKsgl(newList_); | ||
| 1639 | - double jcgl=culateMileageService.culateJccgl(newList_); | ||
| 1640 | - | ||
| 1641 | - double zyygl=Arith.add(yygl, ljgl); | ||
| 1642 | - double zksgl=Arith.add(ksgl, jcgl); | ||
| 1643 | - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); | ||
| 1644 | - sin.setEmptMileage(String.valueOf(zksgl)); | ||
| 1645 | - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); | ||
| 1646 | - sin.setXlmc(BasicData.lineCode2NameMap.get(line)); | ||
| 1647 | - sin.setrQ(startDate); | ||
| 1648 | - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | ||
| 1649 | - sin.setSgh(""); | ||
| 1650 | - sin.setsName(""); | ||
| 1651 | - } | ||
| 1652 | - | ||
| 1653 | - | ||
| 1654 | - Collections.sort(listY,new SingledataByXlbm()); | ||
| 1655 | - Collections.sort(listD,new SingledataByXlbm()); | ||
| 1656 | - list.addAll(listY); | ||
| 1657 | - list.addAll(listD); | ||
| 1658 | - }else{ | ||
| 1659 | - String sql="select r.s_gh,r.s_name, " | ||
| 1660 | - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" | ||
| 1661 | - + " from bsth_c_s_sp_info_real r where " | ||
| 1662 | - + " r.schedule_date_str = '"+startDate+"'" | ||
| 1663 | - + " and r.s_gh !='' and r.s_gh is not null "; | ||
| 1664 | - if(xlbm.equals("")){ | ||
| 1665 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 1666 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1667 | - }else{ | ||
| 1668 | - sql += " and r.xl_bm = '"+xlbm+"'"; | ||
| 1669 | - } | ||
| 1670 | - sql += " group by r.s_gh,r.s_name," | ||
| 1671 | - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 1672 | - | ||
| 1673 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | ||
| 1674 | - //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1675 | - @Override | ||
| 1676 | - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 1677 | - Singledata sin = new Singledata(); | ||
| 1678 | - sin.setrQ(startDate); | ||
| 1679 | - sin.setxL(arg0.getString("xl_bm")); | ||
| 1680 | - sin.setClzbh(arg0.getString("cl_zbh")); | ||
| 1681 | - sin.setSgh(arg0.getString("s_gh")); | ||
| 1682 | - sin.setsName(arg0.getString("s_name")); | ||
| 1683 | - return sin; | ||
| 1684 | - } | ||
| 1685 | - }); | ||
| 1686 | - | ||
| 1687 | - for (int i = 0; i < list.size(); i++) { | ||
| 1688 | - Singledata sin=list.get(i); | ||
| 1689 | - String jsy=sin.getSgh(); | ||
| 1690 | - String line=sin.getxL(); | ||
| 1691 | - String clzbh=sin.getClzbh(); | ||
| 1692 | - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 1693 | - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); | ||
| 1694 | - | ||
| 1695 | - for (int j = 0; j < listReal.size(); j++) { | ||
| 1696 | - ScheduleRealInfo s=listReal.get(j); | ||
| 1697 | - if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh) | ||
| 1698 | - &&s.getXlBm().equals(line)){ | ||
| 1699 | - newList.add(s); | ||
| 1700 | - Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 1701 | - if(cts != null && cts.size() > 0){ | ||
| 1702 | - newList_.add(s); | ||
| 1703 | - }else{ | ||
| 1704 | - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | ||
| 1705 | - newList_.add(s); | ||
| 1706 | - } | ||
| 1707 | - } | ||
| 1708 | - } | ||
| 1709 | - } | ||
| 1710 | - double jhgl=culateMileageService.culateJhgl(newList); | ||
| 1711 | - double jhjcc=culateMileageService.culateJhJccgl(newList); | ||
| 1712 | - double yygl=culateMileageService.culateSjgl(newList_); | ||
| 1713 | - double ljgl=culateMileageService.culateLjgl(newList_); | ||
| 1714 | - double ksgl=culateMileageService.culateKsgl(newList_); | ||
| 1715 | - double jcgl=culateMileageService.culateJccgl(newList_); | ||
| 1716 | - | ||
| 1717 | - double zyygl=Arith.add(yygl, ljgl); | ||
| 1718 | - double zksgl=Arith.add(ksgl, jcgl); | ||
| 1719 | - | ||
| 1720 | - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); | ||
| 1721 | - | ||
| 1722 | - sin.setEmptMileage(String.valueOf(zksgl)); | ||
| 1723 | - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); | ||
| 1724 | - sin.setxL(BasicData.lineCode2NameMap.get(line)); | ||
| 1725 | - sin.setClzbh(clzbh); | ||
| 1726 | - sin.setJsy(""); | ||
| 1727 | - sin.setjName(""); | ||
| 1728 | - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 1729 | - sin.setHyl(""); | ||
| 1730 | - sin.setJzl(""); | ||
| 1731 | - sin.setUnyyyl(""); | ||
| 1732 | - } | ||
| 1733 | - Collections.sort(list,new SingledataByXlbm()); | ||
| 1734 | - } | ||
| 1735 | - | ||
| 1736 | - return list; | ||
| 1737 | - | ||
| 1738 | - }*/ | ||
| 1739 | 1586 | ||
| 1740 | // 路单数据 | 1587 | // 路单数据 |
| 1741 | @Override | 1588 | @Override |
| @@ -1752,39 +1599,31 @@ public class FormsServiceImpl implements FormsService { | @@ -1752,39 +1599,31 @@ public class FormsServiceImpl implements FormsService { | ||
| 1752 | 1599 | ||
| 1753 | String xlbm=map.get("line").toString().trim(); | 1600 | String xlbm=map.get("line").toString().trim(); |
| 1754 | 1601 | ||
| 1755 | - /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1756 | - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日"); | ||
| 1757 | - Date d = null; | ||
| 1758 | - Date d1 = null; | ||
| 1759 | - try { | ||
| 1760 | - d = sdf.parse(map.get("startDate").toString()); | ||
| 1761 | - d1 = sdf.parse(map.get("endDate").toString()); | ||
| 1762 | - } catch (ParseException e) { | ||
| 1763 | 1602 | ||
| 1764 | - e.printStackTrace(); | ||
| 1765 | - } | ||
| 1766 | - String rq2 = sdf1.format(d); | ||
| 1767 | - String rq3 = sdf1.format(d1);*/ | ||
| 1768 | - | ||
| 1769 | -// rq = rq2 + "-" + rq3; | ||
| 1770 | startDate = map.get("startDate").toString(); | 1603 | startDate = map.get("startDate").toString(); |
| 1771 | 1604 | ||
| 1605 | + | ||
| 1606 | + List<String> objList = new ArrayList<String>(); | ||
| 1772 | String sql="select r.s_gh,r.s_name, " | 1607 | String sql="select r.s_gh,r.s_name, " |
| 1773 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm,xl_name" | 1608 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm,xl_name" |
| 1774 | - + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'"; | 1609 | + + " from bsth_c_s_sp_info_real r where r.schedule_date_str = ? "; |
| 1610 | + objList.add(startDate); | ||
| 1775 | if(!xlbm.equals("")){ | 1611 | if(!xlbm.equals("")){ |
| 1776 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 1612 | + sql += " and r.xl_bm = ? "; |
| 1613 | + objList.add(xlbm); | ||
| 1777 | } | 1614 | } |
| 1778 | if(!gsdm.equals("")){ | 1615 | if(!gsdm.equals("")){ |
| 1779 | - sql += " and r.gs_bm='"+gsdm+"'"; | 1616 | + sql += " and r.gs_bm = ? "; |
| 1617 | + objList.add(gsdm); | ||
| 1780 | } | 1618 | } |
| 1781 | if(!fgsdm.equals("")){ | 1619 | if(!fgsdm.equals("")){ |
| 1782 | - sql += " and r.fgs_bm='"+fgsdm+"'"; | 1620 | + sql += " and r.fgs_bm = ? "; |
| 1621 | + objList.add(fgsdm); | ||
| 1783 | } | 1622 | } |
| 1784 | sql += " group by r.s_gh,r.s_name," | 1623 | sql += " group by r.s_gh,r.s_name," |
| 1785 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh"; | 1624 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh"; |
| 1786 | 1625 | ||
| 1787 | - List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1626 | + List<Singledata> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { |
| 1788 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1627 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1789 | @Override | 1628 | @Override |
| 1790 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1629 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -1802,7 +1641,6 @@ public class FormsServiceImpl implements FormsService { | @@ -1802,7 +1641,6 @@ public class FormsServiceImpl implements FormsService { | ||
| 1802 | return sin; | 1641 | return sin; |
| 1803 | } | 1642 | } |
| 1804 | }); | 1643 | }); |
| 1805 | - DecimalFormat df = new DecimalFormat("0.00"); | ||
| 1806 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | 1644 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); |
| 1807 | List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | 1645 | List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); |
| 1808 | List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate); | 1646 | List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate); |
| @@ -1864,9 +1702,9 @@ public class FormsServiceImpl implements FormsService { | @@ -1864,9 +1702,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 1864 | } | 1702 | } |
| 1865 | if(zlcs>0){ | 1703 | if(zlcs>0){ |
| 1866 | double lcbfb= zlc/zlcs; | 1704 | double lcbfb= zlc/zlcs; |
| 1867 | - sin.setHyl(df.format(yhl*lcbfb)); | ||
| 1868 | - sin.setJzl(df.format(jzl*lcbfb)); | ||
| 1869 | - sin.setUnyyyl(df.format(fyy*lcbfb)); | 1705 | + sin.setHyl(Arith.round(yhl*lcbfb, 3) + ""); |
| 1706 | + sin.setJzl(Arith.round(jzl*lcbfb, 3) + ""); | ||
| 1707 | + sin.setUnyyyl(Arith.round(fyy*lcbfb, 3) + ""); | ||
| 1870 | } | 1708 | } |
| 1871 | } | 1709 | } |
| 1872 | return list; | 1710 | return list; |
| @@ -1901,7 +1739,6 @@ public class FormsServiceImpl implements FormsService { | @@ -1901,7 +1739,6 @@ public class FormsServiceImpl implements FormsService { | ||
| 1901 | List<Singledata> listD=new ArrayList<Singledata>(); | 1739 | List<Singledata> listD=new ArrayList<Singledata>(); |
| 1902 | 1740 | ||
| 1903 | if(tjtype.equals("jsy")){ | 1741 | if(tjtype.equals("jsy")){ |
| 1904 | - DecimalFormat df = new DecimalFormat("0.00"); | ||
| 1905 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | 1742 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); |
| 1906 | for (int i = 0; i < listYlb.size(); i++) { | 1743 | for (int i = 0; i < listYlb.size(); i++) { |
| 1907 | Ylb y=listYlb.get(i); | 1744 | Ylb y=listYlb.get(i); |
| @@ -1975,15 +1812,17 @@ public class FormsServiceImpl implements FormsService { | @@ -1975,15 +1812,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 1975 | sin.setrQ(startDate); | 1812 | sin.setrQ(startDate); |
| 1976 | if(newList.size()>0){ | 1813 | if(newList.size()>0){ |
| 1977 | sin.setjName(newList.get(0).getjName()); | 1814 | sin.setjName(newList.get(0).getjName()); |
| 1815 | + }if(y.getJname()!=null && y.getJname().length() > 0){ | ||
| 1816 | + sin.setjName(y.getJname()); | ||
| 1978 | }else{ | 1817 | }else{ |
| 1979 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | 1818 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); |
| 1980 | } | 1819 | } |
| 1981 | sin.setSgh(""); | 1820 | sin.setSgh(""); |
| 1982 | sin.setsName(""); | 1821 | sin.setsName(""); |
| 1983 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 1822 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); |
| 1984 | - sin.setHyl(df.format(y.getYh())); | ||
| 1985 | - sin.setJzl(df.format(y.getJzl())); | ||
| 1986 | - sin.setUnyyyl(df.format(y.getSh())); | 1823 | + sin.setHyl(Arith.round(y.getYh(), 3) + ""); |
| 1824 | + sin.setJzl(Arith.round(y.getJzl(), 3) + ""); | ||
| 1825 | + sin.setUnyyyl(Arith.round(y.getSh(), 3) + ""); | ||
| 1987 | listY.add(sin); | 1826 | listY.add(sin); |
| 1988 | } | 1827 | } |
| 1989 | 1828 | ||
| @@ -2055,20 +1894,23 @@ public class FormsServiceImpl implements FormsService { | @@ -2055,20 +1894,23 @@ public class FormsServiceImpl implements FormsService { | ||
| 2055 | sin.setXlmc(y.getXlname()); | 1894 | sin.setXlmc(y.getXlname()); |
| 2056 | }else{ | 1895 | }else{ |
| 2057 | sin.setXlmc(y.getLinename()); | 1896 | sin.setXlmc(y.getLinename()); |
| 2058 | - } sin.setClzbh(clzbh); | 1897 | + } |
| 1898 | + sin.setClzbh(clzbh); | ||
| 2059 | sin.setJsy(jsy); | 1899 | sin.setJsy(jsy); |
| 2060 | sin.setrQ(startDate); | 1900 | sin.setrQ(startDate); |
| 2061 | if(newList.size()>0){ | 1901 | if(newList.size()>0){ |
| 2062 | sin.setjName(newList.get(0).getjName()); | 1902 | sin.setjName(newList.get(0).getjName()); |
| 1903 | + }if(y.getJname()!=null && y.getJname().length() > 0){ | ||
| 1904 | + sin.setjName(y.getJname()); | ||
| 2063 | }else{ | 1905 | }else{ |
| 2064 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | 1906 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); |
| 2065 | } | 1907 | } |
| 2066 | sin.setSgh(""); | 1908 | sin.setSgh(""); |
| 2067 | sin.setsName(""); | 1909 | sin.setsName(""); |
| 2068 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 1910 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); |
| 2069 | - sin.setHyl(df.format(y.getHd())); | ||
| 2070 | - sin.setJzl(df.format(y.getCdl())); | ||
| 2071 | - sin.setUnyyyl(df.format(y.getSh())); | 1911 | + sin.setHyl(Arith.round(y.getHd(), 3) + ""); |
| 1912 | + sin.setJzl(Arith.round(y.getCdl(), 3) + ""); | ||
| 1913 | + sin.setUnyyyl(Arith.round(y.getSh(), 3) + ""); | ||
| 2072 | listD.add(sin); | 1914 | listD.add(sin); |
| 2073 | } | 1915 | } |
| 2074 | } | 1916 | } |
| @@ -2078,24 +1920,29 @@ public class FormsServiceImpl implements FormsService { | @@ -2078,24 +1920,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 2078 | list.addAll(listY); | 1920 | list.addAll(listY); |
| 2079 | list.addAll(listD); | 1921 | list.addAll(listD); |
| 2080 | }else{ | 1922 | }else{ |
| 1923 | + List<String> objList = new ArrayList<String>(); | ||
| 2081 | String sql="select r.s_gh,r.s_name, " | 1924 | String sql="select r.s_gh,r.s_name, " |
| 2082 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name" | 1925 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name" |
| 2083 | + " from bsth_c_s_sp_info_real r where " | 1926 | + " from bsth_c_s_sp_info_real r where " |
| 2084 | - + " r.schedule_date_str = '"+startDate+"'" | ||
| 2085 | - + " and r.s_gh !='' and r.s_gh is not null "; | 1927 | + + " r.schedule_date_str = ? " |
| 1928 | + + " and r.s_gh !='' and r.s_gh is not null "; | ||
| 1929 | + objList.add(startDate); | ||
| 2086 | if(!xlbm.equals("")){ | 1930 | if(!xlbm.equals("")){ |
| 2087 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 1931 | + sql += " and r.xl_bm = ? "; |
| 1932 | + objList.add(xlbm); | ||
| 2088 | } | 1933 | } |
| 2089 | if(!gsdm.equals("")){ | 1934 | if(!gsdm.equals("")){ |
| 2090 | - sql += " and r.gs_bm='"+gsdm+"'"; | 1935 | + sql += " and r.gs_bm = ? "; |
| 1936 | + objList.add(gsdm); | ||
| 2091 | } | 1937 | } |
| 2092 | if(!fgsdm.equals("")){ | 1938 | if(!fgsdm.equals("")){ |
| 2093 | - sql += " and r.fgs_bm='"+fgsdm+"'"; | 1939 | + sql += " and r.fgs_bm = ? "; |
| 1940 | + objList.add(fgsdm); | ||
| 2094 | } | 1941 | } |
| 2095 | sql += " group by r.s_gh,r.s_name," | 1942 | sql += " group by r.s_gh,r.s_name," |
| 2096 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name order by r.xl_bm,r.cl_zbh"; | 1943 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name order by r.xl_bm,r.cl_zbh"; |
| 2097 | 1944 | ||
| 2098 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1945 | + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { |
| 2099 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1946 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 2100 | @Override | 1947 | @Override |
| 2101 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1948 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -2191,7 +2038,6 @@ public class FormsServiceImpl implements FormsService { | @@ -2191,7 +2038,6 @@ public class FormsServiceImpl implements FormsService { | ||
| 2191 | List<Singledata> listD=new ArrayList<Singledata>(); | 2038 | List<Singledata> listD=new ArrayList<Singledata>(); |
| 2192 | 2039 | ||
| 2193 | if(tjtype.equals("jsy")){ | 2040 | if(tjtype.equals("jsy")){ |
| 2194 | - DecimalFormat df = new DecimalFormat("0.00"); | ||
| 2195 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | 2041 | List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); |
| 2196 | for (int i = 0; i < listYlb.size(); i++) { | 2042 | for (int i = 0; i < listYlb.size(); i++) { |
| 2197 | Ylb y=listYlb.get(i); | 2043 | Ylb y=listYlb.get(i); |
| @@ -2263,15 +2109,17 @@ public class FormsServiceImpl implements FormsService { | @@ -2263,15 +2109,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 2263 | sin.setrQ(startDate); | 2109 | sin.setrQ(startDate); |
| 2264 | if(newList.size()>0){ | 2110 | if(newList.size()>0){ |
| 2265 | sin.setjName(newList.get(0).getjName()); | 2111 | sin.setjName(newList.get(0).getjName()); |
| 2112 | + }if(y.getJname()!=null && y.getJname().length() > 0){ | ||
| 2113 | + sin.setjName(y.getJname()); | ||
| 2266 | }else{ | 2114 | }else{ |
| 2267 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | 2115 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); |
| 2268 | } | 2116 | } |
| 2269 | sin.setSgh(""); | 2117 | sin.setSgh(""); |
| 2270 | sin.setsName(""); | 2118 | sin.setsName(""); |
| 2271 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 2119 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); |
| 2272 | - sin.setHyl(df.format(y.getYh())); | ||
| 2273 | - sin.setJzl(df.format(y.getJzl())); | ||
| 2274 | - sin.setUnyyyl(df.format(y.getSh())); | 2120 | + sin.setHyl(Arith.round(y.getYh(), 2)+""); |
| 2121 | + sin.setJzl(Arith.round(y.getJzl(), 2)+""); | ||
| 2122 | + sin.setUnyyyl(Arith.round(y.getSh(), 2)+""); | ||
| 2275 | listY.add(sin); | 2123 | listY.add(sin); |
| 2276 | } | 2124 | } |
| 2277 | 2125 | ||
| @@ -2349,15 +2197,17 @@ public class FormsServiceImpl implements FormsService { | @@ -2349,15 +2197,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 2349 | sin.setrQ(startDate); | 2197 | sin.setrQ(startDate); |
| 2350 | if(newList.size()>0){ | 2198 | if(newList.size()>0){ |
| 2351 | sin.setjName(newList.get(0).getjName()); | 2199 | sin.setjName(newList.get(0).getjName()); |
| 2200 | + }if(y.getJname()!=null && y.getJname().length() > 0){ | ||
| 2201 | + sin.setjName(y.getJname()); | ||
| 2352 | }else{ | 2202 | }else{ |
| 2353 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | 2203 | sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); |
| 2354 | } | 2204 | } |
| 2355 | sin.setSgh(""); | 2205 | sin.setSgh(""); |
| 2356 | sin.setsName(""); | 2206 | sin.setsName(""); |
| 2357 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 2207 | sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); |
| 2358 | - sin.setHyl(df.format(y.getHd())); | ||
| 2359 | - sin.setJzl(df.format(y.getCdl())); | ||
| 2360 | - sin.setUnyyyl(df.format(y.getSh())); | 2208 | + sin.setHyl(Arith.round(y.getHd(), 3) + ""); |
| 2209 | + sin.setJzl(Arith.round(y.getCdl(), 3) + ""); | ||
| 2210 | + sin.setUnyyyl(Arith.round(y.getSh(), 3) + ""); | ||
| 2361 | listD.add(sin); | 2211 | listD.add(sin); |
| 2362 | } | 2212 | } |
| 2363 | } | 2213 | } |
| @@ -2367,24 +2217,29 @@ public class FormsServiceImpl implements FormsService { | @@ -2367,24 +2217,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 2367 | list.addAll(listY); | 2217 | list.addAll(listY); |
| 2368 | list.addAll(listD); | 2218 | list.addAll(listD); |
| 2369 | }else{ | 2219 | }else{ |
| 2220 | + List<String> objList = new ArrayList<String>(); | ||
| 2370 | String sql="select r.s_gh,r.s_name, " | 2221 | String sql="select r.s_gh,r.s_name, " |
| 2371 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name" | 2222 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name" |
| 2372 | + " from bsth_c_s_sp_info_real r where " | 2223 | + " from bsth_c_s_sp_info_real r where " |
| 2373 | - + " r.schedule_date_str = '"+startDate+"'" | 2224 | + + " r.schedule_date_str = ? " |
| 2374 | + " and r.s_gh !='' and r.s_gh is not null "; | 2225 | + " and r.s_gh !='' and r.s_gh is not null "; |
| 2226 | + objList.add(startDate); | ||
| 2375 | if(!xlbm.equals("")){ | 2227 | if(!xlbm.equals("")){ |
| 2376 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 2228 | + sql += " and r.xl_bm = ? "; |
| 2229 | + objList.add(xlbm); | ||
| 2377 | } | 2230 | } |
| 2378 | if(!gsdm.equals("")){ | 2231 | if(!gsdm.equals("")){ |
| 2379 | - sql += " and r.gs_bm='"+gsdm+"'"; | 2232 | + sql += " and r.gs_bm = ? "; |
| 2233 | + objList.add(gsdm); | ||
| 2380 | } | 2234 | } |
| 2381 | if(!fgsdm.equals("")){ | 2235 | if(!fgsdm.equals("")){ |
| 2382 | - sql += " and r.fgs_bm='"+fgsdm+"'"; | 2236 | + sql += " and r.fgs_bm = ? "; |
| 2237 | + objList.add(fgsdm); | ||
| 2383 | } | 2238 | } |
| 2384 | sql += " group by r.s_gh,r.s_name," | 2239 | sql += " group by r.s_gh,r.s_name," |
| 2385 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh"; | 2240 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh"; |
| 2386 | 2241 | ||
| 2387 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 2242 | + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() { |
| 2388 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 2243 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 2389 | @Override | 2244 | @Override |
| 2390 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 2245 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -2472,22 +2327,28 @@ public class FormsServiceImpl implements FormsService { | @@ -2472,22 +2327,28 @@ public class FormsServiceImpl implements FormsService { | ||
| 2472 | String startDate=map.get("startDate").toString(); | 2327 | String startDate=map.get("startDate").toString(); |
| 2473 | String endDate =map.get("endDate").toString(); | 2328 | String endDate =map.get("endDate").toString(); |
| 2474 | 2329 | ||
| 2330 | + List<String> objList = new ArrayList<String>(); | ||
| 2475 | String sql="select r.xl_bm, r.gs_bm, r.fgs_bm" | 2331 | String sql="select r.xl_bm, r.gs_bm, r.fgs_bm" |
| 2476 | + " from bsth_c_s_sp_info_real r where" | 2332 | + " from bsth_c_s_sp_info_real r where" |
| 2477 | - + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'"; | 2333 | + + " r.schedule_date_str BETWEEN ? and ? "; |
| 2334 | + objList.add(startDate); | ||
| 2335 | + objList.add(endDate); | ||
| 2478 | if(xlbm.length() != 0){ | 2336 | if(xlbm.length() != 0){ |
| 2479 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 2337 | + sql += " and r.xl_bm = ? "; |
| 2338 | + objList.add(xlbm); | ||
| 2480 | } | 2339 | } |
| 2481 | if(gsdm.length() != 0){ | 2340 | if(gsdm.length() != 0){ |
| 2482 | - sql += " and r.gs_bm='"+gsdm+"'"; | 2341 | + sql += " and r.gs_bm = ? "; |
| 2342 | + objList.add(gsdm); | ||
| 2483 | } | 2343 | } |
| 2484 | if(fgsdm.length() != 0){ | 2344 | if(fgsdm.length() != 0){ |
| 2485 | - sql += " and r.fgs_bm='"+fgsdm+"'"; | 2345 | + sql += " and r.fgs_bm = ? "; |
| 2346 | + objList.add(fgsdm); | ||
| 2486 | } | 2347 | } |
| 2487 | sql += " group by r.gs_bm, r.fgs_bm, r.xl_bm " + | 2348 | sql += " group by r.gs_bm, r.fgs_bm, r.xl_bm " + |
| 2488 | "order by r.gs_bm, r.fgs_bm, r.xl_bm"; | 2349 | "order by r.gs_bm, r.fgs_bm, r.xl_bm"; |
| 2489 | 2350 | ||
| 2490 | - List<Operationservice> query = jdbcTemplate.query(sql, new RowMapper<Operationservice>() { | 2351 | + List<Operationservice> query = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Operationservice>() { |
| 2491 | @Override | 2352 | @Override |
| 2492 | public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { | 2353 | public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 2493 | Operationservice ve = new Operationservice(); | 2354 | Operationservice ve = new Operationservice(); |
| @@ -2521,17 +2382,23 @@ public class FormsServiceImpl implements FormsService { | @@ -2521,17 +2382,23 @@ public class FormsServiceImpl implements FormsService { | ||
| 2521 | } | 2382 | } |
| 2522 | } | 2383 | } |
| 2523 | 2384 | ||
| 2524 | - String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; | 2385 | + List<String> ylbObjList = new ArrayList<String>(); |
| 2386 | + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN ? and ? "; | ||
| 2387 | + ylbObjList.add(startDate); | ||
| 2388 | + ylbObjList.add(endDate); | ||
| 2525 | if(!xlbm.equals("")){ | 2389 | if(!xlbm.equals("")){ |
| 2526 | - ylbSql += " and xlbm = '"+xlbm+"'"; | 2390 | + ylbSql += " and xlbm = ? "; |
| 2391 | + ylbObjList.add(xlbm); | ||
| 2527 | } | 2392 | } |
| 2528 | if(!gsdm.equals("")){ | 2393 | if(!gsdm.equals("")){ |
| 2529 | - ylbSql += " and ssgsdm='"+gsdm+"'"; | 2394 | + ylbSql += " and ssgsdm = ? "; |
| 2395 | + ylbObjList.add(gsdm); | ||
| 2530 | } | 2396 | } |
| 2531 | if(!fgsdm.equals("")){ | 2397 | if(!fgsdm.equals("")){ |
| 2532 | - ylbSql += " and fgsdm='"+fgsdm+"'"; | 2398 | + ylbSql += " and fgsdm = ? "; |
| 2399 | + ylbObjList.add(fgsdm); | ||
| 2533 | } | 2400 | } |
| 2534 | - List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() { | 2401 | + List<Ylb> ylbList= jdbcTemplate.query(ylbSql, ylbObjList.toArray(), new RowMapper<Ylb>() { |
| 2535 | @Override | 2402 | @Override |
| 2536 | public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { | 2403 | public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 2537 | Ylb y = new Ylb(); | 2404 | Ylb y = new Ylb(); |
| @@ -2542,17 +2409,23 @@ public class FormsServiceImpl implements FormsService { | @@ -2542,17 +2409,23 @@ public class FormsServiceImpl implements FormsService { | ||
| 2542 | } | 2409 | } |
| 2543 | }); | 2410 | }); |
| 2544 | 2411 | ||
| 2545 | - String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; | 2412 | + List<String> dlbObjList = new ArrayList<String>(); |
| 2413 | + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN ? and ? "; | ||
| 2414 | + dlbObjList.add(startDate); | ||
| 2415 | + dlbObjList.add(endDate); | ||
| 2546 | if(!xlbm.equals("")){ | 2416 | if(!xlbm.equals("")){ |
| 2547 | - ylbSql += " and xlbm = '"+xlbm+"'"; | 2417 | + ylbSql += " and xlbm = ? "; |
| 2418 | + dlbObjList.add(xlbm); | ||
| 2548 | } | 2419 | } |
| 2549 | if(!gsdm.equals("")){ | 2420 | if(!gsdm.equals("")){ |
| 2550 | - ylbSql += " and ssgsdm='"+gsdm+"'"; | 2421 | + ylbSql += " and ssgsdm = ? "; |
| 2422 | + dlbObjList.add(gsdm); | ||
| 2551 | } | 2423 | } |
| 2552 | if(!fgsdm.equals("")){ | 2424 | if(!fgsdm.equals("")){ |
| 2553 | - ylbSql += " and fgsdm='"+fgsdm+"'"; | 2425 | + ylbSql += " and fgsdm = ? "; |
| 2426 | + dlbObjList.add(fgsdm); | ||
| 2554 | } | 2427 | } |
| 2555 | - List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() { | 2428 | + List<Dlb> dlbList= jdbcTemplate.query(dlbSql, dlbObjList.toArray(), new RowMapper<Dlb>() { |
| 2556 | @Override | 2429 | @Override |
| 2557 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { | 2430 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 2558 | Dlb d = new Dlb(); | 2431 | Dlb d = new Dlb(); |
| @@ -2647,13 +2520,16 @@ public class FormsServiceImpl implements FormsService { | @@ -2647,13 +2520,16 @@ public class FormsServiceImpl implements FormsService { | ||
| 2647 | @Override | 2520 | @Override |
| 2648 | public List<Vehicleloading> vehicleloading(String line, String date) { | 2521 | public List<Vehicleloading> vehicleloading(String line, String date) { |
| 2649 | 2522 | ||
| 2523 | + List<String> objList = new ArrayList<String>(); | ||
| 2650 | String sql="select r.s_gh,r.s_name, " | 2524 | String sql="select r.s_gh,r.s_name, " |
| 2651 | + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm" | 2525 | + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm" |
| 2652 | - + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+date+"' " | ||
| 2653 | - + " and r.xl_bm = '"+line+"' group by r.s_gh,r.s_name," | 2526 | + + " from bsth_c_s_sp_info_real r where r.schedule_date_str = ? " |
| 2527 | + + " and r.xl_bm = ? group by r.s_gh,r.s_name," | ||
| 2654 | + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm"; | 2528 | + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm"; |
| 2529 | + objList.add(date); | ||
| 2530 | + objList.add(line); | ||
| 2655 | 2531 | ||
| 2656 | - List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() { | 2532 | + List<Vehicleloading> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Vehicleloading>() { |
| 2657 | @Override | 2533 | @Override |
| 2658 | public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException { | 2534 | public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 2659 | Vehicleloading ve = new Vehicleloading(); | 2535 | Vehicleloading ve = new Vehicleloading(); |
| @@ -2724,10 +2600,10 @@ public class FormsServiceImpl implements FormsService { | @@ -2724,10 +2600,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 2724 | fyy=Arith.add(fyy, d.getSh()==null?0:d.getSh()); | 2600 | fyy=Arith.add(fyy, d.getSh()==null?0:d.getSh()); |
| 2725 | } | 2601 | } |
| 2726 | } | 2602 | } |
| 2727 | - sin.setHyl(String.valueOf(yhl)); | ||
| 2728 | - sin.setJzl(String.valueOf(jzl)); | ||
| 2729 | - sin.setUnyyyl(String.valueOf(fyy)); | ||
| 2730 | - sin.setLs(String.valueOf(ns)); | 2603 | + sin.setHyl(Arith.round(yhl, 3) + ""); |
| 2604 | + sin.setJzl(Arith.round(jzl, 3) + ""); | ||
| 2605 | + sin.setUnyyyl(Arith.round(fyy, 3) + ""); | ||
| 2606 | + sin.setLs(Arith.round(ns, 3) + ""); | ||
| 2731 | } | 2607 | } |
| 2732 | return list; | 2608 | return list; |
| 2733 | } | 2609 | } |
| @@ -2773,19 +2649,24 @@ public class FormsServiceImpl implements FormsService { | @@ -2773,19 +2649,24 @@ public class FormsServiceImpl implements FormsService { | ||
| 2773 | List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, startDate, endDate, company, subCompany); | 2649 | List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, startDate, endDate, company, subCompany); |
| 2774 | List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line); | 2650 | List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line); |
| 2775 | 2651 | ||
| 2652 | + List<String> objList = new ArrayList<String>(); | ||
| 2776 | String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" | 2653 | String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" |
| 2777 | - + " from bsth_c_s_sp_info where " | ||
| 2778 | - + "schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"' "; | 2654 | + + " from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ? "; |
| 2655 | + objList.add(startDate); | ||
| 2656 | + objList.add(endDate); | ||
| 2779 | if(line.trim().length() != 0){ | 2657 | if(line.trim().length() != 0){ |
| 2780 | - sql += "and xl_bm = '"+line+"' "; | 2658 | + sql += "and xl_bm = ? "; |
| 2659 | + objList.add(line); | ||
| 2781 | } | 2660 | } |
| 2782 | if(company.trim().length() != 0){ | 2661 | if(company.trim().length() != 0){ |
| 2783 | - sql += "and gs_bm = '"+company+"' "; | 2662 | + sql += "and gs_bm = ? "; |
| 2663 | + objList.add(company); | ||
| 2784 | } | 2664 | } |
| 2785 | if(subCompany.trim().length() != 0){ | 2665 | if(subCompany.trim().length() != 0){ |
| 2786 | - sql += "and fgs_bm = '"+subCompany+"' "; | 2666 | + sql += "and fgs_bm = ? "; |
| 2667 | + objList.add(subCompany); | ||
| 2787 | } | 2668 | } |
| 2788 | - List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() { | 2669 | + List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<SchedulePlanInfo>() { |
| 2789 | 2670 | ||
| 2790 | @Override | 2671 | @Override |
| 2791 | public SchedulePlanInfo mapRow(ResultSet arg0, int arg1) throws SQLException { | 2672 | public SchedulePlanInfo mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -2944,32 +2825,36 @@ public class FormsServiceImpl implements FormsService { | @@ -2944,32 +2825,36 @@ public class FormsServiceImpl implements FormsService { | ||
| 2944 | String rq3 = sdf1.format(d1); | 2825 | String rq3 = sdf1.format(d1); |
| 2945 | 2826 | ||
| 2946 | rq = rq2 + "-" + rq3; | 2827 | rq = rq2 + "-" + rq3; |
| 2947 | - | ||
| 2948 | - String where = ""; | ||
| 2949 | - if(gsbm.trim().length() != 0){ | ||
| 2950 | - where += " and gs_bm = '" + gsbm + "'"; | ||
| 2951 | - } | ||
| 2952 | - if(fgsbm.trim().length() != 0){ | ||
| 2953 | - where += " and fgs_bm = '" + fgsbm + "'"; | ||
| 2954 | - } | ||
| 2955 | 2828 | ||
| 2829 | + List<String> objList = new ArrayList<String>(); | ||
| 2956 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " | 2830 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " |
| 2957 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" | 2831 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" |
| 2958 | - + " from bsth_c_s_sp_info" + " where schedule_date >= '" | ||
| 2959 | - + map.get("startDate").toString() + "' and schedule_date <= '" + map.get("endDate").toString() + "' and xl_bm='" | ||
| 2960 | - + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" | ||
| 2961 | - + where | ||
| 2962 | -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type " | ||
| 2963 | - + " ) a left JOIN (" | ||
| 2964 | - + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " | ||
| 2965 | - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real " | ||
| 2966 | - + "where schedule_date_str >= '" + map.get("startDate").toString() + "' and schedule_date_str <= '" | ||
| 2967 | - + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() | ||
| 2968 | - + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " | ||
| 2969 | -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type" | 2832 | + + " from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ? " |
| 2833 | + + " and xl_bm = ? AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "; | ||
| 2834 | + objList.add(map.get("startDate").toString()); | ||
| 2835 | + objList.add(map.get("endDate").toString()); | ||
| 2836 | + objList.add(map.get("line").toString()); | ||
| 2837 | + if(gsbm.trim().length() != 0){ | ||
| 2838 | + sql += " and gs_bm = ? "; | ||
| 2839 | + objList.add(gsbm); | ||
| 2840 | + } | ||
| 2841 | + if(fgsbm.trim().length() != 0){ | ||
| 2842 | + sql += " and fgs_bm = ? "; | ||
| 2843 | + objList.add(fgsbm); | ||
| 2844 | + } | ||
| 2845 | + sql += " ) a left JOIN (" | ||
| 2846 | + + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " | ||
| 2847 | + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, " | ||
| 2848 | + + " count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real " | ||
| 2849 | + + " where schedule_date_str >= ? and schedule_date_str <= ? and xl_bm = ? " | ||
| 2850 | + + " AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " | ||
| 2970 | + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " | 2851 | + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " |
| 2971 | - + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; | ||
| 2972 | - List<Executionrate> list = jdbcTemplate.query(sql, new RowMapper<Executionrate>() { | 2852 | + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; |
| 2853 | + objList.add(map.get("startDate").toString()); | ||
| 2854 | + objList.add(map.get("endDate").toString()); | ||
| 2855 | + objList.add(map.get("line").toString()); | ||
| 2856 | + | ||
| 2857 | + List<Executionrate> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Executionrate>() { | ||
| 2973 | 2858 | ||
| 2974 | @Override | 2859 | @Override |
| 2975 | public Executionrate mapRow(ResultSet arg0, int arg1) throws SQLException { | 2860 | public Executionrate mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -3036,27 +2921,29 @@ public class FormsServiceImpl implements FormsService { | @@ -3036,27 +2921,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 3036 | 2921 | ||
| 3037 | rq = rq2 + "-" + rq3; | 2922 | rq = rq2 + "-" + rq3; |
| 3038 | 2923 | ||
| 3039 | - String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " | ||
| 3040 | - + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" | ||
| 3041 | - + " from bsth_c_s_sp_info" + " where schedule_date >= '" | ||
| 3042 | - + map.get("startDate").toString() + "' and schedule_date <='" + map.get("endDate").toString() + "' and xl_bm='" | ||
| 3043 | - + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " | ||
| 3044 | - + " and gs_bm='"+ map.get("gsdmAllline").toString() + "'" | ||
| 3045 | - + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'" | ||
| 3046 | -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type " | ||
| 3047 | - + " ) a left JOIN (" | ||
| 3048 | - + "SELECT COUNT(*" | ||
| 3049 | - + ") as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b." | ||
| 3050 | - + "xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " | ||
| 3051 | - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real " | ||
| 3052 | - + "where schedule_date_str >= '" + map.get("startDate").toString() + "' and schedule_date_str <= '" | ||
| 3053 | - + map.get("endDate").toString() + "' and xl_bm='" + map.get | ||
| 3054 | - ("line").toString() | ||
| 3055 | - + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" | ||
| 3056 | -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type" | ||
| 3057 | - + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " | ||
| 3058 | - + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; | ||
| 3059 | - List<Allline> list = jdbcTemplate.query(sql, new RowMapper<Allline>() { | 2924 | + List<String> objList = new ArrayList<String>(); |
| 2925 | + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name, a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc,a.jxl,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " | ||
| 2926 | + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl,COUNT(DISTINCT cl_zbh) as jcl,bc_type" | ||
| 2927 | + + " from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ? and xl_bm = ? " | ||
| 2928 | + + " AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " | ||
| 2929 | + + " and gs_bm = ? and fgs_bm = ? " | ||
| 2930 | + + " ) a left JOIN ( " | ||
| 2931 | + + " SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name,b.sbc,b.sxl,b.scl " | ||
| 2932 | + + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real " | ||
| 2933 | + + " where schedule_date_str >= ? and schedule_date_str <= ? and xl_bm = ? " | ||
| 2934 | + + " AND gs_bm is not null AND bc_type NOT IN ('in', 'out') " | ||
| 2935 | + + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " | ||
| 2936 | + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm "; | ||
| 2937 | + objList.add(map.get("startDate").toString()); | ||
| 2938 | + objList.add(map.get("endDate").toString()); | ||
| 2939 | + objList.add(map.get("line").toString()); | ||
| 2940 | + objList.add(map.get("gsdmAllline").toString()); | ||
| 2941 | + objList.add(map.get("fgsdmAllline").toString()); | ||
| 2942 | + objList.add(map.get("startDate").toString()); | ||
| 2943 | + objList.add(map.get("endDate").toString()); | ||
| 2944 | + objList.add(map.get("line").toString()); | ||
| 2945 | + | ||
| 2946 | + List<Allline> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Allline>() { | ||
| 3060 | 2947 | ||
| 3061 | @Override | 2948 | @Override |
| 3062 | public Allline mapRow(ResultSet arg0, int arg1) throws SQLException { | 2949 | public Allline mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -3114,40 +3001,29 @@ public class FormsServiceImpl implements FormsService { | @@ -3114,40 +3001,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 3114 | if(map.get("fgsdmDaily")!=null){ | 3001 | if(map.get("fgsdmDaily")!=null){ |
| 3115 | fgsbm=map.get("fgsdmDaily").toString(); | 3002 | fgsbm=map.get("fgsdmDaily").toString(); |
| 3116 | } | 3003 | } |
| 3117 | - | ||
| 3118 | - /*String sql="select t.schedule_date_str," | ||
| 3119 | - + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm," | ||
| 3120 | - + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE " | ||
| 3121 | - + " r.xl_bm='" + map.get("line").toString() + "' " | ||
| 3122 | - + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') " | ||
| 3123 | - + " and r.gs_bm like '%"+gsbm+"%' " | ||
| 3124 | - + " and r.fgs_bm like '%"+fgsbm+"%' " | ||
| 3125 | - + " GROUP BY r.schedule_date_str,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name) t" | ||
| 3126 | - + " left join (select * from bsth_c_ylb y where " | ||
| 3127 | - + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') " | ||
| 3128 | - + " and y.xlbm= '" + map.get("line").toString() + "'" | ||
| 3129 | - + " and y.ssgsdm like '%"+gsbm+"%' " | ||
| 3130 | - + " and y.fgsdm like '%"+fgsbm+"%'" | ||
| 3131 | - + " ) x" | ||
| 3132 | - + " on t.cl_zbh = x.nbbm and t.j_gh=x.jsy";*/ | ||
| 3133 | 3004 | ||
| 3005 | + List<String> objList = new ArrayList<String>(); | ||
| 3134 | String sql="select r.schedule_date_str, " | 3006 | String sql="select r.schedule_date_str, " |
| 3135 | - + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm" | 3007 | + + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm " |
| 3136 | + " from bsth_c_s_sp_info_real r where " | 3008 | + " from bsth_c_s_sp_info_real r where " |
| 3137 | - + "r.schedule_date_str = '"+map.get("date").toString()+"'"; | 3009 | + + " r.schedule_date_str = ? "; |
| 3010 | + objList.add(map.get("date").toString()); | ||
| 3138 | if(!xlbm.equals("")){ | 3011 | if(!xlbm.equals("")){ |
| 3139 | - sql += " and r.xl_bm = '"+xlbm+"'"; | 3012 | + sql += " and r.xl_bm = ? "; |
| 3013 | + objList.add(xlbm); | ||
| 3140 | } | 3014 | } |
| 3141 | if(!gsbm.equals("")){ | 3015 | if(!gsbm.equals("")){ |
| 3142 | - sql += " and r.gs_bm='"+gsbm+"'"; | 3016 | + sql += " and r.gs_bm = ? "; |
| 3017 | + objList.add(gsbm); | ||
| 3143 | } | 3018 | } |
| 3144 | if(!fgsbm.equals("")){ | 3019 | if(!fgsbm.equals("")){ |
| 3145 | - sql += " and r.fgs_bm='"+fgsbm+"'"; | 3020 | + sql += " and r.fgs_bm = ? "; |
| 3021 | + objList.add(fgsbm); | ||
| 3146 | } | 3022 | } |
| 3147 | sql += " group by r.schedule_date_str," | 3023 | sql += " group by r.schedule_date_str," |
| 3148 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 3024 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; |
| 3149 | 3025 | ||
| 3150 | - List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { | 3026 | + List<Daily> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Daily>() { |
| 3151 | @Override | 3027 | @Override |
| 3152 | public Daily mapRow(ResultSet arg0, int arg1) throws SQLException { | 3028 | public Daily mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 3153 | Daily daily = new Daily(); | 3029 | Daily daily = new Daily(); |
| @@ -3179,7 +3055,7 @@ public class FormsServiceImpl implements FormsService { | @@ -3179,7 +3055,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 3179 | yh=Arith.add(yh, b.getHd()); | 3055 | yh=Arith.add(yh, b.getHd()); |
| 3180 | } | 3056 | } |
| 3181 | } | 3057 | } |
| 3182 | - d.setYh(String.valueOf(yh)); | 3058 | + d.setYh(Arith.round(yh, 3) + ""); |
| 3183 | for (int j = 0; j < lists.size(); j++) { | 3059 | for (int j = 0; j < lists.size(); j++) { |
| 3184 | ScheduleRealInfo s=lists.get(j); | 3060 | ScheduleRealInfo s=lists.get(j); |
| 3185 | if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){ | 3061 | if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){ |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| 1 | package com.bsth.service.oil.impl; | 1 | package com.bsth.service.oil.impl; |
| 2 | 2 | ||
| 3 | +import java.math.RoundingMode; | ||
| 3 | import java.sql.ResultSet; | 4 | import java.sql.ResultSet; |
| 4 | import java.sql.SQLException; | 5 | import java.sql.SQLException; |
| 5 | import java.text.DecimalFormat; | 6 | import java.text.DecimalFormat; |
| @@ -94,8 +95,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -94,8 +95,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 94 | String rq=sdf.format(dBefore); | 95 | String rq=sdf.format(dBefore); |
| 95 | // String rq="2017-11-02"; | 96 | // String rq="2017-11-02"; |
| 96 | String line=""; | 97 | String line=""; |
| 97 | - //保留两位小数 | ||
| 98 | - DecimalFormat df = new DecimalFormat("#.000"); | ||
| 99 | // TODO Auto-generated method stub | 98 | // TODO Auto-generated method stub |
| 100 | Map<String, Object> newMap=new HashMap<String,Object>(); | 99 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 101 | //当天DLB信息 | 100 | //当天DLB信息 |
| @@ -176,7 +175,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -176,7 +175,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 176 | 175 | ||
| 177 | t.setNbbm(map.get("clZbh").toString()); | 176 | t.setNbbm(map.get("clZbh").toString()); |
| 178 | t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | 177 | t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); |
| 179 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | 178 | + t.setZlc(map.get("totalKilometers")==null?0.0:Arith.round(map.get("totalKilometers").toString(), 3)); |
| 180 | t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | 179 | t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); |
| 181 | t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | 180 | t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); |
| 182 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | 181 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| @@ -211,6 +210,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -211,6 +210,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 211 | @Transactional | 210 | @Transactional |
| 212 | @Override | 211 | @Override |
| 213 | public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | 212 | public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ |
| 213 | + | ||
| 214 | Map<String, Object> newMap = new HashMap<String, Object>(); | 214 | Map<String, Object> newMap = new HashMap<String, Object>(); |
| 215 | try { | 215 | try { |
| 216 | Date date=new Date(); | 216 | Date date=new Date(); |
| @@ -239,8 +239,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -239,8 +239,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 239 | nbbm=map2.get("nbbm_eq").toString(); | 239 | nbbm=map2.get("nbbm_eq").toString(); |
| 240 | } | 240 | } |
| 241 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 241 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 242 | - // 保留两位小数 | ||
| 243 | - DecimalFormat df = new DecimalFormat("#.000"); | ||
| 244 | // TODO Auto-generated method stub | 242 | // TODO Auto-generated method stub |
| 245 | // 当天DLB信息 | 243 | // 当天DLB信息 |
| 246 | List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | 244 | List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); |
| @@ -251,7 +249,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -251,7 +249,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 251 | for (int i = 0; i < listpbs.size(); i++) { | 249 | for (int i = 0; i < listpbs.size(); i++) { |
| 252 | String cl=listpbs.get(i).get("clZbh").toString(); | 250 | String cl=listpbs.get(i).get("clZbh").toString(); |
| 253 | Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0 | 251 | Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0 |
| 254 | - : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString()); | 252 | + : Arith.round(listpbs.get(i).get("totalKilometers").toString(), 3); |
| 255 | if(lcMap.get(cl)==null){ | 253 | if(lcMap.get(cl)==null){ |
| 256 | lcMap.put(cl, lc); | 254 | lcMap.put(cl, lc); |
| 257 | }else{ | 255 | }else{ |
| @@ -261,18 +259,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -261,18 +259,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 261 | } | 259 | } |
| 262 | } | 260 | } |
| 263 | 261 | ||
| 264 | -// Map<String, Double> shMap=new HashMap<String,Double>(); | ||
| 265 | -// for (int i = 0; i < dlList.size(); i++) { | ||
| 266 | -// Dlb dlb=dlList.get(i); | ||
| 267 | -// String cl=dlb.getNbbm(); | ||
| 268 | -// if(shMap.get(cl)==null){ | ||
| 269 | -// shMap.put(cl, dlb.getSh()); | ||
| 270 | -// }else{ | ||
| 271 | -// double sh=shMap.get(cl); | ||
| 272 | -// shMap.remove(cl); | ||
| 273 | -// shMap.put(cl, Arith.add(sh, dlb.getSh())); | ||
| 274 | -// } | ||
| 275 | -// } | ||
| 276 | List<Jdl> jdlList=jdlRepository.JdlList(rq); | 262 | List<Jdl> jdlList=jdlRepository.JdlList(rq); |
| 277 | String sxtj=map2.get("sxtj").toString(); | 263 | String sxtj=map2.get("sxtj").toString(); |
| 278 | if(sxtj.equals("0")){ | 264 | if(sxtj.equals("0")){ |
| @@ -327,7 +313,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -327,7 +313,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 327 | if(newMap_.get(map_.get("clZbh").toString())==null){ | 313 | if(newMap_.get(map_.get("clZbh").toString())==null){ |
| 328 | newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | 314 | newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); |
| 329 | //车辆总里程 | 315 | //车辆总里程 |
| 330 | - double zlc =lcMap.get(map_.get("clZbh").toString()); | 316 | + double zlc = lcMap.get(map_.get("clZbh").toString()); |
| 331 | //车辆总加电量 | 317 | //车辆总加电量 |
| 332 | double zjzl = 0.0; | 318 | double zjzl = 0.0; |
| 333 | for (int i = 0; i < jdlList.size(); i++) { | 319 | for (int i = 0; i < jdlList.size(); i++) { |
| @@ -335,16 +321,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -335,16 +321,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 335 | if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | 321 | if(map_.get("clZbh").toString().equals(jdl.getNbbm()) |
| 336 | &&map_.get("company").toString().equals(jdl.getGsBm()) | 322 | &&map_.get("company").toString().equals(jdl.getGsBm()) |
| 337 | &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | 323 | &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ |
| 338 | - zjzl = Arith.add(zjzl,jdl.getJdl()); | 324 | + zjzl = Arith.add(zjzl, jdl.getJdl()); |
| 339 | } | 325 | } |
| 340 | } | 326 | } |
| 341 | -// double clsh=0.0; | ||
| 342 | -// if(shMap.get(map_.get("clZbh").toString())==null){ | ||
| 343 | -// clsh=0.0; | ||
| 344 | -// }else{ | ||
| 345 | -// clsh=shMap.get(map_.get("clZbh").toString()); | ||
| 346 | -// } | ||
| 347 | -// zjzl =Arith.sub(zjzl, clsh); | 327 | + |
| 328 | + zjzl = Arith.round(zjzl, 3); // 保留三位小数,四舍五入 | ||
| 329 | + System.out.println("zjzl="+zjzl); | ||
| 330 | + | ||
| 348 | Double nextJzyl = 0.0; | 331 | Double nextJzyl = 0.0; |
| 349 | for (int i = 0; i < listpb.size(); i++) { | 332 | for (int i = 0; i < listpb.size(); i++) { |
| 350 | Map<String, Object> map = listpb.get(i); | 333 | Map<String, Object> map = listpb.get(i); |
| @@ -373,18 +356,19 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -373,18 +356,19 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 373 | } | 356 | } |
| 374 | } | 357 | } |
| 375 | } | 358 | } |
| 376 | - Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | 359 | + Double lc = Arith.round(map.get("totalKilometers").toString(), 3); |
| 360 | + System.out.println("lc="+lc); | ||
| 377 | if(map.get("seqNumber").toString().equals("1")){ | 361 | if(map.get("seqNumber").toString().equals("1")){ |
| 378 | // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | 362 | // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 |
| 379 | Double dh=0.0; | 363 | Double dh=0.0; |
| 380 | if(zlc>0){ | 364 | if(zlc>0){ |
| 381 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | 365 | + dh = Arith.round((zjzl * (lc / zlc)), 3); |
| 366 | + System.out.println("dh="+dh); | ||
| 382 | } | 367 | } |
| 383 | - nextJzyl =Arith.sub(zjzl,dh); | 368 | + nextJzyl = Arith.sub(zjzl, dh); |
| 384 | if(zlc>0){ | 369 | if(zlc>0){ |
| 385 | -// long l=Math.round(nextJzyl); | ||
| 386 | double ylxs=nextJzyl; | 370 | double ylxs=nextJzyl; |
| 387 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 371 | + dh = Arith.add(dh, Arith.sub(nextJzyl, ylxs)); |
| 388 | if(dh<0){ | 372 | if(dh<0){ |
| 389 | t.setHd(0.0); | 373 | t.setHd(0.0); |
| 390 | t.setCdl(0.0); | 374 | t.setCdl(0.0); |
| @@ -401,9 +385,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -401,9 +385,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 401 | }else{ | 385 | }else{ |
| 402 | Double dh=0.0; | 386 | Double dh=0.0; |
| 403 | if(zlc>0){ | 387 | if(zlc>0){ |
| 404 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | 388 | + dh = Arith.round((zjzl * (lc / zlc)), 3); |
| 405 | } | 389 | } |
| 406 | - nextJzyl =Arith.sub( nextJzyl,dh); | 390 | + nextJzyl = Arith.sub(nextJzyl, dh); |
| 407 | if(zlc>0){ | 391 | if(zlc>0){ |
| 408 | // long l=0l; | 392 | // long l=0l; |
| 409 | double ylxs=0.0; | 393 | double ylxs=0.0; |
| @@ -416,7 +400,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -416,7 +400,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 416 | } | 400 | } |
| 417 | 401 | ||
| 418 | } | 402 | } |
| 419 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 403 | + dh=Arith.add(dh, Arith.sub(nextJzyl, ylxs)); |
| 420 | if(dh<0){ | 404 | if(dh<0){ |
| 421 | t.setHd(0.0); | 405 | t.setHd(0.0); |
| 422 | t.setCdl(0.0); | 406 | t.setCdl(0.0); |
| @@ -436,7 +420,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -436,7 +420,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 436 | t.setNbbm(map.get("clZbh").toString()); | 420 | t.setNbbm(map.get("clZbh").toString()); |
| 437 | t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | 421 | t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); |
| 438 | t.setZlc(map.get("totalKilometers") == null ? 0.0 | 422 | t.setZlc(map.get("totalKilometers") == null ? 0.0 |
| 439 | - : Double.parseDouble(map.get("totalKilometers").toString())); | 423 | + : Arith.round(map.get("totalKilometers").toString(), 3)); |
| 440 | t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | 424 | t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); |
| 441 | t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | 425 | t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); |
| 442 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | 426 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| @@ -539,10 +523,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -539,10 +523,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 539 | @Override | 523 | @Override |
| 540 | public Map<String, Object> checkDl(Map<String, Object> map) { | 524 | public Map<String, Object> checkDl(Map<String, Object> map) { |
| 541 | Map<String, Object> newMap=new HashMap<String,Object>(); | 525 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 542 | -// String xlbm=""; | ||
| 543 | -// if(map.get("xlbm_like")!=null){ | ||
| 544 | -// xlbm=map.get("xlbm_like").toString(); | ||
| 545 | -// } | ||
| 546 | // TODO Auto-generated method stub | 526 | // TODO Auto-generated method stub |
| 547 | 527 | ||
| 548 | List<Cars> carsList = carsRepository.findCars(); | 528 | List<Cars> carsList = carsRepository.findCars(); |
| @@ -573,12 +553,19 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -573,12 +553,19 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 573 | nbbm=map.get("nbbm_eq").toString(); | 553 | nbbm=map.get("nbbm_eq").toString(); |
| 574 | } | 554 | } |
| 575 | 555 | ||
| 576 | - String sql="select * from bsth_c_jdl j where j.gs_bm ='"+gsbm+"' " | ||
| 577 | - + " and j.fgs_bm ='"+fgsbm+"' and rq ='"+rq+"' " | ||
| 578 | - + "and nbbm not in (select nbbm from bsth_c_dlb d" | ||
| 579 | - + " where ssgsdm ='"+gsbm+"' and fgsdm ='"+fgsbm+"'" | ||
| 580 | - + " and rq='"+rq+"')"; | ||
| 581 | - List<Jdl> listJdl=jdbcTemplate.query(sql, | 556 | + List<String> objList = new ArrayList<String>(); |
| 557 | + String sql="select * from bsth_c_jdl j where j.gs_bm = ? " | ||
| 558 | + + " and j.fgs_bm = ? and rq = ? " | ||
| 559 | + + " and nbbm not in (select nbbm from bsth_c_dlb d " | ||
| 560 | + + " where ssgsdm = ? and fgsdm = ?" | ||
| 561 | + + " and rq = ?)"; | ||
| 562 | + objList.add(gsbm); | ||
| 563 | + objList.add(fgsbm); | ||
| 564 | + objList.add(rq); | ||
| 565 | + objList.add(gsbm); | ||
| 566 | + objList.add(fgsbm); | ||
| 567 | + objList.add(rq); | ||
| 568 | + List<Jdl> listJdl=jdbcTemplate.query(sql, objList.toArray(), | ||
| 582 | new RowMapper<Jdl>(){ | 569 | new RowMapper<Jdl>(){ |
| 583 | @Override | 570 | @Override |
| 584 | public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException { | 571 | public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException { |
| @@ -880,22 +867,43 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -880,22 +867,43 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 880 | return newMap; | 867 | return newMap; |
| 881 | } | 868 | } |
| 882 | 869 | ||
| 883 | - public List<Dlb> listOrderBy(String rq,String gsdm, | 870 | + |
| 871 | + private List<Dlb> listOrderBy(String rq,String gsdm, | ||
| 884 | String fgsdm,String xlbm,String nbbm, | 872 | String fgsdm,String xlbm,String nbbm, |
| 885 | String px) { | 873 | String px) { |
| 886 | // TODO Auto-generated method stub | 874 | // TODO Auto-generated method stub |
| 887 | - String sql="SELECT * FROM bsth_c_dlb " | ||
| 888 | - + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' " | ||
| 889 | - + " and fgsdm like '%"+fgsdm+"%'"; | ||
| 890 | - if(xlbm.equals("")){ | ||
| 891 | - sql+= " and xlbm like '%"+xlbm+"%' "; | ||
| 892 | - }else{ | ||
| 893 | - sql+= " and xlbm = '"+xlbm+"' "; | 875 | + List<String> objList = new ArrayList<String>(); |
| 876 | + String sql = "SELECT * FROM bsth_c_dlb where rq = ? "; | ||
| 877 | + objList.add(rq); | ||
| 878 | + if(!gsdm.equals("")){ | ||
| 879 | + sql += " and ssgsdm = ? "; | ||
| 880 | + objList.add(gsdm); | ||
| 881 | + if(!fgsdm.equals("")){ | ||
| 882 | + sql += " and fgsdm = ? "; | ||
| 883 | + objList.add(fgsdm); | ||
| 884 | + } | ||
| 885 | + } | ||
| 886 | + if(!xlbm.equals("")){ | ||
| 887 | + sql += " and xlbm = ? "; | ||
| 888 | + objList.add(xlbm); | ||
| 889 | + } | ||
| 890 | + if(!nbbm.equals("")){ | ||
| 891 | + sql += " and nbbm = ? "; | ||
| 892 | + objList.add(nbbm); | ||
| 893 | + } | ||
| 894 | + // 排序字段,本函数仅当前类使用。'px'值为固定值;用switch固定可选值防止sql注入 | ||
| 895 | + switch (px) { | ||
| 896 | + case "jhsj": | ||
| 897 | + sql += " order by jhsj asc "; | ||
| 898 | + break; | ||
| 899 | + case "nbbm": | ||
| 900 | + sql += " order by nbbm asc "; | ||
| 901 | + break; | ||
| 902 | + default: | ||
| 903 | + break; | ||
| 894 | } | 904 | } |
| 895 | - | ||
| 896 | - sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | ||
| 897 | 905 | ||
| 898 | - List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() { | 906 | + List<Dlb> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Dlb>() { |
| 899 | @Override | 907 | @Override |
| 900 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { | 908 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 901 | Dlb y = new Dlb(); | 909 | Dlb y = new Dlb(); |
| @@ -1025,8 +1033,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1025,8 +1033,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1025 | // TODO Auto-generated method stub | 1033 | // TODO Auto-generated method stub |
| 1026 | Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>(); | 1034 | Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>(); |
| 1027 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | 1035 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| 1028 | - // 保留两位小数 | ||
| 1029 | - DecimalFormat df = new DecimalFormat("#.000"); | ||
| 1030 | List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | 1036 | List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); |
| 1031 | List<Dlb> dlbList_upd=new ArrayList<Dlb>(); | 1037 | List<Dlb> dlbList_upd=new ArrayList<Dlb>(); |
| 1032 | List<Dlb> dlbList_del=new ArrayList<Dlb>(); | 1038 | List<Dlb> dlbList_del=new ArrayList<Dlb>(); |
| @@ -1044,7 +1050,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1044,7 +1050,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1044 | &&t.getXlbm().equals(m.get("xlBm").toString()) | 1050 | &&t.getXlbm().equals(m.get("xlBm").toString()) |
| 1045 | &&t.getLp().equals(m.get("lpName").toString())){ | 1051 | &&t.getLp().equals(m.get("lpName").toString())){ |
| 1046 | //该条记录不用删除 | 1052 | //该条记录不用删除 |
| 1047 | - fage =false; | 1053 | + fage = false; |
| 1048 | dlbList_upd.add(t); | 1054 | dlbList_upd.add(t); |
| 1049 | } | 1055 | } |
| 1050 | } | 1056 | } |
| @@ -1059,9 +1065,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1059,9 +1065,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1059 | mapList.put("delList", dlbList_del); | 1065 | mapList.put("delList", dlbList_del); |
| 1060 | Map<String, Double> lcMap=new HashMap<String,Double>(); | 1066 | Map<String, Double> lcMap=new HashMap<String,Double>(); |
| 1061 | for (int i = 0; i < listpbDc.size(); i++) { | 1067 | for (int i = 0; i < listpbDc.size(); i++) { |
| 1062 | - String cl=listpbDc.get(i).get("clZbh").toString(); | ||
| 1063 | - Double lc= listpbDc.get(i).get("totalKilometers") == null ? 0.0 | ||
| 1064 | - : Double.parseDouble(listpbDc.get(i).get("totalKilometers").toString()); | 1068 | + String cl = listpbDc.get(i).get("clZbh").toString(); |
| 1069 | + Double lc = listpbDc.get(i).get("totalKilometers") == null ? 0.0 | ||
| 1070 | + : Arith.round(listpbDc.get(i).get("totalKilometers").toString(), 3); | ||
| 1065 | if(lcMap.get(cl)==null){ | 1071 | if(lcMap.get(cl)==null){ |
| 1066 | lcMap.put(cl, lc); | 1072 | lcMap.put(cl, lc); |
| 1067 | }else{ | 1073 | }else{ |
| @@ -1094,7 +1100,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1094,7 +1100,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1094 | if(newMap_.get(map_.get("clZbh").toString())==null){ | 1100 | if(newMap_.get(map_.get("clZbh").toString())==null){ |
| 1095 | newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | 1101 | newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); |
| 1096 | //车辆总里程 | 1102 | //车辆总里程 |
| 1097 | - double zlc =lcMap.get(map_.get("clZbh").toString()); | 1103 | + double zlc = Arith.round(lcMap.get(map_.get("clZbh").toString()), 3); |
| 1098 | //车辆总加电量 | 1104 | //车辆总加电量 |
| 1099 | double zjzl = 0.0; | 1105 | double zjzl = 0.0; |
| 1100 | for (int i = 0; i < jdlList.size(); i++) { | 1106 | for (int i = 0; i < jdlList.size(); i++) { |
| @@ -1129,21 +1135,21 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1129,21 +1135,21 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1129 | } | 1135 | } |
| 1130 | 1136 | ||
| 1131 | } | 1137 | } |
| 1132 | - Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | 1138 | + Double lc = Arith.round(map.get("totalKilometers").toString(), 3); |
| 1133 | if(map.get("seqNumber").toString().equals("1")){ | 1139 | if(map.get("seqNumber").toString().equals("1")){ |
| 1134 | // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | 1140 | // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 |
| 1135 | Double dh=0.0; | 1141 | Double dh=0.0; |
| 1136 | if(zlc>0){ | 1142 | if(zlc>0){ |
| 1137 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | 1143 | + dh = Arith.round((zjzl * (lc / zlc)), 3); |
| 1138 | } | 1144 | } |
| 1139 | - nextJzyl =Arith.sub(zjzl,dh); | 1145 | + nextJzyl = Arith.sub(zjzl, dh); |
| 1140 | if(zlc>0){ | 1146 | if(zlc>0){ |
| 1141 | // long l=Math.round(nextJzyl); | 1147 | // long l=Math.round(nextJzyl); |
| 1142 | - double ylxs=nextJzyl; | ||
| 1143 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 1148 | + double ylxs = nextJzyl; |
| 1149 | + dh = Arith.round(Arith.add(dh, Arith.sub(nextJzyl, ylxs)), 3); | ||
| 1144 | if(dh<0){ | 1150 | if(dh<0){ |
| 1145 | - t.setHd(0.0); | ||
| 1146 | - t.setCdl(0.0); | 1151 | + t.setHd(0.000); |
| 1152 | + t.setCdl(0.000); | ||
| 1147 | nextJzyl=Arith.add(ylxs, dh); | 1153 | nextJzyl=Arith.add(ylxs, dh); |
| 1148 | }else{ | 1154 | }else{ |
| 1149 | t.setHd(dh); | 1155 | t.setHd(dh); |
| @@ -1151,18 +1157,18 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1151,18 +1157,18 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1151 | nextJzyl=ylxs; | 1157 | nextJzyl=ylxs; |
| 1152 | } | 1158 | } |
| 1153 | }else{ | 1159 | }else{ |
| 1154 | - t.setHd(0.0); | ||
| 1155 | - t.setCdl(0.0); | 1160 | + t.setHd(0.000); |
| 1161 | + t.setCdl(0.000); | ||
| 1156 | } | 1162 | } |
| 1157 | }else{ | 1163 | }else{ |
| 1158 | - Double dh=0.0; | 1164 | + Double dh = 0.0; |
| 1159 | if(zlc>0){ | 1165 | if(zlc>0){ |
| 1160 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | 1166 | + dh = Arith.round((zjzl * (lc / zlc)), 3); |
| 1161 | } | 1167 | } |
| 1162 | - nextJzyl =Arith.sub( nextJzyl,dh); | 1168 | + nextJzyl = Arith.sub(nextJzyl, dh); |
| 1163 | if(zlc>0){ | 1169 | if(zlc>0){ |
| 1164 | // long l=0l; | 1170 | // long l=0l; |
| 1165 | - double ylxs=0.0; | 1171 | + double ylxs = 0.0; |
| 1166 | if(i==listpbDc.size()-1){ | 1172 | if(i==listpbDc.size()-1){ |
| 1167 | // ylxs=czyl; | 1173 | // ylxs=czyl; |
| 1168 | }else{ | 1174 | }else{ |
| @@ -1172,10 +1178,10 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1172,10 +1178,10 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1172 | } | 1178 | } |
| 1173 | 1179 | ||
| 1174 | } | 1180 | } |
| 1175 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | 1181 | + dh = Arith.round(Arith.add(dh, Arith.sub(nextJzyl, ylxs)), 3); |
| 1176 | if(dh<0){ | 1182 | if(dh<0){ |
| 1177 | - t.setHd(0.0); | ||
| 1178 | - t.setCdl(0.0); | 1183 | + t.setHd(0.000); |
| 1184 | + t.setCdl(0.000); | ||
| 1179 | nextJzyl=Arith.add(ylxs, dh); | 1185 | nextJzyl=Arith.add(ylxs, dh); |
| 1180 | }else{ | 1186 | }else{ |
| 1181 | t.setHd(dh); | 1187 | t.setHd(dh); |
| @@ -1183,8 +1189,8 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1183,8 +1189,8 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1183 | nextJzyl=ylxs; | 1189 | nextJzyl=ylxs; |
| 1184 | } | 1190 | } |
| 1185 | }else{ | 1191 | }else{ |
| 1186 | - t.setHd(0.0); | ||
| 1187 | - t.setCdl(0.0); | 1192 | + t.setHd(0.000); |
| 1193 | + t.setCdl(0.000); | ||
| 1188 | } | 1194 | } |
| 1189 | } | 1195 | } |
| 1190 | t.setCzcd(100.0); | 1196 | t.setCzcd(100.0); |
| @@ -1192,7 +1198,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1192,7 +1198,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1192 | t.setNbbm(map.get("clZbh").toString()); | 1198 | t.setNbbm(map.get("clZbh").toString()); |
| 1193 | t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | 1199 | t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); |
| 1194 | t.setZlc(map.get("totalKilometers") == null ? 0.0 | 1200 | t.setZlc(map.get("totalKilometers") == null ? 0.0 |
| 1195 | - : Double.parseDouble(map.get("totalKilometers").toString())); | 1201 | + : Arith.round(map.get("totalKilometers").toString(), 3)); |
| 1196 | t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | 1202 | t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); |
| 1197 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | 1203 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| 1198 | t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | 1204 | t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); |
| @@ -1200,7 +1206,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1200,7 +1206,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1200 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 1206 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 1201 | t.setRq(sdf.parse(date)); | 1207 | t.setRq(sdf.parse(date)); |
| 1202 | t.setLp(map.get("lpName").toString()); | 1208 | t.setLp(map.get("lpName").toString()); |
| 1203 | - t.setCdl(Arith.add(t.getCdl(), t.getSh())); | 1209 | + t.setCdl(Arith.round(Arith.add(t.getCdl(), t.getSh()), 3)); |
| 1204 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | 1210 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 1205 | if(type.equals("add")){ | 1211 | if(type.equals("add")){ |
| 1206 | t.setCreatetime(new Date()); | 1212 | t.setCreatetime(new Date()); |
| @@ -1210,10 +1216,10 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1210,10 +1216,10 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1210 | } | 1216 | } |
| 1211 | 1217 | ||
| 1212 | if(t.getHd()<0){ | 1218 | if(t.getHd()<0){ |
| 1213 | - t.setHd(0.0); | 1219 | + t.setHd(0.000); |
| 1214 | } | 1220 | } |
| 1215 | if(t.getCdl()<0){ | 1221 | if(t.getCdl()<0){ |
| 1216 | - t.setCdl(0.0); | 1222 | + t.setCdl(0.000); |
| 1217 | } | 1223 | } |
| 1218 | updateDlb.add(t); | 1224 | updateDlb.add(t); |
| 1219 | } | 1225 | } |
| @@ -1251,3 +1257,5 @@ class NbbmJcsxMap implements Comparator<Map<String, Object>>{ | @@ -1251,3 +1257,5 @@ class NbbmJcsxMap implements Comparator<Map<String, Object>>{ | ||
| 1251 | return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString())); | 1257 | return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString())); |
| 1252 | } | 1258 | } |
| 1253 | } | 1259 | } |
| 1260 | + | ||
| 1261 | +//2025年三月工单:电量保留三位小数,四舍五入 |
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
| @@ -2,6 +2,8 @@ package com.bsth.service.oil.impl; | @@ -2,6 +2,8 @@ package com.bsth.service.oil.impl; | ||
| 2 | 2 | ||
| 3 | import java.io.File; | 3 | import java.io.File; |
| 4 | import java.io.FileInputStream; | 4 | import java.io.FileInputStream; |
| 5 | +import java.math.BigDecimal; | ||
| 6 | +import java.math.RoundingMode; | ||
| 5 | import java.text.DecimalFormat; | 7 | import java.text.DecimalFormat; |
| 6 | import java.text.SimpleDateFormat; | 8 | import java.text.SimpleDateFormat; |
| 7 | import java.util.ArrayList; | 9 | import java.util.ArrayList; |
| @@ -23,6 +25,7 @@ import com.bsth.entity.oil.Jdl; | @@ -23,6 +25,7 @@ import com.bsth.entity.oil.Jdl; | ||
| 23 | import com.bsth.repository.oil.JdlRepository; | 25 | import com.bsth.repository.oil.JdlRepository; |
| 24 | import com.bsth.service.impl.BaseServiceImpl; | 26 | import com.bsth.service.impl.BaseServiceImpl; |
| 25 | import com.bsth.service.oil.JdlService; | 27 | import com.bsth.service.oil.JdlService; |
| 28 | +import com.bsth.util.Arith; | ||
| 26 | import com.bsth.util.ReportUtils; | 29 | import com.bsth.util.ReportUtils; |
| 27 | 30 | ||
| 28 | @Service | 31 | @Service |
| @@ -35,7 +38,6 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl | @@ -35,7 +38,6 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl | ||
| 35 | public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) { | 38 | public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) { |
| 36 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 39 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 37 | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 40 | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 38 | - DecimalFormat df = new DecimalFormat("######0.00"); | ||
| 39 | List<String> textList = new ArrayList<String>(); | 41 | List<String> textList = new ArrayList<String>(); |
| 40 | try { | 42 | try { |
| 41 | POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); | 43 | POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); |
| @@ -83,14 +85,16 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl | @@ -83,14 +85,16 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl | ||
| 83 | rq = sdf.format(new Date()); | 85 | rq = sdf.format(new Date()); |
| 84 | } | 86 | } |
| 85 | 87 | ||
| 88 | + String jdlStr = new BigDecimal(Arith.round(jdl, 3)).toString(); // 保留三位小数,四舍五入 | ||
| 89 | + | ||
| 86 | List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm); | 90 | List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm); |
| 87 | 91 | ||
| 88 | if(jdl_.size() == 0){ | 92 | if(jdl_.size() == 0){ |
| 89 | repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm, | 93 | repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm, |
| 90 | - df.format(jdl), jdz, remarks, sd.format(new Date())); | 94 | + jdlStr, jdz, remarks, sd.format(new Date())); |
| 91 | }else{ | 95 | }else{ |
| 92 | // jdl += jdl_.get(0); | 96 | // jdl += jdl_.get(0); |
| 93 | - repository.UpdateJdl(df.format(jdl), sd.format(new Date()), gsbm, fgsbm, rq, nbbm); | 97 | + repository.UpdateJdl(jdlStr, sd.format(new Date()), gsbm, fgsbm, rq, nbbm); |
| 94 | } | 98 | } |
| 95 | } | 99 | } |
| 96 | wb.close(); | 100 | wb.close(); |
| @@ -154,3 +158,5 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl | @@ -154,3 +158,5 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl | ||
| 154 | } | 158 | } |
| 155 | 159 | ||
| 156 | } | 160 | } |
| 161 | + | ||
| 162 | +// 2025年三月工单:电量保留三位小数,四舍五入 |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -2,6 +2,7 @@ package com.bsth.service.report.impl; | @@ -2,6 +2,7 @@ package com.bsth.service.report.impl; | ||
| 2 | import com.bsth.common.ResponseCode; | 2 | import com.bsth.common.ResponseCode; |
| 3 | import com.bsth.data.BasicData; | 3 | import com.bsth.data.BasicData; |
| 4 | import com.bsth.entity.Business; | 4 | import com.bsth.entity.Business; |
| 5 | +import com.bsth.entity.Cars; | ||
| 5 | import com.bsth.entity.Line; | 6 | import com.bsth.entity.Line; |
| 6 | import com.bsth.entity.Personnel; | 7 | import com.bsth.entity.Personnel; |
| 7 | import com.bsth.entity.StationRoute; | 8 | import com.bsth.entity.StationRoute; |
| @@ -14,6 +15,8 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | @@ -14,6 +15,8 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 14 | import com.bsth.entity.sys.Dictionary; | 15 | import com.bsth.entity.sys.Dictionary; |
| 15 | import com.bsth.entity.sys.Interval; | 16 | import com.bsth.entity.sys.Interval; |
| 16 | import com.bsth.repository.BusinessRepository; | 17 | import com.bsth.repository.BusinessRepository; |
| 18 | +import com.bsth.repository.CarDeviceRepository; | ||
| 19 | +import com.bsth.repository.CarsRepository; | ||
| 17 | import com.bsth.repository.LineRepository; | 20 | import com.bsth.repository.LineRepository; |
| 18 | import com.bsth.repository.LsStationRouteRepository; | 21 | import com.bsth.repository.LsStationRouteRepository; |
| 19 | import com.bsth.repository.StationRouteRepository; | 22 | import com.bsth.repository.StationRouteRepository; |
| @@ -85,6 +88,10 @@ public class ReportServiceImpl implements ReportService{ | @@ -85,6 +88,10 @@ public class ReportServiceImpl implements ReportService{ | ||
| 85 | CalcWaybillService calcWaybillService; | 88 | CalcWaybillService calcWaybillService; |
| 86 | @Autowired | 89 | @Autowired |
| 87 | BusinessRepository businessRepository; | 90 | BusinessRepository businessRepository; |
| 91 | + @Autowired | ||
| 92 | + CarDeviceRepository carDeviceRepository; | ||
| 93 | + @Autowired | ||
| 94 | + CarsRepository carsRepository; | ||
| 88 | 95 | ||
| 89 | @Override | 96 | @Override |
| 90 | public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) { | 97 | public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) { |
| @@ -180,19 +187,73 @@ public class ReportServiceImpl implements ReportService{ | @@ -180,19 +187,73 @@ public class ReportServiceImpl implements ReportService{ | ||
| 180 | 187 | ||
| 181 | public List<ArrivalInfo> resultSet2Set(ResultSet rs) throws SQLException{ | 188 | public List<ArrivalInfo> resultSet2Set(ResultSet rs) throws SQLException{ |
| 182 | List<ArrivalInfo> list = new ArrayList<>(); | 189 | List<ArrivalInfo> list = new ArrayList<>(); |
| 183 | - | 190 | + |
| 191 | + List<Cars> findCars = carsRepository.findCars(); | ||
| 192 | + Map<String, Cars> carDeviceNoMap = new HashMap<String, Cars>(); | ||
| 193 | + for(Cars c : findCars){ | ||
| 194 | + String deviceNo = c.getEquipmentCode(); | ||
| 195 | + deviceNo = deviceNo.replaceAll("BF-", ""); | ||
| 196 | + carDeviceNoMap.put(deviceNo, c); | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + List<Object[]> selectCarHistoryDevice = carDeviceRepository.selectCarHistoryDeviceNo(); | ||
| 200 | + Map<String, List<Map<String, Object>>> deviceNoMap = new HashMap<String, List<Map<String,Object>>>(); | ||
| 201 | + for(Object[] obj : selectCarHistoryDevice){ | ||
| 202 | + String nbbm = obj[0].toString(); | ||
| 203 | + String pzh = obj[1].toString(); | ||
| 204 | + String deviceNo = obj[2].toString(); | ||
| 205 | + deviceNo = deviceNo.replaceAll("BF-", ""); | ||
| 206 | + Date qyrq = (Date)obj[3]; | ||
| 207 | + String state = obj[4].toString(); | ||
| 208 | + Map<String, Object> temp = new HashMap<String, Object>(); | ||
| 209 | + temp.put("nbbm", nbbm); | ||
| 210 | + temp.put("pzh", pzh); | ||
| 211 | + temp.put("deviceNo", deviceNo); | ||
| 212 | + temp.put("qyrq", qyrq); | ||
| 213 | + temp.put("state", state); | ||
| 214 | + if(!deviceNoMap.containsKey(deviceNo)){ | ||
| 215 | + deviceNoMap.put(deviceNo, new ArrayList<Map<String,Object>>()); | ||
| 216 | + } | ||
| 217 | + deviceNoMap.get(deviceNo).add(temp); | ||
| 218 | + } | ||
| 219 | + | ||
| 184 | ArrivalInfo arr; | 220 | ArrivalInfo arr; |
| 185 | while(rs.next()){ | 221 | while(rs.next()){ |
| 186 | arr = new ArrivalInfo(); | 222 | arr = new ArrivalInfo(); |
| 187 | - arr.setDeviceId(rs.getString("device_id")); | ||
| 188 | - String nbbm=BasicData.deviceId2NbbmMap.get(arr.getDeviceId()); | ||
| 189 | - arr.setNbbm(nbbm); | ||
| 190 | - arr.setPzh(BasicData.nbbmCompanyPlateMap.get(nbbm)); | 223 | + String deviceNo = rs.getString("device_id"); |
| 224 | + arr.setDeviceId(deviceNo); | ||
| 225 | + String ts = rs.getString("ts"); | ||
| 226 | + Date gpsDate = new Date(Long.valueOf(ts).longValue()); | ||
| 227 | + if(deviceNoMap.containsKey(deviceNo)){ | ||
| 228 | + for(Map<String, Object> m : deviceNoMap.get(deviceNo)){ | ||
| 229 | + Date qyrq = (Date)m.get("qyrq"); | ||
| 230 | + String state = m.get("state").toString(); | ||
| 231 | + if("off".equals(state) && qyrq.getTime() > gpsDate.getTime()){ // 启用时间前的旧设备号,旧设备号里符合时间的最后一个 | ||
| 232 | + arr.setNbbm(m.get("nbbm").toString()); | ||
| 233 | + arr.setPzh(m.get("pzh").toString()); | ||
| 234 | + } else if("on".equals(state) && qyrq.getTime() <= gpsDate.getTime()){ // 启用时间后的新设备号,新设备号符合时间的第一个 | ||
| 235 | + if(StringUtils.isEmpty(arr.getNbbm())){ | ||
| 236 | + arr.setNbbm(m.get("nbbm").toString()); | ||
| 237 | + arr.setPzh(m.get("pzh").toString()); | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + if(StringUtils.isEmpty(arr.getNbbm()) && carDeviceNoMap.containsKey(deviceNo)){ | ||
| 243 | + Cars cars = carDeviceNoMap.get(deviceNo); | ||
| 244 | + arr.setNbbm(cars.getInsideCode()); | ||
| 245 | + arr.setPzh(cars.getCarPlate()); | ||
| 246 | + } | ||
| 247 | + if(StringUtils.isEmpty(arr.getNbbm()) && BasicData.deviceId2NbbmMap.containsKey(arr.getDeviceId())){ | ||
| 248 | + String nbbm=BasicData.deviceId2NbbmMap.get(arr.getDeviceId()); | ||
| 249 | + arr.setNbbm(nbbm); | ||
| 250 | + arr.setPzh(BasicData.nbbmCompanyPlateMap.get(nbbm)); | ||
| 251 | + } | ||
| 191 | if(null == arr.getNbbm()){ | 252 | if(null == arr.getNbbm()){ |
| 192 | logger.warn("未注册的设备号," + arr.getDeviceId()); | 253 | logger.warn("未注册的设备号," + arr.getDeviceId()); |
| 193 | continue; | 254 | continue; |
| 194 | } | 255 | } |
| 195 | - | 256 | + |
| 196 | arr.setTs(rs.getLong("ts")); | 257 | arr.setTs(rs.getLong("ts")); |
| 197 | arr.setLineCode(rs.getString("line_id")); | 258 | arr.setLineCode(rs.getString("line_id")); |
| 198 | arr.setUpDown(rs.getInt("up_down")); | 259 | arr.setUpDown(rs.getInt("up_down")); |
| @@ -202,7 +263,7 @@ public class ReportServiceImpl implements ReportService{ | @@ -202,7 +263,7 @@ public class ReportServiceImpl implements ReportService{ | ||
| 202 | arr.setCreateDate(rs.getLong("create_timestamp")); | 263 | arr.setCreateDate(rs.getLong("create_timestamp")); |
| 203 | arr.setWeeksYear(rs.getInt("weeks_year")); | 264 | arr.setWeeksYear(rs.getInt("weeks_year")); |
| 204 | arr.setEnable(true); | 265 | arr.setEnable(true); |
| 205 | - | 266 | + |
| 206 | list.add(arr); | 267 | list.add(arr); |
| 207 | } | 268 | } |
| 208 | return list; | 269 | return list; |
| @@ -297,7 +358,6 @@ public class ReportServiceImpl implements ReportService{ | @@ -297,7 +358,6 @@ public class ReportServiceImpl implements ReportService{ | ||
| 297 | 358 | ||
| 298 | String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year in ("+tempStr+") " | 359 | String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year in ("+tempStr+") " |
| 299 | + " AND line_id=? AND up_down=? AND stop_no like ? AND ts between ? AND ? order by ts"; | 360 | + " AND line_id=? AND up_down=? AND stop_no like ? AND ts between ? AND ? order by ts"; |
| 300 | - System.out.println(sql); | ||
| 301 | try{ | 361 | try{ |
| 302 | conn = DBUtils_MS.getConnection(); | 362 | conn = DBUtils_MS.getConnection(); |
| 303 | ps = conn.prepareStatement(sql); | 363 | ps = conn.prepareStatement(sql); |
| @@ -3117,8 +3177,6 @@ public class ReportServiceImpl implements ReportService{ | @@ -3117,8 +3177,6 @@ public class ReportServiceImpl implements ReportService{ | ||
| 3117 | map.put("nbbm", arg0.getString("cl_zbh")); | 3177 | map.put("nbbm", arg0.getString("cl_zbh")); |
| 3118 | map.put("jGh", arg0.getString("j_gh")); | 3178 | map.put("jGh", arg0.getString("j_gh")); |
| 3119 | map.put("sGh", arg0.getString("s_gh")); | 3179 | map.put("sGh", arg0.getString("s_gh")); |
| 3120 | -// map.put("jName", arg0.getString("j_name")); | ||
| 3121 | -// map.put("sName", arg0.getString("s_name")); | ||
| 3122 | return map; | 3180 | return map; |
| 3123 | } | 3181 | } |
| 3124 | }); | 3182 | }); |
| @@ -3187,8 +3245,8 @@ public class ReportServiceImpl implements ReportService{ | @@ -3187,8 +3245,8 @@ public class ReportServiceImpl implements ReportService{ | ||
| 3187 | newMap.put("yhl", yhl); | 3245 | newMap.put("yhl", yhl); |
| 3188 | newMap.put("jzl", jzl); | 3246 | newMap.put("jzl", jzl); |
| 3189 | newMap.put("hyl", hyl); | 3247 | newMap.put("hyl", hyl); |
| 3190 | - newMap.put("dhl", dhl); | ||
| 3191 | - newMap.put("cdl", cdl); | 3248 | + newMap.put("dhl", Arith.round(dhl, 3)); |
| 3249 | + newMap.put("cdl", Arith.round(cdl, 3)); | ||
| 3192 | lMap.add(newMap); | 3250 | lMap.add(newMap); |
| 3193 | }else{ | 3251 | }else{ |
| 3194 | Map<String, Object> newMap=staticTj(lists, ""); | 3252 | Map<String, Object> newMap=staticTj(lists, ""); |
| @@ -3222,13 +3280,13 @@ public class ReportServiceImpl implements ReportService{ | @@ -3222,13 +3280,13 @@ public class ReportServiceImpl implements ReportService{ | ||
| 3222 | } | 3280 | } |
| 3223 | double div=0.0; | 3281 | double div=0.0; |
| 3224 | if(lc>0){ | 3282 | if(lc>0){ |
| 3225 | - div=Arith.div(zlc, lc,2); | 3283 | + div=Arith.div(zlc, lc, 2); |
| 3226 | } | 3284 | } |
| 3227 | - newMap.put("yhl", yhl*div); | ||
| 3228 | - newMap.put("jzl", jzl*div); | ||
| 3229 | - newMap.put("hyl", hyl*div); | ||
| 3230 | - newMap.put("dhl", dhl*div); | ||
| 3231 | - newMap.put("cdl", cdl*div); | 3285 | + newMap.put("yhl", Arith.round(yhl*div, 2)); |
| 3286 | + newMap.put("jzl", Arith.round(jzl*div, 2)); | ||
| 3287 | + newMap.put("hyl", Arith.round(hyl*div, 2)); | ||
| 3288 | + newMap.put("dhl", Arith.round(dhl*div, 3)); | ||
| 3289 | + newMap.put("cdl", Arith.round(cdl*div, 3)); | ||
| 3232 | lMaps.add(newMap); | 3290 | lMaps.add(newMap); |
| 3233 | } | 3291 | } |
| 3234 | 3292 |
src/main/resources/static/pages/electricity/list/list.html
| @@ -226,7 +226,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | @@ -226,7 +226,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | ||
| 226 | </td> | 226 | </td> |
| 227 | <td> | 227 | <td> |
| 228 | <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_hd" readOnly="true" | 228 | <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_hd" readOnly="true" |
| 229 | - type="text" value=" {{obj.hd}}" style=" width:45px;float:left" | 229 | + type="text" value=" {{obj.hd}}" style=" width:70px;float:left" |
| 230 | onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | 230 | onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" |
| 231 | onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> | 231 | onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> |
| 232 | </td> | 232 | </td> |
| @@ -245,7 +245,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | @@ -245,7 +245,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | ||
| 245 | </td> | 245 | </td> |
| 246 | <td> | 246 | <td> |
| 247 | <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl" | 247 | <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl" |
| 248 | - value={{obj.sh}} style=" width:40px" type="text" | 248 | + value={{obj.sh}} style=" width:55px" type="text" |
| 249 | onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | 249 | onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" |
| 250 | onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> | 250 | onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> |
| 251 | 251 |
src/main/resources/static/pages/forms/calc/calcsingledata.html
| @@ -18,8 +18,9 @@ | @@ -18,8 +18,9 @@ | ||
| 18 | </style> | 18 | </style> |
| 19 | 19 | ||
| 20 | <div class="page-head"> | 20 | <div class="page-head"> |
| 21 | - <div class="page-title"> | ||
| 22 | - <h1>路单数据(统计)</h1> | 21 | + <div class="page-title" style="width:99%;"> |
| 22 | + <h1 style="float:left;">路单数据(统计)</h1> | ||
| 23 | + <i class="fa fa-info" style="float:right;" title="本表计算能耗加注量时,油车统计油量,电车统计电量; 25年3月底更新后电量保留三位小数。"></i> | ||
| 23 | </div> | 24 | </div> |
| 24 | </div> | 25 | </div> |
| 25 | 26 |
src/main/resources/static/pages/forms/mould/daily.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/daily.html
| 1 | -<style type="text/css"> | ||
| 2 | - .table-bordered { | ||
| 3 | - border: 1px solid; } | ||
| 4 | - .table-bordered > thead > tr > th, | ||
| 5 | - .table-bordered > thead > tr > td, | ||
| 6 | - .table-bordered > tbody > tr > th, | ||
| 7 | - .table-bordered > tbody > tr > td, | ||
| 8 | - .table-bordered > tfoot > tr > th, | ||
| 9 | - .table-bordered > tfoot > tr > td { | ||
| 10 | - border: 1px solid; } | ||
| 11 | - .table-bordered > thead > tr > th, | ||
| 12 | - .table-bordered > thead > tr > td { | ||
| 13 | - border-bottom-width: 2px; } | ||
| 14 | - | ||
| 15 | - .table > tbody + tbody { | ||
| 16 | - border-top: 1px solid; } | ||
| 17 | -</style> | ||
| 18 | - | ||
| 19 | -<div class="page-head"> | ||
| 20 | - <div class="page-title"> | ||
| 21 | - <h1>班次日报表</h1> | ||
| 22 | - </div> | ||
| 23 | -</div> | ||
| 24 | - | ||
| 25 | -<div class="row"> | ||
| 26 | - <div class="col-md-12"> | ||
| 27 | - <div class="portlet light porttlet-fit bordered"> | ||
| 28 | - <div class="portlet-title"> | ||
| 29 | - <form class="form-inline" action=""> | ||
| 30 | - <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_daily"> | ||
| 31 | - <span class="item-label" style="width: 80px;">公司: </span> | ||
| 32 | - <select class="form-control" name="company" id="gsdmDaily" style="width: 180px;"></select> | ||
| 33 | - </div> | ||
| 34 | - <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_daily"> | ||
| 35 | - <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 36 | - <select class="form-control" name="subCompany" id="fgsdmDaily" style="width: 180px;"></select> | ||
| 37 | - </div> | ||
| 38 | - <div style="margin-top: 2px"></div> | ||
| 39 | - <div style="display: inline-block;margin-left: 33px;"> | ||
| 40 | - <span class="item-label" style="width: 80px;">线路: </span> | ||
| 41 | - <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 42 | - </div> | ||
| 43 | - <div style="display: inline-block;margin-left: 24px;"> | ||
| 44 | - <span class="item-label" style="width: 80px;"> 时间: </span> | ||
| 45 | - <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 46 | - </div> | ||
| 47 | - <div class="form-group"> | ||
| 48 | - <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 49 | - <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 50 | - </div> | ||
| 51 | - </form> | ||
| 52 | - </div> | ||
| 53 | - <div class="portlet-body"> | ||
| 54 | - <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 55 | - <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 56 | - <thead> | ||
| 57 | - <tr> | ||
| 58 | - <th colspan="7">调度班次日报</th> | ||
| 59 | - </tr> | ||
| 60 | - <tr> | ||
| 61 | - <td>路线:</td> | ||
| 62 | - <td colspan="2"><span id="form_line"> </span></td> | ||
| 63 | - <td>时间:</td> | ||
| 64 | - <td colspan="3"><span id="form_date"> </span></td> | ||
| 65 | - </tr> | ||
| 66 | - <tr> | ||
| 67 | - <td>车辆</td> | ||
| 68 | - <td>工号</td> | ||
| 69 | - <td>姓名</td> | ||
| 70 | - <td>总公里</td> | ||
| 71 | - <td>空驶公里</td> | ||
| 72 | - <td>油耗</td> | ||
| 73 | - <td>班次</td> | ||
| 74 | - </tr> | ||
| 75 | - </thead> | ||
| 76 | - <tbody id="tbody"> | ||
| 77 | - | ||
| 78 | - </tbody> | ||
| 79 | - <tr> | ||
| 80 | - <td colspan="3">小计</td> | ||
| 81 | - <td><span id="total_zgl"> </span></td> | ||
| 82 | - <td><span id="total_ks"> </span></td> | ||
| 83 | - <td><span id="total_yh"> </span></td> | ||
| 84 | - <td><span id="total_bc"> </span></td> | ||
| 85 | - </tr> | ||
| 86 | - </table> | ||
| 87 | - </div> | ||
| 88 | - </div> | ||
| 89 | - </div> | ||
| 90 | - </div> | ||
| 91 | -</div> | ||
| 92 | - | ||
| 93 | -<script> | ||
| 94 | - $(function(){ | ||
| 95 | - | ||
| 96 | - // 关闭左侧栏 | ||
| 97 | - if (!$('body').hasClass('page-sidebar-closed')) | ||
| 98 | - $('.menu-toggler.sidebar-toggler').click(); | ||
| 99 | - | ||
| 100 | - $("#date").datetimepicker({ | ||
| 101 | - format : 'YYYY-MM-DD', | ||
| 102 | - locale : 'zh-cn' | ||
| 103 | - }); | ||
| 104 | - var fage=false; | ||
| 105 | - var xlList; | ||
| 106 | - var obj = []; | ||
| 107 | - | ||
| 108 | - | ||
| 109 | - $.get('/report/lineList',function(result){ | ||
| 110 | - xlList=result; | ||
| 111 | - $.get('/user/companyData', function(result){ | ||
| 112 | - obj = result; | ||
| 113 | - var options = ''; | ||
| 114 | - for(var i = 0; i < obj.length; i++){ | ||
| 115 | - options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - if(obj.length ==0){ | ||
| 119 | - $("#gsdmDiv_daily").css('display','none'); | ||
| 120 | - }else if(obj.length ==1){ | ||
| 121 | - $("#gsdmDiv_daily").css('display','none'); | ||
| 122 | - if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 123 | - $('#fgsdmDiv_daily').css('display','none'); | ||
| 124 | - } | ||
| 125 | - $('#gsdmDaily').html(options); | ||
| 126 | - updateCompany(); | ||
| 127 | - }); | ||
| 128 | - }) | ||
| 129 | - $("#gsdmDaily").on("change",updateCompany); | ||
| 130 | - function updateCompany(){ | ||
| 131 | - var company = $('#gsdmDaily').val(); | ||
| 132 | - var options = ''; | ||
| 133 | - for(var i = 0; i < obj.length; i++){ | ||
| 134 | - if(obj[i].companyCode == company){ | ||
| 135 | - var children = obj[i].children; | ||
| 136 | - for(var j = 0; j < children.length; j++){ | ||
| 137 | - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 138 | - } | ||
| 139 | - } | ||
| 140 | - } | ||
| 141 | - $('#fgsdmDaily').html(options); | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - var tempData = {}; | ||
| 145 | - $.get('/report/lineList',function(xlList){ | ||
| 146 | - var data = []; | ||
| 147 | -// data.push({id: " ", text: "全部线路"}); | ||
| 148 | - $.get('/user/companyData', function(result){ | ||
| 149 | - for(var i = 0; i < result.length; i++){ | ||
| 150 | - var companyCode = result[i].companyCode; | ||
| 151 | - var children = result[i].children; | ||
| 152 | - for(var j = 0; j < children.length; j++){ | ||
| 153 | - var code = children[j].code; | ||
| 154 | - for(var k=0;k < xlList.length;k++ ){ | ||
| 155 | - if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 156 | - data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 157 | - tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - initPinYinSelect2('#line',data,''); | ||
| 163 | - | ||
| 164 | - }); | ||
| 165 | - }); | ||
| 166 | - | ||
| 167 | - $("#line").on("change", function(){ | ||
| 168 | - if($("#line").val() == " "){ | ||
| 169 | - $("#gsdmDaily").attr("disabled", false); | ||
| 170 | - $("#fgsdmDaily").attr("disabled", false); | ||
| 171 | - } else { | ||
| 172 | - var temp = (tempData[$("#line").val()] ? tempData[$("#line").val()] : " : ").split(":"); | ||
| 173 | - $("#gsdmDaily").val(temp[0]); | ||
| 174 | - updateCompany(); | ||
| 175 | - $("#fgsdmDaily").val(temp[1]); | ||
| 176 | - $("#gsdmDaily").attr("disabled", true); | ||
| 177 | - $("#fgsdmDaily").attr("disabled", true); | ||
| 178 | - } | ||
| 179 | - }); | ||
| 180 | - | ||
| 181 | - | ||
| 182 | - var line; | ||
| 183 | - var date; | ||
| 184 | - var gsdmDaily; | ||
| 185 | - var fgsdmDaily; | ||
| 186 | - var lineName=$("#select2-line-container").html(); | ||
| 187 | - $("#query").on("click",function(){ | ||
| 188 | - if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 189 | - layer.msg("请选择时间"); | ||
| 190 | - return; | ||
| 191 | - } | ||
| 192 | - line = $("#line").val(); | ||
| 193 | - date = $("#date").val(); | ||
| 194 | - gsdmDaily=$("#gsdmDaily").val(); | ||
| 195 | - fgsdmDaily = $("#fgsdmDaily").val(); | ||
| 196 | - lineName=$("#select2-line-container").html(); | ||
| 197 | - var i = layer.load(2); | ||
| 198 | - $get('/mcy_forms/daily',{gsdmDaily:gsdmDaily,fgsdmDaily:fgsdmDaily, line:line,date:date,type:'query'},function(result){ | ||
| 199 | - $("#form_line").text(lineName); | ||
| 200 | - $("#form_date").text(date); | ||
| 201 | - // 把数据填充到模版中 | ||
| 202 | - var tbodyHtml = template('dailyInfo',{list:result}); | ||
| 203 | - // 把渲染好的模版html文本追加到表格中 | ||
| 204 | - $('#tbody').html(tbodyHtml); | ||
| 205 | - layer.close(i); | ||
| 206 | - | ||
| 207 | - line = $("#line").val(); | ||
| 208 | - startDate = $("#startDate").val(); | ||
| 209 | - endDate = $("#endDate").val(); | ||
| 210 | - $("#sDate").text(startDate); | ||
| 211 | - $("#eDate").text(endDate); | ||
| 212 | - | ||
| 213 | - var total_zgl = 0,total_ks = 0; | ||
| 214 | - var total_yh = 0,total_bc = 0; | ||
| 215 | - | ||
| 216 | - $.each(result, function(i, obj) { | ||
| 217 | - total_zgl +=Number(obj.zlc*10000); | ||
| 218 | - total_ks +=Number(obj.jzl1*10000); | ||
| 219 | - total_yh += Number(obj.yh*10000); | ||
| 220 | - total_bc += Number(obj.bc); | ||
| 221 | - | ||
| 222 | - }); | ||
| 223 | - $("#total_zgl").text((total_zgl/10000).toFixed(3)); | ||
| 224 | - $("#total_ks").text((total_ks/10000).toFixed(3)); | ||
| 225 | - $("#total_yh").text((total_yh/10000).toFixed(2)); | ||
| 226 | - $("#total_bc").text(total_bc.toFixed(0)); | ||
| 227 | - | ||
| 228 | - var temp = {}; | ||
| 229 | - var today_account = 0; | ||
| 230 | - | ||
| 231 | - temp["line"] = $("#line").text(); | ||
| 232 | - $.each(result, function(i, obj) { | ||
| 233 | - if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){ | ||
| 234 | - today_account++; | ||
| 235 | - } | ||
| 236 | - obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); | ||
| 237 | - }); | ||
| 238 | - }) | ||
| 239 | - }); | ||
| 240 | - | ||
| 241 | - $("#export").on("click",function(){ | ||
| 242 | - if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 243 | - layer.msg("请选择时间"); | ||
| 244 | - return; | ||
| 245 | - } | ||
| 246 | - line = $("#line").val(); | ||
| 247 | - date = $("#date").val(); | ||
| 248 | - gsdmDaily=$("#gsdmDaily").val(); | ||
| 249 | - fgsdmDaily = $("#fgsdmDaily").val(); | ||
| 250 | - lineName=$("#select2-line-container").html(); | ||
| 251 | - var i = layer.load(2); | ||
| 252 | - $post('/mcy_export/dailyExport',{gsdmDaily:gsdmDaily,fgsdmDaily:fgsdmDaily,line:line,date:date,type:'export',lineName:lineName},function(result){ | ||
| 253 | - window.open("/downloadFile/download?fileName=" | ||
| 254 | - +moment(date).format("YYYYMMDD")+"-"+lineName+"-班次日报表"); | ||
| 255 | - layer.close(i); | ||
| 256 | - }); | ||
| 257 | - }); | ||
| 258 | -}); | ||
| 259 | -</script> | ||
| 260 | -<script type="text/html" id="dailyInfo"> | ||
| 261 | - {{each list as obj i}} | ||
| 262 | - <tr> | ||
| 263 | - <td>{{obj.zbh}}</td> | ||
| 264 | - <td>{{obj.jgh}}</td> | ||
| 265 | - <td>{{obj.jName}}</td> | ||
| 266 | - <td>{{obj.zlc}}</td> | ||
| 267 | - <td>{{obj.jzl1}}</td> | ||
| 268 | - <td>{{obj.yh}}</td> | ||
| 269 | - <td>{{obj.bc}}</td> | ||
| 270 | - </tr> | ||
| 271 | - {{/each}} | ||
| 272 | - {{if list.length == 0}} | ||
| 273 | - <tr> | ||
| 274 | - <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 275 | - </tr> | ||
| 276 | - {{/if}} | 1 | +<style type="text/css"> |
| 2 | + .table-bordered { | ||
| 3 | + border: 1px solid; } | ||
| 4 | + .table-bordered > thead > tr > th, | ||
| 5 | + .table-bordered > thead > tr > td, | ||
| 6 | + .table-bordered > tbody > tr > th, | ||
| 7 | + .table-bordered > tbody > tr > td, | ||
| 8 | + .table-bordered > tfoot > tr > th, | ||
| 9 | + .table-bordered > tfoot > tr > td { | ||
| 10 | + border: 1px solid; } | ||
| 11 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + | ||
| 15 | + .table > tbody + tbody { | ||
| 16 | + border-top: 1px solid; } | ||
| 17 | + .h2 {} | ||
| 18 | +</style> | ||
| 19 | + | ||
| 20 | +<div class="page-head"> | ||
| 21 | + <div class="page-title" style="width:99%;"> | ||
| 22 | + <h1 style="float:left;width:50%;">班次日报表</h1> | ||
| 23 | + <i class="fa fa-info" style="float:right;" title="本表计算能耗加注量时,油车统计油量,电车统计电量; 25年3月底更新后电量保留三位小数。"></i> | ||
| 24 | + </div> | ||
| 25 | +</div> | ||
| 26 | + | ||
| 27 | +<div class="row"> | ||
| 28 | + <div class="col-md-12"> | ||
| 29 | + <div class="portlet light porttlet-fit bordered"> | ||
| 30 | + <div class="portlet-title"> | ||
| 31 | + <form class="form-inline" action=""> | ||
| 32 | + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_daily"> | ||
| 33 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 34 | + <select class="form-control" name="company" id="gsdmDaily" style="width: 180px;"></select> | ||
| 35 | + </div> | ||
| 36 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_daily"> | ||
| 37 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 38 | + <select class="form-control" name="subCompany" id="fgsdmDaily" style="width: 180px;"></select> | ||
| 39 | + </div> | ||
| 40 | + <div style="margin-top: 2px"></div> | ||
| 41 | + <div style="display: inline-block;margin-left: 33px;"> | ||
| 42 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 43 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 44 | + </div> | ||
| 45 | + <div style="display: inline-block;margin-left: 24px;"> | ||
| 46 | + <span class="item-label" style="width: 80px;"> 时间: </span> | ||
| 47 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 48 | + </div> | ||
| 49 | + <div class="form-group"> | ||
| 50 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 51 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 52 | + </div> | ||
| 53 | + </form> | ||
| 54 | + </div> | ||
| 55 | + <div class="portlet-body"> | ||
| 56 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 57 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 58 | + <thead> | ||
| 59 | + <tr> | ||
| 60 | + <th colspan="7">调度班次日报</th> | ||
| 61 | + </tr> | ||
| 62 | + <tr> | ||
| 63 | + <td>路线:</td> | ||
| 64 | + <td colspan="2"><span id="form_line"> </span></td> | ||
| 65 | + <td>时间:</td> | ||
| 66 | + <td colspan="3"><span id="form_date"> </span></td> | ||
| 67 | + </tr> | ||
| 68 | + <tr> | ||
| 69 | + <td>车辆</td> | ||
| 70 | + <td>工号</td> | ||
| 71 | + <td>姓名</td> | ||
| 72 | + <td>总公里</td> | ||
| 73 | + <td>空驶公里</td> | ||
| 74 | + <td>油耗</td> | ||
| 75 | + <td>班次</td> | ||
| 76 | + </tr> | ||
| 77 | + </thead> | ||
| 78 | + <tbody id="tbody"> | ||
| 79 | + | ||
| 80 | + </tbody> | ||
| 81 | + <tr> | ||
| 82 | + <td colspan="3">小计</td> | ||
| 83 | + <td><span id="total_zgl"> </span></td> | ||
| 84 | + <td><span id="total_ks"> </span></td> | ||
| 85 | + <td><span id="total_yh"> </span></td> | ||
| 86 | + <td><span id="total_bc"> </span></td> | ||
| 87 | + </tr> | ||
| 88 | + </table> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | + </div> | ||
| 92 | + </div> | ||
| 93 | +</div> | ||
| 94 | + | ||
| 95 | +<script> | ||
| 96 | + $(function(){ | ||
| 97 | + | ||
| 98 | + // 关闭左侧栏 | ||
| 99 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 100 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 101 | + | ||
| 102 | + $("#date").datetimepicker({ | ||
| 103 | + format : 'YYYY-MM-DD', | ||
| 104 | + locale : 'zh-cn' | ||
| 105 | + }); | ||
| 106 | + var fage=false; | ||
| 107 | + var xlList; | ||
| 108 | + var obj = []; | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + $.get('/report/lineList',function(result){ | ||
| 112 | + xlList=result; | ||
| 113 | + $.get('/user/companyData', function(result){ | ||
| 114 | + obj = result; | ||
| 115 | + var options = ''; | ||
| 116 | + for(var i = 0; i < obj.length; i++){ | ||
| 117 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + if(obj.length ==0){ | ||
| 121 | + $("#gsdmDiv_daily").css('display','none'); | ||
| 122 | + }else if(obj.length ==1){ | ||
| 123 | + $("#gsdmDiv_daily").css('display','none'); | ||
| 124 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 125 | + $('#fgsdmDiv_daily').css('display','none'); | ||
| 126 | + } | ||
| 127 | + $('#gsdmDaily').html(options); | ||
| 128 | + updateCompany(); | ||
| 129 | + }); | ||
| 130 | + }) | ||
| 131 | + $("#gsdmDaily").on("change",updateCompany); | ||
| 132 | + function updateCompany(){ | ||
| 133 | + var company = $('#gsdmDaily').val(); | ||
| 134 | + var options = ''; | ||
| 135 | + for(var i = 0; i < obj.length; i++){ | ||
| 136 | + if(obj[i].companyCode == company){ | ||
| 137 | + var children = obj[i].children; | ||
| 138 | + for(var j = 0; j < children.length; j++){ | ||
| 139 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + $('#fgsdmDaily').html(options); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + var tempData = {}; | ||
| 147 | + $.get('/report/lineList',function(xlList){ | ||
| 148 | + var data = []; | ||
| 149 | +// data.push({id: " ", text: "全部线路"}); | ||
| 150 | + $.get('/user/companyData', function(result){ | ||
| 151 | + for(var i = 0; i < result.length; i++){ | ||
| 152 | + var companyCode = result[i].companyCode; | ||
| 153 | + var children = result[i].children; | ||
| 154 | + for(var j = 0; j < children.length; j++){ | ||
| 155 | + var code = children[j].code; | ||
| 156 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 157 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 158 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 159 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 160 | + } | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + initPinYinSelect2('#line',data,''); | ||
| 165 | + | ||
| 166 | + }); | ||
| 167 | + }); | ||
| 168 | + | ||
| 169 | + $("#line").on("change", function(){ | ||
| 170 | + if($("#line").val() == " "){ | ||
| 171 | + $("#gsdmDaily").attr("disabled", false); | ||
| 172 | + $("#fgsdmDaily").attr("disabled", false); | ||
| 173 | + } else { | ||
| 174 | + var temp = (tempData[$("#line").val()] ? tempData[$("#line").val()] : " : ").split(":"); | ||
| 175 | + $("#gsdmDaily").val(temp[0]); | ||
| 176 | + updateCompany(); | ||
| 177 | + $("#fgsdmDaily").val(temp[1]); | ||
| 178 | + $("#gsdmDaily").attr("disabled", true); | ||
| 179 | + $("#fgsdmDaily").attr("disabled", true); | ||
| 180 | + } | ||
| 181 | + }); | ||
| 182 | + | ||
| 183 | + | ||
| 184 | + var line; | ||
| 185 | + var date; | ||
| 186 | + var gsdmDaily; | ||
| 187 | + var fgsdmDaily; | ||
| 188 | + var lineName=$("#select2-line-container").html(); | ||
| 189 | + $("#query").on("click",function(){ | ||
| 190 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 191 | + layer.msg("请选择时间"); | ||
| 192 | + return; | ||
| 193 | + } | ||
| 194 | + line = $("#line").val(); | ||
| 195 | + date = $("#date").val(); | ||
| 196 | + gsdmDaily=$("#gsdmDaily").val(); | ||
| 197 | + fgsdmDaily = $("#fgsdmDaily").val(); | ||
| 198 | + lineName=$("#select2-line-container").html(); | ||
| 199 | + var i = layer.load(2); | ||
| 200 | + $get('/mcy_forms/daily',{gsdmDaily:gsdmDaily,fgsdmDaily:fgsdmDaily, line:line,date:date,type:'query'},function(result){ | ||
| 201 | + $("#form_line").text(lineName); | ||
| 202 | + $("#form_date").text(date); | ||
| 203 | + // 把数据填充到模版中 | ||
| 204 | + var tbodyHtml = template('dailyInfo',{list:result}); | ||
| 205 | + // 把渲染好的模版html文本追加到表格中 | ||
| 206 | + $('#tbody').html(tbodyHtml); | ||
| 207 | + layer.close(i); | ||
| 208 | + | ||
| 209 | + line = $("#line").val(); | ||
| 210 | + startDate = $("#startDate").val(); | ||
| 211 | + endDate = $("#endDate").val(); | ||
| 212 | + $("#sDate").text(startDate); | ||
| 213 | + $("#eDate").text(endDate); | ||
| 214 | + | ||
| 215 | + var total_zgl = 0,total_ks = 0; | ||
| 216 | + var total_yh = 0,total_bc = 0; | ||
| 217 | + | ||
| 218 | + $.each(result, function(i, obj) { | ||
| 219 | + total_zgl += Number(obj.zlc*10000); | ||
| 220 | + total_ks += Number(obj.jzl1*10000); | ||
| 221 | + total_yh += Number(obj.yh*10000); | ||
| 222 | + total_bc += Number(obj.bc); | ||
| 223 | + | ||
| 224 | + }); | ||
| 225 | + $("#total_zgl").text((total_zgl/10000).toFixed(3)); | ||
| 226 | + $("#total_ks").text((total_ks/10000).toFixed(3)); | ||
| 227 | + $("#total_yh").text((total_yh/10000).toFixed(3)); | ||
| 228 | + $("#total_bc").text(total_bc.toFixed(0)); | ||
| 229 | + | ||
| 230 | + var temp = {}; | ||
| 231 | + var today_account = 0; | ||
| 232 | + | ||
| 233 | + temp["line"] = $("#line").text(); | ||
| 234 | + $.each(result, function(i, obj) { | ||
| 235 | + if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){ | ||
| 236 | + today_account++; | ||
| 237 | + } | ||
| 238 | + obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); | ||
| 239 | + }); | ||
| 240 | + }) | ||
| 241 | + }); | ||
| 242 | + | ||
| 243 | + $("#export").on("click",function(){ | ||
| 244 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 245 | + layer.msg("请选择时间"); | ||
| 246 | + return; | ||
| 247 | + } | ||
| 248 | + line = $("#line").val(); | ||
| 249 | + date = $("#date").val(); | ||
| 250 | + gsdmDaily=$("#gsdmDaily").val(); | ||
| 251 | + fgsdmDaily = $("#fgsdmDaily").val(); | ||
| 252 | + lineName=$("#select2-line-container").html(); | ||
| 253 | + var i = layer.load(2); | ||
| 254 | + $post('/mcy_export/dailyExport',{gsdmDaily:gsdmDaily,fgsdmDaily:fgsdmDaily,line:line,date:date,type:'export',lineName:lineName},function(result){ | ||
| 255 | + window.open("/downloadFile/download?fileName=" | ||
| 256 | + +moment(date).format("YYYYMMDD")+"-"+lineName+"-班次日报表"); | ||
| 257 | + layer.close(i); | ||
| 258 | + }); | ||
| 259 | + }); | ||
| 260 | +}); | ||
| 261 | +</script> | ||
| 262 | +<script type="text/html" id="dailyInfo"> | ||
| 263 | + {{each list as obj i}} | ||
| 264 | + <tr> | ||
| 265 | + <td>{{obj.zbh}}</td> | ||
| 266 | + <td>{{obj.jgh}}</td> | ||
| 267 | + <td>{{obj.jName}}</td> | ||
| 268 | + <td>{{obj.zlc}}</td> | ||
| 269 | + <td>{{obj.jzl1}}</td> | ||
| 270 | + <td>{{obj.yh}}</td> | ||
| 271 | + <td>{{obj.bc}}</td> | ||
| 272 | + </tr> | ||
| 273 | + {{/each}} | ||
| 274 | + {{if list.length == 0}} | ||
| 275 | + <tr> | ||
| 276 | + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 277 | + </tr> | ||
| 278 | + {{/if}} | ||
| 277 | </script> | 279 | </script> |
| 278 | \ No newline at end of file | 280 | \ No newline at end of file |
src/main/resources/static/pages/history_sch/edit/history_sch_maintain.html
| @@ -497,7 +497,7 @@ | @@ -497,7 +497,7 @@ | ||
| 497 | $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | 497 | $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); |
| 498 | 498 | ||
| 499 | 499 | ||
| 500 | - var reCountEp = EventProxy.create('ylbUpdate', 'calcWaybill', 'scheduleDetail', function () { | 500 | + var reCountEp = EventProxy.create('calcWaybill', 'scheduleDetail', function () { |
| 501 | $('i.uk-icon-spin', that).remove(); | 501 | $('i.uk-icon-spin', that).remove(); |
| 502 | $(that).removeAttr('disabled'); | 502 | $(that).removeAttr('disabled'); |
| 503 | notify_succ('重新统计成功!'); | 503 | notify_succ('重新统计成功!'); |
src/main/resources/static/pages/mforms/singledatas/singledata.html
| @@ -18,8 +18,9 @@ | @@ -18,8 +18,9 @@ | ||
| 18 | </style> | 18 | </style> |
| 19 | 19 | ||
| 20 | <div class="page-head"> | 20 | <div class="page-head"> |
| 21 | - <div class="page-title"> | ||
| 22 | - <h1>路单数据</h1> | 21 | + <div class="page-title" style="width:99%;"> |
| 22 | + <h1 style="float:left;">路单数据</h1> | ||
| 23 | + <i class="fa fa-info" style="float:right;" title="本表计算能耗加注量时,油车统计油量,电车统计电量; 25年3月底更新后电量保留三位小数。"></i> | ||
| 23 | </div> | 24 | </div> |
| 24 | </div> | 25 | </div> |
| 25 | 26 |
src/main/resources/static/pages/mforms/singledatas/singledatas.html
| @@ -18,8 +18,9 @@ | @@ -18,8 +18,9 @@ | ||
| 18 | </style> | 18 | </style> |
| 19 | 19 | ||
| 20 | <div class="page-head"> | 20 | <div class="page-head"> |
| 21 | - <div class="page-title"> | ||
| 22 | - <h1>路单数据</h1> | 21 | + <div class="page-title" style="width:99%;"> |
| 22 | + <h1 style="float:left;">路单数据</h1> | ||
| 23 | + <i class="fa fa-info" style="float:right;" title="本表计算能耗加注量时,油车统计油量,电车统计电量; 25年3月底更新后电量保留三位小数。"></i> | ||
| 23 | </div> | 24 | </div> |
| 24 | </div> | 25 | </div> |
| 25 | 26 |
src/main/resources/static/pages/mforms/vehicleloadings/vehicleloading.html
| @@ -18,8 +18,9 @@ | @@ -18,8 +18,9 @@ | ||
| 18 | </style> | 18 | </style> |
| 19 | 19 | ||
| 20 | <div class="page-head"> | 20 | <div class="page-head"> |
| 21 | - <div class="page-title"> | ||
| 22 | - <h1>车辆加注</h1> | 21 | + <div class="page-title" style="width:99%;"> |
| 22 | + <h1 style="float:left;">车辆加注</h1> | ||
| 23 | + <i class="fa fa-info" style="float:right;" title="本表计算能耗加注量时,油车统计油量,电车统计电量; 25年3月底更新后电量保留三位小数。"></i> | ||
| 23 | </div> | 24 | </div> |
| 24 | </div> | 25 | </div> |
| 25 | 26 |
src/main/resources/static/pages/mforms/waybilldays/waybillday.html
| @@ -18,8 +18,9 @@ | @@ -18,8 +18,9 @@ | ||
| 18 | </style> | 18 | </style> |
| 19 | 19 | ||
| 20 | <div class="page-head"> | 20 | <div class="page-head"> |
| 21 | - <div class="page-title"> | ||
| 22 | - <h1>行车路单日报表</h1> | 21 | + <div class="page-title" style="width:99%;"> |
| 22 | + <h1 style="float:left;">行车路单日报表</h1> | ||
| 23 | + <i class="fa fa-info" style="float:right;" title="本表计算能耗加注量时,油车统计油量,电车统计电量; 25年3月底更新后电量保留三位小数。"></i> | ||
| 23 | </div> | 24 | </div> |
| 24 | </div> | 25 | </div> |
| 25 | 26 |
src/main/resources/static/pages/report/countMileage/countBus/company/countBusMileage.html
| @@ -27,8 +27,9 @@ | @@ -27,8 +27,9 @@ | ||
| 27 | </style> | 27 | </style> |
| 28 | 28 | ||
| 29 | <div class="page-head"> | 29 | <div class="page-head"> |
| 30 | - <div class="page-title"> | ||
| 31 | - <h1>路单数据统计表</h1> | 30 | + <div class="page-title" style="width:99%;"> |
| 31 | + <h1 style="float:left;">路单数据统计表</h1> | ||
| 32 | + <i class="fa fa-info" style="float:right;" title="25年3月底更新后电量保留三位小数。"></i> | ||
| 32 | </div> | 33 | </div> |
| 33 | </div> | 34 | </div> |
| 34 | 35 | ||
| @@ -224,7 +225,7 @@ | @@ -224,7 +225,7 @@ | ||
| 224 | }else{ | 225 | }else{ |
| 225 | var params = {}; | 226 | var params = {}; |
| 226 | params['gsdm'] = gsdm; | 227 | params['gsdm'] = gsdm; |
| 227 | - params['fgsdm'] =fgsdm ; | 228 | + params['fgsdm'] =fgsdm; |
| 228 | params['line'] = line; | 229 | params['line'] = line; |
| 229 | params['date'] = date; | 230 | params['date'] = date; |
| 230 | params['date2'] = date2; | 231 | params['date2'] = date2; |
src/main/resources/static/pages/report/countMileage/countBus/countBusMileage.html
| @@ -27,8 +27,9 @@ | @@ -27,8 +27,9 @@ | ||
| 27 | </style> | 27 | </style> |
| 28 | 28 | ||
| 29 | <div class="page-head"> | 29 | <div class="page-head"> |
| 30 | - <div class="page-title"> | ||
| 31 | - <h1>路单数据统计表(审计)</h1> | 30 | + <div class="page-title" style="width:99%;"> |
| 31 | + <h1 style="float:left;">路单数据统计表(审计)</h1> | ||
| 32 | + <i class="fa fa-info" style="float:right;" title="25年3月底更新后电量保留三位小数。"></i> | ||
| 32 | </div> | 33 | </div> |
| 33 | </div> | 34 | </div> |
| 34 | 35 |
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch_maintain.html
| @@ -431,7 +431,7 @@ | @@ -431,7 +431,7 @@ | ||
| 431 | $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | 431 | $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); |
| 432 | 432 | ||
| 433 | 433 | ||
| 434 | - var reCountEp = EventProxy.create('ylbUpdate', 'calcWaybill', 'scheduleDetail', function () { | 434 | + var reCountEp = EventProxy.create('calcWaybill', 'scheduleDetail', function () { |
| 435 | $('i.uk-icon-spin', that).remove(); | 435 | $('i.uk-icon-spin', that).remove(); |
| 436 | $(that).removeAttr('disabled'); | 436 | $(that).removeAttr('disabled'); |
| 437 | notify_succ('重新统计成功!'); | 437 | notify_succ('重新统计成功!'); |