Commit f06e882a3a289a4be693054bfe3b0de94464d278
1 parent
8621c493
统计
Showing
10 changed files
with
2275 additions
and
0 deletions
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
0 → 100644
| 1 | +package com.bsth.controller.calc; | ||
| 2 | + | ||
| 3 | +import java.util.HashMap; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Map; | ||
| 6 | + | ||
| 7 | +import com.bsth.common.ResponseCode; | ||
| 8 | +import com.bsth.controller.BaseController; | ||
| 9 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 10 | +import com.bsth.service.calc.CalcWaybillService; | ||
| 11 | + | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 15 | +import org.springframework.web.bind.annotation.RestController; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * Created by 17/10/23. | ||
| 19 | + */ | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("calcWaybill") | ||
| 22 | +public class CalcWaybillController extends BaseController<CalcWaybill, Integer> { | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + private CalcWaybillService calcWaybillService; | ||
| 26 | + | ||
| 27 | + @RequestMapping(value="/generateNew") | ||
| 28 | + public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 29 | + String date = "", line = ""; | ||
| 30 | + if(map.get("date")!=null){ | ||
| 31 | + date=map.get("date").toString().trim(); | ||
| 32 | + } | ||
| 33 | + if(map.get("line")!=null){ | ||
| 34 | + line=map.get("line").toString().trim(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 38 | + try { | ||
| 39 | + | ||
| 40 | + m = calcWaybillService.generateNew(date, line); | ||
| 41 | + | ||
| 42 | + } catch (Exception e) { | ||
| 43 | + // TODO: handle exception | ||
| 44 | + e.printStackTrace(); | ||
| 45 | + m.put("status", ResponseCode.ERROR); | ||
| 46 | + return m; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + return m; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @RequestMapping(value="/statisticsDailyTj") | ||
| 53 | + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | ||
| 54 | + String gsdm=""; | ||
| 55 | + if(map.get("gsdm")!=null){ | ||
| 56 | + gsdm=map.get("gsdm").toString().trim(); | ||
| 57 | + } | ||
| 58 | + String fgsdm=""; | ||
| 59 | + if(map.get("fgsdm")!=null){ | ||
| 60 | + fgsdm=map.get("fgsdm").toString().trim(); | ||
| 61 | + } | ||
| 62 | + String line=""; | ||
| 63 | + if(map.get("line")!=null){ | ||
| 64 | + line=map.get("line").toString().trim(); | ||
| 65 | + } | ||
| 66 | + String date=""; | ||
| 67 | + if(map.get("date")!=null){ | ||
| 68 | + date=map.get("date").toString().trim(); | ||
| 69 | + } | ||
| 70 | + String date2=""; | ||
| 71 | + if(map.get("date2")!=null){ | ||
| 72 | + date2=map.get("date2").toString().trim(); | ||
| 73 | + } | ||
| 74 | + String xlName=""; | ||
| 75 | + if(map.get("xlName")!=null){ | ||
| 76 | + xlName=map.get("xlName").toString().trim(); | ||
| 77 | + } | ||
| 78 | + String type=""; | ||
| 79 | + if(map.get("type")!=null){ | ||
| 80 | + type=map.get("type").toString().trim(); | ||
| 81 | + } | ||
| 82 | + return calcWaybillService.statisticsDailyTj(gsdm,fgsdm,line,date,date2,xlName,type); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | +} |
src/main/java/com/bsth/entity/calc/CalcWaybill.java
0 → 100644
| 1 | +package com.bsth.entity.calc; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | + | ||
| 10 | +@Entity | ||
| 11 | +@Table(name = "calc_waybill") | ||
| 12 | +public class CalcWaybill { | ||
| 13 | + /* 主键*/ | ||
| 14 | + @Id | ||
| 15 | + @GeneratedValue | ||
| 16 | + private Long id; | ||
| 17 | + /* 公司代码*/ | ||
| 18 | + private String gsdm; | ||
| 19 | + /* 公司名称*/ | ||
| 20 | + private String gsname; | ||
| 21 | + /* 分公司代码*/ | ||
| 22 | + private String fgsdm; | ||
| 23 | + /* 分公司名称*/ | ||
| 24 | + private String fgsname; | ||
| 25 | + /* 日期*/ | ||
| 26 | + private Date rq; | ||
| 27 | + /* 日期字符串*/ | ||
| 28 | + private String rqStr; | ||
| 29 | + /* 线路编码*/ | ||
| 30 | + private String xl; | ||
| 31 | + /* 线路名称*/ | ||
| 32 | + private String xlName; | ||
| 33 | + /* 车辆自编号*/ | ||
| 34 | + private String cl; | ||
| 35 | + /* 路牌名字*/ | ||
| 36 | + private String lp; | ||
| 37 | + /* 驾驶员工号*/ | ||
| 38 | + private String jGh; | ||
| 39 | + /* 驾驶员名字*/ | ||
| 40 | + private String jName; | ||
| 41 | + /* 售票员工号*/ | ||
| 42 | + private String sGh; | ||
| 43 | + /* 售票员名字*/ | ||
| 44 | + private String sName; | ||
| 45 | + /* 计划营运班次*/ | ||
| 46 | + private int jhyybc; | ||
| 47 | + /* 计划早高峰营运班次*/ | ||
| 48 | + private int jhyybczgf; | ||
| 49 | + /* 计划晚高峰营运班次*/ | ||
| 50 | + private int jhyybcwgf; | ||
| 51 | + /* 计划非营运班次*/ | ||
| 52 | + private int jhfyybc; | ||
| 53 | + /* 计划营运里程*/ | ||
| 54 | + private Double jhyylc; | ||
| 55 | + /* 计划非营运里程*/ | ||
| 56 | + private Double jhfyylc; | ||
| 57 | + /* 实际营运班次*/ | ||
| 58 | + private int sjyybc; | ||
| 59 | + /* 实际早高峰营运班次*/ | ||
| 60 | + private int sjyybczgf; | ||
| 61 | + /* 实际晚高峰营运班次*/ | ||
| 62 | + private int sjyybcwgf; | ||
| 63 | + /* 实际非营运班次*/ | ||
| 64 | + private int sjfyybc; | ||
| 65 | + /* 实际营运里程*/ | ||
| 66 | + private Double sjyylc; | ||
| 67 | + /* 实际非营运里程*/ | ||
| 68 | + private Double sjfyylc; | ||
| 69 | + /* 临加班次*/ | ||
| 70 | + private int ljbc; | ||
| 71 | + /* 临加早高峰班次*/ | ||
| 72 | + private int ljbczgf; | ||
| 73 | + /* 临加晚高峰班次*/ | ||
| 74 | + private int ljbcwgf; | ||
| 75 | + /* 临加营运里程*/ | ||
| 76 | + private Double ljyylc; | ||
| 77 | + /* 临加非营运里程*/ | ||
| 78 | + private Double ljfyylc; | ||
| 79 | + /* 烂班班次*/ | ||
| 80 | + private int lbbc; | ||
| 81 | + /* 烂班里程*/ | ||
| 82 | + private Double lblc; | ||
| 83 | + /* 路阻*/ | ||
| 84 | + private Double lblcLz; | ||
| 85 | + /* 吊慢*/ | ||
| 86 | + private Double lblcDm; | ||
| 87 | + /* 故障*/ | ||
| 88 | + private Double lblcGz; | ||
| 89 | + /* 纠纷*/ | ||
| 90 | + private Double lblcJf; | ||
| 91 | + /* 肇事*/ | ||
| 92 | + private Double lblcZs; | ||
| 93 | + /* 缺人*/ | ||
| 94 | + private Double lblcQr; | ||
| 95 | + /* 缺车*/ | ||
| 96 | + private Double lblcQc; | ||
| 97 | + /* 客稀*/ | ||
| 98 | + private Double lblcKx; | ||
| 99 | + /* 气候*/ | ||
| 100 | + private Double lblcQh; | ||
| 101 | + /* 援外*/ | ||
| 102 | + private Double lblcYw; | ||
| 103 | + /* 其他*/ | ||
| 104 | + private Double lblcQt; | ||
| 105 | + /* 放站班次*/ | ||
| 106 | + private int fzbc; | ||
| 107 | + /* 放站早高峰班次*/ | ||
| 108 | + private int fzbczgf; | ||
| 109 | + /* 放站晚高峰班次*/ | ||
| 110 | + private int fzbcwgf; | ||
| 111 | + /* 掉头班次*/ | ||
| 112 | + private int dtbc; | ||
| 113 | + /* 掉头早高峰班次*/ | ||
| 114 | + private int dtbczgf; | ||
| 115 | + /* 掉头晚高峰班次*/ | ||
| 116 | + private int dtbcwgf; | ||
| 117 | + /* 创建时间*/ | ||
| 118 | + private Date createTime; | ||
| 119 | + /* 修改时间*/ | ||
| 120 | + private Date updateTime; | ||
| 121 | + public Long getId() { | ||
| 122 | + return id; | ||
| 123 | + } | ||
| 124 | + public void setId(Long id) { | ||
| 125 | + this.id = id; | ||
| 126 | + } | ||
| 127 | + public String getGsdm() { | ||
| 128 | + return gsdm; | ||
| 129 | + } | ||
| 130 | + public void setGsdm(String gsdm) { | ||
| 131 | + this.gsdm = gsdm; | ||
| 132 | + } | ||
| 133 | + public String getGsname() { | ||
| 134 | + return gsname; | ||
| 135 | + } | ||
| 136 | + public void setGsname(String gsname) { | ||
| 137 | + this.gsname = gsname; | ||
| 138 | + } | ||
| 139 | + public String getFgsdm() { | ||
| 140 | + return fgsdm; | ||
| 141 | + } | ||
| 142 | + public void setFgsdm(String fgsdm) { | ||
| 143 | + this.fgsdm = fgsdm; | ||
| 144 | + } | ||
| 145 | + public String getFgsname() { | ||
| 146 | + return fgsname; | ||
| 147 | + } | ||
| 148 | + public void setFgsname(String fgsname) { | ||
| 149 | + this.fgsname = fgsname; | ||
| 150 | + } | ||
| 151 | + public Date getRq() { | ||
| 152 | + return rq; | ||
| 153 | + } | ||
| 154 | + public void setRq(Date rq) { | ||
| 155 | + this.rq = rq; | ||
| 156 | + } | ||
| 157 | + public String getRqStr() { | ||
| 158 | + return rqStr; | ||
| 159 | + } | ||
| 160 | + public void setRqStr(String rqStr) { | ||
| 161 | + this.rqStr = rqStr; | ||
| 162 | + } | ||
| 163 | + public String getXl() { | ||
| 164 | + return xl; | ||
| 165 | + } | ||
| 166 | + public void setXl(String xl) { | ||
| 167 | + this.xl = xl; | ||
| 168 | + } | ||
| 169 | + public String getXlName() { | ||
| 170 | + return xlName; | ||
| 171 | + } | ||
| 172 | + public void setXlName(String xlName) { | ||
| 173 | + this.xlName = xlName; | ||
| 174 | + } | ||
| 175 | + public String getCl() { | ||
| 176 | + return cl; | ||
| 177 | + } | ||
| 178 | + public void setCl(String cl) { | ||
| 179 | + this.cl = cl; | ||
| 180 | + } | ||
| 181 | + public String getLp() { | ||
| 182 | + return lp; | ||
| 183 | + } | ||
| 184 | + public void setLp(String lp) { | ||
| 185 | + this.lp = lp; | ||
| 186 | + } | ||
| 187 | + public String getjGh() { | ||
| 188 | + return jGh; | ||
| 189 | + } | ||
| 190 | + public void setjGh(String jGh) { | ||
| 191 | + this.jGh = jGh; | ||
| 192 | + } | ||
| 193 | + public String getjName() { | ||
| 194 | + return jName; | ||
| 195 | + } | ||
| 196 | + public void setjName(String jName) { | ||
| 197 | + this.jName = jName; | ||
| 198 | + } | ||
| 199 | + public String getsGh() { | ||
| 200 | + return sGh; | ||
| 201 | + } | ||
| 202 | + public void setsGh(String sGh) { | ||
| 203 | + this.sGh = sGh; | ||
| 204 | + } | ||
| 205 | + public String getsName() { | ||
| 206 | + return sName; | ||
| 207 | + } | ||
| 208 | + public void setsName(String sName) { | ||
| 209 | + this.sName = sName; | ||
| 210 | + } | ||
| 211 | + public int getJhyybc() { | ||
| 212 | + return jhyybc; | ||
| 213 | + } | ||
| 214 | + public void setJhyybc(int jhyybc) { | ||
| 215 | + this.jhyybc = jhyybc; | ||
| 216 | + } | ||
| 217 | + public int getJhyybczgf() { | ||
| 218 | + return jhyybczgf; | ||
| 219 | + } | ||
| 220 | + public void setJhyybczgf(int jhyybczgf) { | ||
| 221 | + this.jhyybczgf = jhyybczgf; | ||
| 222 | + } | ||
| 223 | + public int getJhyybcwgf() { | ||
| 224 | + return jhyybcwgf; | ||
| 225 | + } | ||
| 226 | + public void setJhyybcwgf(int jhyybcwgf) { | ||
| 227 | + this.jhyybcwgf = jhyybcwgf; | ||
| 228 | + } | ||
| 229 | + public int getJhfyybc() { | ||
| 230 | + return jhfyybc; | ||
| 231 | + } | ||
| 232 | + public void setJhfyybc(int jhfyybc) { | ||
| 233 | + this.jhfyybc = jhfyybc; | ||
| 234 | + } | ||
| 235 | + public Double getJhyylc() { | ||
| 236 | + return jhyylc; | ||
| 237 | + } | ||
| 238 | + public void setJhyylc(Double jhyylc) { | ||
| 239 | + this.jhyylc = jhyylc; | ||
| 240 | + } | ||
| 241 | + public Double getJhfyylc() { | ||
| 242 | + return jhfyylc; | ||
| 243 | + } | ||
| 244 | + public void setJhfyylc(Double jhfyylc) { | ||
| 245 | + this.jhfyylc = jhfyylc; | ||
| 246 | + } | ||
| 247 | + public int getSjyybc() { | ||
| 248 | + return sjyybc; | ||
| 249 | + } | ||
| 250 | + public void setSjyybc(int sjyybc) { | ||
| 251 | + this.sjyybc = sjyybc; | ||
| 252 | + } | ||
| 253 | + public int getSjyybczgf() { | ||
| 254 | + return sjyybczgf; | ||
| 255 | + } | ||
| 256 | + public void setSjyybczgf(int sjyybczgf) { | ||
| 257 | + this.sjyybczgf = sjyybczgf; | ||
| 258 | + } | ||
| 259 | + public int getSjyybcwgf() { | ||
| 260 | + return sjyybcwgf; | ||
| 261 | + } | ||
| 262 | + public void setSjyybcwgf(int sjyybcwgf) { | ||
| 263 | + this.sjyybcwgf = sjyybcwgf; | ||
| 264 | + } | ||
| 265 | + public int getSjfyybc() { | ||
| 266 | + return sjfyybc; | ||
| 267 | + } | ||
| 268 | + public void setSjfyybc(int sjfyybc) { | ||
| 269 | + this.sjfyybc = sjfyybc; | ||
| 270 | + } | ||
| 271 | + public Double getSjyylc() { | ||
| 272 | + return sjyylc; | ||
| 273 | + } | ||
| 274 | + public void setSjyylc(Double sjyylc) { | ||
| 275 | + this.sjyylc = sjyylc; | ||
| 276 | + } | ||
| 277 | + public Double getSjfyylc() { | ||
| 278 | + return sjfyylc; | ||
| 279 | + } | ||
| 280 | + public void setSjfyylc(Double sjfyylc) { | ||
| 281 | + this.sjfyylc = sjfyylc; | ||
| 282 | + } | ||
| 283 | + public int getLjbc() { | ||
| 284 | + return ljbc; | ||
| 285 | + } | ||
| 286 | + public void setLjbc(int ljbc) { | ||
| 287 | + this.ljbc = ljbc; | ||
| 288 | + } | ||
| 289 | + public int getLjbczgf() { | ||
| 290 | + return ljbczgf; | ||
| 291 | + } | ||
| 292 | + public void setLjbczgf(int ljbczgf) { | ||
| 293 | + this.ljbczgf = ljbczgf; | ||
| 294 | + } | ||
| 295 | + public int getLjbcwgf() { | ||
| 296 | + return ljbcwgf; | ||
| 297 | + } | ||
| 298 | + public void setLjbcwgf(int ljbcwgf) { | ||
| 299 | + this.ljbcwgf = ljbcwgf; | ||
| 300 | + } | ||
| 301 | + public Double getLjyylc() { | ||
| 302 | + return ljyylc; | ||
| 303 | + } | ||
| 304 | + public void setLjyylc(Double ljyylc) { | ||
| 305 | + this.ljyylc = ljyylc; | ||
| 306 | + } | ||
| 307 | + public Double getLjfyylc() { | ||
| 308 | + return ljfyylc; | ||
| 309 | + } | ||
| 310 | + public void setLjfyylc(Double ljfyylc) { | ||
| 311 | + this.ljfyylc = ljfyylc; | ||
| 312 | + } | ||
| 313 | + public int getLbbc() { | ||
| 314 | + return lbbc; | ||
| 315 | + } | ||
| 316 | + public void setLbbc(int lbbc) { | ||
| 317 | + this.lbbc = lbbc; | ||
| 318 | + } | ||
| 319 | + public Double getLblc() { | ||
| 320 | + return lblc; | ||
| 321 | + } | ||
| 322 | + public void setLblc(Double lblc) { | ||
| 323 | + this.lblc = lblc; | ||
| 324 | + } | ||
| 325 | + public Double getLblcLz() { | ||
| 326 | + return lblcLz; | ||
| 327 | + } | ||
| 328 | + public void setLblcLz(Double lblcLz) { | ||
| 329 | + this.lblcLz = lblcLz; | ||
| 330 | + } | ||
| 331 | + public Double getLblcDm() { | ||
| 332 | + return lblcDm; | ||
| 333 | + } | ||
| 334 | + public void setLblcDm(Double lblcDm) { | ||
| 335 | + this.lblcDm = lblcDm; | ||
| 336 | + } | ||
| 337 | + public Double getLblcGz() { | ||
| 338 | + return lblcGz; | ||
| 339 | + } | ||
| 340 | + public void setLblcGz(Double lblcGz) { | ||
| 341 | + this.lblcGz = lblcGz; | ||
| 342 | + } | ||
| 343 | + public Double getLblcJf() { | ||
| 344 | + return lblcJf; | ||
| 345 | + } | ||
| 346 | + public void setLblcJf(Double lblcJf) { | ||
| 347 | + this.lblcJf = lblcJf; | ||
| 348 | + } | ||
| 349 | + public Double getLblcZs() { | ||
| 350 | + return lblcZs; | ||
| 351 | + } | ||
| 352 | + public void setLblcZs(Double lblcZs) { | ||
| 353 | + this.lblcZs = lblcZs; | ||
| 354 | + } | ||
| 355 | + public Double getLblcQr() { | ||
| 356 | + return lblcQr; | ||
| 357 | + } | ||
| 358 | + public void setLblcQr(Double lblcQr) { | ||
| 359 | + this.lblcQr = lblcQr; | ||
| 360 | + } | ||
| 361 | + public Double getLblcQc() { | ||
| 362 | + return lblcQc; | ||
| 363 | + } | ||
| 364 | + public void setLblcQc(Double lblcQc) { | ||
| 365 | + this.lblcQc = lblcQc; | ||
| 366 | + } | ||
| 367 | + public Double getLblcKx() { | ||
| 368 | + return lblcKx; | ||
| 369 | + } | ||
| 370 | + public void setLblcKx(Double lblcKx) { | ||
| 371 | + this.lblcKx = lblcKx; | ||
| 372 | + } | ||
| 373 | + public Double getLblcQh() { | ||
| 374 | + return lblcQh; | ||
| 375 | + } | ||
| 376 | + public void setLblcQh(Double lblcQh) { | ||
| 377 | + this.lblcQh = lblcQh; | ||
| 378 | + } | ||
| 379 | + public Double getLblcYw() { | ||
| 380 | + return lblcYw; | ||
| 381 | + } | ||
| 382 | + public void setLblcYw(Double lblcYw) { | ||
| 383 | + this.lblcYw = lblcYw; | ||
| 384 | + } | ||
| 385 | + public Double getLblcQt() { | ||
| 386 | + return lblcQt; | ||
| 387 | + } | ||
| 388 | + public void setLblcQt(Double lblcQt) { | ||
| 389 | + this.lblcQt = lblcQt; | ||
| 390 | + } | ||
| 391 | + public int getFzbc() { | ||
| 392 | + return fzbc; | ||
| 393 | + } | ||
| 394 | + public void setFzbc(int fzbc) { | ||
| 395 | + this.fzbc = fzbc; | ||
| 396 | + } | ||
| 397 | + public int getFzbczgf() { | ||
| 398 | + return fzbczgf; | ||
| 399 | + } | ||
| 400 | + public void setFzbczgf(int fzbczgf) { | ||
| 401 | + this.fzbczgf = fzbczgf; | ||
| 402 | + } | ||
| 403 | + public int getFzbcwgf() { | ||
| 404 | + return fzbcwgf; | ||
| 405 | + } | ||
| 406 | + public void setFzbcwgf(int fzbcwgf) { | ||
| 407 | + this.fzbcwgf = fzbcwgf; | ||
| 408 | + } | ||
| 409 | + public int getDtbc() { | ||
| 410 | + return dtbc; | ||
| 411 | + } | ||
| 412 | + public void setDtbc(int dtbc) { | ||
| 413 | + this.dtbc = dtbc; | ||
| 414 | + } | ||
| 415 | + public int getDtbczgf() { | ||
| 416 | + return dtbczgf; | ||
| 417 | + } | ||
| 418 | + public void setDtbczgf(int dtbczgf) { | ||
| 419 | + this.dtbczgf = dtbczgf; | ||
| 420 | + } | ||
| 421 | + public int getDtbcwgf() { | ||
| 422 | + return dtbcwgf; | ||
| 423 | + } | ||
| 424 | + public void setDtbcwgf(int dtbcwgf) { | ||
| 425 | + this.dtbcwgf = dtbcwgf; | ||
| 426 | + } | ||
| 427 | + public Date getCreateTime() { | ||
| 428 | + return createTime; | ||
| 429 | + } | ||
| 430 | + public void setCreateTime(Date createTime) { | ||
| 431 | + this.createTime = createTime; | ||
| 432 | + } | ||
| 433 | + public Date getUpdateTime() { | ||
| 434 | + return updateTime; | ||
| 435 | + } | ||
| 436 | + public void setUpdateTime(Date updateTime) { | ||
| 437 | + this.updateTime = updateTime; | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + | ||
| 441 | + | ||
| 442 | +} |
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
0 → 100644
| 1 | +package com.bsth.repository.calc; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import javax.transaction.Transactional; | ||
| 6 | + | ||
| 7 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 8 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | +import com.bsth.repository.BaseRepository; | ||
| 10 | + | ||
| 11 | +import org.springframework.data.jpa.repository.EntityGraph; | ||
| 12 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 13 | +import org.springframework.data.jpa.repository.Query; | ||
| 14 | +import org.springframework.stereotype.Repository; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * | ||
| 18 | + */ | ||
| 19 | +@Repository | ||
| 20 | +public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integer>{ | ||
| 21 | + | ||
| 22 | + //按照时间段统计,公司下线路 | ||
| 23 | + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl") | ||
| 24 | + List<CalcWaybill> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); | ||
| 25 | + | ||
| 26 | + //按照时间段统计,单条线路 | ||
| 27 | + @Query(value="select DISTINCT c from CalcWaybill c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl") | ||
| 28 | + List<CalcWaybill> scheduleByDateAndLineTj2(String line,String date,String date2); | ||
| 29 | + | ||
| 30 | + //按照日期和线路删除数据 | ||
| 31 | + @Modifying | ||
| 32 | + @Transactional | ||
| 33 | + @Query(value = "delete CalcWaybill c where c.rqStr=?1 and c.xl=?2") | ||
| 34 | + void deleteByDateAndLine(String date, String line); | ||
| 35 | + | ||
| 36 | + //按照日期删除数据 | ||
| 37 | + @Modifying | ||
| 38 | + @Transactional | ||
| 39 | + @Query(value = "delete CalcWaybill c where c.rqStr=?1") | ||
| 40 | + void deleteByDate(String date); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 根据日期和线路编码获取班次信息 | ||
| 44 | + * @param schDate | ||
| 45 | + * @param lineCode | ||
| 46 | + * @return | ||
| 47 | + */ | ||
| 48 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ||
| 49 | + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.xlBm=?2") | ||
| 50 | + List<ScheduleRealInfo> findAllSchedule(String schDate, String lineCode); | ||
| 51 | + | ||
| 52 | +} |
src/main/java/com/bsth/service/calc/CalcCulateMileageService.java
0 → 100644
| 1 | +package com.bsth.service.calc; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +public interface CalcCulateMileageService { | ||
| 9 | + | ||
| 10 | + int culateJhyybc(List<ScheduleRealInfo> lists,String item);//计划营运班次 | ||
| 11 | + double culateJhyylc(List<ScheduleRealInfo> lists);//计划营运里程 | ||
| 12 | + int culateJhfyybc(List<ScheduleRealInfo> lists);//计划非营运班次 | ||
| 13 | + double culateJhfyylc(List<ScheduleRealInfo> lists);//计划非营运里程 | ||
| 14 | + int culateSjyybc(List<ScheduleRealInfo> lists,String item);//实际班次 | ||
| 15 | + double culateSjyylc(List<ScheduleRealInfo> lists);//实际营运里程(驾售) | ||
| 16 | + double culateSjyylc_j(List<ScheduleRealInfo> lists);//实际营运里程(驾) | ||
| 17 | + double culateSjfyylc(List<ScheduleRealInfo> lists);//实际非营运里程(驾售) | ||
| 18 | + double culateSjfyylc_j(List<ScheduleRealInfo> lists);//实际非营运里程(驾售) | ||
| 19 | + int culateLjbc(List<ScheduleRealInfo> lists,String item);//临加营运班次 | ||
| 20 | + double culateLjyylc(List<ScheduleRealInfo> lists);//临加营运里程(驾售) | ||
| 21 | + double culateLjyylc_j(List<ScheduleRealInfo> lists);//临加营运里程(驾) | ||
| 22 | + double culateLjfyylc(List<ScheduleRealInfo> lists);//临加非营运里程(驾售) | ||
| 23 | + double culateLjfyylc_j(List<ScheduleRealInfo> lists);//临加非营运里程(驾) | ||
| 24 | + int culateLbbc(List<ScheduleRealInfo> lists);//烂班班次 | ||
| 25 | + double culateLbgl(List<ScheduleRealInfo> lists);//烂班公里 | ||
| 26 | + double culateCJLC(List<ScheduleRealInfo> lists,String item);//烂班公里详细 | ||
| 27 | + int culateDtfzbc(List<ScheduleRealInfo> lists,String type,String item);//掉头放站班次 | ||
| 28 | + | ||
| 29 | +} | ||
| 30 | + |
src/main/java/com/bsth/service/calc/CalcToolService.java
0 → 100644
src/main/java/com/bsth/service/calc/CalcWaybillService.java
0 → 100644
| 1 | +package com.bsth.service.calc; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 7 | +import com.bsth.service.BaseService; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Created by 17/11/16. | ||
| 11 | + */ | ||
| 12 | +public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> { | ||
| 13 | + | ||
| 14 | + Map<String, Object> generateNew(String date, String line) throws Exception; | ||
| 15 | + | ||
| 16 | + List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); | ||
| 17 | + | ||
| 18 | +} |
src/main/java/com/bsth/service/calc/impl/CalcCulateMileageServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.calc.impl; | ||
| 2 | + | ||
| 3 | +import java.util.Iterator; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Set; | ||
| 6 | + | ||
| 7 | +import org.apache.commons.lang.StringUtils; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 13 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 14 | +import com.bsth.service.calc.CalcCulateMileageService; | ||
| 15 | +import com.bsth.util.Arith; | ||
| 16 | + | ||
| 17 | +@Service | ||
| 18 | +public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | ||
| 19 | + @Autowired | ||
| 20 | + JdbcTemplate jdbcTemplate; | ||
| 21 | + private static long zgf1 = 6 * 60 + 31, | ||
| 22 | + zgf2 = 8 * 60 + 30, | ||
| 23 | + wgf1 = 16 * 60 + 1, | ||
| 24 | + wgf2 = 18 * 60; | ||
| 25 | + public static boolean isInOut(ScheduleRealInfo s){ | ||
| 26 | + boolean fage=false; | ||
| 27 | + if(s.getBcType().equals("in")){ | ||
| 28 | + fage=true; | ||
| 29 | + } | ||
| 30 | + if(s.getBcType().equals("out")){ | ||
| 31 | + fage=true; | ||
| 32 | + } | ||
| 33 | + if(s.getBcType().equals("ldks")){ | ||
| 34 | + fage=true; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + return fage; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public int culateJhyybc(List<ScheduleRealInfo> lists,String item) { | ||
| 42 | + //计划班次 | ||
| 43 | + int jhbc=0; | ||
| 44 | + for (int i = 0; i < lists.size(); i++) { | ||
| 45 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 46 | + if (!isInOut(scheduleRealInfo)) { | ||
| 47 | + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){ | ||
| 48 | + String[] fcsjStr = scheduleRealInfo.getFcsj().split(":"); | ||
| 49 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 50 | + if(item.equals("zgf")){ | ||
| 51 | + if(fcsj>=zgf1 && fcsj<=zgf2) | ||
| 52 | + jhbc++; | ||
| 53 | + }else if(item.equals("wgf")){ | ||
| 54 | + if(fcsj>=wgf1 && fcsj<=wgf2) | ||
| 55 | + jhbc++; | ||
| 56 | + }else{ | ||
| 57 | + jhbc++; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + return jhbc; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public double culateJhyylc(List<ScheduleRealInfo> lists) { | ||
| 68 | + //计划营运里程 | ||
| 69 | + double jhgl=0; | ||
| 70 | + for (int i = 0; i < lists.size(); i++) { | ||
| 71 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 72 | + if (!isInOut(scheduleRealInfo)) { | ||
| 73 | + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){ | ||
| 74 | + jhgl=Arith.add(jhgl,scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig()); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + return jhgl; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public int culateJhfyybc(List<ScheduleRealInfo> lists) { | ||
| 83 | + // 计划非营运里程 | ||
| 84 | + int fyybc =0; | ||
| 85 | + for (int i = 0; i < lists.size(); i++) { | ||
| 86 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 87 | + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){ | ||
| 88 | + if (scheduleRealInfo.getBcType().equals("in") | ||
| 89 | + || scheduleRealInfo.getBcType().equals("out")|| scheduleRealInfo.getBcType().equals("ldks")) { | ||
| 90 | + if(!scheduleRealInfo.isSflj()){ | ||
| 91 | + fyybc++; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + return fyybc; | ||
| 97 | + } | ||
| 98 | + @Override | ||
| 99 | + public double culateJhfyylc(List<ScheduleRealInfo> lists) { | ||
| 100 | + // 计划非营运里程 | ||
| 101 | + double fyylc =0; | ||
| 102 | + for (int i = 0; i < lists.size(); i++) { | ||
| 103 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 104 | + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){ | ||
| 105 | + if (scheduleRealInfo.getBcType().equals("in") | ||
| 106 | + || scheduleRealInfo.getBcType().equals("out")|| scheduleRealInfo.getBcType().equals("ldks")) { | ||
| 107 | + if(!scheduleRealInfo.isSflj()){ | ||
| 108 | + fyylc =Arith.add(fyylc, scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig()); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + return fyylc; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + @Override | ||
| 117 | + public int culateSjyybc(List<ScheduleRealInfo> lists,String item) { | ||
| 118 | + // 实际班次 | ||
| 119 | + int sjbc=0; | ||
| 120 | + for (int i = 0; i < lists.size(); i++) { | ||
| 121 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 122 | + if (!isInOut(scheduleRealInfo)) { | ||
| 123 | + if(!scheduleRealInfo.isSflj() && !scheduleRealInfo.isCcService()){ | ||
| 124 | + String time=""; | ||
| 125 | + if(item.equals("zgf") || item.equals("wgf")){ | ||
| 126 | + if(scheduleRealInfo.getFcsjActual()!=null){ | ||
| 127 | + time=scheduleRealInfo.getFcsjActual(); | ||
| 128 | + } | ||
| 129 | + if(time.equals("")){ | ||
| 130 | + if(scheduleRealInfo.getDfsj()!=null){ | ||
| 131 | + time=scheduleRealInfo.getDfsj(); | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + }else{ | ||
| 135 | + time=scheduleRealInfo.getFcsj(); | ||
| 136 | + } | ||
| 137 | + if(!time.equals("")){ | ||
| 138 | + String[] fcsjStr = time.split(":"); | ||
| 139 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 140 | + if(scheduleRealInfo.getStatus()!=-1){ | ||
| 141 | + if(item.equals("zgf")){ | ||
| 142 | + if(fcsj>=zgf1 && fcsj<=zgf2){ | ||
| 143 | + sjbc++; | ||
| 144 | + } | ||
| 145 | + }else if(item.equals("wgf")){ | ||
| 146 | + if(fcsj>=wgf1 && fcsj<=wgf2){ | ||
| 147 | + sjbc++; | ||
| 148 | + } | ||
| 149 | + }else{ | ||
| 150 | + sjbc++; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + return sjbc; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + @Override | ||
| 162 | + public double culateSjyylc(List<ScheduleRealInfo> lists) { | ||
| 163 | + // 实际营运里程 | ||
| 164 | + double sjgl =0; | ||
| 165 | + for (int i = 0; i < lists.size(); i++) { | ||
| 166 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 167 | + if (!isInOut(scheduleRealInfo)) { | ||
| 168 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 169 | + if(!scheduleRealInfo.isSflj()){ | ||
| 170 | + if(childTaskPlans.isEmpty()){ | ||
| 171 | + if(!scheduleRealInfo.isDestroy()){ | ||
| 172 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | ||
| 173 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 174 | + if(jhlc-jhlcOrig>0){ | ||
| 175 | + sjgl=Arith.add(sjgl,jhlcOrig); | ||
| 176 | + }else{ | ||
| 177 | + sjgl=Arith.add(sjgl,jhlc); | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + }else{ | ||
| 181 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 182 | + while (it.hasNext()) { | ||
| 183 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 184 | + if(childTaskPlan.getMileageType().equals("service") | ||
| 185 | + &&"正常".equals(childTaskPlan.getType1()) | ||
| 186 | + && childTaskPlan.getCcId()==null | ||
| 187 | + && (!childTaskPlan.isNoClerk())){ | ||
| 188 | + if (!childTaskPlan.isDestroy()) { | ||
| 189 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 190 | + sjgl=Arith.add(sjgl,jhgl); | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + return sjgl; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + @Override | ||
| 202 | + public double culateSjyylc_j(List<ScheduleRealInfo> lists) { | ||
| 203 | + // 实际营运里程 | ||
| 204 | + double sjgl =0; | ||
| 205 | + for (int i = 0; i < lists.size(); i++) { | ||
| 206 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 207 | + if (!isInOut(scheduleRealInfo)) { | ||
| 208 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 209 | + if(!scheduleRealInfo.isSflj()){ | ||
| 210 | + if(!childTaskPlans.isEmpty()){ | ||
| 211 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 212 | + while (it.hasNext()) { | ||
| 213 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 214 | + if(childTaskPlan.getMileageType().equals("service") | ||
| 215 | + &&"正常".equals(childTaskPlan.getType1()) | ||
| 216 | + && childTaskPlan.getCcId()==null | ||
| 217 | + && childTaskPlan.isNoClerk()){ | ||
| 218 | + if (!childTaskPlan.isDestroy()) { | ||
| 219 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 220 | + sjgl=Arith.add(sjgl,jhgl); | ||
| 221 | + } | ||
| 222 | + } | ||
| 223 | + } | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + return sjgl; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + @Override | ||
| 232 | + public double culateSjfyylc(List<ScheduleRealInfo> lists) { | ||
| 233 | + // 实际非营运里程(驾售) | ||
| 234 | + double sjgl =0; | ||
| 235 | + for (int i = 0; i < lists.size(); i++) { | ||
| 236 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 237 | +// if(!scheduleRealInfo.isSflj()){ | ||
| 238 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 239 | + if(childTaskPlans.isEmpty()){ | ||
| 240 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 241 | + ||scheduleRealInfo.getBcType().equals("ldks")) { | ||
| 242 | + if(!scheduleRealInfo.isDestroy()){ | ||
| 243 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | ||
| 244 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 245 | +// if(jhlc-jhlcOrig>0){ | ||
| 246 | +// sjgl=Arith.add(sjgl,jhlcOrig); | ||
| 247 | +// }else{ | ||
| 248 | + sjgl=Arith.add(sjgl,jhlc); | ||
| 249 | +// } | ||
| 250 | + } | ||
| 251 | + } | ||
| 252 | + }else{ | ||
| 253 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 254 | + while (it.hasNext()) { | ||
| 255 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 256 | + if(childTaskPlan.getMileageType().equals("empty") | ||
| 257 | +// &&"正常".equals(childTaskPlan.getType1()) | ||
| 258 | + && (!childTaskPlan.isNoClerk()) | ||
| 259 | + && childTaskPlan.getCcId()==null){ | ||
| 260 | + if (!childTaskPlan.isDestroy()) { | ||
| 261 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 262 | + sjgl=Arith.add(sjgl,jhgl); | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + } | ||
| 266 | + } | ||
| 267 | +// } | ||
| 268 | + } | ||
| 269 | + return sjgl; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + @Override | ||
| 273 | + public double culateSjfyylc_j(List<ScheduleRealInfo> lists) { | ||
| 274 | + // 实际非营运里程(驾) | ||
| 275 | + double sjgl =0; | ||
| 276 | + for (int i = 0; i < lists.size(); i++) { | ||
| 277 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 278 | + if(!scheduleRealInfo.isSflj()){ | ||
| 279 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 280 | + if(!childTaskPlans.isEmpty()){ | ||
| 281 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 282 | + while (it.hasNext()) { | ||
| 283 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 284 | + if(childTaskPlan.getMileageType().equals("empty") | ||
| 285 | + &&"正常".equals(childTaskPlan.getType1()) | ||
| 286 | + && childTaskPlan.getCcId()==null | ||
| 287 | + && childTaskPlan.isNoClerk()){ | ||
| 288 | + if (!childTaskPlan.isDestroy()) { | ||
| 289 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 290 | + sjgl=Arith.add(sjgl,jhgl); | ||
| 291 | + } | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + } | ||
| 297 | + return sjgl; | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + @Override | ||
| 301 | + public int culateLjbc(List<ScheduleRealInfo> lists,String item) { | ||
| 302 | + // 临加班次 | ||
| 303 | + int ljbc=0; | ||
| 304 | + for (int i = 0; i < lists.size(); i++) { | ||
| 305 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 306 | + if (!isInOut(scheduleRealInfo)) { | ||
| 307 | + if(scheduleRealInfo.isSflj()){ | ||
| 308 | + if(item.equals("zgf") || item.equals("wgf")){ | ||
| 309 | + String time=""; | ||
| 310 | + if(scheduleRealInfo.getFcsjActual()!=null) | ||
| 311 | + time=scheduleRealInfo.getFcsjActual(); | ||
| 312 | + if(time.equals("")){ | ||
| 313 | + if(scheduleRealInfo.getDfsj()!=null) | ||
| 314 | + time=scheduleRealInfo.getDfsj(); | ||
| 315 | + } | ||
| 316 | + if(!time.equals("")){ | ||
| 317 | + String[] fcsjStr = time.split(":"); | ||
| 318 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 319 | + if(item.equals("zgf")){ | ||
| 320 | + if(fcsj>=zgf1 && fcsj<=zgf2) | ||
| 321 | + ljbc++; | ||
| 322 | + }else if(item.equals("wgf")){ | ||
| 323 | + if(fcsj>=wgf1 && fcsj<=wgf2) | ||
| 324 | + ljbc++; | ||
| 325 | + } | ||
| 326 | + } | ||
| 327 | + }else{ | ||
| 328 | + ljbc++; | ||
| 329 | + } | ||
| 330 | + } | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | + return ljbc; | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + | ||
| 337 | + @Override | ||
| 338 | + public double culateLjyylc(List<ScheduleRealInfo> lists) { | ||
| 339 | + // 临加营运里程(驾售) | ||
| 340 | + double ljgl =0; | ||
| 341 | + for (int i = 0; i < lists.size(); i++) { | ||
| 342 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 343 | + if (!isInOut(scheduleRealInfo)) { | ||
| 344 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 345 | + if(scheduleRealInfo.isSflj()){ | ||
| 346 | + if(childTaskPlans.isEmpty()){ | ||
| 347 | + if(!scheduleRealInfo.isDestroy()) | ||
| 348 | + ljgl=Arith.add(ljgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | ||
| 349 | + }else{ | ||
| 350 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 351 | + while (it.hasNext()) { | ||
| 352 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 353 | + if(childTaskPlan.getMileageType().equals("service") | ||
| 354 | + && childTaskPlan.getCcId() == null | ||
| 355 | + && (!childTaskPlan.isNoClerk())){ | ||
| 356 | + if (!childTaskPlan.isDestroy()) { | ||
| 357 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 358 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 359 | + } | ||
| 360 | + } | ||
| 361 | + } | ||
| 362 | + } | ||
| 363 | + }else{ | ||
| 364 | + if(childTaskPlans.isEmpty()){ | ||
| 365 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 366 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | ||
| 367 | + double zjlc=Arith.sub(jhlc, jhlcOrig); | ||
| 368 | + if(zjlc>0){ | ||
| 369 | + ljgl=Arith.add(zjlc, ljgl); | ||
| 370 | + } | ||
| 371 | + }else{ | ||
| 372 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 373 | + while (it.hasNext()) { | ||
| 374 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 375 | + if("service".equals(childTaskPlan.getMileageType()) | ||
| 376 | + &&"临加".equals(childTaskPlan.getType1()) | ||
| 377 | + && childTaskPlan.getCcId() == null | ||
| 378 | + && (!childTaskPlan.isNoClerk())){ | ||
| 379 | + if (!childTaskPlan.isDestroy()) { | ||
| 380 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 381 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 382 | + } | ||
| 383 | + } | ||
| 384 | + } | ||
| 385 | + } | ||
| 386 | + } | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + return ljgl; | ||
| 390 | + } | ||
| 391 | + | ||
| 392 | + @Override | ||
| 393 | + public double culateLjyylc_j(List<ScheduleRealInfo> lists) { | ||
| 394 | + // 临加营运里程(驾) | ||
| 395 | + double ljgl =0; | ||
| 396 | + for (int i = 0; i < lists.size(); i++) { | ||
| 397 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 398 | + if (!isInOut(scheduleRealInfo)) { | ||
| 399 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 400 | + if(scheduleRealInfo.isSflj()){ | ||
| 401 | + if(!childTaskPlans.isEmpty()){ | ||
| 402 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 403 | + while (it.hasNext()) { | ||
| 404 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 405 | + if(childTaskPlan.getMileageType().equals("service") | ||
| 406 | + && childTaskPlan.getCcId()==null | ||
| 407 | + && childTaskPlan.isNoClerk()){ | ||
| 408 | + if (!childTaskPlan.isDestroy()) { | ||
| 409 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 410 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 411 | + } | ||
| 412 | + } | ||
| 413 | + } | ||
| 414 | + } | ||
| 415 | + }else{ | ||
| 416 | + if(childTaskPlans.isEmpty()){ | ||
| 417 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 418 | + while (it.hasNext()) { | ||
| 419 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 420 | + if("service".equals(childTaskPlan.getMileageType()) | ||
| 421 | + &&"临加".equals(childTaskPlan.getType1()) | ||
| 422 | + && childTaskPlan.getCcId()==null | ||
| 423 | + && childTaskPlan.isNoClerk()){ | ||
| 424 | + if (!childTaskPlan.isDestroy()) { | ||
| 425 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 426 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | + } | ||
| 430 | + } | ||
| 431 | + } | ||
| 432 | + } | ||
| 433 | + } | ||
| 434 | + return ljgl; | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + @Override | ||
| 438 | + public double culateLjfyylc(List<ScheduleRealInfo> lists) { | ||
| 439 | + // 临加非营运里程(驾售) | ||
| 440 | + double ljgl =0; | ||
| 441 | + for (int i = 0; i < lists.size(); i++) { | ||
| 442 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 443 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 444 | + if (isInOut(scheduleRealInfo)) { | ||
| 445 | + if(scheduleRealInfo.isSflj()){ | ||
| 446 | + if(childTaskPlans.isEmpty()){ | ||
| 447 | + if(!scheduleRealInfo.isDestroy()) | ||
| 448 | + ljgl=Arith.add(ljgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | ||
| 449 | + }else{ | ||
| 450 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 451 | + while (it.hasNext()) { | ||
| 452 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 453 | + if(childTaskPlan.getMileageType().equals("empty") | ||
| 454 | + && childTaskPlan.getCcId() == null | ||
| 455 | + && (!childTaskPlan.isNoClerk())){ | ||
| 456 | + if (!childTaskPlan.isDestroy()) { | ||
| 457 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 458 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 459 | + } | ||
| 460 | + } | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + }else{ | ||
| 464 | + if(childTaskPlans.isEmpty()){ | ||
| 465 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 466 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | ||
| 467 | + double zjlc=Arith.sub(jhlc, jhlcOrig); | ||
| 468 | + if(zjlc>0){ | ||
| 469 | + ljgl=Arith.add(zjlc, ljgl); | ||
| 470 | + } | ||
| 471 | + }else{ | ||
| 472 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 473 | + while (it.hasNext()) { | ||
| 474 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 475 | + if("empty".equals(childTaskPlan.getMileageType()) | ||
| 476 | + &&"临加".equals(childTaskPlan.getType1()) | ||
| 477 | + && childTaskPlan.getCcId() == null | ||
| 478 | + && (!childTaskPlan.isNoClerk())){ | ||
| 479 | + if (!childTaskPlan.isDestroy()) { | ||
| 480 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 481 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 482 | + } | ||
| 483 | + } | ||
| 484 | + } | ||
| 485 | + } | ||
| 486 | + } | ||
| 487 | + }else{ | ||
| 488 | + if (!childTaskPlans.isEmpty()) { | ||
| 489 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 490 | + while (it.hasNext()) { | ||
| 491 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 492 | + if ("empty".equals(childTaskPlan.getMileageType()) | ||
| 493 | + && "临加".equals(childTaskPlan.getType1()) | ||
| 494 | + && childTaskPlan.getCcId() == null | ||
| 495 | + && (!childTaskPlan.isNoClerk())) { | ||
| 496 | + if (!childTaskPlan.isDestroy()) { | ||
| 497 | + Float jhgl = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | ||
| 498 | + ljgl = Arith.add(ljgl, jhgl); | ||
| 499 | + } | ||
| 500 | + } | ||
| 501 | + } | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + } | ||
| 505 | + return ljgl; | ||
| 506 | + } | ||
| 507 | + | ||
| 508 | + @Override | ||
| 509 | + public double culateLjfyylc_j(List<ScheduleRealInfo> lists) { | ||
| 510 | + // 临加非营运里程(驾) | ||
| 511 | + double ljgl =0; | ||
| 512 | + for (int i = 0; i < lists.size(); i++) { | ||
| 513 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 514 | + if (!isInOut(scheduleRealInfo)) { | ||
| 515 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 516 | + if(scheduleRealInfo.isSflj()){ | ||
| 517 | + if(!childTaskPlans.isEmpty()){ | ||
| 518 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 519 | + while (it.hasNext()) { | ||
| 520 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 521 | + if(childTaskPlan.getMileageType().equals("empty") | ||
| 522 | + && childTaskPlan.getCcId()==null | ||
| 523 | + && childTaskPlan.isNoClerk()){ | ||
| 524 | + if (!childTaskPlan.isDestroy()) { | ||
| 525 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 526 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 527 | + } | ||
| 528 | + } | ||
| 529 | + } | ||
| 530 | + } | ||
| 531 | + }else{ | ||
| 532 | + if(childTaskPlans.isEmpty()){ | ||
| 533 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 534 | + while (it.hasNext()) { | ||
| 535 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 536 | + if("empty".equals(childTaskPlan.getMileageType()) | ||
| 537 | + &&"临加".equals(childTaskPlan.getType1()) | ||
| 538 | + && childTaskPlan.getCcId()==null | ||
| 539 | + && childTaskPlan.isNoClerk()){ | ||
| 540 | + if (!childTaskPlan.isDestroy()) { | ||
| 541 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | ||
| 542 | + ljgl=Arith.add(ljgl,jhgl); | ||
| 543 | + } | ||
| 544 | + } | ||
| 545 | + } | ||
| 546 | + } | ||
| 547 | + } | ||
| 548 | + } | ||
| 549 | + } | ||
| 550 | + return ljgl; | ||
| 551 | + } | ||
| 552 | + | ||
| 553 | + @Override | ||
| 554 | + public int culateLbbc(List<ScheduleRealInfo> lists) { | ||
| 555 | + // 烂班班次 | ||
| 556 | + int lbbc=0; | ||
| 557 | + for (int i = 0; i < lists.size(); i++) { | ||
| 558 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 559 | + if (!isInOut(scheduleRealInfo) && !scheduleRealInfo.isCcService()) { | ||
| 560 | + if(scheduleRealInfo.getStatus() == -1){ | ||
| 561 | + lbbc++; | ||
| 562 | + } | ||
| 563 | + } | ||
| 564 | + } | ||
| 565 | + return lbbc; | ||
| 566 | + } | ||
| 567 | + | ||
| 568 | + @Override | ||
| 569 | + public double culateLbgl(List<ScheduleRealInfo> lists) { | ||
| 570 | + // TODO Auto-generated method stub | ||
| 571 | + double zlblc =0.0; | ||
| 572 | + for (int i = 0; i < lists.size(); i++) { | ||
| 573 | + ScheduleRealInfo scheduleRealInfo=lists.get(i); | ||
| 574 | + if (!isInOut(scheduleRealInfo)) { | ||
| 575 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 576 | + if(childTaskPlans.isEmpty()){ | ||
| 577 | + if(scheduleRealInfo.isDestroy()){ | ||
| 578 | + zlblc=Arith.add(zlblc,scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig()); | ||
| 579 | + }else{ | ||
| 580 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | ||
| 581 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | ||
| 582 | + double cjlc=Arith.sub(jhlcOrig,jhlc); | ||
| 583 | + if(cjlc>0){ | ||
| 584 | + zlblc=Arith.add(zlblc, cjlc); | ||
| 585 | + } | ||
| 586 | + } | ||
| 587 | + }else{ | ||
| 588 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 589 | + while (it.hasNext()) { | ||
| 590 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 591 | + if(childTaskPlan.getMileageType().equals("service") && childTaskPlan.getCcId() == null){ | ||
| 592 | + if (childTaskPlan.isDestroy()) { | ||
| 593 | + zlblc=Arith.add(zlblc,childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage()); | ||
| 594 | + } | ||
| 595 | + } | ||
| 596 | + } | ||
| 597 | + } | ||
| 598 | + } | ||
| 599 | + } | ||
| 600 | + return zlblc; | ||
| 601 | + } | ||
| 602 | + | ||
| 603 | + @Override | ||
| 604 | + public double culateCJLC(List<ScheduleRealInfo> list, String item) { | ||
| 605 | + // TODO Auto-generated method stub | ||
| 606 | + double sum = 0; | ||
| 607 | + Set<ChildTaskPlan> cts; | ||
| 608 | + for(ScheduleRealInfo sch : list){ | ||
| 609 | + if (sch.isSflj()) | ||
| 610 | + continue; | ||
| 611 | + cts = sch.getcTasks(); | ||
| 612 | + //有子任务 | ||
| 613 | + if (cts != null && cts.size() > 0) { | ||
| 614 | + for(ChildTaskPlan c : cts){ | ||
| 615 | + if(c.getCcId() == null){ | ||
| 616 | + if(item.equals("其他")){ | ||
| 617 | + if(c.isDestroy() && | ||
| 618 | + ((c.getDestroyReason()==null?"": c.getDestroyReason()).equals(item)|| | ||
| 619 | + (c.getDestroyReason()==null?"": c.getDestroyReason()).equals(""))) | ||
| 620 | + sum = Arith.add(sum, c.getMileage()); | ||
| 621 | + }else{ | ||
| 622 | + if(c.isDestroy() && (c.getDestroyReason()==null?"": c.getDestroyReason()).equals(item)) | ||
| 623 | + sum = Arith.add(sum, c.getMileage()); | ||
| 624 | + } | ||
| 625 | + } | ||
| 626 | + } | ||
| 627 | + } | ||
| 628 | + else if(isInOut(sch)) | ||
| 629 | + continue; | ||
| 630 | + //主任务烂班 | ||
| 631 | + else if(sch.getStatus() == -1){ | ||
| 632 | + if(sch.getAdjustExps().equals(item) || | ||
| 633 | + (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){ | ||
| 634 | + sum = Arith.add(sum, sch.getJhlcOrig()); | ||
| 635 | + } | ||
| 636 | + } | ||
| 637 | + else if(item.equals("其他")){ | ||
| 638 | + double diff = Arith.sub(sch.getJhlcOrig(), sch.getJhlc()); | ||
| 639 | + if(diff > 0){ | ||
| 640 | + sum = Arith.add(sum, diff); | ||
| 641 | + } | ||
| 642 | + } | ||
| 643 | + } | ||
| 644 | + return sum; | ||
| 645 | + } | ||
| 646 | + | ||
| 647 | + @Override | ||
| 648 | + public int culateDtfzbc(List<ScheduleRealInfo> lists,String type,String item){ | ||
| 649 | + int bc=0; | ||
| 650 | + for (int i = 0; i < lists.size(); i++) { | ||
| 651 | + ScheduleRealInfo s=lists.get(i); | ||
| 652 | + if (s.getBcType().equals(type)) { | ||
| 653 | + if (s.getFcsjActual() != null) { | ||
| 654 | + if (!s.isDestroy()) { | ||
| 655 | + String fcsjs = s.getFcsjActual(); | ||
| 656 | + String[] fcsjStr = fcsjs.split(":"); | ||
| 657 | + long fcsj = Long.parseLong(fcsjStr[0]) * 60 + Long.parseLong(fcsjStr[1]); | ||
| 658 | + if (item.equals("zgf")) { | ||
| 659 | + if (fcsj > zgf1 && fcsj < zgf2) | ||
| 660 | + bc++; | ||
| 661 | + } else if (item.equals("wgf")) { | ||
| 662 | + if (fcsj > wgf1 && fcsj < wgf2) | ||
| 663 | + bc++; | ||
| 664 | + } else { | ||
| 665 | + bc++; | ||
| 666 | + } | ||
| 667 | + } | ||
| 668 | + } | ||
| 669 | + } | ||
| 670 | + } | ||
| 671 | + return bc; | ||
| 672 | + } | ||
| 673 | +} |
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.calc.impl; | ||
| 2 | + | ||
| 3 | +import java.sql.ResultSet; | ||
| 4 | +import java.sql.SQLException; | ||
| 5 | +import java.util.ArrayList; | ||
| 6 | +import java.util.Date; | ||
| 7 | +import java.util.HashMap; | ||
| 8 | +import java.util.List; | ||
| 9 | +import java.util.Map; | ||
| 10 | +import java.util.Set; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 13 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 14 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 15 | +import com.bsth.repository.calc.CalcWaybillRepository; | ||
| 16 | +import com.bsth.service.calc.CalcToolService; | ||
| 17 | +import com.bsth.service.calc.CalcCulateMileageService; | ||
| 18 | +import com.bsth.service.report.CulateMileageService; | ||
| 19 | +import com.bsth.util.Arith; | ||
| 20 | + | ||
| 21 | +import org.slf4j.Logger; | ||
| 22 | +import org.slf4j.LoggerFactory; | ||
| 23 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 24 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 25 | +import org.springframework.jdbc.core.RowMapper; | ||
| 26 | +import org.springframework.stereotype.Service; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * Created by 17/11/16. | ||
| 30 | + */ | ||
| 31 | +@Service | ||
| 32 | +public class CalcToolServiceImpl implements CalcToolService { | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + private CalcWaybillRepository clacRepository; | ||
| 36 | + | ||
| 37 | + @Autowired | ||
| 38 | + private CalcCulateMileageService culateMileageService; | ||
| 39 | + | ||
| 40 | + @Autowired | ||
| 41 | + private CulateMileageService culateMileageService2; | ||
| 42 | + | ||
| 43 | + @Autowired | ||
| 44 | + JdbcTemplate jdbcTemplate; | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public List<CalcWaybill> findAll(String rq, String lineCode) { | ||
| 52 | + List<CalcWaybill> listCal=new ArrayList<CalcWaybill>(); | ||
| 53 | + List<ScheduleRealInfo> list = clacRepository.findAllSchedule(rq,lineCode); | ||
| 54 | + String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM" | ||
| 55 | + + " bsth_c_s_sp_info_real r where " | ||
| 56 | + + " r.schedule_date_str='"+rq+"' and r.xl_bm = '"+lineCode+"'" | ||
| 57 | + + " GROUP BY r.j_gh,r.s_gh,r.cl_zbh,r.xl_bm,r.lp_name "; | ||
| 58 | + | ||
| 59 | + List<Map<String, String>> listMap = jdbcTemplate.query(sql, new RowMapper<Map<String, String>>() { | ||
| 60 | + @Override | ||
| 61 | + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 62 | + Map<String, String> c = new HashMap<String,String>(); | ||
| 63 | + c.put("jGh", arg0.getString("j_gh")); | ||
| 64 | + c.put("sGh", arg0.getString("s_gh")==null?"":arg0.getString("s_gh")); | ||
| 65 | + c.put("clZbh", arg0.getString("cl_zbh")); | ||
| 66 | + c.put("xlBm", arg0.getString("xl_bm")); | ||
| 67 | + c.put("lpName", arg0.getString("lp_name")); | ||
| 68 | + return c; | ||
| 69 | + } | ||
| 70 | + }); | ||
| 71 | + for (int i = 0; i < listMap.size(); i++) { | ||
| 72 | + Map<String, String> m=listMap.get(i); | ||
| 73 | + String jGh=m.get("jGh"); | ||
| 74 | + String sGh=m.get("sGh"); | ||
| 75 | + String clZbh=m.get("clZbh"); | ||
| 76 | + String xlBm=m.get("xlBm"); | ||
| 77 | + String lpName=m.get("lpName"); | ||
| 78 | + //所有数据排班数据 | ||
| 79 | + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>(); | ||
| 80 | + //执行了的班次的排班数据 | ||
| 81 | + List<ScheduleRealInfo> lists_=new ArrayList<ScheduleRealInfo>(); | ||
| 82 | + for (int j = 0; j < list.size(); j++) { | ||
| 83 | + ScheduleRealInfo s=list.get(j); | ||
| 84 | + s.setCreateDate(new Date()); | ||
| 85 | + if(jGh.equals(s.getjGh()) | ||
| 86 | + && sGh.equals(s.getsGh()==null?"":s.getsGh()) | ||
| 87 | + && clZbh.equals(s.getClZbh()) | ||
| 88 | + && xlBm.equals(s.getXlBm()) | ||
| 89 | + && lpName.equals(s.getLpName())){ | ||
| 90 | + | ||
| 91 | + list_.add(s); | ||
| 92 | + | ||
| 93 | + Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 94 | + if(cts != null && cts.size() > 0){ | ||
| 95 | + lists_.add(s); | ||
| 96 | + }else{ | ||
| 97 | + if(s.getZdsjActual()!=null | ||
| 98 | + && s.getFcsjActual() !=null){ | ||
| 99 | + lists_.add(s); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + //计算方法 | ||
| 106 | + if(list_.size()>0){ | ||
| 107 | + listCal.addAll(this.cul(list_, lists_)); | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + while(true){ | ||
| 111 | + int i = 0, l = 0; | ||
| 112 | + boolean flag = false; | ||
| 113 | + for(; i < listCal.size(); i++){ | ||
| 114 | + CalcWaybill c1 = listCal.get(i); | ||
| 115 | + String key = c1.getRqStr() +"-"+ c1.getXl() +"-"+ c1.getCl() +"-"+ c1.getjGh() +"-"+ c1.getsGh() +"-"+ c1.getLp(); | ||
| 116 | + for(l = 0; l < listCal.size(); l++){ | ||
| 117 | + if(l != i){ | ||
| 118 | + CalcWaybill c2 = listCal.get(l); | ||
| 119 | + String key_ = c2.getRqStr() +"-"+ c2.getXl() +"-"+ c2.getCl() +"-"+ c2.getjGh() +"-"+ c2.getsGh() +"-"+ c2.getLp(); | ||
| 120 | + if(key_.equals(key)){ | ||
| 121 | + flag = true; | ||
| 122 | + break; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + if(flag){ | ||
| 127 | + break; | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + if(i != l){ | ||
| 131 | + CalcWaybill c1 = listCal.get(i); | ||
| 132 | + CalcWaybill c2 = listCal.get(l); | ||
| 133 | + | ||
| 134 | + c1.setSjyylc(c1.getSjyylc() + c2.getSjyylc()); | ||
| 135 | + c1.setSjfyylc(c1.getSjfyylc() + c2.getSjfyylc()); | ||
| 136 | + c1.setLjyylc(c1.getLjyylc() + c2.getLjyylc()); | ||
| 137 | + c1.setLjfyylc(c1.getLjfyylc() + c2.getLjfyylc()); | ||
| 138 | + | ||
| 139 | + listCal.remove(l); | ||
| 140 | + } else { | ||
| 141 | + break; | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + return listCal; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + //list_ 全部班次 lists_执行了的班次(实到实发不为空) | ||
| 148 | + private List<CalcWaybill> cul(List<ScheduleRealInfo> list_,List<ScheduleRealInfo> lists_){ | ||
| 149 | + List<CalcWaybill> list=new ArrayList<CalcWaybill>(); | ||
| 150 | + if(list_.size()>0){ | ||
| 151 | + Date date=list_.get(0).getScheduleDate(); | ||
| 152 | + String dateStr=list_.get(0).getScheduleDateStr(); | ||
| 153 | + String gsdm=list_.get(0).getGsBm(); | ||
| 154 | + String gsname=list_.get(0).getGsName(); | ||
| 155 | + String fgsdm=list_.get(0).getFgsBm(); | ||
| 156 | + String fgsname=list_.get(0).getFgsName(); | ||
| 157 | + String xlbm=list_.get(0).getXlBm(); | ||
| 158 | + String xlname=list_.get(0).getXlName(); | ||
| 159 | + String lp=list_.get(0).getLpName(); | ||
| 160 | + String jgh=list_.get(0).getjGh(); | ||
| 161 | + String jname=list_.get(0).getjName(); | ||
| 162 | + String sgh=list_.get(0).getsGh(); | ||
| 163 | + String sname=list_.get(0).getsName(); | ||
| 164 | + String clzbh=list_.get(0).getClZbh(); | ||
| 165 | + int jhyybc=culateMileageService.culateJhyybc(list_, ""); | ||
| 166 | + int jhyybcZgf=culateMileageService.culateJhyybc(list_, "zgf"); | ||
| 167 | + int jhyybcWgf=culateMileageService.culateJhyybc(list_, "wgf"); | ||
| 168 | + double jhyylc=culateMileageService.culateJhyylc(list_); | ||
| 169 | + double jhfyylc=culateMileageService.culateJhfyylc(list_); | ||
| 170 | + int sjyybc=culateMileageService.culateSjyybc(lists_, ""); | ||
| 171 | + int sjyybcZgf=culateMileageService.culateSjyybc(lists_, "zgf"); | ||
| 172 | + int sjyybcWgf=culateMileageService.culateSjyybc(lists_, "wgf"); | ||
| 173 | + double sjyylc=culateMileageService.culateSjyylc(lists_);//驾售共有 | ||
| 174 | + double sjyylc_j=culateMileageService.culateSjyylc_j(lists_);//无售 | ||
| 175 | + double sjfyylc=culateMileageService.culateSjfyylc(lists_);//驾售 | ||
| 176 | + double sjfyylc_j=culateMileageService.culateSjfyylc_j(lists_);//无售 | ||
| 177 | + int ljbc=culateMileageService.culateLjbc(lists_, ""); | ||
| 178 | + int ljbcZgf=culateMileageService.culateLjbc(lists_, "zgf"); | ||
| 179 | + int ljbcWgf=culateMileageService.culateLjbc(lists_, "wgf"); | ||
| 180 | + double ljyylc=culateMileageService.culateLjyylc(lists_);//驾售 | ||
| 181 | + double ljyylc_j=culateMileageService.culateLjyylc_j(lists_);//无售 | ||
| 182 | + double ljfyylc=culateMileageService.culateLjfyylc(lists_);//驾售 | ||
| 183 | + double ljfyylc_j=culateMileageService.culateLjfyylc_j(lists_);//无售 | ||
| 184 | + int lbbc=culateMileageService.culateLbbc(list_); | ||
| 185 | + double lblc=culateMileageService.culateLbgl(list_); | ||
| 186 | + double ssgl_lz= culateMileageService.culateCJLC(list_, "路阻"); | ||
| 187 | + double ssgl_dm= culateMileageService.culateCJLC(list_, "吊慢"); | ||
| 188 | + double ssgl_gz= culateMileageService.culateCJLC(list_, "故障"); | ||
| 189 | + double ssgl_jf= culateMileageService.culateCJLC(list_, "纠纷"); | ||
| 190 | + double ssgl_zs= culateMileageService.culateCJLC(list_, "肇事"); | ||
| 191 | + double ssgl_qr= culateMileageService.culateCJLC(list_, "缺人"); | ||
| 192 | + double ssgl_qc= culateMileageService.culateCJLC(list_, "缺车"); | ||
| 193 | + double ssgl_kx= culateMileageService.culateCJLC(list_, "客稀"); | ||
| 194 | + double ssgl_qh= culateMileageService.culateCJLC(list_, "气候"); | ||
| 195 | + double ssgl_yw= culateMileageService.culateCJLC(list_, "援外"); | ||
| 196 | + | ||
| 197 | + double ssgl_pc=culateMileageService.culateCJLC(list_, "配车"); | ||
| 198 | + double ssgl_by=culateMileageService.culateCJLC(list_, "保养"); | ||
| 199 | + double ssgl_cj=culateMileageService.culateCJLC(list_, "抽减"); | ||
| 200 | + double ssgl_qt=culateMileageService.culateCJLC(list_, "其他"); | ||
| 201 | + double ssgl_qtz=Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj,ssgl_qt)); | ||
| 202 | + int fzbc=culateMileageService.culateDtfzbc(lists_, "major", "");//放站 | ||
| 203 | + int fzbcZgf=culateMileageService.culateDtfzbc(lists_, "major", "zgf"); | ||
| 204 | + int fzbcWgf=culateMileageService.culateDtfzbc(lists_, "major", "wgf"); | ||
| 205 | + int zfbc=culateMileageService.culateDtfzbc(lists_, "venting", "");//直放 | ||
| 206 | + int zfbcZgf=culateMileageService.culateDtfzbc(lists_, "venting", "zgf"); | ||
| 207 | + int zfbcWgf=culateMileageService.culateDtfzbc(lists_, "venting", "wgf"); | ||
| 208 | + CalcWaybill t=new CalcWaybill(); | ||
| 209 | + t.setRq(date); | ||
| 210 | + t.setRqStr(dateStr); | ||
| 211 | + t.setGsdm(gsdm); | ||
| 212 | + t.setGsname(gsname); | ||
| 213 | + t.setFgsdm(fgsdm); | ||
| 214 | + t.setFgsname(fgsname); | ||
| 215 | + t.setXl(xlbm); | ||
| 216 | + t.setXlName(xlname); | ||
| 217 | + t.setLp(lp); | ||
| 218 | + t.setCl(clzbh); | ||
| 219 | + t.setjGh(jgh); | ||
| 220 | + t.setjName(jname); | ||
| 221 | + t.setsGh(sgh); | ||
| 222 | + t.setsName(sname); | ||
| 223 | + t.setJhyybc(jhyybc); | ||
| 224 | + t.setJhyybczgf(jhyybcZgf); | ||
| 225 | + t.setJhyybcwgf(jhyybcWgf); | ||
| 226 | + t.setJhyylc(jhyylc); | ||
| 227 | + t.setJhfyylc(jhfyylc); | ||
| 228 | + t.setSjyybc(sjyybc); | ||
| 229 | + t.setSjyybczgf(sjyybcZgf); | ||
| 230 | + t.setSjyybcwgf(sjyybcWgf); | ||
| 231 | + t.setSjyylc(sjyylc); | ||
| 232 | + t.setSjfyylc(sjfyylc); | ||
| 233 | + t.setLjbc(ljbc); | ||
| 234 | + t.setLjbczgf(ljbcZgf); | ||
| 235 | + t.setLjbcwgf(ljbcWgf); | ||
| 236 | + t.setLjyylc(ljyylc); | ||
| 237 | + t.setLjfyylc(ljfyylc); | ||
| 238 | + t.setLbbc(lbbc); | ||
| 239 | + t.setLblc(lblc); | ||
| 240 | + t.setLblcLz(ssgl_lz); | ||
| 241 | + t.setLblcDm(ssgl_dm); | ||
| 242 | + t.setLblcGz(ssgl_gz); | ||
| 243 | + t.setLblcJf(ssgl_jf); | ||
| 244 | + t.setLblcZs(ssgl_zs); | ||
| 245 | + t.setLblcQr(ssgl_qr); | ||
| 246 | + t.setLblcQc(ssgl_qc); | ||
| 247 | + t.setLblcKx(ssgl_kx); | ||
| 248 | + t.setLblcQh(ssgl_qh); | ||
| 249 | + t.setLblcYw(ssgl_yw); | ||
| 250 | + t.setLblcQt(ssgl_qtz); | ||
| 251 | + t.setFzbc(fzbc+zfbc); | ||
| 252 | + t.setFzbczgf(fzbcZgf+zfbcZgf); | ||
| 253 | + t.setFzbcwgf(fzbcWgf+zfbcWgf); | ||
| 254 | + t.setDtbc(0); | ||
| 255 | + t.setDtbczgf(0); | ||
| 256 | + t.setDtbcwgf(0); | ||
| 257 | + list.add(t); | ||
| 258 | + //驾驶员单独行驶里程 | ||
| 259 | + if(sjyylc_j>0||sjfyylc_j>0||ljyylc_j>0||ljfyylc_j>0){ | ||
| 260 | + CalcWaybill t_=new CalcWaybill(); | ||
| 261 | + t_.setRq(date); | ||
| 262 | + t_.setRqStr(dateStr); | ||
| 263 | + t_.setGsdm(gsdm); | ||
| 264 | + t_.setGsname(gsname); | ||
| 265 | + t_.setFgsdm(fgsdm); | ||
| 266 | + t_.setFgsname(fgsname); | ||
| 267 | + t_.setXl(xlbm); | ||
| 268 | + t_.setXlName(xlname); | ||
| 269 | + t_.setLp(lp); | ||
| 270 | + t_.setCl(clzbh); | ||
| 271 | + t_.setjGh(jgh); | ||
| 272 | + t_.setjName(jname); | ||
| 273 | + t_.setSjyylc(sjyylc_j); | ||
| 274 | + t_.setSjfyylc(sjfyylc_j); | ||
| 275 | + t_.setLjyylc(ljyylc_j); | ||
| 276 | + t_.setLjfyylc(ljfyylc_j); | ||
| 277 | + t_.setsGh(""); | ||
| 278 | + t_.setsName(""); | ||
| 279 | + t_.setJhyybc(0); | ||
| 280 | + t_.setJhyybczgf(0); | ||
| 281 | + t_.setJhyybcwgf(0); | ||
| 282 | + t_.setJhyylc(0.0); | ||
| 283 | + t_.setJhfyylc(0.0); | ||
| 284 | + t_.setSjyybc(0); | ||
| 285 | + t_.setSjyybczgf(0); | ||
| 286 | + t_.setSjyybcwgf(0); | ||
| 287 | + t_.setLjbc(0); | ||
| 288 | + t_.setLjbczgf(0); | ||
| 289 | + t_.setLjbcwgf(0); | ||
| 290 | + t_.setLbbc(0); | ||
| 291 | + t_.setLblc(0.0); | ||
| 292 | + t_.setLblcLz(0.0); | ||
| 293 | + t_.setLblcDm(0.0); | ||
| 294 | + t_.setLblcGz(0.0); | ||
| 295 | + t_.setLblcJf(0.0); | ||
| 296 | + t_.setLblcZs(0.0); | ||
| 297 | + t_.setLblcQr(0.0); | ||
| 298 | + t_.setLblcQc(0.0); | ||
| 299 | + t_.setLblcKx(0.0); | ||
| 300 | + t_.setLblcQh(0.0); | ||
| 301 | + t_.setLblcYw(0.0); | ||
| 302 | + t_.setLblcQt(0.0); | ||
| 303 | + t_.setFzbc(0); | ||
| 304 | + t_.setFzbczgf(0); | ||
| 305 | + t_.setFzbcwgf(0); | ||
| 306 | + t_.setDtbc(0); | ||
| 307 | + t_.setDtbczgf(0); | ||
| 308 | + t_.setDtbcwgf(0); | ||
| 309 | + list.add(t_); | ||
| 310 | + } | ||
| 311 | + } | ||
| 312 | + return list; | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | +} |
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.calc.impl; | ||
| 2 | + | ||
| 3 | +import java.sql.ResultSet; | ||
| 4 | +import java.sql.SQLException; | ||
| 5 | +import java.util.ArrayList; | ||
| 6 | +import java.util.HashMap; | ||
| 7 | +import java.util.HashSet; | ||
| 8 | +import java.util.List; | ||
| 9 | +import java.util.Map; | ||
| 10 | +import java.util.Set; | ||
| 11 | + | ||
| 12 | +import javax.transaction.Transactional; | ||
| 13 | + | ||
| 14 | +import com.bsth.common.ResponseCode; | ||
| 15 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 16 | +import com.bsth.repository.calc.CalcWaybillRepository; | ||
| 17 | +import com.bsth.service.calc.CalcToolService; | ||
| 18 | +import com.bsth.service.calc.CalcWaybillService; | ||
| 19 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 20 | +import com.bsth.util.Arith; | ||
| 21 | +import com.bsth.util.BatchSaveUtils; | ||
| 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 17/11/16. | ||
| 32 | + */ | ||
| 33 | +@Service | ||
| 34 | +public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer> implements CalcWaybillService { | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private CalcWaybillRepository clacRepository; | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + private CalcToolService calcToolService; | ||
| 41 | + | ||
| 42 | + @Autowired | ||
| 43 | + JdbcTemplate jdbcTemplate; | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + @Transactional | ||
| 50 | + @Override | ||
| 51 | + public Map<String, Object> generateNew(String date, String line) throws Exception { | ||
| 52 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 53 | + | ||
| 54 | + try { | ||
| 55 | + | ||
| 56 | + if(date.length() != 0 && line.length() != 0){ | ||
| 57 | + clacRepository.deleteByDateAndLine(date, line); | ||
| 58 | + } else if(date.length() != 0){ | ||
| 59 | + clacRepository.deleteByDate(date); | ||
| 60 | + } else { | ||
| 61 | + newMap.put("status", ResponseCode.ERROR); | ||
| 62 | + logger.error("save erro.", "日期不能为空"); | ||
| 63 | + return newMap; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + if(date.trim().length() == 0){ | ||
| 67 | + newMap.put("status", ResponseCode.ERROR); | ||
| 68 | + logger.error("save erro.", "日期不能为空"); | ||
| 69 | + return newMap; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + String sql = "select c.id,c.out_config,c.start_opt,c.trust,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id"; | ||
| 73 | + if(line.length() != 0){ | ||
| 74 | + sql += " where t.line_code = " + line; | ||
| 75 | + } | ||
| 76 | +// List<LineConfig> listLineConfig = //jdbcTemplate.query(sql, new BeanPropertyRowMapper(LineConfig.class)); | ||
| 77 | + List<Map<String, Object>> listLineConfig = jdbcTemplate.query(sql, | ||
| 78 | + new RowMapper<Map<String, Object>>(){ | ||
| 79 | + @Override | ||
| 80 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 81 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 82 | + m.put("id", rs.getLong("id")); | ||
| 83 | + m.put("out_config", rs.getString("out_config")); | ||
| 84 | + m.put("start_opt", rs.getString("start_opt")); | ||
| 85 | + m.put("trust", rs.getString("trust")); | ||
| 86 | + m.put("line_code", rs.getString("line_code")); | ||
| 87 | + return m; | ||
| 88 | + }}); | ||
| 89 | + | ||
| 90 | + Set<String> lineSet = new HashSet<String>(); | ||
| 91 | + for (int i = 0; i < listLineConfig.size(); i++) { | ||
| 92 | + Map<String, Object> m =listLineConfig.get(i); | ||
| 93 | + String lineCode=m.get("line_code").toString().trim(); | ||
| 94 | + String startOpt=m.get("start_opt").toString().trim(); | ||
| 95 | + if(!lineSet.add(lineCode)) | ||
| 96 | + continue; | ||
| 97 | + | ||
| 98 | + List<CalcWaybill> findAll = calcToolService.findAll(date, lineCode); | ||
| 99 | + | ||
| 100 | +// new BatchSaveUtils<CalcWaybill>().saveList2(findAll, CalcWaybill.class); | ||
| 101 | + | ||
| 102 | + clacRepository.save(findAll); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 106 | + } catch (Exception e) { | ||
| 107 | + // TODO: handle exception | ||
| 108 | + newMap.put("status", ResponseCode.ERROR); | ||
| 109 | + logger.error("save erro.", e); | ||
| 110 | + throw e; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + return newMap; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + @Override | ||
| 117 | + public List<Map<String, Object>> statisticsDailyTj(String gsdm, | ||
| 118 | + String fgsdm, String line, String date, String date2, | ||
| 119 | + String xlName, String type) { | ||
| 120 | + | ||
| 121 | + List<CalcWaybill> list = new ArrayList<CalcWaybill>(); | ||
| 122 | + List<CalcWaybill> lists = new ArrayList<CalcWaybill>(); | ||
| 123 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ||
| 124 | + Map<String, List<CalcWaybill>> keyMap = new HashMap<String, List<CalcWaybill>>(); | ||
| 125 | + | ||
| 126 | + if(line.equals("")){ | ||
| 127 | + //查询所有线路 | ||
| 128 | + list = clacRepository.scheduleByDateAndLineTj(line,date,date2,gsdm,fgsdm); | ||
| 129 | + }else{ | ||
| 130 | + //查询单条线路 | ||
| 131 | + list = clacRepository.scheduleByDateAndLineTj2(line,date,date2); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + for(CalcWaybill c : list){ | ||
| 135 | + String key = c.getXlName(); | ||
| 136 | + if(!keyMap.containsKey(key)){ | ||
| 137 | + keyMap.put(key, new ArrayList<CalcWaybill>()); | ||
| 138 | + } | ||
| 139 | + keyMap.get(key).add(c); | ||
| 140 | + } | ||
| 141 | + for(String key : keyMap.keySet()){ | ||
| 142 | + CalcWaybill calc = keyMap.get(key).get(0); | ||
| 143 | + for(int i = 1; i < keyMap.get(key).size(); i++){ | ||
| 144 | + CalcWaybill c= keyMap.get(key).get(i); | ||
| 145 | + calc.setJhyylc(Arith.add(calc.getJhyylc(), c.getJhyylc())); | ||
| 146 | + calc.setJhfyylc(Arith.add(calc.getJhfyylc(), c.getJhfyylc())); | ||
| 147 | + calc.setSjyylc(Arith.add(calc.getSjyylc(), c.getSjyylc())); | ||
| 148 | + calc.setSjfyylc(Arith.add(calc.getSjfyylc(), c.getSjfyylc())); | ||
| 149 | + calc.setLblc(Arith.add(calc.getLblc(), c.getLblc())); | ||
| 150 | + calc.setLbbc(calc.getLbbc() + c.getLbbc()); | ||
| 151 | + calc.setLblcLz(Arith.add(calc.getLblcLz(), c.getLblcLz())); | ||
| 152 | + calc.setLblcDm(Arith.add(calc.getLblcDm(), c.getLblcDm())); | ||
| 153 | + calc.setLblcGz(Arith.add(calc.getLblcGz(), c.getLblcGz())); | ||
| 154 | + calc.setLblcJf(Arith.add(calc.getLblcJf(), c.getLblcJf())); | ||
| 155 | + calc.setLblcZs(Arith.add(calc.getLblcZs(), c.getLblcZs())); | ||
| 156 | + calc.setLblcQr(Arith.add(calc.getLblcQr(), c.getLblcQr())); | ||
| 157 | + calc.setLblcQc(Arith.add(calc.getLblcQc(), c.getLblcQc())); | ||
| 158 | + calc.setLblcKx(Arith.add(calc.getLblcKx(), c.getLblcKx())); | ||
| 159 | + calc.setLblcQh(Arith.add(calc.getLblcQh(), c.getLblcQh())); | ||
| 160 | + calc.setLblcYw(Arith.add(calc.getLblcYw(), c.getLblcYw())); | ||
| 161 | + calc.setLblcQt(Arith.add(calc.getLblcQt(), c.getLblcQt())); | ||
| 162 | + calc.setLjyylc(Arith.add(calc.getLjyylc(), c.getLjyylc())); | ||
| 163 | + calc.setJhyybc(calc.getJhyybc() + c.getJhyybc()); | ||
| 164 | + calc.setJhyybczgf(calc.getJhyybczgf() + c.getJhyybczgf()); | ||
| 165 | + calc.setJhyybcwgf(calc.getJhyybcwgf() + c.getJhyybcwgf()); | ||
| 166 | + calc.setSjyybc(calc.getSjyybc() + c.getSjyybc()); | ||
| 167 | + calc.setSjyybczgf(calc.getSjyybczgf() + c.getSjyybczgf()); | ||
| 168 | + calc.setSjyybcwgf(calc.getSjyybcwgf() + c.getSjyybcwgf()); | ||
| 169 | + calc.setLjbc(calc.getLjbc() + c.getLjbc()); | ||
| 170 | + calc.setLjbczgf(calc.getLjbczgf() + c.getLjbczgf()); | ||
| 171 | + calc.setLjbcwgf(calc.getLjbcwgf() + c.getLjbcwgf()); | ||
| 172 | + calc.setFzbc(calc.getFzbc() + c.getFzbc()); | ||
| 173 | + calc.setFzbczgf(calc.getFzbczgf() + c.getFzbczgf()); | ||
| 174 | + calc.setFzbcwgf(calc.getFzbcwgf() + c.getFzbcwgf()); | ||
| 175 | + calc.setDtbc(calc.getDtbc() + c.getFzbc()); | ||
| 176 | + calc.setDtbczgf(calc.getDtbczgf() + c.getDtbczgf()); | ||
| 177 | + calc.setDtbcwgf(calc.getDtbcwgf() + c.getDtbcwgf()); | ||
| 178 | + | ||
| 179 | + } | ||
| 180 | + calc.setSjyylc(Arith.add(calc.getSjyylc(), calc.getLjyylc())); | ||
| 181 | + System.out.println(); | ||
| 182 | + lists.add(calc); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + CalcWaybill sum = new CalcWaybill(); | ||
| 186 | + sum.setXlName("合计"); | ||
| 187 | + for(CalcWaybill c : lists){ | ||
| 188 | + sum.setJhyylc(Arith.add(sum.getJhyylc()!=null?sum.getJhyylc():0, c.getJhyylc())); | ||
| 189 | + sum.setJhfyylc(Arith.add(sum.getJhfyylc()!=null?sum.getJhfyylc():0, c.getJhfyylc())); | ||
| 190 | + sum.setSjyylc(Arith.add(sum.getSjyylc()!=null?sum.getSjyylc():0, c.getSjyylc())); | ||
| 191 | + sum.setSjfyylc(Arith.add(sum.getSjfyylc()!=null?sum.getSjfyylc():0, c.getSjfyylc())); | ||
| 192 | + sum.setLblc(Arith.add(sum.getLblc()!=null?sum.getLblc():0, c.getLblc())); | ||
| 193 | + sum.setLbbc(sum.getLbbc() + c.getLbbc()); | ||
| 194 | + sum.setLblcLz(Arith.add(sum.getLblcLz()!=null?sum.getLblcLz():0, c.getLblcLz())); | ||
| 195 | + sum.setLblcDm(Arith.add(sum.getLblcDm()!=null?sum.getLblcDm():0, c.getLblcDm())); | ||
| 196 | + sum.setLblcGz(Arith.add(sum.getLblcGz()!=null?sum.getLblcGz():0, c.getLblcGz())); | ||
| 197 | + sum.setLblcJf(Arith.add(sum.getLblcJf()!=null?sum.getLblcJf():0, c.getLblcJf())); | ||
| 198 | + sum.setLblcZs(Arith.add(sum.getLblcZs()!=null?sum.getLblcZs():0, c.getLblcZs())); | ||
| 199 | + sum.setLblcQr(Arith.add(sum.getLblcQr()!=null?sum.getLblcQr():0, c.getLblcQr())); | ||
| 200 | + sum.setLblcQc(Arith.add(sum.getLblcQc()!=null?sum.getLblcQc():0, c.getLblcQc())); | ||
| 201 | + sum.setLblcKx(Arith.add(sum.getLblcKx()!=null?sum.getLblcKx():0, c.getLblcKx())); | ||
| 202 | + sum.setLblcQh(Arith.add(sum.getLblcQh()!=null?sum.getLblcQh():0, c.getLblcQh())); | ||
| 203 | + sum.setLblcYw(Arith.add(sum.getLblcYw()!=null?sum.getLblcYw():0, c.getLblcYw())); | ||
| 204 | + sum.setLblcQt(Arith.add(sum.getLblcQt()!=null?sum.getLblcQt():0, c.getLblcQt())); | ||
| 205 | + sum.setLjyylc(Arith.add(sum.getLjyylc()!=null?sum.getLjyylc():0, c.getLjyylc())); | ||
| 206 | + sum.setJhyybc(sum.getJhyybc() + c.getJhyybc()); | ||
| 207 | + sum.setJhyybczgf(sum.getJhyybczgf() + c.getJhyybczgf()); | ||
| 208 | + sum.setJhyybcwgf(sum.getJhyybcwgf() + c.getJhyybcwgf()); | ||
| 209 | + sum.setSjyybc(sum.getSjyybc() + c.getSjyybc()); | ||
| 210 | + sum.setSjyybczgf(sum.getSjyybczgf() + c.getSjyybczgf()); | ||
| 211 | + sum.setSjyybcwgf(sum.getSjyybcwgf() + c.getSjyybcwgf()); | ||
| 212 | + sum.setLjbc(sum.getLjbc() + c.getLjbc()); | ||
| 213 | + sum.setLjbczgf(sum.getLjbczgf() + c.getLjbczgf()); | ||
| 214 | + sum.setLjbcwgf(sum.getLjbcwgf() + c.getLjbcwgf()); | ||
| 215 | + sum.setFzbc(sum.getFzbc() + c.getFzbc()); | ||
| 216 | + sum.setFzbczgf(sum.getFzbczgf() + c.getFzbczgf()); | ||
| 217 | + sum.setFzbcwgf(sum.getFzbcwgf() + c.getFzbcwgf()); | ||
| 218 | + sum.setDtbc(sum.getDtbc() + c.getFzbc()); | ||
| 219 | + sum.setDtbczgf(sum.getDtbczgf() + c.getDtbczgf()); | ||
| 220 | + sum.setDtbcwgf(sum.getDtbcwgf() + c.getDtbcwgf()); | ||
| 221 | + } | ||
| 222 | + if(lists.size() > 0){ | ||
| 223 | + lists.add(sum); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + for(CalcWaybill c : lists){ | ||
| 227 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 228 | + m.put("xlName", c.getXlName()); | ||
| 229 | + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); | ||
| 230 | + m.put("jhlc", c.getJhyylc()); | ||
| 231 | + m.put("jcclc", c.getJhfyylc()); | ||
| 232 | + m.put("sjzgl", Arith.add(c.getSjyylc(), c.getSjfyylc())); | ||
| 233 | + m.put("sjgl", c.getSjyylc()); | ||
| 234 | + m.put("sjksgl", c.getSjfyylc()); | ||
| 235 | + m.put("ssgl", c.getLblc()); | ||
| 236 | + m.put("ssbc", c.getLbbc()); | ||
| 237 | + m.put("ssgl_lz", c.getLblcLz()); | ||
| 238 | + m.put("ssgl_dm", c.getLblcDm()); | ||
| 239 | + m.put("ssgl_gz", c.getLblcGz()); | ||
| 240 | + m.put("ssgl_jf", c.getLblcJf()); | ||
| 241 | + m.put("ssgl_zs", c.getLblcZs()); | ||
| 242 | + m.put("ssgl_qr", c.getLblcQr()); | ||
| 243 | + m.put("ssgl_qc", c.getLblcQc()); | ||
| 244 | + m.put("ssgl_kx", c.getLblcKx()); | ||
| 245 | + m.put("ssgl_qh", c.getLblcQh()); | ||
| 246 | + m.put("ssgl_yw", c.getLblcYw()); | ||
| 247 | + m.put("ssgl_other", c.getLblcQt()); | ||
| 248 | + m.put("ljgl", c.getLjyylc()); | ||
| 249 | + m.put("jhbc", c.getJhyybc()); | ||
| 250 | + m.put("jhbc_m", c.getJhyybczgf()); | ||
| 251 | + m.put("jhbc_a", c.getJhyybcwgf()); | ||
| 252 | + m.put("sjbc", c.getSjyybc()); | ||
| 253 | + m.put("sjbc_m", c.getSjyybczgf()); | ||
| 254 | + m.put("sjbc_a", c.getSjyybcwgf()); | ||
| 255 | + m.put("ljbc", c.getLjbc()); | ||
| 256 | + m.put("ljbc_m", c.getLjbczgf()); | ||
| 257 | + m.put("ljbc_a", c.getLjbcwgf()); | ||
| 258 | + m.put("fzbc", c.getFzbc()); | ||
| 259 | + m.put("fzbc_m", c.getFzbczgf()); | ||
| 260 | + m.put("fzbc_a", c.getFzbcwgf()); | ||
| 261 | + m.put("dtbc", c.getDtbc()); | ||
| 262 | + m.put("dtbc_m", c.getDtbczgf()); | ||
| 263 | + m.put("dtbc_a", c.getDtbcwgf()); | ||
| 264 | + m.put("djg", 0); | ||
| 265 | + m.put("djg_m", 0); | ||
| 266 | + m.put("djg_a", 0); | ||
| 267 | + m.put("djg_time", 0); | ||
| 268 | + resList.add(m); | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + return resList; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | +} |
src/main/resources/static/pages/forms/calc/statisticsDaily.html
0 → 100644
| 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 | + | ||
| 18 | + #forms > thead > tr> td >span{ | ||
| 19 | + width: 5px; | ||
| 20 | + word-wrap: break-word; | ||
| 21 | + letter-spacing: 20px; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + #forms > thead > tr> td >label{ | ||
| 25 | + word-break: keep-all;white-space:nowrap; | ||
| 26 | + } | ||
| 27 | +</style> | ||
| 28 | + | ||
| 29 | +<div class="page-head"> | ||
| 30 | + <div class="page-title"> | ||
| 31 | + <h1>统计日报</h1> | ||
| 32 | + </div> | ||
| 33 | +</div> | ||
| 34 | + | ||
| 35 | +<!-- <div class="row"> --> | ||
| 36 | + <div class="col-md-12 portlet light porttlet-fit bordered" style="height:calc(100% - 56px)"> | ||
| 37 | +<!-- <div> --> | ||
| 38 | + <div class="portlet-title"> | ||
| 39 | + <form class="form-inline" action=""> | ||
| 40 | + <div style="display: inline-block; " id="gsdmDiv"> | ||
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 42 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | ||
| 43 | + </div> | ||
| 44 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | ||
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 46 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | ||
| 47 | + </div> | ||
| 48 | + <div style="margin-top: 2px"></div> | ||
| 49 | + <div style="display: inline-block;"> | ||
| 50 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 51 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 52 | + </div> | ||
| 53 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 54 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 55 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 56 | + </div> | ||
| 57 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 58 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 59 | + <input class="form-control" type="text" id="date2" style="width: 180px;"/> | ||
| 60 | + </div> | ||
| 61 | + <div class="form-group"> | ||
| 62 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 63 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 64 | + </div> | ||
| 65 | + </form> | ||
| 66 | + </div> | ||
| 67 | + <div class="portlet-body" id="tjrbBody" style="overflow:auto;height: calc(100% - 80px)"> | ||
| 68 | + <div class="table-container" style="margin-top: 10px;min-width: 906px"> | ||
| 69 | + <label>早高峰:6:31~8:30 晚高峰:16:01~18:00</label> | ||
| 70 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 71 | + <thead> | ||
| 72 | + <tr> | ||
| 73 | + <th colspan="44"><label id="tjrq"></label> 线路统计日报</th> | ||
| 74 | + </tr> | ||
| 75 | + <tr> | ||
| 76 | + <td rowspan="3"><span >路线名</span></td> | ||
| 77 | + <td colspan="20">全日营运里程(公里)</td> | ||
| 78 | + <td colspan="15">全日营运班次</td> | ||
| 79 | + <td colspan="9">大间隔情况</td> | ||
| 80 | + </tr> | ||
| 81 | + <tr> | ||
| 82 | + <td rowspan="2"><label>计划总</label> | ||
| 83 | + <label>公里 </label></td> | ||
| 84 | + <td rowspan="2"><label>计划营</label><label>运公里</label></td> | ||
| 85 | + <td rowspan="2"><label>计划空</label><label>驶公里</label></td> | ||
| 86 | + <td rowspan="2"><label>实际</label><label>总公里</label></td> | ||
| 87 | + <td rowspan="2"><label>实际营</label><label>运公里</label></td> | ||
| 88 | + <td rowspan="2"><label>实际空</label><label>驶公里</label></td> | ||
| 89 | + <td rowspan="2"><span>少驶公里</span></td> | ||
| 90 | + <td rowspan="2"><span>少驶班次</span></td> | ||
| 91 | + <td colspan="11">少驶原因(公里)</td> | ||
| 92 | + <td rowspan="2"><span >临加公里</span></td> | ||
| 93 | + <td colspan="3">计划班次</td> | ||
| 94 | + <td colspan="3">实际班次</td> | ||
| 95 | + <td colspan="3">临加班次</td> | ||
| 96 | + <td colspan="3">放站班次</td> | ||
| 97 | + <td colspan="3">调头班次</td> | ||
| 98 | + <td colspan="3">发生次数</td> | ||
| 99 | + <td rowspan="2">最大间隔时间(分)</td> | ||
| 100 | + <td rowspan="2">原因</td> | ||
| 101 | + </tr> | ||
| 102 | + <tr> | ||
| 103 | + <td><span >路阻</span></td> | ||
| 104 | + <td><span>吊慢</span></td> | ||
| 105 | + <td><span >故障</span></td> | ||
| 106 | + <td><span >纠纷</span></td> | ||
| 107 | + <td><span >肇事</span></td> | ||
| 108 | + <td><span>缺人</span></td> | ||
| 109 | + <td><span>缺车</span></td> | ||
| 110 | + <td><span >客稀</span></td> | ||
| 111 | + <td><span>气候</span></td> | ||
| 112 | + <td><span>援外</span></td> | ||
| 113 | + <td><span>其他</span></td> | ||
| 114 | + <td><span>全日</span></td> | ||
| 115 | + <td><span>早高峰</span></td> | ||
| 116 | + <td><span>晚高峰</span></td> | ||
| 117 | + <td><span>全日</span></td> | ||
| 118 | + <td><span>早高峰</span></td> | ||
| 119 | + <td><span>晚高峰</span></td> | ||
| 120 | + <td><span>全日</span></td> | ||
| 121 | + <td><span>早高峰</span></td> | ||
| 122 | + <td><span>晚高峰</span></td> | ||
| 123 | + <td><span>全日</span></td> | ||
| 124 | + <td><span>早高峰</span></td> | ||
| 125 | + <td><span>晚高峰</span></td> | ||
| 126 | + <td><span>全日</span></td> | ||
| 127 | + <td><span>早高峰</span></td> | ||
| 128 | + <td><span>晚高峰</span></td> | ||
| 129 | + <td><span>全日</span></td> | ||
| 130 | + <td><span>早高峰</span></td> | ||
| 131 | + <td><span>晚高峰</span></td> | ||
| 132 | + </tr> | ||
| 133 | + </thead> | ||
| 134 | + <tbody class="statisticsDaily"> | ||
| 135 | + | ||
| 136 | + </tbody> | ||
| 137 | + </table> | ||
| 138 | + </div> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + </div> | ||
| 142 | +</div> | ||
| 143 | + | ||
| 144 | +<script> | ||
| 145 | + $(function(){ | ||
| 146 | + $('#export').attr('disabled', "true"); | ||
| 147 | + | ||
| 148 | + // 关闭左侧栏 | ||
| 149 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 150 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 151 | + | ||
| 152 | + var d = new Date(); | ||
| 153 | + d.setTime(d.getTime() - 1*1000*60*60*24); | ||
| 154 | + var year = d.getFullYear(); | ||
| 155 | + var month = d.getMonth() + 1; | ||
| 156 | + var day = d.getDate(); | ||
| 157 | + if(month < 10) | ||
| 158 | + month = "0" + month; | ||
| 159 | + if(day < 10) | ||
| 160 | + day = "0" + day; | ||
| 161 | + var dateTime = year + "-" + month + "-" + day; | ||
| 162 | + $("#date").datetimepicker({ | ||
| 163 | + format : 'YYYY-MM-DD', | ||
| 164 | + locale : 'zh-cn', | ||
| 165 | + maxDate : dateTime | ||
| 166 | + }); | ||
| 167 | + $("#date2").datetimepicker({ | ||
| 168 | + format : 'YYYY-MM-DD', | ||
| 169 | + locale : 'zh-cn', | ||
| 170 | + maxDate : dateTime | ||
| 171 | + }); | ||
| 172 | + $("#date").val(dateTime); | ||
| 173 | + $("#date2").val(dateTime); | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + var fage=false; | ||
| 177 | + var obj = []; | ||
| 178 | + var xlList; | ||
| 179 | + $.get('/report/lineList',function(result){ | ||
| 180 | + xlList=result; | ||
| 181 | + $.get('/user/companyData', function(result){ | ||
| 182 | + obj = result; | ||
| 183 | + var options = ''; | ||
| 184 | + for(var i = 0; i < obj.length; i++){ | ||
| 185 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + if(obj.length ==0){ | ||
| 189 | + $("#gsdmDiv").css('display','none'); | ||
| 190 | + }else if(obj.length ==1){ | ||
| 191 | + $("#gsdmDiv").css('display','none'); | ||
| 192 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 193 | + $('#fgsdmDiv').css('display','none'); | ||
| 194 | + } | ||
| 195 | + $('#gsdm').html(options); | ||
| 196 | + updateCompany(); | ||
| 197 | + }); | ||
| 198 | + }) | ||
| 199 | + $("#gsdm").on("change",updateCompany); | ||
| 200 | + function updateCompany(){ | ||
| 201 | + var company = $('#gsdm').val(); | ||
| 202 | + var options = ''; | ||
| 203 | + for(var i = 0; i < obj.length; i++){ | ||
| 204 | + if(obj[i].companyCode == company){ | ||
| 205 | + var children = obj[i].children; | ||
| 206 | + for(var j = 0; j < children.length; j++){ | ||
| 207 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + $('#fgsdm').html(options); | ||
| 212 | +// initXl(); | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + var tempData = {}; | ||
| 216 | + $.get('/report/lineList',function(xlList){ | ||
| 217 | + var data = []; | ||
| 218 | + data.push({id: " ", text: "全部线路"}); | ||
| 219 | + $.get('/user/companyData', function(result){ | ||
| 220 | + for(var i = 0; i < result.length; i++){ | ||
| 221 | + var companyCode = result[i].companyCode; | ||
| 222 | + var children = result[i].children; | ||
| 223 | + for(var j = 0; j < children.length; j++){ | ||
| 224 | + var code = children[j].code; | ||
| 225 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 226 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 227 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 228 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + initPinYinSelect2('#line',data,''); | ||
| 234 | + | ||
| 235 | + }); | ||
| 236 | + }); | ||
| 237 | + | ||
| 238 | + $("#line").on("change", function(){ | ||
| 239 | + if($("#line").val() == " "){ | ||
| 240 | + $("#gsdm").attr("disabled", false); | ||
| 241 | + $("#fgsdm").attr("disabled", false); | ||
| 242 | + } else { | ||
| 243 | + var temp = tempData[$("#line").val()].split(":"); | ||
| 244 | + $("#gsdm").val(temp[0]); | ||
| 245 | + updateCompany(); | ||
| 246 | + $("#fgsdm").val(temp[1]); | ||
| 247 | + $("#gsdm").attr("disabled", true); | ||
| 248 | + $("#fgsdm").attr("disabled", true); | ||
| 249 | + } | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + var line =""; | ||
| 254 | + var xlName =""; | ||
| 255 | + var date = ""; | ||
| 256 | + var date2 =""; | ||
| 257 | + var gsdm=""; | ||
| 258 | + var fgsdm=""; | ||
| 259 | + $("#query").on("click",function(){ | ||
| 260 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 261 | + layer.msg("请选择时间范围!"); | ||
| 262 | + return; | ||
| 263 | + } | ||
| 264 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | ||
| 265 | + layer.msg("请选择时间范围!"); | ||
| 266 | + return; | ||
| 267 | + } | ||
| 268 | +// $("#tjrbBody").height($(window).height()-100); | ||
| 269 | + line = $("#line").val(); | ||
| 270 | + xlName = $("#select2-line-container").html(); | ||
| 271 | + date = $("#date").val(); | ||
| 272 | + date2 =$("#date2").val(); | ||
| 273 | + gsdm =$("#gsdm").val(); | ||
| 274 | + fgsdm=$("#fgsdm").val(); | ||
| 275 | + if(line=="请选择"){ | ||
| 276 | + line=""; | ||
| 277 | + } | ||
| 278 | + if(date==null || date =="" ||date2==null || date2 ==""){ | ||
| 279 | + layer.msg('请选择时间段.'); | ||
| 280 | + }else{ | ||
| 281 | + $("#tjrq").html(date+"至"+date2); | ||
| 282 | + var params = {}; | ||
| 283 | + params['gsdm'] = gsdm; | ||
| 284 | + params['fgsdm'] =fgsdm ; | ||
| 285 | + params['line'] = line; | ||
| 286 | + params['date'] = date; | ||
| 287 | + params['date2'] = date2; | ||
| 288 | + params['xlName'] = xlName; | ||
| 289 | + params['type'] = "query"; | ||
| 290 | + $get('/calcWaybill/statisticsDailyTj',params,function(result){ | ||
| 291 | + // 把数据填充到模版中 | ||
| 292 | + var tbodyHtml = template('statisticsDaily',{list:result}); | ||
| 293 | + // 把渲染好的模版html文本追加到表格中 | ||
| 294 | + $('#forms .statisticsDaily').html(tbodyHtml); | ||
| 295 | + | ||
| 296 | + if(result.length == 0) | ||
| 297 | + $("#export").attr('disabled',"true"); | ||
| 298 | + else | ||
| 299 | + $("#export").removeAttr("disabled"); | ||
| 300 | + }); | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + }); | ||
| 304 | +// $("#tjrbBody").height($(window).height()-100); | ||
| 305 | + $("#export").on("click",function(){ | ||
| 306 | + var params = {}; | ||
| 307 | + params['gsdm'] = gsdm; | ||
| 308 | + params['fgsdm'] =fgsdm ; | ||
| 309 | + params['line'] = line; | ||
| 310 | + params['date'] = date; | ||
| 311 | + params['date2'] = date2; | ||
| 312 | + params['xlName'] = xlName; | ||
| 313 | + params['type'] = "export"; | ||
| 314 | + $get('/realSchedule/statisticsDailyTj',params,function(result){ | ||
| 315 | + window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); | ||
| 316 | + }); | ||
| 317 | + }); | ||
| 318 | + | ||
| 319 | + }); | ||
| 320 | +</script> | ||
| 321 | +<script type="text/html" id="statisticsDaily"> | ||
| 322 | + {{each list as obj i}} | ||
| 323 | + <tr {{if obj.zt==1}}style='color: red'{{/if}}> | ||
| 324 | + <td>{{obj.xlName}}</td> | ||
| 325 | + <td>{{obj.jhzlc}}</td> | ||
| 326 | + <td>{{obj.jhlc}}</td> | ||
| 327 | + <td>{{obj.jcclc}}</td> | ||
| 328 | + <td>{{obj.sjzgl}}</td> | ||
| 329 | + <td>{{obj.sjgl}}</td> | ||
| 330 | + <td>{{obj.sjksgl}}</td> | ||
| 331 | + <td>{{obj.ssgl}}</td> | ||
| 332 | + <td>{{obj.ssbc}}</td> | ||
| 333 | + <td>{{obj.ssgl_lz}}</td> | ||
| 334 | + <td>{{obj.ssgl_dm}}</td> | ||
| 335 | + <td>{{obj.ssgl_gz}}</td> | ||
| 336 | + <td>{{obj.ssgl_jf}}</td> | ||
| 337 | + <td>{{obj.ssgl_zs}}</td> | ||
| 338 | + <td>{{obj.ssgl_qr}}</td> | ||
| 339 | + <td>{{obj.ssgl_qc}}</td> | ||
| 340 | + <td>{{obj.ssgl_kx}}</td> | ||
| 341 | + <td>{{obj.ssgl_qh}}</td> | ||
| 342 | + <td>{{obj.ssgl_yw}}</td> | ||
| 343 | + <td>{{obj.ssgl_other}}</td> | ||
| 344 | + <td>{{obj.ljgl}}</td> | ||
| 345 | + <td>{{obj.jhbc}}</td> | ||
| 346 | + <td>{{obj.jhbc_m}}</td> | ||
| 347 | + <td>{{obj.jhbc_a}}</td> | ||
| 348 | + <td>{{obj.sjbc}}</td> | ||
| 349 | + <td>{{obj.sjbc_m}}</td> | ||
| 350 | + <td>{{obj.sjbc_a}}</td> | ||
| 351 | + <td>{{obj.ljbc}}</td> | ||
| 352 | + <td>{{obj.ljbc_m}}</td> | ||
| 353 | + <td>{{obj.ljbc_a}}</td> | ||
| 354 | + <td>{{obj.fzbc}}</td> | ||
| 355 | + <td>{{obj.fzbc_m}}</td> | ||
| 356 | + <td>{{obj.fzbc_a}}</td> | ||
| 357 | + <td>{{obj.dtbc}}</td> | ||
| 358 | + <td>{{obj.dtbc_m}}</td> | ||
| 359 | + <td>{{obj.dtbc_a}}</td> | ||
| 360 | + <td>{{obj.djg}}</td> | ||
| 361 | + <td>{{obj.djg_m}}</td> | ||
| 362 | + <td>{{obj.djg_a}}</td> | ||
| 363 | + <td>{{obj.djg_time}}</td> | ||
| 364 | + <td> </td> | ||
| 365 | + </tr> | ||
| 366 | + {{/each}} | ||
| 367 | + {{if list.length == 0}} | ||
| 368 | + <tr> | ||
| 369 | + <td colspan="44"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 370 | + </tr> | ||
| 371 | + {{/if}} | ||
| 372 | +</script> | ||
| 0 | \ No newline at end of file | 373 | \ No newline at end of file |