Commit 828cfd941fd6760070d153c5938effed91a16e4b
1 parent
42606316
油电混合修改为可导入油量可导入电量(以前是油量电量均导入油量表)
Showing
4 changed files
with
1752 additions
and
1792 deletions
src/main/java/com/bsth/data/report_register/entity/ReportRegister.java
| 1 | -package com.bsth.data.report_register.entity; | |
| 2 | - | |
| 3 | -import javax.persistence.*; | |
| 4 | -import java.text.DateFormat; | |
| 5 | -import java.text.SimpleDateFormat; | |
| 6 | -import java.util.Date; | |
| 7 | - | |
| 8 | - | |
| 9 | -@Entity | |
| 10 | -@Table(name = "bsth_t_report") | |
| 11 | -public class ReportRegister { | |
| 12 | - | |
| 13 | - @Id | |
| 14 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 15 | - private long ID; | |
| 16 | - | |
| 17 | - /** 类型*/ | |
| 18 | - private String REPORT_TYPE; | |
| 19 | - /** 公司 */ | |
| 20 | - private String REPORT_GS; | |
| 21 | - /** 分公司 */ | |
| 22 | - private String REPORT_FGS; | |
| 23 | - /** 公司名 */ | |
| 24 | - private String REPORT_GSNAME; | |
| 25 | - /** 分公司名 */ | |
| 26 | - private String REPORT_FGSNAME; | |
| 27 | - /** 时间*/ | |
| 28 | - private Date REPORT_DATE; | |
| 29 | - /** 报备人*/ | |
| 30 | - private String REPORT_BBR; | |
| 31 | - /** 线路编码 */ | |
| 32 | - private String REPORT_XL; | |
| 33 | - /** 线路名*/ | |
| 34 | - private String REPORT_XLNAME; | |
| 35 | - /** 站点*/ | |
| 36 | - private String REPORT_STATION; | |
| 37 | - /** 对外上报部门*/ | |
| 38 | - private String REPORT_DWSBBM; | |
| 39 | - /** 对外上报时间*/ | |
| 40 | - private String REPORT_DWSBSJ; | |
| 41 | - /** 延误时间*/ | |
| 42 | - private String REPORT_YWSJ; | |
| 43 | - /** 首末班误点原因*/ | |
| 44 | - private String REPORT_SMBWD; | |
| 45 | - /** 大间隔时间*/ | |
| 46 | - private String REPORT_DJGSJ; | |
| 47 | - /** 大间隔原因*/ | |
| 48 | - private String REPORT_DJGYY; | |
| 49 | - /** 突发事件*/ | |
| 50 | - private String REPORT_TFSJ; | |
| 51 | - /** 影响时间*/ | |
| 52 | - private String REPORT_YXSJ; | |
| 53 | - /** 影响班次数*/ | |
| 54 | - private String REPORT_YXBC; | |
| 55 | - /** 调整措施*/ | |
| 56 | - private String REPORT_TZCS; | |
| 57 | - /** 报案事故编号*/ | |
| 58 | - private String REPORT_SGBH; | |
| 59 | - /** 车辆自编号*/ | |
| 60 | - private String REPORT_ZBH; | |
| 61 | - /** 车辆牌照号*/ | |
| 62 | - private String REPORT_PZH; | |
| 63 | - /** 驾驶员*/ | |
| 64 | - private String REPORT_JSY; | |
| 65 | - /** 事故发生时间*/ | |
| 66 | - private String REPORT_SGSJ; | |
| 67 | - /** 事故发生地点*/ | |
| 68 | - private String REPORT_SGDD; | |
| 69 | - /** 行驶方向*/ | |
| 70 | - private String REPORT_XSFX; | |
| 71 | - /** 事故对象*/ | |
| 72 | - private String REPORT_SGDX; | |
| 73 | - /** 对象车牌照号*/ | |
| 74 | - private String REPORT_DXPZH; | |
| 75 | - /** 事故概况*/ | |
| 76 | - private String REPORT_SGGK; | |
| 77 | - /** 受伤人数*/ | |
| 78 | - private String REPORT_SSRS; | |
| 79 | - /** 死亡人数*/ | |
| 80 | - private String REPORT_SWRS; | |
| 81 | - /** 报告人 */ | |
| 82 | - private String REPORT_BGR; | |
| 83 | - /** 报告人电话 */ | |
| 84 | - private String REPORT_BGRDH; | |
| 85 | - /** 备注 */ | |
| 86 | - private String REPORT_BZ; | |
| 87 | - /** 路段*/ | |
| 88 | - private String REPORT_ROAD; | |
| 89 | - /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */ | |
| 90 | - private String STATUS; | |
| 91 | - /** 创建人*/ | |
| 92 | - private String CREATE_BY; | |
| 93 | - /** 创建时间 */ | |
| 94 | - @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 95 | - private Date CREATE_DATE; | |
| 96 | - /** 修改人*/ | |
| 97 | - private String UPDATE_BY; | |
| 98 | - /** 修改时间*/ | |
| 99 | - @Column(name = "UPDATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 100 | - private Date UPDATE_DATE; | |
| 101 | - | |
| 102 | - public long getID() { | |
| 103 | - return ID; | |
| 104 | - } | |
| 105 | - | |
| 106 | - public void setID(long ID) { | |
| 107 | - this.ID = ID; | |
| 108 | - } | |
| 109 | - | |
| 110 | - public String getREPORT_TYPE() { | |
| 111 | - return REPORT_TYPE; | |
| 112 | - } | |
| 113 | - | |
| 114 | - public void setREPORT_TYPE(String REPORT_TYPE) { | |
| 115 | - this.REPORT_TYPE = REPORT_TYPE; | |
| 116 | - } | |
| 117 | - | |
| 118 | - public String getREPORT_GS() { | |
| 119 | - return REPORT_GS; | |
| 120 | - } | |
| 121 | - | |
| 122 | - public void setREPORT_GS(String REPORT_GS) { | |
| 123 | - this.REPORT_GS = REPORT_GS; | |
| 124 | - } | |
| 125 | - | |
| 126 | - public String getREPORT_FGS() { | |
| 127 | - return REPORT_FGS; | |
| 128 | - } | |
| 129 | - | |
| 130 | - public void setREPORT_FGS(String REPORT_FGS) { | |
| 131 | - this.REPORT_FGS = REPORT_FGS; | |
| 132 | - } | |
| 133 | - | |
| 134 | - public String getREPORT_GSNAME() { | |
| 135 | - return REPORT_GSNAME; | |
| 136 | - } | |
| 137 | - | |
| 138 | - public void setREPORT_GSNAME(String REPORT_GSNAME) { | |
| 139 | - this.REPORT_GSNAME = REPORT_GSNAME; | |
| 140 | - } | |
| 141 | - | |
| 142 | - public String getREPORT_FGSNAME() { | |
| 143 | - return REPORT_FGSNAME; | |
| 144 | - } | |
| 145 | - | |
| 146 | - public void setREPORT_FGSNAME(String REPORT_FGSNAME) { | |
| 147 | - this.REPORT_FGSNAME = REPORT_FGSNAME; | |
| 148 | - } | |
| 149 | - | |
| 150 | - public Date getREPORT_DATE() { | |
| 151 | - return REPORT_DATE; | |
| 152 | - } | |
| 153 | - | |
| 154 | - public void setREPORT_DATE(Date REPORT_DATE) { | |
| 155 | - this.REPORT_DATE = REPORT_DATE; | |
| 156 | - } | |
| 157 | - | |
| 158 | - public String getREPORT_BBR() { | |
| 159 | - return REPORT_BBR; | |
| 160 | - } | |
| 161 | - | |
| 162 | - public void setREPORT_BBR(String REPORT_BBR) { | |
| 163 | - this.REPORT_BBR = REPORT_BBR; | |
| 164 | - } | |
| 165 | - | |
| 166 | - public String getREPORT_XL() { | |
| 167 | - return REPORT_XL; | |
| 168 | - } | |
| 169 | - | |
| 170 | - public void setREPORT_XL(String REPORT_XL) { | |
| 171 | - this.REPORT_XL = REPORT_XL; | |
| 172 | - } | |
| 173 | - | |
| 174 | - public String getREPORT_XLNAME() { | |
| 175 | - return REPORT_XLNAME; | |
| 176 | - } | |
| 177 | - | |
| 178 | - public void setREPORT_XLNAME(String REPORT_XLNAME) { | |
| 179 | - this.REPORT_XLNAME = REPORT_XLNAME; | |
| 180 | - } | |
| 181 | - | |
| 182 | - public String getREPORT_STATION() { | |
| 183 | - return REPORT_STATION; | |
| 184 | - } | |
| 185 | - | |
| 186 | - public void setREPORT_STATION(String REPORT_STATION) { | |
| 187 | - this.REPORT_STATION = REPORT_STATION; | |
| 188 | - } | |
| 189 | - | |
| 190 | - public String getREPORT_DWSBBM() { | |
| 191 | - return REPORT_DWSBBM; | |
| 192 | - } | |
| 193 | - | |
| 194 | - public void setREPORT_DWSBBM(String REPORT_DWSBBM) { | |
| 195 | - this.REPORT_DWSBBM = REPORT_DWSBBM; | |
| 196 | - } | |
| 197 | - | |
| 198 | - public String getREPORT_DWSBSJ() { | |
| 199 | - return REPORT_DWSBSJ; | |
| 200 | - } | |
| 201 | - | |
| 202 | - public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) { | |
| 203 | - this.REPORT_DWSBSJ = REPORT_DWSBSJ; | |
| 204 | - } | |
| 205 | - | |
| 206 | - public String getREPORT_YWSJ() { | |
| 207 | - return REPORT_YWSJ; | |
| 208 | - } | |
| 209 | - | |
| 210 | - public void setREPORT_YWSJ(String REPORT_YWSJ) { | |
| 211 | - this.REPORT_YWSJ = REPORT_YWSJ; | |
| 212 | - } | |
| 213 | - | |
| 214 | - public String getREPORT_SMBWD() { | |
| 215 | - return REPORT_SMBWD; | |
| 216 | - } | |
| 217 | - | |
| 218 | - public void setREPORT_SMBWD(String REPORT_SMBWD) { | |
| 219 | - this.REPORT_SMBWD = REPORT_SMBWD; | |
| 220 | - } | |
| 221 | - | |
| 222 | - public String getREPORT_DJGSJ() { | |
| 223 | - return REPORT_DJGSJ; | |
| 224 | - } | |
| 225 | - | |
| 226 | - public void setREPORT_DJGSJ(String REPORT_DJGSJ) { | |
| 227 | - this.REPORT_DJGSJ = REPORT_DJGSJ; | |
| 228 | - } | |
| 229 | - | |
| 230 | - public String getREPORT_DJGYY() { | |
| 231 | - return REPORT_DJGYY; | |
| 232 | - } | |
| 233 | - | |
| 234 | - public void setREPORT_DJGYY(String REPORT_DJGYY) { | |
| 235 | - this.REPORT_DJGYY = REPORT_DJGYY; | |
| 236 | - } | |
| 237 | - | |
| 238 | - public String getREPORT_TFSJ() { | |
| 239 | - return REPORT_TFSJ; | |
| 240 | - } | |
| 241 | - | |
| 242 | - public void setREPORT_TFSJ(String REPORT_TFSJ) { | |
| 243 | - this.REPORT_TFSJ = REPORT_TFSJ; | |
| 244 | - } | |
| 245 | - | |
| 246 | - public String getREPORT_YXSJ() { | |
| 247 | - return REPORT_YXSJ; | |
| 248 | - } | |
| 249 | - | |
| 250 | - public void setREPORT_YXSJ(String REPORT_YXSJ) { | |
| 251 | - this.REPORT_YXSJ = REPORT_YXSJ; | |
| 252 | - } | |
| 253 | - | |
| 254 | - public String getREPORT_YXBC() { | |
| 255 | - return REPORT_YXBC; | |
| 256 | - } | |
| 257 | - | |
| 258 | - public void setREPORT_YXBC(String REPORT_YXBC) { | |
| 259 | - this.REPORT_YXBC = REPORT_YXBC; | |
| 260 | - } | |
| 261 | - | |
| 262 | - public String getREPORT_TZCS() { | |
| 263 | - return REPORT_TZCS; | |
| 264 | - } | |
| 265 | - | |
| 266 | - public void setREPORT_TZCS(String REPORT_TZCS) { | |
| 267 | - this.REPORT_TZCS = REPORT_TZCS; | |
| 268 | - } | |
| 269 | - | |
| 270 | - public String getREPORT_SGBH() { | |
| 271 | - return REPORT_SGBH; | |
| 272 | - } | |
| 273 | - | |
| 274 | - public void setREPORT_SGBH(String REPORT_SGBH) { | |
| 275 | - this.REPORT_SGBH = REPORT_SGBH; | |
| 276 | - } | |
| 277 | - | |
| 278 | - public String getREPORT_ZBH() { | |
| 279 | - return REPORT_ZBH; | |
| 280 | - } | |
| 281 | - | |
| 282 | - public void setREPORT_ZBH(String REPORT_ZBH) { | |
| 283 | - this.REPORT_ZBH = REPORT_ZBH; | |
| 284 | - } | |
| 285 | - | |
| 286 | - public String getREPORT_PZH() { | |
| 287 | - return REPORT_PZH; | |
| 288 | - } | |
| 289 | - | |
| 290 | - public void setREPORT_PZH(String REPORT_PZH) { | |
| 291 | - this.REPORT_PZH = REPORT_PZH; | |
| 292 | - } | |
| 293 | - | |
| 294 | - public String getREPORT_JSY() { | |
| 295 | - return REPORT_JSY; | |
| 296 | - } | |
| 297 | - | |
| 298 | - public void setREPORT_JSY(String REPORT_JSY) { | |
| 299 | - this.REPORT_JSY = REPORT_JSY; | |
| 300 | - } | |
| 301 | - | |
| 302 | - public String getREPORT_SGSJ() { | |
| 303 | - return REPORT_SGSJ; | |
| 304 | - } | |
| 305 | - | |
| 306 | - public void setREPORT_SGSJ(String REPORT_SGSJ) { | |
| 307 | - this.REPORT_SGSJ = REPORT_SGSJ; | |
| 308 | - } | |
| 309 | - | |
| 310 | - public String getREPORT_SGDD() { | |
| 311 | - return REPORT_SGDD; | |
| 312 | - } | |
| 313 | - | |
| 314 | - public void setREPORT_SGDD(String REPORT_SGDD) { | |
| 315 | - this.REPORT_SGDD = REPORT_SGDD; | |
| 316 | - } | |
| 317 | - | |
| 318 | - public String getREPORT_XSFX() { | |
| 319 | - return REPORT_XSFX; | |
| 320 | - } | |
| 321 | - | |
| 322 | - public void setREPORT_XSFX(String REPORT_XSFX) { | |
| 323 | - this.REPORT_XSFX = REPORT_XSFX; | |
| 324 | - } | |
| 325 | - | |
| 326 | - public String getREPORT_SGDX() { | |
| 327 | - return REPORT_SGDX; | |
| 328 | - } | |
| 329 | - | |
| 330 | - public void setREPORT_SGDX(String REPORT_SGDX) { | |
| 331 | - this.REPORT_SGDX = REPORT_SGDX; | |
| 332 | - } | |
| 333 | - | |
| 334 | - public String getREPORT_DXPZH() { | |
| 335 | - return REPORT_DXPZH; | |
| 336 | - } | |
| 337 | - | |
| 338 | - public void setREPORT_DXPZH(String REPORT_DXPZH) { | |
| 339 | - this.REPORT_DXPZH = REPORT_DXPZH; | |
| 340 | - } | |
| 341 | - | |
| 342 | - public String getREPORT_SGGK() { | |
| 343 | - return REPORT_SGGK; | |
| 344 | - } | |
| 345 | - | |
| 346 | - public void setREPORT_SGGK(String REPORT_SGGK) { | |
| 347 | - this.REPORT_SGGK = REPORT_SGGK; | |
| 348 | - } | |
| 349 | - | |
| 350 | - public String getREPORT_SSRS() { | |
| 351 | - return REPORT_SSRS; | |
| 352 | - } | |
| 353 | - | |
| 354 | - public void setREPORT_SSRS(String REPORT_SSRS) { | |
| 355 | - this.REPORT_SSRS = REPORT_SSRS; | |
| 356 | - } | |
| 357 | - | |
| 358 | - public String getREPORT_SWRS() { | |
| 359 | - return REPORT_SWRS; | |
| 360 | - } | |
| 361 | - | |
| 362 | - public void setREPORT_SWRS(String REPORT_SWRS) { | |
| 363 | - this.REPORT_SWRS = REPORT_SWRS; | |
| 364 | - } | |
| 365 | - | |
| 366 | - public String getREPORT_BGR() { | |
| 367 | - return REPORT_BGR; | |
| 368 | - } | |
| 369 | - | |
| 370 | - public void setREPORT_BGR(String REPORT_BGR) { | |
| 371 | - this.REPORT_BGR = REPORT_BGR; | |
| 372 | - } | |
| 373 | - | |
| 374 | - public String getREPORT_BGRDH() { | |
| 375 | - return REPORT_BGRDH; | |
| 376 | - } | |
| 377 | - | |
| 378 | - public void setREPORT_BGRDH(String REPORT_BGRDH) { | |
| 379 | - this.REPORT_BGRDH = REPORT_BGRDH; | |
| 380 | - } | |
| 381 | - | |
| 382 | - public String getREPORT_BZ() { | |
| 383 | - return REPORT_BZ; | |
| 384 | - } | |
| 385 | - | |
| 386 | - public void setREPORT_BZ(String REPORT_BZ) { | |
| 387 | - this.REPORT_BZ = REPORT_BZ; | |
| 388 | - } | |
| 389 | - | |
| 390 | - public String getCREATE_BY() { | |
| 391 | - return CREATE_BY; | |
| 392 | - } | |
| 393 | - | |
| 394 | - public void setCREATE_BY(String CREATE_BY) { | |
| 395 | - this.CREATE_BY = CREATE_BY; | |
| 396 | - } | |
| 397 | - | |
| 398 | - public Date getCREATE_DATE() { | |
| 399 | - return CREATE_DATE; | |
| 400 | - } | |
| 401 | - | |
| 402 | - public void setCREATE_DATE(Date CREATE_DATE) { | |
| 403 | - this.CREATE_DATE = CREATE_DATE; | |
| 404 | - } | |
| 405 | - | |
| 406 | - public String getUPDATE_BY() { | |
| 407 | - return UPDATE_BY; | |
| 408 | - } | |
| 409 | - | |
| 410 | - public void setUPDATE_BY(String UPDATE_BY) { | |
| 411 | - this.UPDATE_BY = UPDATE_BY; | |
| 412 | - } | |
| 413 | - | |
| 414 | - public Date getUPDATE_DATE() { | |
| 415 | - return UPDATE_DATE; | |
| 416 | - } | |
| 417 | - | |
| 418 | - public void setUPDATE_DATE(Date UPDATE_DATE) { | |
| 419 | - this.UPDATE_DATE = UPDATE_DATE; | |
| 420 | - } | |
| 421 | - | |
| 422 | - public String getREPORT_ROAD() { | |
| 423 | - return REPORT_ROAD; | |
| 424 | - } | |
| 425 | - | |
| 426 | - public void setREPORT_ROAD(String REPORT_ROAD) { | |
| 427 | - this.REPORT_ROAD = REPORT_ROAD; | |
| 428 | - } | |
| 429 | - | |
| 430 | - public String getSTATUS() { | |
| 431 | - return STATUS; | |
| 432 | - } | |
| 433 | - | |
| 434 | - public void setSTATUS(String STATUS) { | |
| 435 | - this.STATUS = STATUS; | |
| 436 | - } | |
| 437 | - | |
| 438 | - @Override | |
| 439 | - public String toString() { | |
| 440 | - DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 441 | - return "{" + | |
| 442 | - "ID:'" + ID + '\'' + | |
| 443 | - ", REPORT_TYPE:'" + REPORT_TYPE + '\'' + | |
| 444 | - ", REPORT_GS:'" + REPORT_GS + '\'' + | |
| 445 | - ", REPORT_FGS:'" + REPORT_FGS + '\'' + | |
| 446 | - ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' + | |
| 447 | - ", REPORT_BBR:'" + REPORT_BBR + '\'' + | |
| 448 | - ", REPORT_XL:'" + REPORT_XL + '\'' + | |
| 449 | - ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' + | |
| 450 | - ", REPORT_STATION:'" + REPORT_STATION + '\'' + | |
| 451 | - ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' + | |
| 452 | - ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' + | |
| 453 | - ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' + | |
| 454 | - ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' + | |
| 455 | - ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' + | |
| 456 | - ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' + | |
| 457 | - ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' + | |
| 458 | - ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' + | |
| 459 | - ", REPORT_YXBC:'" + REPORT_YXBC + '\'' + | |
| 460 | - ", REPORT_TZCS:'" + REPORT_TZCS + '\'' + | |
| 461 | - ", REPORT_SGBH:'" + REPORT_SGBH + '\'' + | |
| 462 | - ", REPORT_ZBH:'" + REPORT_ZBH + '\'' + | |
| 463 | - ", REPORT_PZH:'" + REPORT_PZH + '\'' + | |
| 464 | - ", REPORT_JSY:'" + REPORT_JSY + '\'' + | |
| 465 | - ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' + | |
| 466 | - ", REPORT_SGDD:'" + REPORT_SGDD + '\'' + | |
| 467 | - ", REPORT_XSFX:'" + REPORT_XSFX + '\'' + | |
| 468 | - ", REPORT_SGDX:'" + REPORT_SGDX + '\'' + | |
| 469 | - ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' + | |
| 470 | - ", REPORT_SGGK:'" + REPORT_SGGK + '\'' + | |
| 471 | - ", REPORT_SSRS:'" + REPORT_SSRS + '\'' + | |
| 472 | - ", REPORT_SWRS:'" + REPORT_SWRS + '\'' + | |
| 473 | - ", REPORT_BGR:'" + REPORT_BGR + '\'' + | |
| 474 | - ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' + | |
| 475 | - ", REPORT_BZ:'" + REPORT_BZ + '\'' + | |
| 476 | - ", CREATE_BY:'" + CREATE_BY + '\'' + | |
| 477 | - ", CREATE_DATE:" + CREATE_DATE + | |
| 478 | - ", UPDATE_BY:'" + UPDATE_BY + '\'' + | |
| 479 | - ", UPDATE_DATE:" + UPDATE_DATE + | |
| 480 | - ", REPORT_ROAD:'" + REPORT_ROAD + '\'' + | |
| 481 | - ", STATUS:'" + STATUS + '\'' + | |
| 482 | - '}'; | |
| 483 | - } | |
| 484 | -} | |
| 1 | +package com.bsth.data.report_register.entity; | |
| 2 | + | |
| 3 | +import javax.persistence.*; | |
| 4 | +import java.text.DateFormat; | |
| 5 | +import java.text.SimpleDateFormat; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | + | |
| 9 | +@Entity | |
| 10 | +@Table(name = "bsth_t_report") | |
| 11 | +public class ReportRegister { | |
| 12 | + | |
| 13 | + @Id | |
| 14 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 15 | + private long ID; | |
| 16 | + | |
| 17 | + /** 类型,1:首末班误点,2:大间隔,3:突发事件,4:事故,5:其他,6:咨询,7:绕改道 */ | |
| 18 | + private String REPORT_TYPE; | |
| 19 | + /** 公司 */ | |
| 20 | + private String REPORT_GS; | |
| 21 | + /** 分公司 */ | |
| 22 | + private String REPORT_FGS; | |
| 23 | + /** 公司名 */ | |
| 24 | + private String REPORT_GSNAME; | |
| 25 | + /** 分公司名 */ | |
| 26 | + private String REPORT_FGSNAME; | |
| 27 | + /** 时间*/ | |
| 28 | + private Date REPORT_DATE; | |
| 29 | + /** 报备人*/ | |
| 30 | + private String REPORT_BBR; | |
| 31 | + /** 线路编码 */ | |
| 32 | + private String REPORT_XL; | |
| 33 | + /** 线路名*/ | |
| 34 | + private String REPORT_XLNAME; | |
| 35 | + /** 站点*/ | |
| 36 | + private String REPORT_STATION; | |
| 37 | + /** 对外上报部门*/ | |
| 38 | + private String REPORT_DWSBBM; | |
| 39 | + /** 对外上报时间*/ | |
| 40 | + private String REPORT_DWSBSJ; | |
| 41 | + /** 延误时间*/ | |
| 42 | + private String REPORT_YWSJ; | |
| 43 | + /** 首末班误点原因*/ | |
| 44 | + private String REPORT_SMBWD; | |
| 45 | + /** 大间隔时间*/ | |
| 46 | + private String REPORT_DJGSJ; | |
| 47 | + /** 大间隔原因*/ | |
| 48 | + private String REPORT_DJGYY; | |
| 49 | + /** 突发事件*/ | |
| 50 | + private String REPORT_TFSJ; | |
| 51 | + /** 影响时间*/ | |
| 52 | + private String REPORT_YXSJ; | |
| 53 | + /** 影响班次数*/ | |
| 54 | + private String REPORT_YXBC; | |
| 55 | + /** 调整措施*/ | |
| 56 | + private String REPORT_TZCS; | |
| 57 | + /** 报案事故编号*/ | |
| 58 | + private String REPORT_SGBH; | |
| 59 | + /** 车辆自编号*/ | |
| 60 | + private String REPORT_ZBH; | |
| 61 | + /** 车辆牌照号*/ | |
| 62 | + private String REPORT_PZH; | |
| 63 | + /** 驾驶员*/ | |
| 64 | + private String REPORT_JSY; | |
| 65 | + /** 事故发生时间*/ | |
| 66 | + private String REPORT_SGSJ; | |
| 67 | + /** 事故发生地点*/ | |
| 68 | + private String REPORT_SGDD; | |
| 69 | + /** 行驶方向*/ | |
| 70 | + private String REPORT_XSFX; | |
| 71 | + /** 事故对象*/ | |
| 72 | + private String REPORT_SGDX; | |
| 73 | + /** 对象车牌照号*/ | |
| 74 | + private String REPORT_DXPZH; | |
| 75 | + /** 事故概况*/ | |
| 76 | + private String REPORT_SGGK; | |
| 77 | + /** 受伤人数*/ | |
| 78 | + private String REPORT_SSRS; | |
| 79 | + /** 死亡人数*/ | |
| 80 | + private String REPORT_SWRS; | |
| 81 | + /** 报告人 */ | |
| 82 | + private String REPORT_BGR; | |
| 83 | + /** 报告人电话 */ | |
| 84 | + private String REPORT_BGRDH; | |
| 85 | + /** 备注 */ | |
| 86 | + private String REPORT_BZ; | |
| 87 | + /** 路段*/ | |
| 88 | + private String REPORT_ROAD; | |
| 89 | + /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */ | |
| 90 | + private String STATUS; | |
| 91 | + /** 创建人*/ | |
| 92 | + private String CREATE_BY; | |
| 93 | + /** 创建时间 */ | |
| 94 | + @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 95 | + private Date CREATE_DATE; | |
| 96 | + /** 修改人*/ | |
| 97 | + private String UPDATE_BY; | |
| 98 | + /** 修改时间*/ | |
| 99 | + @Column(name = "UPDATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 100 | + private Date UPDATE_DATE; | |
| 101 | + | |
| 102 | + public long getID() { | |
| 103 | + return ID; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setID(long ID) { | |
| 107 | + this.ID = ID; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public String getREPORT_TYPE() { | |
| 111 | + return REPORT_TYPE; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setREPORT_TYPE(String REPORT_TYPE) { | |
| 115 | + this.REPORT_TYPE = REPORT_TYPE; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getREPORT_GS() { | |
| 119 | + return REPORT_GS; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setREPORT_GS(String REPORT_GS) { | |
| 123 | + this.REPORT_GS = REPORT_GS; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public String getREPORT_FGS() { | |
| 127 | + return REPORT_FGS; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setREPORT_FGS(String REPORT_FGS) { | |
| 131 | + this.REPORT_FGS = REPORT_FGS; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public String getREPORT_GSNAME() { | |
| 135 | + return REPORT_GSNAME; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setREPORT_GSNAME(String REPORT_GSNAME) { | |
| 139 | + this.REPORT_GSNAME = REPORT_GSNAME; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public String getREPORT_FGSNAME() { | |
| 143 | + return REPORT_FGSNAME; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setREPORT_FGSNAME(String REPORT_FGSNAME) { | |
| 147 | + this.REPORT_FGSNAME = REPORT_FGSNAME; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public Date getREPORT_DATE() { | |
| 151 | + return REPORT_DATE; | |
| 152 | + } | |
| 153 | + | |
| 154 | + public void setREPORT_DATE(Date REPORT_DATE) { | |
| 155 | + this.REPORT_DATE = REPORT_DATE; | |
| 156 | + } | |
| 157 | + | |
| 158 | + public String getREPORT_BBR() { | |
| 159 | + return REPORT_BBR; | |
| 160 | + } | |
| 161 | + | |
| 162 | + public void setREPORT_BBR(String REPORT_BBR) { | |
| 163 | + this.REPORT_BBR = REPORT_BBR; | |
| 164 | + } | |
| 165 | + | |
| 166 | + public String getREPORT_XL() { | |
| 167 | + return REPORT_XL; | |
| 168 | + } | |
| 169 | + | |
| 170 | + public void setREPORT_XL(String REPORT_XL) { | |
| 171 | + this.REPORT_XL = REPORT_XL; | |
| 172 | + } | |
| 173 | + | |
| 174 | + public String getREPORT_XLNAME() { | |
| 175 | + return REPORT_XLNAME; | |
| 176 | + } | |
| 177 | + | |
| 178 | + public void setREPORT_XLNAME(String REPORT_XLNAME) { | |
| 179 | + this.REPORT_XLNAME = REPORT_XLNAME; | |
| 180 | + } | |
| 181 | + | |
| 182 | + public String getREPORT_STATION() { | |
| 183 | + return REPORT_STATION; | |
| 184 | + } | |
| 185 | + | |
| 186 | + public void setREPORT_STATION(String REPORT_STATION) { | |
| 187 | + this.REPORT_STATION = REPORT_STATION; | |
| 188 | + } | |
| 189 | + | |
| 190 | + public String getREPORT_DWSBBM() { | |
| 191 | + return REPORT_DWSBBM; | |
| 192 | + } | |
| 193 | + | |
| 194 | + public void setREPORT_DWSBBM(String REPORT_DWSBBM) { | |
| 195 | + this.REPORT_DWSBBM = REPORT_DWSBBM; | |
| 196 | + } | |
| 197 | + | |
| 198 | + public String getREPORT_DWSBSJ() { | |
| 199 | + return REPORT_DWSBSJ; | |
| 200 | + } | |
| 201 | + | |
| 202 | + public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) { | |
| 203 | + this.REPORT_DWSBSJ = REPORT_DWSBSJ; | |
| 204 | + } | |
| 205 | + | |
| 206 | + public String getREPORT_YWSJ() { | |
| 207 | + return REPORT_YWSJ; | |
| 208 | + } | |
| 209 | + | |
| 210 | + public void setREPORT_YWSJ(String REPORT_YWSJ) { | |
| 211 | + this.REPORT_YWSJ = REPORT_YWSJ; | |
| 212 | + } | |
| 213 | + | |
| 214 | + public String getREPORT_SMBWD() { | |
| 215 | + return REPORT_SMBWD; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setREPORT_SMBWD(String REPORT_SMBWD) { | |
| 219 | + this.REPORT_SMBWD = REPORT_SMBWD; | |
| 220 | + } | |
| 221 | + | |
| 222 | + public String getREPORT_DJGSJ() { | |
| 223 | + return REPORT_DJGSJ; | |
| 224 | + } | |
| 225 | + | |
| 226 | + public void setREPORT_DJGSJ(String REPORT_DJGSJ) { | |
| 227 | + this.REPORT_DJGSJ = REPORT_DJGSJ; | |
| 228 | + } | |
| 229 | + | |
| 230 | + public String getREPORT_DJGYY() { | |
| 231 | + return REPORT_DJGYY; | |
| 232 | + } | |
| 233 | + | |
| 234 | + public void setREPORT_DJGYY(String REPORT_DJGYY) { | |
| 235 | + this.REPORT_DJGYY = REPORT_DJGYY; | |
| 236 | + } | |
| 237 | + | |
| 238 | + public String getREPORT_TFSJ() { | |
| 239 | + return REPORT_TFSJ; | |
| 240 | + } | |
| 241 | + | |
| 242 | + public void setREPORT_TFSJ(String REPORT_TFSJ) { | |
| 243 | + this.REPORT_TFSJ = REPORT_TFSJ; | |
| 244 | + } | |
| 245 | + | |
| 246 | + public String getREPORT_YXSJ() { | |
| 247 | + return REPORT_YXSJ; | |
| 248 | + } | |
| 249 | + | |
| 250 | + public void setREPORT_YXSJ(String REPORT_YXSJ) { | |
| 251 | + this.REPORT_YXSJ = REPORT_YXSJ; | |
| 252 | + } | |
| 253 | + | |
| 254 | + public String getREPORT_YXBC() { | |
| 255 | + return REPORT_YXBC; | |
| 256 | + } | |
| 257 | + | |
| 258 | + public void setREPORT_YXBC(String REPORT_YXBC) { | |
| 259 | + this.REPORT_YXBC = REPORT_YXBC; | |
| 260 | + } | |
| 261 | + | |
| 262 | + public String getREPORT_TZCS() { | |
| 263 | + return REPORT_TZCS; | |
| 264 | + } | |
| 265 | + | |
| 266 | + public void setREPORT_TZCS(String REPORT_TZCS) { | |
| 267 | + this.REPORT_TZCS = REPORT_TZCS; | |
| 268 | + } | |
| 269 | + | |
| 270 | + public String getREPORT_SGBH() { | |
| 271 | + return REPORT_SGBH; | |
| 272 | + } | |
| 273 | + | |
| 274 | + public void setREPORT_SGBH(String REPORT_SGBH) { | |
| 275 | + this.REPORT_SGBH = REPORT_SGBH; | |
| 276 | + } | |
| 277 | + | |
| 278 | + public String getREPORT_ZBH() { | |
| 279 | + return REPORT_ZBH; | |
| 280 | + } | |
| 281 | + | |
| 282 | + public void setREPORT_ZBH(String REPORT_ZBH) { | |
| 283 | + this.REPORT_ZBH = REPORT_ZBH; | |
| 284 | + } | |
| 285 | + | |
| 286 | + public String getREPORT_PZH() { | |
| 287 | + return REPORT_PZH; | |
| 288 | + } | |
| 289 | + | |
| 290 | + public void setREPORT_PZH(String REPORT_PZH) { | |
| 291 | + this.REPORT_PZH = REPORT_PZH; | |
| 292 | + } | |
| 293 | + | |
| 294 | + public String getREPORT_JSY() { | |
| 295 | + return REPORT_JSY; | |
| 296 | + } | |
| 297 | + | |
| 298 | + public void setREPORT_JSY(String REPORT_JSY) { | |
| 299 | + this.REPORT_JSY = REPORT_JSY; | |
| 300 | + } | |
| 301 | + | |
| 302 | + public String getREPORT_SGSJ() { | |
| 303 | + return REPORT_SGSJ; | |
| 304 | + } | |
| 305 | + | |
| 306 | + public void setREPORT_SGSJ(String REPORT_SGSJ) { | |
| 307 | + this.REPORT_SGSJ = REPORT_SGSJ; | |
| 308 | + } | |
| 309 | + | |
| 310 | + public String getREPORT_SGDD() { | |
| 311 | + return REPORT_SGDD; | |
| 312 | + } | |
| 313 | + | |
| 314 | + public void setREPORT_SGDD(String REPORT_SGDD) { | |
| 315 | + this.REPORT_SGDD = REPORT_SGDD; | |
| 316 | + } | |
| 317 | + | |
| 318 | + public String getREPORT_XSFX() { | |
| 319 | + return REPORT_XSFX; | |
| 320 | + } | |
| 321 | + | |
| 322 | + public void setREPORT_XSFX(String REPORT_XSFX) { | |
| 323 | + this.REPORT_XSFX = REPORT_XSFX; | |
| 324 | + } | |
| 325 | + | |
| 326 | + public String getREPORT_SGDX() { | |
| 327 | + return REPORT_SGDX; | |
| 328 | + } | |
| 329 | + | |
| 330 | + public void setREPORT_SGDX(String REPORT_SGDX) { | |
| 331 | + this.REPORT_SGDX = REPORT_SGDX; | |
| 332 | + } | |
| 333 | + | |
| 334 | + public String getREPORT_DXPZH() { | |
| 335 | + return REPORT_DXPZH; | |
| 336 | + } | |
| 337 | + | |
| 338 | + public void setREPORT_DXPZH(String REPORT_DXPZH) { | |
| 339 | + this.REPORT_DXPZH = REPORT_DXPZH; | |
| 340 | + } | |
| 341 | + | |
| 342 | + public String getREPORT_SGGK() { | |
| 343 | + return REPORT_SGGK; | |
| 344 | + } | |
| 345 | + | |
| 346 | + public void setREPORT_SGGK(String REPORT_SGGK) { | |
| 347 | + this.REPORT_SGGK = REPORT_SGGK; | |
| 348 | + } | |
| 349 | + | |
| 350 | + public String getREPORT_SSRS() { | |
| 351 | + return REPORT_SSRS; | |
| 352 | + } | |
| 353 | + | |
| 354 | + public void setREPORT_SSRS(String REPORT_SSRS) { | |
| 355 | + this.REPORT_SSRS = REPORT_SSRS; | |
| 356 | + } | |
| 357 | + | |
| 358 | + public String getREPORT_SWRS() { | |
| 359 | + return REPORT_SWRS; | |
| 360 | + } | |
| 361 | + | |
| 362 | + public void setREPORT_SWRS(String REPORT_SWRS) { | |
| 363 | + this.REPORT_SWRS = REPORT_SWRS; | |
| 364 | + } | |
| 365 | + | |
| 366 | + public String getREPORT_BGR() { | |
| 367 | + return REPORT_BGR; | |
| 368 | + } | |
| 369 | + | |
| 370 | + public void setREPORT_BGR(String REPORT_BGR) { | |
| 371 | + this.REPORT_BGR = REPORT_BGR; | |
| 372 | + } | |
| 373 | + | |
| 374 | + public String getREPORT_BGRDH() { | |
| 375 | + return REPORT_BGRDH; | |
| 376 | + } | |
| 377 | + | |
| 378 | + public void setREPORT_BGRDH(String REPORT_BGRDH) { | |
| 379 | + this.REPORT_BGRDH = REPORT_BGRDH; | |
| 380 | + } | |
| 381 | + | |
| 382 | + public String getREPORT_BZ() { | |
| 383 | + return REPORT_BZ; | |
| 384 | + } | |
| 385 | + | |
| 386 | + public void setREPORT_BZ(String REPORT_BZ) { | |
| 387 | + this.REPORT_BZ = REPORT_BZ; | |
| 388 | + } | |
| 389 | + | |
| 390 | + public String getCREATE_BY() { | |
| 391 | + return CREATE_BY; | |
| 392 | + } | |
| 393 | + | |
| 394 | + public void setCREATE_BY(String CREATE_BY) { | |
| 395 | + this.CREATE_BY = CREATE_BY; | |
| 396 | + } | |
| 397 | + | |
| 398 | + public Date getCREATE_DATE() { | |
| 399 | + return CREATE_DATE; | |
| 400 | + } | |
| 401 | + | |
| 402 | + public void setCREATE_DATE(Date CREATE_DATE) { | |
| 403 | + this.CREATE_DATE = CREATE_DATE; | |
| 404 | + } | |
| 405 | + | |
| 406 | + public String getUPDATE_BY() { | |
| 407 | + return UPDATE_BY; | |
| 408 | + } | |
| 409 | + | |
| 410 | + public void setUPDATE_BY(String UPDATE_BY) { | |
| 411 | + this.UPDATE_BY = UPDATE_BY; | |
| 412 | + } | |
| 413 | + | |
| 414 | + public Date getUPDATE_DATE() { | |
| 415 | + return UPDATE_DATE; | |
| 416 | + } | |
| 417 | + | |
| 418 | + public void setUPDATE_DATE(Date UPDATE_DATE) { | |
| 419 | + this.UPDATE_DATE = UPDATE_DATE; | |
| 420 | + } | |
| 421 | + | |
| 422 | + public String getREPORT_ROAD() { | |
| 423 | + return REPORT_ROAD; | |
| 424 | + } | |
| 425 | + | |
| 426 | + public void setREPORT_ROAD(String REPORT_ROAD) { | |
| 427 | + this.REPORT_ROAD = REPORT_ROAD; | |
| 428 | + } | |
| 429 | + | |
| 430 | + public String getSTATUS() { | |
| 431 | + return STATUS; | |
| 432 | + } | |
| 433 | + | |
| 434 | + public void setSTATUS(String STATUS) { | |
| 435 | + this.STATUS = STATUS; | |
| 436 | + } | |
| 437 | + | |
| 438 | + @Override | |
| 439 | + public String toString() { | |
| 440 | + DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 441 | + return "{" + | |
| 442 | + "ID:'" + ID + '\'' + | |
| 443 | + ", REPORT_TYPE:'" + REPORT_TYPE + '\'' + | |
| 444 | + ", REPORT_GS:'" + REPORT_GS + '\'' + | |
| 445 | + ", REPORT_FGS:'" + REPORT_FGS + '\'' + | |
| 446 | + ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' + | |
| 447 | + ", REPORT_BBR:'" + REPORT_BBR + '\'' + | |
| 448 | + ", REPORT_XL:'" + REPORT_XL + '\'' + | |
| 449 | + ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' + | |
| 450 | + ", REPORT_STATION:'" + REPORT_STATION + '\'' + | |
| 451 | + ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' + | |
| 452 | + ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' + | |
| 453 | + ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' + | |
| 454 | + ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' + | |
| 455 | + ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' + | |
| 456 | + ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' + | |
| 457 | + ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' + | |
| 458 | + ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' + | |
| 459 | + ", REPORT_YXBC:'" + REPORT_YXBC + '\'' + | |
| 460 | + ", REPORT_TZCS:'" + REPORT_TZCS + '\'' + | |
| 461 | + ", REPORT_SGBH:'" + REPORT_SGBH + '\'' + | |
| 462 | + ", REPORT_ZBH:'" + REPORT_ZBH + '\'' + | |
| 463 | + ", REPORT_PZH:'" + REPORT_PZH + '\'' + | |
| 464 | + ", REPORT_JSY:'" + REPORT_JSY + '\'' + | |
| 465 | + ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' + | |
| 466 | + ", REPORT_SGDD:'" + REPORT_SGDD + '\'' + | |
| 467 | + ", REPORT_XSFX:'" + REPORT_XSFX + '\'' + | |
| 468 | + ", REPORT_SGDX:'" + REPORT_SGDX + '\'' + | |
| 469 | + ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' + | |
| 470 | + ", REPORT_SGGK:'" + REPORT_SGGK + '\'' + | |
| 471 | + ", REPORT_SSRS:'" + REPORT_SSRS + '\'' + | |
| 472 | + ", REPORT_SWRS:'" + REPORT_SWRS + '\'' + | |
| 473 | + ", REPORT_BGR:'" + REPORT_BGR + '\'' + | |
| 474 | + ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' + | |
| 475 | + ", REPORT_BZ:'" + REPORT_BZ + '\'' + | |
| 476 | + ", CREATE_BY:'" + CREATE_BY + '\'' + | |
| 477 | + ", CREATE_DATE:" + CREATE_DATE + | |
| 478 | + ", UPDATE_BY:'" + UPDATE_BY + '\'' + | |
| 479 | + ", UPDATE_DATE:" + UPDATE_DATE + | |
| 480 | + ", REPORT_ROAD:'" + REPORT_ROAD + '\'' + | |
| 481 | + ", STATUS:'" + STATUS + '\'' + | |
| 482 | + '}'; | |
| 483 | + } | |
| 484 | +} | ... | ... |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| 1 | -package com.bsth.service.oil.impl; | |
| 2 | - | |
| 3 | - | |
| 4 | - | |
| 5 | -import java.sql.ResultSet; | |
| 6 | -import java.sql.SQLException; | |
| 7 | -import java.text.DecimalFormat; | |
| 8 | -import java.text.ParseException; | |
| 9 | -import java.text.SimpleDateFormat; | |
| 10 | -import java.util.ArrayList; | |
| 11 | -import java.util.Calendar; | |
| 12 | -import java.util.Collections; | |
| 13 | -import java.util.Comparator; | |
| 14 | -import java.util.Date; | |
| 15 | -import java.util.HashMap; | |
| 16 | -import java.util.Iterator; | |
| 17 | -import java.util.List; | |
| 18 | -import java.util.Map; | |
| 19 | - | |
| 20 | -import javax.transaction.Transactional; | |
| 21 | - | |
| 22 | -import org.apache.commons.lang3.StringEscapeUtils; | |
| 23 | -import org.apache.commons.lang3.StringUtils; | |
| 24 | -import org.slf4j.Logger; | |
| 25 | -import org.slf4j.LoggerFactory; | |
| 26 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 27 | -import org.springframework.data.domain.Sort; | |
| 28 | -import org.springframework.data.domain.Sort.Direction; | |
| 29 | -import org.springframework.jdbc.core.JdbcTemplate; | |
| 30 | -import org.springframework.jdbc.core.RowMapper; | |
| 31 | -import org.springframework.stereotype.Service; | |
| 32 | - | |
| 33 | -import com.alibaba.fastjson.JSONArray; | |
| 34 | -import com.alibaba.fastjson.JSONObject; | |
| 35 | -import com.bsth.common.ResponseCode; | |
| 36 | -import com.bsth.data.BasicData; | |
| 37 | -import com.bsth.entity.Cars; | |
| 38 | -import com.bsth.entity.Line; | |
| 39 | -import com.bsth.entity.oil.Cdl; | |
| 40 | -import com.bsth.entity.oil.Cyl; | |
| 41 | -import com.bsth.entity.oil.Dlb; | |
| 42 | -import com.bsth.entity.oil.Jdl; | |
| 43 | -import com.bsth.entity.oil.Nylog; | |
| 44 | -import com.bsth.entity.oil.Ylxxb; | |
| 45 | -import com.bsth.entity.search.CustomerSpecs; | |
| 46 | -import com.bsth.entity.sys.SysUser; | |
| 47 | -import com.bsth.repository.CarsRepository; | |
| 48 | -import com.bsth.repository.oil.CdlRepository; | |
| 49 | -import com.bsth.repository.oil.CylRepository; | |
| 50 | -import com.bsth.repository.oil.DlbRepository; | |
| 51 | -import com.bsth.repository.oil.JdlRepository; | |
| 52 | -import com.bsth.repository.oil.NylogRepository; | |
| 53 | -import com.bsth.repository.oil.YlbRepository; | |
| 54 | -import com.bsth.repository.oil.YlxxbRepository; | |
| 55 | -import com.bsth.security.util.SecurityUtils; | |
| 56 | -import com.bsth.service.impl.BaseServiceImpl; | |
| 57 | -import com.bsth.service.oil.DlbService; | |
| 58 | -import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 59 | -import com.bsth.util.Arith; | |
| 60 | -import com.bsth.util.BatchSaveUtils; | |
| 61 | - | |
| 62 | -@Service | |
| 63 | -public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ | |
| 64 | - @Autowired | |
| 65 | - DlbRepository repository; | |
| 66 | - @Autowired | |
| 67 | - NylogRepository nylogRepository; | |
| 68 | - @Autowired | |
| 69 | - YlxxbRepository ylxxbRepository; | |
| 70 | - | |
| 71 | - @Autowired | |
| 72 | - CdlRepository cdlRepository; | |
| 73 | - @Autowired | |
| 74 | - JdlRepository jdlRepository; | |
| 75 | - @Autowired | |
| 76 | - CarsRepository carsRepository; | |
| 77 | - | |
| 78 | - @Autowired | |
| 79 | - ScheduleRealInfoService scheduleRealInfoService; | |
| 80 | - | |
| 81 | - @Autowired | |
| 82 | - JdbcTemplate jdbcTemplate; | |
| 83 | - | |
| 84 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 85 | - | |
| 86 | - @Transactional | |
| 87 | - @Override | |
| 88 | - public String obtainDsq() throws Exception{ | |
| 89 | - String result = "failure"; | |
| 90 | - List<Cars> carsList=carsRepository.findCars(); | |
| 91 | - Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 92 | - for (int i = 0; i < carsList.size(); i++) { | |
| 93 | - Cars c=carsList.get(i); | |
| 94 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 95 | - } | |
| 96 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 97 | - Date dNow = new Date(); //当前时间 | |
| 98 | - Date dBefore = new Date(); | |
| 99 | - Calendar calendar = Calendar.getInstance(); //得到日历 | |
| 100 | - calendar.setTime(dNow);//把当前时间赋给日历 | |
| 101 | - calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | |
| 102 | - dBefore = calendar.getTime(); //得到前一天的时间 | |
| 103 | - String rq=sdf.format(dBefore); | |
| 104 | -// String rq="2017-11-02"; | |
| 105 | - String line=""; | |
| 106 | - //保留两位小数 | |
| 107 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 108 | - // TODO Auto-generated method stub | |
| 109 | - Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 110 | - //当天DLB信息 | |
| 111 | - List<Dlb> dlList=repository.obtainDl(rq, "", "", line, "", "nbbm"); | |
| 112 | - //当天YLXXB信息 | |
| 113 | - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,""); | |
| 114 | - //当天加电信息表 | |
| 115 | - List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 116 | - //前一天所有车辆最后进场班次信息 | |
| 117 | -// List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); | |
| 118 | - List<Cdl> cdyList=cdlRepository.obtainCdl(); | |
| 119 | - //从排班表中计算出行驶的总里程 | |
| 120 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); | |
| 121 | - for(int x=0;x<listpb.size();x++){ | |
| 122 | - String type="add"; | |
| 123 | - boolean sfdc=false; | |
| 124 | - Map<String, Object> map=listpb.get(x); | |
| 125 | - if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 126 | - sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 127 | - }else{ | |
| 128 | - sfdc=false; | |
| 129 | - } | |
| 130 | - if(sfdc){ | |
| 131 | - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 132 | - Dlb t=new Dlb(); | |
| 133 | - for(int k=0;k<dlList.size();k++){ | |
| 134 | - Dlb t1=dlList.get(k); | |
| 135 | - if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 136 | - &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 137 | - &&t1.getXlbm().equals(map.get("xlBm").toString()) | |
| 138 | - &&t1.getLp().equals(map.get("lpName").toString())) | |
| 139 | - { | |
| 140 | - t=t1; | |
| 141 | - type="update"; | |
| 142 | - } | |
| 143 | - } | |
| 144 | - try { | |
| 145 | - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 146 | - Double jzl=0.0; | |
| 147 | - if(map.get("seqNumber").toString().equals("1")){ | |
| 148 | - boolean fage=true; | |
| 149 | -// for (int i = 0; i < dlListBe.size(); i++) { | |
| 150 | -// Dlb dlb=dlListBe.get(i); | |
| 151 | -// if(map.get("clZbh").toString().equals(dlb.getNbbm())){ | |
| 152 | -// t.setCzcd(dlb.getJzcd()); | |
| 153 | -// fage=false; | |
| 154 | -// break; | |
| 155 | -// } | |
| 156 | -// } | |
| 157 | - if(fage){ | |
| 158 | - for (int y = 0; y < cdyList.size(); y++) { | |
| 159 | - Cdl cdl=cdyList.get(y); | |
| 160 | - if(map.get("clZbh").toString().equals(cdl.getNbbm())){ | |
| 161 | - t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd()); | |
| 162 | - fage=false; | |
| 163 | - break; | |
| 164 | - } | |
| 165 | - } | |
| 166 | - } | |
| 167 | - if(fage){ | |
| 168 | - t.setCzcd(0.0); | |
| 169 | - } | |
| 170 | - | |
| 171 | - //手动导入没有驾驶员工号 | |
| 172 | - for (int i = 0; i < jdlList.size(); i++) { | |
| 173 | - Jdl jdl=jdlList.get(i); | |
| 174 | - if(map.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 175 | - &&map.get("jGh").toString().equals(jdl.getJsy())){ | |
| 176 | - jzl+=jdl.getJdl(); | |
| 177 | - } | |
| 178 | - } | |
| 179 | - } | |
| 180 | - | |
| 181 | - | |
| 182 | - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 183 | - for(int j=0;j<ylxxList.size();j++){ | |
| 184 | - Ylxxb ylxxb= ylxxList.get(j); | |
| 185 | - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 186 | - jzl+=ylxxb.getJzl(); | |
| 187 | - } | |
| 188 | - } | |
| 189 | - | |
| 190 | - t.setCdl(jzl); | |
| 191 | - if(type.equals("add")){ | |
| 192 | - t.setHd(jzl); | |
| 193 | - t.setJzcd(t.getCzcd()); | |
| 194 | - } | |
| 195 | - | |
| 196 | - t.setNbbm(map.get("clZbh").toString()); | |
| 197 | - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 198 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 199 | - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 200 | - t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | |
| 201 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 202 | - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 203 | - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 204 | - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 205 | - t.setLp(map.get("lpName").toString()); | |
| 206 | - t.setRq(sdf.parse(rq)); | |
| 207 | - t.setCreatetime(new Date()); | |
| 208 | - t.setJname(map.get("jName").toString()); | |
| 209 | - /*if(type.equals("add")){ | |
| 210 | - addList.add(t); | |
| 211 | - }else{ | |
| 212 | - updateList.add(t); | |
| 213 | - }*/ | |
| 214 | - repository.save(t); | |
| 215 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 216 | - } catch (ParseException e) { | |
| 217 | - // TODO Auto-generated catch block | |
| 218 | - newMap.put("status", ResponseCode.ERROR); | |
| 219 | - e.printStackTrace(); | |
| 220 | - } | |
| 221 | - } | |
| 222 | - } | |
| 223 | - return result; | |
| 224 | - } | |
| 225 | - | |
| 226 | - /** | |
| 227 | - * 获取进存油信息 | |
| 228 | - * @Transactional 回滚事物 | |
| 229 | - */ | |
| 230 | - @Transactional | |
| 231 | - @Override | |
| 232 | - public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | |
| 233 | - Map<String, Object> newMap = new HashMap<String, Object>(); | |
| 234 | - try { | |
| 235 | - Date date=new Date(); | |
| 236 | - List<Cars> carsList = carsRepository.findCars(); | |
| 237 | - Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | |
| 238 | - for (int i = 0; i < carsList.size(); i++) { | |
| 239 | - Cars c = carsList.get(i); | |
| 240 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 241 | - } | |
| 242 | - String rq = map2.get("rq").toString(); | |
| 243 | - String line = ""; | |
| 244 | - if (map2.get("xlbm_like") != null) { | |
| 245 | - line = map2.get("xlbm_like").toString().trim(); | |
| 246 | - } | |
| 247 | - String gsbm=""; | |
| 248 | - if(map2.get("ssgsdm_like")!=null){ | |
| 249 | - gsbm=map2.get("ssgsdm_like").toString(); | |
| 250 | - } | |
| 251 | - String fgsbm=""; | |
| 252 | - if(map2.get("fgsdm_like")!=null){ | |
| 253 | - fgsbm=map2.get("fgsdm_like").toString(); | |
| 254 | - } | |
| 255 | - String nbbm=""; | |
| 256 | - if(map2.get("nbbm_eq")!=null){ | |
| 257 | - nbbm=map2.get("nbbm_eq").toString(); | |
| 258 | - } | |
| 259 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 260 | - // 保留两位小数 | |
| 261 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 262 | - // TODO Auto-generated method stub | |
| 263 | - // 当天DLB信息 | |
| 264 | - List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | |
| 265 | - // 当天YLXXB信息 | |
| 266 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | |
| 267 | - // 从排班表中计算出行驶的总里程 | |
| 268 | - List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | |
| 269 | - List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | |
| 270 | - Map<String, Double> lcMap=new HashMap<String,Double>(); | |
| 271 | - for (int i = 0; i < listpbs.size(); i++) { | |
| 272 | - String cl=listpbs.get(i).get("clZbh").toString(); | |
| 273 | - Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0 | |
| 274 | - : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString()); | |
| 275 | - if(lcMap.get(cl)==null){ | |
| 276 | - lcMap.put(cl, lc); | |
| 277 | - }else{ | |
| 278 | - double lc_=lcMap.get(cl); | |
| 279 | - lcMap.remove(cl); | |
| 280 | - lcMap.put(cl, Arith.add(lc, lc_)); | |
| 281 | - } | |
| 282 | - } | |
| 283 | - | |
| 284 | -// Map<String, Double> shMap=new HashMap<String,Double>(); | |
| 285 | -// for (int i = 0; i < dlList.size(); i++) { | |
| 286 | -// Dlb dlb=dlList.get(i); | |
| 287 | -// String cl=dlb.getNbbm(); | |
| 288 | -// if(shMap.get(cl)==null){ | |
| 289 | -// shMap.put(cl, dlb.getSh()); | |
| 290 | -// }else{ | |
| 291 | -// double sh=shMap.get(cl); | |
| 292 | -// shMap.remove(cl); | |
| 293 | -// shMap.put(cl, Arith.add(sh, dlb.getSh())); | |
| 294 | -// } | |
| 295 | -// } | |
| 296 | - List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 297 | - String sxtj=map2.get("sxtj").toString(); | |
| 298 | - if(sxtj.equals("0")){ | |
| 299 | - listpb=listpbs; | |
| 300 | - }else{ | |
| 301 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); | |
| 302 | - List<String> stringList=new ArrayList<String>(); | |
| 303 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 304 | - String clbm=objectLists.get(i)[0].toString(); | |
| 305 | - int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | |
| 306 | - //一车一单 | |
| 307 | - if(sxtj.equals("1")){ | |
| 308 | - if(cs==1){ | |
| 309 | - stringList.add(clbm); | |
| 310 | - } | |
| 311 | - } | |
| 312 | - //一车多单 | |
| 313 | - if(sxtj.equals("2")){ | |
| 314 | - if(cs>1){ | |
| 315 | - stringList.add(clbm); | |
| 316 | - } | |
| 317 | - } | |
| 318 | - } | |
| 319 | - | |
| 320 | - for (int i = 0; i < stringList.size(); i++) { | |
| 321 | - String strNbbm=stringList.get(i); | |
| 322 | - for (int j = 0; j < listpbs.size(); j++) { | |
| 323 | - Map<String, Object> map = listpbs.get(j); | |
| 324 | - String mapNbbm=map.get("clZbh").toString(); | |
| 325 | - if(strNbbm.equals(mapNbbm)){ | |
| 326 | - listpb.add(map); | |
| 327 | - } | |
| 328 | - } | |
| 329 | - } | |
| 330 | - } | |
| 331 | - Map<String, Object> newMap_=new HashMap<String,Object>(); | |
| 332 | - List<Dlb> addList = new ArrayList<Dlb>(); | |
| 333 | - List<Dlb> updateList = new ArrayList<Dlb>(); | |
| 334 | - Map<String, Object> cMap=new HashMap<String, Object>(); | |
| 335 | - List<Map<String, Object>> listpb_=listpb; | |
| 336 | - Collections.sort(listpb,new NbbmJcsxMap()); | |
| 337 | - for (int x = 0; x < listpb_.size(); x++) { | |
| 338 | - String type = "add"; | |
| 339 | - boolean sfdc = false; | |
| 340 | - Map<String, Object> map_ = listpb_.get(x); | |
| 341 | - if (carsMap.get(map_.get("clZbh").toString()) != null) { | |
| 342 | - sfdc = carsMap.get(map_.get("clZbh").toString()); | |
| 343 | - } else { | |
| 344 | - sfdc = false; | |
| 345 | - } | |
| 346 | - if (sfdc) { | |
| 347 | - if(newMap_.get(map_.get("clZbh").toString())==null){ | |
| 348 | - newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | |
| 349 | - //车辆总里程 | |
| 350 | - double zlc =lcMap.get(map_.get("clZbh").toString()); | |
| 351 | - //车辆总加电量 | |
| 352 | - double zjzl = 0.0; | |
| 353 | - for (int j = 0; j < ylxxList.size(); j++) { | |
| 354 | - Ylxxb ylxxb = ylxxList.get(j); | |
| 355 | - if (map_.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 356 | - && map_.get("company").toString().equals(ylxxb.getGsdm())) { | |
| 357 | - zjzl = Arith.add(zjzl, ylxxb.getJzl()); | |
| 358 | - } | |
| 359 | - } | |
| 360 | - for (int i = 0; i < jdlList.size(); i++) { | |
| 361 | - Jdl jdl=jdlList.get(i); | |
| 362 | - if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 363 | - &&map_.get("company").toString().equals(jdl.getGsBm()) | |
| 364 | - &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | |
| 365 | - zjzl = Arith.add(zjzl,jdl.getJdl()); | |
| 366 | - } | |
| 367 | - } | |
| 368 | -// double clsh=0.0; | |
| 369 | -// if(shMap.get(map_.get("clZbh").toString())==null){ | |
| 370 | -// clsh=0.0; | |
| 371 | -// }else{ | |
| 372 | -// clsh=shMap.get(map_.get("clZbh").toString()); | |
| 373 | -// } | |
| 374 | -// zjzl =Arith.sub(zjzl, clsh); | |
| 375 | - Double nextJzyl = 0.0; | |
| 376 | - for (int i = 0; i < listpb.size(); i++) { | |
| 377 | - Map<String, Object> map = listpb.get(i); | |
| 378 | - if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 379 | - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 380 | - Dlb t = new Dlb(); | |
| 381 | - for (int k = 0; k < dlList.size(); k++) { | |
| 382 | - Dlb t1 = dlList.get(k); | |
| 383 | - if (t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 384 | - && t1.getJsy().equals(map.get("jGh").toString()) | |
| 385 | - && t1.getXlbm().equals(map.get("xlBm").toString())) { | |
| 386 | - if(t1.getLp()==null){ | |
| 387 | - //同人同车同线路不同路牌的过滤 (考虑到历史数据) | |
| 388 | - if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | |
| 389 | - t = t1; | |
| 390 | - type = "update"; | |
| 391 | - cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | |
| 392 | - map.get("clZbh").toString()); | |
| 393 | - } | |
| 394 | - }else{ | |
| 395 | - if(t1.getLp().equals(map.get("lpName").toString())){ | |
| 396 | - t = t1; | |
| 397 | - type = "update"; | |
| 398 | - } | |
| 399 | - | |
| 400 | - } | |
| 401 | - } | |
| 402 | - } | |
| 403 | - Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | |
| 404 | - if(map.get("seqNumber").toString().equals("1")){ | |
| 405 | - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 406 | - Double dh=0.0; | |
| 407 | - if(zlc>0){ | |
| 408 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 409 | - } | |
| 410 | - nextJzyl =Arith.sub(zjzl,dh); | |
| 411 | - if(zlc>0){ | |
| 412 | -// long l=Math.round(nextJzyl); | |
| 413 | - double ylxs=nextJzyl; | |
| 414 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 415 | - if(dh<0){ | |
| 416 | - t.setHd(0.0); | |
| 417 | - t.setCdl(0.0); | |
| 418 | - nextJzyl=Arith.add(ylxs, dh); | |
| 419 | - }else{ | |
| 420 | - t.setHd(dh); | |
| 421 | - t.setCdl(dh); | |
| 422 | - nextJzyl=ylxs; | |
| 423 | - } | |
| 424 | - }else{ | |
| 425 | - t.setHd(0.0); | |
| 426 | - t.setCdl(0.0); | |
| 427 | - } | |
| 428 | - }else{ | |
| 429 | - Double dh=0.0; | |
| 430 | - if(zlc>0){ | |
| 431 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 432 | - } | |
| 433 | - nextJzyl =Arith.sub( nextJzyl,dh); | |
| 434 | - if(zlc>0){ | |
| 435 | -// long l=0l; | |
| 436 | - double ylxs=0.0; | |
| 437 | - if(i==listpb.size()-1){ | |
| 438 | -// ylxs=czyl; | |
| 439 | - }else{ | |
| 440 | - if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 441 | -// l=Math.round(nextJzyl); | |
| 442 | - ylxs=nextJzyl; | |
| 443 | - } | |
| 444 | - | |
| 445 | - } | |
| 446 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 447 | - if(dh<0){ | |
| 448 | - t.setHd(0.0); | |
| 449 | - t.setCdl(0.0); | |
| 450 | - nextJzyl=Arith.add(ylxs, dh); | |
| 451 | - }else{ | |
| 452 | - t.setHd(dh); | |
| 453 | - t.setCdl(dh); | |
| 454 | - nextJzyl=ylxs; | |
| 455 | - } | |
| 456 | - }else{ | |
| 457 | - t.setHd(0.0); | |
| 458 | - t.setCdl(0.0); | |
| 459 | - } | |
| 460 | - } | |
| 461 | - t.setCzcd(100.0); | |
| 462 | - t.setJzcd(100.0); | |
| 463 | - t.setNbbm(map.get("clZbh").toString()); | |
| 464 | - t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | |
| 465 | - t.setZlc(map.get("totalKilometers") == null ? 0.0 | |
| 466 | - : Double.parseDouble(map.get("totalKilometers").toString())); | |
| 467 | - t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | |
| 468 | - t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | |
| 469 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 470 | - t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | |
| 471 | - t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | |
| 472 | - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 473 | - t.setRq(sdf.parse(rq)); | |
| 474 | - t.setLp(map.get("lpName").toString()); | |
| 475 | - t.setJname(map.get("jName").toString()); | |
| 476 | - if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) { | |
| 477 | - if (t.getHd() < 0) { | |
| 478 | - t.setHd(0.0); | |
| 479 | - } | |
| 480 | - if (t.getCdl() < 0) { | |
| 481 | - t.setCdl(0.0); | |
| 482 | - } | |
| 483 | - if (type.equals("add")) { | |
| 484 | - t.setCreatetime(date); | |
| 485 | - addList.add(t); | |
| 486 | - } else { | |
| 487 | - t.setUpdatetime(date); | |
| 488 | - updateList.add(t); | |
| 489 | - } | |
| 490 | - } | |
| 491 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 492 | - } | |
| 493 | - } | |
| 494 | - } | |
| 495 | - } | |
| 496 | - } | |
| 497 | - if(addList.size()>0){ | |
| 498 | - try { | |
| 499 | - new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class); | |
| 500 | - } catch (Exception e) { | |
| 501 | - // TODO: handle exception | |
| 502 | - if(e.getMessage().indexOf("PK_DLB_UK")>0){ | |
| 503 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | |
| 504 | - logger.info("获取:存在相同数据,数据已经过滤"); | |
| 505 | - } | |
| 506 | - } | |
| 507 | - | |
| 508 | - } | |
| 509 | - | |
| 510 | - if(updateList.size()>0){ | |
| 511 | - for (int i = 0; i < updateList.size(); i++) { | |
| 512 | - repository.save(updateList.get(i)); | |
| 513 | - } | |
| 514 | - } | |
| 515 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 516 | - Nylog nylog=new Nylog(); | |
| 517 | - nylog.setCreatedate(new Date()); | |
| 518 | - nylog.setCzmc("获取"); | |
| 519 | - nylog.setNylx("电"); | |
| 520 | - nylog.setUserid(user.getUserName()); | |
| 521 | - nylog.setUsername(user.getName()); | |
| 522 | - nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm); | |
| 523 | - nylogRepository.save(nylog); | |
| 524 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 525 | - } catch (Exception e) { | |
| 526 | - // TODO Auto-generated catch block | |
| 527 | - newMap.put("status", ResponseCode.ERROR); | |
| 528 | - throw e; | |
| 529 | - } | |
| 530 | - | |
| 531 | - return newMap; | |
| 532 | - } | |
| 533 | - | |
| 534 | - /** | |
| 535 | - * 拆分 | |
| 536 | - */ | |
| 537 | - @Transactional | |
| 538 | - @Override | |
| 539 | - public Map<String, Object> sort(Map<String, Object> map) { | |
| 540 | - // TODO Auto-generated method stub | |
| 541 | - Map<String, Object> newMap = new HashMap<String, Object>(); | |
| 542 | - try{ | |
| 543 | - int id=Integer.parseInt(map.get("id").toString()); | |
| 544 | - //最后存油量 | |
| 545 | - Double jzdl=Double.parseDouble(map.get("jzdl").toString()); | |
| 546 | - Double hdl=Double.parseDouble(map.get("hdl").toString()); | |
| 547 | - Dlb dlb=repository.findById(id).get(); | |
| 548 | - dlb.setJzcd(jzdl); | |
| 549 | - dlb.setHd(hdl); | |
| 550 | - repository.save(dlb); | |
| 551 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 552 | - }catch(Exception e){ | |
| 553 | - newMap.put("status", ResponseCode.ERROR); | |
| 554 | - logger.error("save erro.", e); | |
| 555 | - } | |
| 556 | - return newMap; | |
| 557 | - } | |
| 558 | - | |
| 559 | - | |
| 560 | - /** | |
| 561 | - * 核对,有加注没里程 | |
| 562 | - * @param map | |
| 563 | - * @return | |
| 564 | - */ | |
| 565 | - @Transactional | |
| 566 | - @Override | |
| 567 | - public Map<String, Object> checkDl(Map<String, Object> map) { | |
| 568 | - Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 569 | -// String xlbm=""; | |
| 570 | -// if(map.get("xlbm_like")!=null){ | |
| 571 | -// xlbm=map.get("xlbm_like").toString(); | |
| 572 | -// } | |
| 573 | - // TODO Auto-generated method stub | |
| 574 | - | |
| 575 | - List<Cars> carsList = carsRepository.findCars(); | |
| 576 | - Map<String, String> carsMap = new HashMap<String, String>(); | |
| 577 | - for (int i = 0; i < carsList.size(); i++) { | |
| 578 | - Cars c = carsList.get(i); | |
| 579 | - carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | |
| 580 | - } | |
| 581 | - | |
| 582 | - try{ | |
| 583 | - //获取车辆存油信息 | |
| 584 | - | |
| 585 | - String rq=map.get("rq").toString(); | |
| 586 | - String xlbm=""; | |
| 587 | - if(map.get("xlbm_like")!=null){ | |
| 588 | - xlbm= map.get("xlbm_like").toString().trim(); | |
| 589 | - } | |
| 590 | - String gsbm=""; | |
| 591 | - if(map.get("ssgsdm_like")!=null){ | |
| 592 | - gsbm=map.get("ssgsdm_like").toString(); | |
| 593 | - } | |
| 594 | - String fgsbm=""; | |
| 595 | - if(map.get("fgsdm_like")!=null){ | |
| 596 | - fgsbm=map.get("fgsdm_like").toString(); | |
| 597 | - } | |
| 598 | - String nbbm=""; | |
| 599 | - if(map.get("nbbm_eq")!=null){ | |
| 600 | - nbbm=map.get("nbbm_eq").toString(); | |
| 601 | - } | |
| 602 | - | |
| 603 | - String sql="select * from bsth_c_jdl j where j.gs_bm ='"+gsbm+"' " | |
| 604 | - + " and j.fgs_bm ='"+fgsbm+"' and rq ='"+rq+"' " | |
| 605 | - + "and nbbm not in (select nbbm from bsth_c_dlb d" | |
| 606 | - + " where ssgsdm ='"+gsbm+"' and fgsdm ='"+fgsbm+"'" | |
| 607 | - + " and rq='"+rq+"')"; | |
| 608 | - List<Jdl> listJdl=jdbcTemplate.query(sql, | |
| 609 | - new RowMapper<Jdl>(){ | |
| 610 | - @Override | |
| 611 | - public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 612 | - Jdl s = new Jdl(); | |
| 613 | - s.setNbbm(rs.getString("nbbm")); | |
| 614 | - s.setGsBm(rs.getString("gs_bm")); | |
| 615 | - s.setFgsBm(rs.getString("fgs_bm")); | |
| 616 | - s.setJdl(rs.getDouble("jdl")); | |
| 617 | - s.setRq(rs.getDate("rq")); | |
| 618 | - return s; | |
| 619 | - } | |
| 620 | - }); | |
| 621 | - for (int i = 0; i < listJdl.size(); i++) { | |
| 622 | - Jdl j=listJdl.get(i); | |
| 623 | - Dlb t=new Dlb(); | |
| 624 | - Line line= BasicData.nbbm2LineMap.get(j.getNbbm()); | |
| 625 | - if(null !=line){ | |
| 626 | - t.setCdl(j.getJdl()); | |
| 627 | - t.setNbbm(j.getNbbm()); | |
| 628 | - t.setRq(j.getRq()); | |
| 629 | - t.setJsy(""); | |
| 630 | - t.setCdl(j.getJdl()); | |
| 631 | - t.setSsgsdm(j.getGsBm()); | |
| 632 | - t.setFgsdm(j.getFgsBm()); | |
| 633 | - t.setJzcd(100.0); | |
| 634 | - t.setCzcd(100.0); | |
| 635 | - t.setHd(0.0); | |
| 636 | - t.setJcsx(1); | |
| 637 | - t.setXlbm(line.getLineCode()); | |
| 638 | - t.setLp(""); | |
| 639 | - repository.save(t); | |
| 640 | - } | |
| 641 | - } | |
| 642 | - | |
| 643 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 644 | - Nylog nylog=new Nylog(); | |
| 645 | - nylog.setCreatedate(new Date()); | |
| 646 | - nylog.setCzmc("核对"); | |
| 647 | - nylog.setNylx("电"); | |
| 648 | - nylog.setUserid(user.getUserName()); | |
| 649 | - nylog.setUsername(user.getName()); | |
| 650 | - nylog.setCxtj(xlbm+"-"+ rq+"-"+gsbm+"-"+fgsbm); | |
| 651 | - nylogRepository.save(nylog); | |
| 652 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 653 | - }catch(Exception e){ | |
| 654 | - newMap.put("status", ResponseCode.ERROR); | |
| 655 | - logger.error("save erro.", e); | |
| 656 | - throw e; | |
| 657 | - } | |
| 658 | - | |
| 659 | - return newMap; | |
| 660 | - } | |
| 661 | - | |
| 662 | - @Override | |
| 663 | - public List<Dlb> listDlb(Map<String, Object> map) { | |
| 664 | - // TODO Auto-generated method stub | |
| 665 | - List<Dlb> listDlb = new ArrayList<Dlb>(); | |
| 666 | - List<String> stringList = new ArrayList<String>(); | |
| 667 | - String rq = map.get("rq").toString(); | |
| 668 | - String gsbm = map.get("ssgsdm_like").toString(); | |
| 669 | - String fgsbm = map.get("fgsdm_like").toString(); | |
| 670 | - String xlbm = map.get("xlbm_like").toString().trim(); | |
| 671 | - String nbbm = map.get("nbbm_eq").toString(); | |
| 672 | - String sxtj = map.get("sxtj").toString(); | |
| 673 | - String type = map.get("type").toString(); | |
| 674 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 675 | - try { | |
| 676 | - if (nbbm.trim() != "") { | |
| 677 | - stringList.add(nbbm); | |
| 678 | - if (type.equals("1")) | |
| 679 | - listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 680 | - else | |
| 681 | - listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 682 | - | |
| 683 | - } else { | |
| 684 | - // 全部 | |
| 685 | - if (sxtj.equals("0")) { | |
| 686 | - List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 687 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 688 | - String clbm = objectLists.get(i)[0].toString(); | |
| 689 | - stringList.add(clbm); | |
| 690 | - } | |
| 691 | - if (stringList.size() > 0) { | |
| 692 | - if (type.equals("1")) | |
| 693 | - listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 694 | - else | |
| 695 | - listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 696 | - } | |
| 697 | - } else { | |
| 698 | - List<Object[]> objectLists; | |
| 699 | - if (sxtj.equals("3")) { | |
| 700 | - // 有加油没里程 | |
| 701 | - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 702 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 703 | - String clbm = objectLists.get(i)[0].toString(); | |
| 704 | - double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 705 | - double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 706 | - if (jzl > 0 && zlc <= 0) { | |
| 707 | - stringList.add(clbm); | |
| 708 | - } | |
| 709 | - | |
| 710 | - } | |
| 711 | - | |
| 712 | - } else if (sxtj.equals("4")) { | |
| 713 | - // 有里程没加油 | |
| 714 | - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 715 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 716 | - String clbm = objectLists.get(i)[0].toString(); | |
| 717 | - double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 718 | - double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 719 | - if (zlc > 0 && jzl <= 0) { | |
| 720 | - stringList.add(clbm); | |
| 721 | - } | |
| 722 | - | |
| 723 | - } | |
| 724 | - } else { | |
| 725 | - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 726 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 727 | - String clbm = objectLists.get(i)[0].toString(); | |
| 728 | - int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | |
| 729 | - // 一车一单 | |
| 730 | - if (sxtj.equals("1")) { | |
| 731 | - if (cs == 1) { | |
| 732 | - stringList.add(clbm); | |
| 733 | - } | |
| 734 | - } | |
| 735 | - // 一车多单 | |
| 736 | - if (sxtj.equals("2")) { | |
| 737 | - if (cs > 1) { | |
| 738 | - stringList.add(clbm); | |
| 739 | - } | |
| 740 | - } | |
| 741 | - } | |
| 742 | - } | |
| 743 | - | |
| 744 | - if (stringList.size() > 0) { | |
| 745 | - if (type.equals("1")) | |
| 746 | - listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 747 | - else | |
| 748 | - listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 749 | - } | |
| 750 | - } | |
| 751 | - } | |
| 752 | - } catch (ParseException e) { | |
| 753 | - // TODO Auto-generated catch block | |
| 754 | - e.printStackTrace(); | |
| 755 | - } | |
| 756 | - return listDlb; | |
| 757 | - } | |
| 758 | - | |
| 759 | - @Override | |
| 760 | - public Map<String, Object> sumYlb(Map<String, Object> map) { | |
| 761 | - // TODO Auto-generated method stub | |
| 762 | - List<String> stringList = new ArrayList<String>(); | |
| 763 | - String rq = map.get("rq").toString(); | |
| 764 | - String gsbm = map.get("ssgsdm_like").toString(); | |
| 765 | - String fgsbm = map.get("fgsdm_like").toString(); | |
| 766 | - String xlbm = map.get("xlbm_like").toString().trim(); | |
| 767 | - String nbbm = map.get("nbbm_eq").toString(); | |
| 768 | - String sxtj = map.get("sxtj").toString(); | |
| 769 | - String type = map.get("type").toString(); | |
| 770 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 771 | - List<Object[]> sumYlbList = new ArrayList<Object[]>(); | |
| 772 | - try { | |
| 773 | - if (nbbm.trim() != "") { | |
| 774 | - stringList.add(nbbm); | |
| 775 | - } else { | |
| 776 | - if (!sxtj.equals("0")) { | |
| 777 | - List<Object[]> objectLists; | |
| 778 | - if (sxtj.equals("3")) { | |
| 779 | - // 有加油没里程 | |
| 780 | - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 781 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 782 | - String clbm = objectLists.get(i)[0].toString(); | |
| 783 | - double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 784 | - double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 785 | - if (jzl > 0 && zlc <= 0) { | |
| 786 | - stringList.add(clbm); | |
| 787 | - } | |
| 788 | - | |
| 789 | - } | |
| 790 | - | |
| 791 | - } else if (sxtj.equals("4")) { | |
| 792 | - // 有里程没加油 | |
| 793 | - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 794 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 795 | - String clbm = objectLists.get(i)[0].toString(); | |
| 796 | - double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 797 | - double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 798 | - if (zlc > 0 && jzl <= 0) { | |
| 799 | - stringList.add(clbm); | |
| 800 | - } | |
| 801 | - | |
| 802 | - } | |
| 803 | - } else { | |
| 804 | - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 805 | - for (int i = 0; i < objectLists.size(); i++) { | |
| 806 | - String clbm = objectLists.get(i)[0].toString(); | |
| 807 | - int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | |
| 808 | - // 一车一单 | |
| 809 | - | |
| 810 | - if (sxtj.equals("1")) { | |
| 811 | - if (cs == 1) { | |
| 812 | - stringList.add(clbm); | |
| 813 | - } | |
| 814 | - } | |
| 815 | - // 一车多单 | |
| 816 | - if (sxtj.equals("2")) { | |
| 817 | - if (cs > 1) { | |
| 818 | - stringList.add(clbm); | |
| 819 | - } | |
| 820 | - } | |
| 821 | - } | |
| 822 | - } | |
| 823 | - } | |
| 824 | - } | |
| 825 | - if (sxtj.equals("0")) { | |
| 826 | - sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 827 | - } else { | |
| 828 | - if (stringList.size() > 0) { | |
| 829 | - | |
| 830 | - // String strings[]=new String[stringList.size()]; | |
| 831 | - // for(int i=0;i<stringList.size();i++){ | |
| 832 | - // strings[i]=stringList.get(i); | |
| 833 | - // } | |
| 834 | - if (type.equals("1")) | |
| 835 | - sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 836 | - else | |
| 837 | - sumYlbList = repository.sumDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 838 | - | |
| 839 | - } | |
| 840 | - // else { | |
| 841 | - // sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 842 | - // } | |
| 843 | - } | |
| 844 | - } catch (ParseException e) { | |
| 845 | - // TODO Auto-generated catch block | |
| 846 | - e.printStackTrace(); | |
| 847 | - } | |
| 848 | - Double jzl = 0.0, yh = 0.0, sh = 0.0; | |
| 849 | - for (int i = 0; i < sumYlbList.size(); i++) { | |
| 850 | - jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString())); | |
| 851 | - yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString())); | |
| 852 | - sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString())); | |
| 853 | - } | |
| 854 | - | |
| 855 | - Map<String, Object> sumMap = new HashMap<String, Object>(); | |
| 856 | - sumMap.put("jzl", jzl); | |
| 857 | - sumMap.put("yh", yh); | |
| 858 | - sumMap.put("sh", sh); | |
| 859 | - return sumMap; | |
| 860 | - } | |
| 861 | - | |
| 862 | - | |
| 863 | - @Transactional | |
| 864 | - @Override | |
| 865 | - public Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception { | |
| 866 | - // TODO Auto-generated method stub | |
| 867 | - Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 868 | - try{ | |
| 869 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 870 | - String json =StringEscapeUtils.unescapeHtml4(map.get("dlbList").toString()); | |
| 871 | - JSONArray jsonArray=JSONArray.parseArray(json); | |
| 872 | - JSONObject jsonObject; | |
| 873 | - // 获取车辆存油信息 | |
| 874 | -// List<Cyl> cylList = cylRepository.obtainCyl("",""); | |
| 875 | - for (int i = 0; i < jsonArray.size(); i++) { | |
| 876 | -// Ylb t=new Ylb(); | |
| 877 | - jsonObject=jsonArray.getJSONObject(i); | |
| 878 | - double czcd = jsonObject.getDoubleValue("czcd"); | |
| 879 | - double cdl =jsonObject.getDoubleValue("cdl"); | |
| 880 | - double jzcd =jsonObject.getDoubleValue("jzcd"); | |
| 881 | - double sh =jsonObject.getDoubleValue("sh"); | |
| 882 | - String shyy =jsonObject.getString("shyy"); | |
| 883 | - double hd = jsonObject.getDoubleValue("hd"); | |
| 884 | - int yhlx =jsonObject.getIntValue("yhlx"); | |
| 885 | - Integer id =jsonObject.getInteger("id"); | |
| 886 | -// String nbbm =jsonObject.getString("nbbm"); | |
| 887 | -// String rq=jsonObject.getString("rq"); | |
| 888 | - repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx); | |
| 889 | - | |
| 890 | - } | |
| 891 | - | |
| 892 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 893 | - Nylog nylog=new Nylog(); | |
| 894 | - nylog.setCreatedate(new Date()); | |
| 895 | - nylog.setCzmc("保存全部"); | |
| 896 | - nylog.setNylx("电"); | |
| 897 | - nylog.setUserid(user.getUserName()); | |
| 898 | - nylog.setUsername(user.getName()); | |
| 899 | - nylog.setCxtj(""); | |
| 900 | - nylogRepository.save(nylog); | |
| 901 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 902 | - }catch(Exception e){ | |
| 903 | - newMap.put("status", ResponseCode.ERROR); | |
| 904 | - logger.error("save erro.", e); | |
| 905 | - throw e; | |
| 906 | - } | |
| 907 | - return newMap; | |
| 908 | - } | |
| 909 | - | |
| 910 | - public List<Dlb> listOrderBy(String rq,String gsdm, | |
| 911 | - String fgsdm,String xlbm,String nbbm, | |
| 912 | - String px) { | |
| 913 | - // TODO Auto-generated method stub | |
| 914 | - String sql="SELECT * FROM bsth_c_dlb " | |
| 915 | - + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' " | |
| 916 | - + " and fgsdm like '%"+fgsdm+"%'"; | |
| 917 | - if(xlbm.equals("")){ | |
| 918 | - sql+= " and xlbm like '%"+xlbm+"%' "; | |
| 919 | - }else{ | |
| 920 | - sql+= " and xlbm = '"+xlbm+"' "; | |
| 921 | - } | |
| 922 | - | |
| 923 | - sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | |
| 924 | - | |
| 925 | - List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() { | |
| 926 | - @Override | |
| 927 | - public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 928 | - Dlb y = new Dlb(); | |
| 929 | - y.setId(arg0.getInt("id")); | |
| 930 | - return y; | |
| 931 | - } | |
| 932 | - }); | |
| 933 | - List<Dlb> lists=new ArrayList<Dlb>(); | |
| 934 | - List<Dlb> dlbLists=repository.obtainDl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx"); | |
| 935 | - for (int i = 0; i < list.size(); i++) { | |
| 936 | - Dlb t=list.get(i); | |
| 937 | - for (int j = 0; j < dlbLists.size(); j++) { | |
| 938 | - Dlb t2=dlbLists.get(j); | |
| 939 | - if(t.getId().intValue()==t2.getId().intValue()){ | |
| 940 | - lists.add(t2); | |
| 941 | - break; | |
| 942 | - } | |
| 943 | - } | |
| 944 | - } | |
| 945 | - | |
| 946 | - return lists; | |
| 947 | - } | |
| 948 | - | |
| 949 | - | |
| 950 | - @Override | |
| 951 | - public String checkJsy(Map<String, Object> map) { | |
| 952 | - // TODO Auto-generated method stub | |
| 953 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 954 | - String rq=map.get("date").toString(); | |
| 955 | - String nbbm=map.get("nbbm").toString(); | |
| 956 | - String jsy =map.get("jsy").toString(); | |
| 957 | - String xlbm=map.get("xlbm").toString(); | |
| 958 | - List<Dlb> list= repository.queryListDlb(rq, nbbm, jsy, xlbm); | |
| 959 | - String type="1"; | |
| 960 | - if(list.size()>0){ | |
| 961 | - type="0"; | |
| 962 | - } | |
| 963 | - return type; | |
| 964 | - } | |
| 965 | - | |
| 966 | - @Override | |
| 967 | - public Map<String, Object> saveDlb(Dlb t) { | |
| 968 | - // TODO Auto-generated method stub | |
| 969 | - Map<String, Object> map = new HashMap<>(); | |
| 970 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 971 | - String rq=sdf.format(t.getRq()); | |
| 972 | - String gsdm=t.getSsgsdm(); | |
| 973 | - String fgsdm=t.getFgsdm(); | |
| 974 | - String xlbm=t.getXlbm(); | |
| 975 | - String jhsj=t.getJhsj(); | |
| 976 | - String jsy=t.getJsy(); | |
| 977 | - String nbbm=t.getNbbm(); | |
| 978 | - int sfkt=t.getSfkt(); | |
| 979 | - t.setCreatetime(new Date()); | |
| 980 | - String[] jhsjStr = jhsj.split(":"); | |
| 981 | - long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]); | |
| 982 | - List<Dlb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | |
| 983 | -// repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | |
| 984 | - int jcsx=1; | |
| 985 | - if(list.size()>0){ | |
| 986 | - for (int i = 0; i < list.size(); i++) { | |
| 987 | - Dlb y=list.get(i); | |
| 988 | - String[] fcsjStr = y.getJhsj().split(":"); | |
| 989 | - long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | |
| 990 | - if(fcsjL>fcsj){ | |
| 991 | - jcsx=jcsx+y.getJcsx(); | |
| 992 | - }else{ | |
| 993 | - y.setJcsx(y.getJcsx()+1); | |
| 994 | - repository.save(y); | |
| 995 | - } | |
| 996 | - } | |
| 997 | - | |
| 998 | - } | |
| 999 | - t.setJcsx(jcsx); | |
| 1000 | - repository.save(t); | |
| 1001 | - | |
| 1002 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 1003 | - Nylog nylog=new Nylog(); | |
| 1004 | - nylog.setCreatedate(new Date()); | |
| 1005 | - nylog.setCzmc("手动添加"); | |
| 1006 | - nylog.setNylx("电"); | |
| 1007 | - nylog.setUserid(user.getUserName()); | |
| 1008 | - nylog.setUsername(user.getName()); | |
| 1009 | - nylog.setCxtj(""); | |
| 1010 | - nylogRepository.save(nylog); | |
| 1011 | - map.put("status", ResponseCode.SUCCESS); | |
| 1012 | - map.put("t", t); | |
| 1013 | - return map; | |
| 1014 | - } | |
| 1015 | - | |
| 1016 | - @Transactional | |
| 1017 | - @Override | |
| 1018 | - public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{ | |
| 1019 | - // TODO Auto-generated method stub | |
| 1020 | - Map<String, Object> maps = new HashMap<>(); | |
| 1021 | - try{ | |
| 1022 | - String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString()); | |
| 1023 | - JSONArray jsonArray=JSONArray.parseArray(json); | |
| 1024 | - JSONObject jsonObject; | |
| 1025 | - for (int x = 0; x < jsonArray.size(); x++) { | |
| 1026 | - jsonObject=jsonArray.getJSONObject(x); | |
| 1027 | - Integer id =jsonObject.getInteger("id"); | |
| 1028 | - repository.deleteById(id); | |
| 1029 | - } | |
| 1030 | - | |
| 1031 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 1032 | - Nylog nylog=new Nylog(); | |
| 1033 | - nylog.setCreatedate(new Date()); | |
| 1034 | - nylog.setCzmc("删除"); | |
| 1035 | - nylog.setNylx("电"); | |
| 1036 | - nylog.setUserid(user.getUserName()); | |
| 1037 | - nylog.setUsername(user.getName()); | |
| 1038 | - nylog.setCxtj(""); | |
| 1039 | - nylogRepository.save(nylog); | |
| 1040 | - maps.put("status", ResponseCode.SUCCESS); | |
| 1041 | - } catch (Exception e) { | |
| 1042 | - maps.put("status", ResponseCode.ERROR); | |
| 1043 | - logger.error("save erro.", e); | |
| 1044 | - throw e; | |
| 1045 | - } | |
| 1046 | - return maps; | |
| 1047 | - } | |
| 1048 | - | |
| 1049 | - @Override | |
| 1050 | - public Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> listpbDc,String date, | |
| 1051 | - String gsdm,String fgsdm,String line) { | |
| 1052 | - // TODO Auto-generated method stub | |
| 1053 | - Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>(); | |
| 1054 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 1055 | - // 保留两位小数 | |
| 1056 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 1057 | - List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | |
| 1058 | - List<Dlb> dlbList_upd=new ArrayList<Dlb>(); | |
| 1059 | - List<Dlb> dlbList_del=new ArrayList<Dlb>(); | |
| 1060 | - try{ | |
| 1061 | - for (int j = 0; j < dlbList.size(); j++) { | |
| 1062 | - Dlb t=dlbList.get(j); | |
| 1063 | - boolean fage=true; | |
| 1064 | - if(StringUtils.isEmpty(t.getLp())){ | |
| 1065 | - fage=false; | |
| 1066 | - }else{ | |
| 1067 | - for (int i = 0; i < listpbDc.size(); i++) { | |
| 1068 | - Map<String, Object> m = listpbDc.get(i); | |
| 1069 | - if(t.getNbbm().equals(m.get("clZbh").toString()) | |
| 1070 | - &&t.getJsy().equals(m.get("jGh").toString()) | |
| 1071 | - &&t.getXlbm().equals(m.get("xlBm").toString()) | |
| 1072 | - &&t.getLp().equals(m.get("lpName").toString())){ | |
| 1073 | - //该条记录不用删除 | |
| 1074 | - fage =false; | |
| 1075 | - dlbList_upd.add(t); | |
| 1076 | - } | |
| 1077 | - } | |
| 1078 | - } | |
| 1079 | - | |
| 1080 | - if(fage){ | |
| 1081 | - if(t.getXlbm().equals(line)){ | |
| 1082 | - dlbList_del.add(t); | |
| 1083 | - } | |
| 1084 | - } | |
| 1085 | - } | |
| 1086 | - mapList.put("delList", dlbList_del); | |
| 1087 | - Map<String, Double> lcMap=new HashMap<String,Double>(); | |
| 1088 | - for (int i = 0; i < listpbDc.size(); i++) { | |
| 1089 | - String cl=listpbDc.get(i).get("clZbh").toString(); | |
| 1090 | - Double lc= listpbDc.get(i).get("totalKilometers") == null ? 0.0 | |
| 1091 | - : Double.parseDouble(listpbDc.get(i).get("totalKilometers").toString()); | |
| 1092 | - if(lcMap.get(cl)==null){ | |
| 1093 | - lcMap.put(cl, lc); | |
| 1094 | - }else{ | |
| 1095 | - double lc_=lcMap.get(cl); | |
| 1096 | - lcMap.remove(cl); | |
| 1097 | - lcMap.put(cl, Arith.add(lc, lc_)); | |
| 1098 | - } | |
| 1099 | - } | |
| 1100 | - Map<String, Double> shMap=new HashMap<String,Double>(); | |
| 1101 | - for (int i = 0; i < dlbList_upd.size(); i++) { | |
| 1102 | - Dlb dlb=dlbList_upd.get(i); | |
| 1103 | - String cl=dlb.getNbbm(); | |
| 1104 | - if(shMap.get(cl)==null){ | |
| 1105 | - shMap.put(cl, dlb.getSh()); | |
| 1106 | - }else{ | |
| 1107 | - double sh=shMap.get(cl); | |
| 1108 | - shMap.remove(cl); | |
| 1109 | - shMap.put(cl, Arith.add(sh, dlb.getSh())); | |
| 1110 | - } | |
| 1111 | - } | |
| 1112 | - List<Jdl> jdlList=jdlRepository.JdlList(date); | |
| 1113 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | |
| 1114 | - Map<String, Object> newMap_=new HashMap<String,Object>(); | |
| 1115 | - Map<String, Object> cMap=new HashMap<String, Object>(); | |
| 1116 | - List<Map<String, Object>> listpb_=listpbDc; | |
| 1117 | - Collections.sort(listpbDc,new NbbmJcsxMap()); | |
| 1118 | - List<Dlb> updateDlb=new ArrayList<Dlb>(); | |
| 1119 | - for (int x = 0; x < listpb_.size(); x++) { | |
| 1120 | - String type = "add"; | |
| 1121 | - Map<String, Object> map_ = listpb_.get(x); | |
| 1122 | - if(newMap_.get(map_.get("clZbh").toString())==null){ | |
| 1123 | - newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | |
| 1124 | - //车辆总里程 | |
| 1125 | - double zlc =lcMap.get(map_.get("clZbh").toString()); | |
| 1126 | - //车辆总加电量 | |
| 1127 | - double zjzl = 0.0; | |
| 1128 | - for (int j = 0; j < ylxxList.size(); j++) { | |
| 1129 | - Ylxxb ylxxb = ylxxList.get(j); | |
| 1130 | - if (map_.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 1131 | - && map_.get("company").toString().equals(ylxxb.getGsdm())) { | |
| 1132 | - zjzl = Arith.add(zjzl, ylxxb.getJzl()); | |
| 1133 | - } | |
| 1134 | - } | |
| 1135 | - for (int i = 0; i < jdlList.size(); i++) { | |
| 1136 | - Jdl jdl=jdlList.get(i); | |
| 1137 | - if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 1138 | - &&map_.get("company").toString().equals(jdl.getGsBm()) | |
| 1139 | - &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | |
| 1140 | - zjzl = Arith.add(zjzl,jdl.getJdl()); | |
| 1141 | - } | |
| 1142 | - } | |
| 1143 | - double clsh=0.0; | |
| 1144 | - if(shMap.get(map_.get("clZbh").toString())==null){ | |
| 1145 | - clsh=0.0; | |
| 1146 | - }else{ | |
| 1147 | - clsh=shMap.get(map_.get("clZbh").toString()); | |
| 1148 | - } | |
| 1149 | - zjzl =Arith.sub(zjzl, clsh); | |
| 1150 | - Double nextJzyl = 0.0; | |
| 1151 | - for (int i = 0; i < listpbDc.size(); i++) { | |
| 1152 | - Map<String, Object> map = listpbDc.get(i); | |
| 1153 | - if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 1154 | - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 1155 | - Dlb t = new Dlb(); | |
| 1156 | - for (int k = 0; k < dlbList_upd.size(); k++) { | |
| 1157 | - Dlb t1 = dlbList_upd.get(k); | |
| 1158 | - if (t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 1159 | - && t1.getJsy().equals(map.get("jGh").toString()) | |
| 1160 | - && t1.getXlbm().equals(map.get("xlBm").toString()) | |
| 1161 | - && t1.getLp().equals(map.get("lpName").toString())) { | |
| 1162 | - t = t1; | |
| 1163 | - type = "update"; | |
| 1164 | - } | |
| 1165 | - | |
| 1166 | - } | |
| 1167 | - Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | |
| 1168 | - if(map.get("seqNumber").toString().equals("1")){ | |
| 1169 | - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 1170 | - Double dh=0.0; | |
| 1171 | - if(zlc>0){ | |
| 1172 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 1173 | - } | |
| 1174 | - nextJzyl =Arith.sub(zjzl,dh); | |
| 1175 | - if(zlc>0){ | |
| 1176 | -// long l=Math.round(nextJzyl); | |
| 1177 | - double ylxs=nextJzyl; | |
| 1178 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 1179 | - if(dh<0){ | |
| 1180 | - t.setHd(0.0); | |
| 1181 | - t.setCdl(0.0); | |
| 1182 | - nextJzyl=Arith.add(ylxs, dh); | |
| 1183 | - }else{ | |
| 1184 | - t.setHd(dh); | |
| 1185 | - t.setCdl(dh); | |
| 1186 | - nextJzyl=ylxs; | |
| 1187 | - } | |
| 1188 | - }else{ | |
| 1189 | - t.setHd(0.0); | |
| 1190 | - t.setCdl(0.0); | |
| 1191 | - } | |
| 1192 | - }else{ | |
| 1193 | - Double dh=0.0; | |
| 1194 | - if(zlc>0){ | |
| 1195 | - dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 1196 | - } | |
| 1197 | - nextJzyl =Arith.sub( nextJzyl,dh); | |
| 1198 | - if(zlc>0){ | |
| 1199 | -// long l=0l; | |
| 1200 | - double ylxs=0.0; | |
| 1201 | - if(i==listpbDc.size()-1){ | |
| 1202 | -// ylxs=czyl; | |
| 1203 | - }else{ | |
| 1204 | - if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 1205 | -// l=Math.round(nextJzyl); | |
| 1206 | - ylxs=nextJzyl; | |
| 1207 | - } | |
| 1208 | - | |
| 1209 | - } | |
| 1210 | - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 1211 | - if(dh<0){ | |
| 1212 | - t.setHd(0.0); | |
| 1213 | - t.setCdl(0.0); | |
| 1214 | - nextJzyl=Arith.add(ylxs, dh); | |
| 1215 | - }else{ | |
| 1216 | - t.setHd(dh); | |
| 1217 | - t.setCdl(dh); | |
| 1218 | - nextJzyl=ylxs; | |
| 1219 | - } | |
| 1220 | - }else{ | |
| 1221 | - t.setHd(0.0); | |
| 1222 | - t.setCdl(0.0); | |
| 1223 | - } | |
| 1224 | - } | |
| 1225 | - t.setCzcd(100.0); | |
| 1226 | - t.setJzcd(100.0); | |
| 1227 | - t.setNbbm(map.get("clZbh").toString()); | |
| 1228 | - t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | |
| 1229 | - t.setZlc(map.get("totalKilometers") == null ? 0.0 | |
| 1230 | - : Double.parseDouble(map.get("totalKilometers").toString())); | |
| 1231 | - t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | |
| 1232 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 1233 | - t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | |
| 1234 | - t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | |
| 1235 | - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 1236 | - t.setRq(sdf.parse(date)); | |
| 1237 | - t.setLp(map.get("lpName").toString()); | |
| 1238 | - t.setCdl(Arith.add(t.getCdl(), t.getSh())); | |
| 1239 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | |
| 1240 | - if(type.equals("add")){ | |
| 1241 | - t.setCreatetime(new Date()); | |
| 1242 | - }else{ | |
| 1243 | - t.setUpdatetime(new Date()); | |
| 1244 | - } | |
| 1245 | - } | |
| 1246 | - | |
| 1247 | - if(t.getHd()<0){ | |
| 1248 | - t.setHd(0.0); | |
| 1249 | - } | |
| 1250 | - if(t.getCdl()<0){ | |
| 1251 | - t.setCdl(0.0); | |
| 1252 | - } | |
| 1253 | - updateDlb.add(t); | |
| 1254 | - } | |
| 1255 | - } | |
| 1256 | - } | |
| 1257 | - } | |
| 1258 | - mapList.put("updList", updateDlb); | |
| 1259 | - }catch(Exception e){ | |
| 1260 | - logger.error("save erro.", e); | |
| 1261 | - } | |
| 1262 | - return mapList; | |
| 1263 | - } | |
| 1264 | - | |
| 1265 | - @Override | |
| 1266 | - public Map<String, Object> update(Map<String, Object> map) { | |
| 1267 | - if(map.get("id")!=null){ | |
| 1268 | - if(map.get("id").toString().length()>0){ | |
| 1269 | - Integer id=Integer.parseInt(map.get("id").toString()); | |
| 1270 | - String jsy=map.get("jsy").toString(); | |
| 1271 | - Dlb t=repository.findById(id).get(); | |
| 1272 | - t.setJsy(jsy); | |
| 1273 | - repository.save(t); | |
| 1274 | - map.put("status", ResponseCode.SUCCESS); | |
| 1275 | - } | |
| 1276 | - } | |
| 1277 | - return map; | |
| 1278 | - } | |
| 1279 | - | |
| 1280 | -} | |
| 1281 | - | |
| 1282 | -class NbbmJcsxMap implements Comparator<Map<String, Object>>{ | |
| 1283 | - @Override | |
| 1284 | - public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 1285 | - // TODO Auto-generated method stub | |
| 1286 | - return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString())); | |
| 1287 | - } | |
| 1288 | -} | |
| 1 | +package com.bsth.service.oil.impl; | |
| 2 | + | |
| 3 | +import java.sql.ResultSet; | |
| 4 | +import java.sql.SQLException; | |
| 5 | +import java.text.DecimalFormat; | |
| 6 | +import java.text.ParseException; | |
| 7 | +import java.text.SimpleDateFormat; | |
| 8 | +import java.util.ArrayList; | |
| 9 | +import java.util.Calendar; | |
| 10 | +import java.util.Collections; | |
| 11 | +import java.util.Comparator; | |
| 12 | +import java.util.Date; | |
| 13 | +import java.util.HashMap; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.Map; | |
| 16 | + | |
| 17 | +import javax.transaction.Transactional; | |
| 18 | + | |
| 19 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 20 | +import org.apache.commons.lang3.StringUtils; | |
| 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 | +import com.alibaba.fastjson.JSONArray; | |
| 29 | +import com.alibaba.fastjson.JSONObject; | |
| 30 | +import com.bsth.common.ResponseCode; | |
| 31 | +import com.bsth.data.BasicData; | |
| 32 | +import com.bsth.entity.Cars; | |
| 33 | +import com.bsth.entity.Line; | |
| 34 | +import com.bsth.entity.oil.Cdl; | |
| 35 | +import com.bsth.entity.oil.Dlb; | |
| 36 | +import com.bsth.entity.oil.Jdl; | |
| 37 | +import com.bsth.entity.oil.Nylog; | |
| 38 | +import com.bsth.entity.sys.SysUser; | |
| 39 | +import com.bsth.repository.CarsRepository; | |
| 40 | +import com.bsth.repository.oil.CdlRepository; | |
| 41 | +import com.bsth.repository.oil.DlbRepository; | |
| 42 | +import com.bsth.repository.oil.JdlRepository; | |
| 43 | +import com.bsth.repository.oil.NylogRepository; | |
| 44 | +import com.bsth.repository.oil.YlxxbRepository; | |
| 45 | +import com.bsth.security.util.SecurityUtils; | |
| 46 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 47 | +import com.bsth.service.oil.DlbService; | |
| 48 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 49 | +import com.bsth.util.Arith; | |
| 50 | +import com.bsth.util.BatchSaveUtils; | |
| 51 | + | |
| 52 | +@Service | |
| 53 | +public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ | |
| 54 | + @Autowired | |
| 55 | + DlbRepository repository; | |
| 56 | + @Autowired | |
| 57 | + NylogRepository nylogRepository; | |
| 58 | + @Autowired | |
| 59 | + YlxxbRepository ylxxbRepository; | |
| 60 | + | |
| 61 | + @Autowired | |
| 62 | + CdlRepository cdlRepository; | |
| 63 | + @Autowired | |
| 64 | + JdlRepository jdlRepository; | |
| 65 | + @Autowired | |
| 66 | + CarsRepository carsRepository; | |
| 67 | + | |
| 68 | + @Autowired | |
| 69 | + ScheduleRealInfoService scheduleRealInfoService; | |
| 70 | + | |
| 71 | + @Autowired | |
| 72 | + JdbcTemplate jdbcTemplate; | |
| 73 | + | |
| 74 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 75 | + | |
| 76 | + @Transactional | |
| 77 | + @Override | |
| 78 | + public String obtainDsq() throws Exception{ | |
| 79 | + String result = "failure"; | |
| 80 | + List<Cars> carsList=carsRepository.findCars(); | |
| 81 | + Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 82 | + for (int i = 0; i < carsList.size(); i++) { | |
| 83 | + Cars c=carsList.get(i); | |
| 84 | + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false) | |
| 85 | + || (c.getSfmix()!=null?c.getSfmix():false));//电车或油电混合,都可以充电 | |
| 86 | + } | |
| 87 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 88 | + Date dNow = new Date(); //当前时间 | |
| 89 | + Date dBefore = new Date(); | |
| 90 | + Calendar calendar = Calendar.getInstance(); //得到日历 | |
| 91 | + calendar.setTime(dNow);//把当前时间赋给日历 | |
| 92 | + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | |
| 93 | + dBefore = calendar.getTime(); //得到前一天的时间 | |
| 94 | + String rq=sdf.format(dBefore); | |
| 95 | +// String rq="2017-11-02"; | |
| 96 | + String line=""; | |
| 97 | + //保留两位小数 | |
| 98 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 99 | + // TODO Auto-generated method stub | |
| 100 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 101 | + //当天DLB信息 | |
| 102 | + List<Dlb> dlList=repository.obtainDl(rq, "", "", line, "", "nbbm"); | |
| 103 | + //当天加电信息表 | |
| 104 | + List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 105 | + //前一天所有车辆最后进场班次信息 | |
| 106 | +// List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); | |
| 107 | + List<Cdl> cdyList=cdlRepository.obtainCdl(); | |
| 108 | + //从排班表中计算出行驶的总里程 | |
| 109 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); | |
| 110 | + for(int x=0;x<listpb.size();x++){ | |
| 111 | + String type="add"; | |
| 112 | + boolean sfdc=false; | |
| 113 | + Map<String, Object> map=listpb.get(x); | |
| 114 | + if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 115 | + sfdc = carsMap.get(map.get("clZbh").toString()); | |
| 116 | + }else{ | |
| 117 | + sfdc=false; | |
| 118 | + } | |
| 119 | + if(sfdc){ | |
| 120 | + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 121 | + Dlb t=new Dlb(); | |
| 122 | + for(int k=0;k<dlList.size();k++){ | |
| 123 | + Dlb t1=dlList.get(k); | |
| 124 | + if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 125 | + &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 126 | + &&t1.getXlbm().equals(map.get("xlBm").toString()) | |
| 127 | + &&t1.getLp().equals(map.get("lpName").toString())) | |
| 128 | + { | |
| 129 | + t=t1; | |
| 130 | + type="update"; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + try { | |
| 134 | + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 135 | + Double jzl=0.0; | |
| 136 | + if(map.get("seqNumber").toString().equals("1")){ | |
| 137 | + boolean fage=true; | |
| 138 | +// for (int i = 0; i < dlListBe.size(); i++) { | |
| 139 | +// Dlb dlb=dlListBe.get(i); | |
| 140 | +// if(map.get("clZbh").toString().equals(dlb.getNbbm())){ | |
| 141 | +// t.setCzcd(dlb.getJzcd()); | |
| 142 | +// fage=false; | |
| 143 | +// break; | |
| 144 | +// } | |
| 145 | +// } | |
| 146 | + if(fage){ | |
| 147 | + for (int y = 0; y < cdyList.size(); y++) { | |
| 148 | + Cdl cdl=cdyList.get(y); | |
| 149 | + if(map.get("clZbh").toString().equals(cdl.getNbbm())){ | |
| 150 | + t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd()); | |
| 151 | + fage=false; | |
| 152 | + break; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + } | |
| 156 | + if(fage){ | |
| 157 | + t.setCzcd(0.0); | |
| 158 | + } | |
| 159 | + | |
| 160 | + //手动导入没有驾驶员工号 | |
| 161 | + for (int i = 0; i < jdlList.size(); i++) { | |
| 162 | + Jdl jdl=jdlList.get(i); | |
| 163 | + if(map.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 164 | + &&map.get("jGh").toString().equals(jdl.getJsy())){ | |
| 165 | + jzl+=jdl.getJdl(); | |
| 166 | + } | |
| 167 | + } | |
| 168 | + } | |
| 169 | + | |
| 170 | + | |
| 171 | + t.setCdl(jzl); | |
| 172 | + if(type.equals("add")){ | |
| 173 | + t.setHd(jzl); | |
| 174 | + t.setJzcd(t.getCzcd()); | |
| 175 | + } | |
| 176 | + | |
| 177 | + t.setNbbm(map.get("clZbh").toString()); | |
| 178 | + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 179 | + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 180 | + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 181 | + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | |
| 182 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 183 | + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 184 | + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 185 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 186 | + t.setLp(map.get("lpName").toString()); | |
| 187 | + t.setRq(sdf.parse(rq)); | |
| 188 | + t.setCreatetime(new Date()); | |
| 189 | + t.setJname(map.get("jName").toString()); | |
| 190 | + /*if(type.equals("add")){ | |
| 191 | + addList.add(t); | |
| 192 | + }else{ | |
| 193 | + updateList.add(t); | |
| 194 | + }*/ | |
| 195 | + repository.save(t); | |
| 196 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 197 | + } catch (ParseException e) { | |
| 198 | + // TODO Auto-generated catch block | |
| 199 | + newMap.put("status", ResponseCode.ERROR); | |
| 200 | + e.printStackTrace(); | |
| 201 | + } | |
| 202 | + } | |
| 203 | + } | |
| 204 | + return result; | |
| 205 | + } | |
| 206 | + | |
| 207 | + /** | |
| 208 | + * 获取进存油信息 | |
| 209 | + * @Transactional 回滚事物 | |
| 210 | + */ | |
| 211 | + @Transactional | |
| 212 | + @Override | |
| 213 | + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | |
| 214 | + Map<String, Object> newMap = new HashMap<String, Object>(); | |
| 215 | + try { | |
| 216 | + Date date=new Date(); | |
| 217 | + List<Cars> carsList = carsRepository.findCars(); | |
| 218 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | |
| 219 | + for (int i = 0; i < carsList.size(); i++) { | |
| 220 | + Cars c = carsList.get(i); | |
| 221 | + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false) | |
| 222 | + || (c.getSfmix()!=null?c.getSfmix():false));//电车或油电混合,都可以充电 | |
| 223 | + } | |
| 224 | + String rq = map2.get("rq").toString(); | |
| 225 | + String line = ""; | |
| 226 | + if (map2.get("xlbm_like") != null) { | |
| 227 | + line = map2.get("xlbm_like").toString().trim(); | |
| 228 | + } | |
| 229 | + String gsbm=""; | |
| 230 | + if(map2.get("ssgsdm_like")!=null){ | |
| 231 | + gsbm=map2.get("ssgsdm_like").toString(); | |
| 232 | + } | |
| 233 | + String fgsbm=""; | |
| 234 | + if(map2.get("fgsdm_like")!=null){ | |
| 235 | + fgsbm=map2.get("fgsdm_like").toString(); | |
| 236 | + } | |
| 237 | + String nbbm=""; | |
| 238 | + if(map2.get("nbbm_eq")!=null){ | |
| 239 | + nbbm=map2.get("nbbm_eq").toString(); | |
| 240 | + } | |
| 241 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 242 | + // 保留两位小数 | |
| 243 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 244 | + // TODO Auto-generated method stub | |
| 245 | + // 当天DLB信息 | |
| 246 | + List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | |
| 247 | + // 从排班表中计算出行驶的总里程 | |
| 248 | + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | |
| 249 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | |
| 250 | + Map<String, Double> lcMap=new HashMap<String,Double>(); | |
| 251 | + for (int i = 0; i < listpbs.size(); i++) { | |
| 252 | + String cl=listpbs.get(i).get("clZbh").toString(); | |
| 253 | + Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0 | |
| 254 | + : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString()); | |
| 255 | + if(lcMap.get(cl)==null){ | |
| 256 | + lcMap.put(cl, lc); | |
| 257 | + }else{ | |
| 258 | + double lc_=lcMap.get(cl); | |
| 259 | + lcMap.remove(cl); | |
| 260 | + lcMap.put(cl, Arith.add(lc, lc_)); | |
| 261 | + } | |
| 262 | + } | |
| 263 | + | |
| 264 | +// Map<String, Double> shMap=new HashMap<String,Double>(); | |
| 265 | +// for (int i = 0; i < dlList.size(); i++) { | |
| 266 | +// Dlb dlb=dlList.get(i); | |
| 267 | +// String cl=dlb.getNbbm(); | |
| 268 | +// if(shMap.get(cl)==null){ | |
| 269 | +// shMap.put(cl, dlb.getSh()); | |
| 270 | +// }else{ | |
| 271 | +// double sh=shMap.get(cl); | |
| 272 | +// shMap.remove(cl); | |
| 273 | +// shMap.put(cl, Arith.add(sh, dlb.getSh())); | |
| 274 | +// } | |
| 275 | +// } | |
| 276 | + List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 277 | + String sxtj=map2.get("sxtj").toString(); | |
| 278 | + if(sxtj.equals("0")){ | |
| 279 | + listpb=listpbs; | |
| 280 | + }else{ | |
| 281 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); | |
| 282 | + List<String> stringList=new ArrayList<String>(); | |
| 283 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 284 | + String clbm=objectLists.get(i)[0].toString(); | |
| 285 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | |
| 286 | + //一车一单 | |
| 287 | + if(sxtj.equals("1")){ | |
| 288 | + if(cs==1){ | |
| 289 | + stringList.add(clbm); | |
| 290 | + } | |
| 291 | + } | |
| 292 | + //一车多单 | |
| 293 | + if(sxtj.equals("2")){ | |
| 294 | + if(cs>1){ | |
| 295 | + stringList.add(clbm); | |
| 296 | + } | |
| 297 | + } | |
| 298 | + } | |
| 299 | + | |
| 300 | + for (int i = 0; i < stringList.size(); i++) { | |
| 301 | + String strNbbm=stringList.get(i); | |
| 302 | + for (int j = 0; j < listpbs.size(); j++) { | |
| 303 | + Map<String, Object> map = listpbs.get(j); | |
| 304 | + String mapNbbm=map.get("clZbh").toString(); | |
| 305 | + if(strNbbm.equals(mapNbbm)){ | |
| 306 | + listpb.add(map); | |
| 307 | + } | |
| 308 | + } | |
| 309 | + } | |
| 310 | + } | |
| 311 | + Map<String, Object> newMap_=new HashMap<String,Object>(); | |
| 312 | + List<Dlb> addList = new ArrayList<Dlb>(); | |
| 313 | + List<Dlb> updateList = new ArrayList<Dlb>(); | |
| 314 | + Map<String, Object> cMap=new HashMap<String, Object>(); | |
| 315 | + List<Map<String, Object>> listpb_=listpb; | |
| 316 | + Collections.sort(listpb,new NbbmJcsxMap()); | |
| 317 | + for (int x = 0; x < listpb_.size(); x++) { | |
| 318 | + String type = "add"; | |
| 319 | + boolean sfdc = false; | |
| 320 | + Map<String, Object> map_ = listpb_.get(x); | |
| 321 | + if (carsMap.get(map_.get("clZbh").toString()) != null) { | |
| 322 | + sfdc = carsMap.get(map_.get("clZbh").toString()); | |
| 323 | + } else { | |
| 324 | + sfdc = false; | |
| 325 | + } | |
| 326 | + if (sfdc) { | |
| 327 | + if(newMap_.get(map_.get("clZbh").toString())==null){ | |
| 328 | + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | |
| 329 | + //车辆总里程 | |
| 330 | + double zlc =lcMap.get(map_.get("clZbh").toString()); | |
| 331 | + //车辆总加电量 | |
| 332 | + double zjzl = 0.0; | |
| 333 | + for (int i = 0; i < jdlList.size(); i++) { | |
| 334 | + Jdl jdl=jdlList.get(i); | |
| 335 | + if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 336 | + &&map_.get("company").toString().equals(jdl.getGsBm()) | |
| 337 | + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | |
| 338 | + zjzl = Arith.add(zjzl,jdl.getJdl()); | |
| 339 | + } | |
| 340 | + } | |
| 341 | +// double clsh=0.0; | |
| 342 | +// if(shMap.get(map_.get("clZbh").toString())==null){ | |
| 343 | +// clsh=0.0; | |
| 344 | +// }else{ | |
| 345 | +// clsh=shMap.get(map_.get("clZbh").toString()); | |
| 346 | +// } | |
| 347 | +// zjzl =Arith.sub(zjzl, clsh); | |
| 348 | + Double nextJzyl = 0.0; | |
| 349 | + for (int i = 0; i < listpb.size(); i++) { | |
| 350 | + Map<String, Object> map = listpb.get(i); | |
| 351 | + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 352 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 353 | + Dlb t = new Dlb(); | |
| 354 | + for (int k = 0; k < dlList.size(); k++) { | |
| 355 | + Dlb t1 = dlList.get(k); | |
| 356 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 357 | + && t1.getJsy().equals(map.get("jGh").toString()) | |
| 358 | + && t1.getXlbm().equals(map.get("xlBm").toString())) { | |
| 359 | + if(t1.getLp()==null){ | |
| 360 | + //同人同车同线路不同路牌的过滤 (考虑到历史数据) | |
| 361 | + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | |
| 362 | + t = t1; | |
| 363 | + type = "update"; | |
| 364 | + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | |
| 365 | + map.get("clZbh").toString()); | |
| 366 | + } | |
| 367 | + }else{ | |
| 368 | + if(t1.getLp().equals(map.get("lpName").toString())){ | |
| 369 | + t = t1; | |
| 370 | + type = "update"; | |
| 371 | + } | |
| 372 | + | |
| 373 | + } | |
| 374 | + } | |
| 375 | + } | |
| 376 | + Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | |
| 377 | + if(map.get("seqNumber").toString().equals("1")){ | |
| 378 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 379 | + Double dh=0.0; | |
| 380 | + if(zlc>0){ | |
| 381 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 382 | + } | |
| 383 | + nextJzyl =Arith.sub(zjzl,dh); | |
| 384 | + if(zlc>0){ | |
| 385 | +// long l=Math.round(nextJzyl); | |
| 386 | + double ylxs=nextJzyl; | |
| 387 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 388 | + if(dh<0){ | |
| 389 | + t.setHd(0.0); | |
| 390 | + t.setCdl(0.0); | |
| 391 | + nextJzyl=Arith.add(ylxs, dh); | |
| 392 | + }else{ | |
| 393 | + t.setHd(dh); | |
| 394 | + t.setCdl(dh); | |
| 395 | + nextJzyl=ylxs; | |
| 396 | + } | |
| 397 | + }else{ | |
| 398 | + t.setHd(0.0); | |
| 399 | + t.setCdl(0.0); | |
| 400 | + } | |
| 401 | + }else{ | |
| 402 | + Double dh=0.0; | |
| 403 | + if(zlc>0){ | |
| 404 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 405 | + } | |
| 406 | + nextJzyl =Arith.sub( nextJzyl,dh); | |
| 407 | + if(zlc>0){ | |
| 408 | +// long l=0l; | |
| 409 | + double ylxs=0.0; | |
| 410 | + if(i==listpb.size()-1){ | |
| 411 | +// ylxs=czyl; | |
| 412 | + }else{ | |
| 413 | + if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 414 | +// l=Math.round(nextJzyl); | |
| 415 | + ylxs=nextJzyl; | |
| 416 | + } | |
| 417 | + | |
| 418 | + } | |
| 419 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 420 | + if(dh<0){ | |
| 421 | + t.setHd(0.0); | |
| 422 | + t.setCdl(0.0); | |
| 423 | + nextJzyl=Arith.add(ylxs, dh); | |
| 424 | + }else{ | |
| 425 | + t.setHd(dh); | |
| 426 | + t.setCdl(dh); | |
| 427 | + nextJzyl=ylxs; | |
| 428 | + } | |
| 429 | + }else{ | |
| 430 | + t.setHd(0.0); | |
| 431 | + t.setCdl(0.0); | |
| 432 | + } | |
| 433 | + } | |
| 434 | + t.setCzcd(100.0); | |
| 435 | + t.setJzcd(100.0); | |
| 436 | + t.setNbbm(map.get("clZbh").toString()); | |
| 437 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | |
| 438 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | |
| 439 | + : Double.parseDouble(map.get("totalKilometers").toString())); | |
| 440 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | |
| 441 | + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | |
| 442 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 443 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | |
| 444 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | |
| 445 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 446 | + t.setRq(sdf.parse(rq)); | |
| 447 | + t.setLp(map.get("lpName").toString()); | |
| 448 | + t.setJname(map.get("jName").toString()); | |
| 449 | + if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) { | |
| 450 | + if (t.getHd() < 0) { | |
| 451 | + t.setHd(0.0); | |
| 452 | + } | |
| 453 | + if (t.getCdl() < 0) { | |
| 454 | + t.setCdl(0.0); | |
| 455 | + } | |
| 456 | + if (type.equals("add")) { | |
| 457 | + t.setCreatetime(date); | |
| 458 | + addList.add(t); | |
| 459 | + } else { | |
| 460 | + t.setUpdatetime(date); | |
| 461 | + updateList.add(t); | |
| 462 | + } | |
| 463 | + } | |
| 464 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 465 | + } | |
| 466 | + } | |
| 467 | + } | |
| 468 | + } | |
| 469 | + } | |
| 470 | + if(addList.size()>0){ | |
| 471 | + try { | |
| 472 | + new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class); | |
| 473 | + } catch (Exception e) { | |
| 474 | + // TODO: handle exception | |
| 475 | + if(e.getMessage().indexOf("PK_DLB_UK")>0){ | |
| 476 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | |
| 477 | + logger.info("获取:存在相同数据,数据已经过滤"); | |
| 478 | + } | |
| 479 | + } | |
| 480 | + | |
| 481 | + } | |
| 482 | + | |
| 483 | + if(updateList.size()>0){ | |
| 484 | + for (int i = 0; i < updateList.size(); i++) { | |
| 485 | + repository.save(updateList.get(i)); | |
| 486 | + } | |
| 487 | + } | |
| 488 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 489 | + Nylog nylog=new Nylog(); | |
| 490 | + nylog.setCreatedate(new Date()); | |
| 491 | + nylog.setCzmc("获取"); | |
| 492 | + nylog.setNylx("电"); | |
| 493 | + nylog.setUserid(user.getUserName()); | |
| 494 | + nylog.setUsername(user.getName()); | |
| 495 | + nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm); | |
| 496 | + nylogRepository.save(nylog); | |
| 497 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 498 | + } catch (Exception e) { | |
| 499 | + // TODO Auto-generated catch block | |
| 500 | + newMap.put("status", ResponseCode.ERROR); | |
| 501 | + throw e; | |
| 502 | + } | |
| 503 | + | |
| 504 | + return newMap; | |
| 505 | + } | |
| 506 | + | |
| 507 | + /** | |
| 508 | + * 拆分 | |
| 509 | + */ | |
| 510 | + @Transactional | |
| 511 | + @Override | |
| 512 | + public Map<String, Object> sort(Map<String, Object> map) { | |
| 513 | + // TODO Auto-generated method stub | |
| 514 | + Map<String, Object> newMap = new HashMap<String, Object>(); | |
| 515 | + try{ | |
| 516 | + int id=Integer.parseInt(map.get("id").toString()); | |
| 517 | + //最后存油量 | |
| 518 | + Double jzdl=Double.parseDouble(map.get("jzdl").toString()); | |
| 519 | + Double hdl=Double.parseDouble(map.get("hdl").toString()); | |
| 520 | + Dlb dlb=repository.findById(id).get(); | |
| 521 | + dlb.setJzcd(jzdl); | |
| 522 | + dlb.setHd(hdl); | |
| 523 | + repository.save(dlb); | |
| 524 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 525 | + }catch(Exception e){ | |
| 526 | + newMap.put("status", ResponseCode.ERROR); | |
| 527 | + logger.error("save erro.", e); | |
| 528 | + } | |
| 529 | + return newMap; | |
| 530 | + } | |
| 531 | + | |
| 532 | + | |
| 533 | + /** | |
| 534 | + * 核对,有加注没里程 | |
| 535 | + * @param map | |
| 536 | + * @return | |
| 537 | + */ | |
| 538 | + @Transactional | |
| 539 | + @Override | |
| 540 | + public Map<String, Object> checkDl(Map<String, Object> map) { | |
| 541 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 542 | +// String xlbm=""; | |
| 543 | +// if(map.get("xlbm_like")!=null){ | |
| 544 | +// xlbm=map.get("xlbm_like").toString(); | |
| 545 | +// } | |
| 546 | + // TODO Auto-generated method stub | |
| 547 | + | |
| 548 | + List<Cars> carsList = carsRepository.findCars(); | |
| 549 | + Map<String, String> carsMap = new HashMap<String, String>(); | |
| 550 | + for (int i = 0; i < carsList.size(); i++) { | |
| 551 | + Cars c = carsList.get(i); | |
| 552 | + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | |
| 553 | + } | |
| 554 | + | |
| 555 | + try{ | |
| 556 | + //获取车辆存油信息 | |
| 557 | + | |
| 558 | + String rq=map.get("rq").toString(); | |
| 559 | + String xlbm=""; | |
| 560 | + if(map.get("xlbm_like")!=null){ | |
| 561 | + xlbm= map.get("xlbm_like").toString().trim(); | |
| 562 | + } | |
| 563 | + String gsbm=""; | |
| 564 | + if(map.get("ssgsdm_like")!=null){ | |
| 565 | + gsbm=map.get("ssgsdm_like").toString(); | |
| 566 | + } | |
| 567 | + String fgsbm=""; | |
| 568 | + if(map.get("fgsdm_like")!=null){ | |
| 569 | + fgsbm=map.get("fgsdm_like").toString(); | |
| 570 | + } | |
| 571 | + String nbbm=""; | |
| 572 | + if(map.get("nbbm_eq")!=null){ | |
| 573 | + nbbm=map.get("nbbm_eq").toString(); | |
| 574 | + } | |
| 575 | + | |
| 576 | + String sql="select * from bsth_c_jdl j where j.gs_bm ='"+gsbm+"' " | |
| 577 | + + " and j.fgs_bm ='"+fgsbm+"' and rq ='"+rq+"' " | |
| 578 | + + "and nbbm not in (select nbbm from bsth_c_dlb d" | |
| 579 | + + " where ssgsdm ='"+gsbm+"' and fgsdm ='"+fgsbm+"'" | |
| 580 | + + " and rq='"+rq+"')"; | |
| 581 | + List<Jdl> listJdl=jdbcTemplate.query(sql, | |
| 582 | + new RowMapper<Jdl>(){ | |
| 583 | + @Override | |
| 584 | + public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 585 | + Jdl s = new Jdl(); | |
| 586 | + s.setNbbm(rs.getString("nbbm")); | |
| 587 | + s.setGsBm(rs.getString("gs_bm")); | |
| 588 | + s.setFgsBm(rs.getString("fgs_bm")); | |
| 589 | + s.setJdl(rs.getDouble("jdl")); | |
| 590 | + s.setRq(rs.getDate("rq")); | |
| 591 | + return s; | |
| 592 | + } | |
| 593 | + }); | |
| 594 | + for (int i = 0; i < listJdl.size(); i++) { | |
| 595 | + Jdl j=listJdl.get(i); | |
| 596 | + Dlb t=new Dlb(); | |
| 597 | + Line line= BasicData.nbbm2LineMap.get(j.getNbbm()); | |
| 598 | + if(null !=line){ | |
| 599 | + t.setCdl(j.getJdl()); | |
| 600 | + t.setNbbm(j.getNbbm()); | |
| 601 | + t.setRq(j.getRq()); | |
| 602 | + t.setJsy(""); | |
| 603 | + t.setCdl(j.getJdl()); | |
| 604 | + t.setSsgsdm(j.getGsBm()); | |
| 605 | + t.setFgsdm(j.getFgsBm()); | |
| 606 | + t.setJzcd(100.0); | |
| 607 | + t.setCzcd(100.0); | |
| 608 | + t.setHd(0.0); | |
| 609 | + t.setJcsx(1); | |
| 610 | + t.setXlbm(line.getLineCode()); | |
| 611 | + t.setLp(""); | |
| 612 | + repository.save(t); | |
| 613 | + } | |
| 614 | + } | |
| 615 | + | |
| 616 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 617 | + Nylog nylog=new Nylog(); | |
| 618 | + nylog.setCreatedate(new Date()); | |
| 619 | + nylog.setCzmc("核对"); | |
| 620 | + nylog.setNylx("电"); | |
| 621 | + nylog.setUserid(user.getUserName()); | |
| 622 | + nylog.setUsername(user.getName()); | |
| 623 | + nylog.setCxtj(xlbm+"-"+ rq+"-"+gsbm+"-"+fgsbm); | |
| 624 | + nylogRepository.save(nylog); | |
| 625 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 626 | + }catch(Exception e){ | |
| 627 | + newMap.put("status", ResponseCode.ERROR); | |
| 628 | + logger.error("save erro.", e); | |
| 629 | + throw e; | |
| 630 | + } | |
| 631 | + | |
| 632 | + return newMap; | |
| 633 | + } | |
| 634 | + | |
| 635 | + @Override | |
| 636 | + public List<Dlb> listDlb(Map<String, Object> map) { | |
| 637 | + // TODO Auto-generated method stub | |
| 638 | + List<Dlb> listDlb = new ArrayList<Dlb>(); | |
| 639 | + List<String> stringList = new ArrayList<String>(); | |
| 640 | + String rq = map.get("rq").toString(); | |
| 641 | + String gsbm = map.get("ssgsdm_like").toString(); | |
| 642 | + String fgsbm = map.get("fgsdm_like").toString(); | |
| 643 | + String xlbm = map.get("xlbm_like").toString().trim(); | |
| 644 | + String nbbm = map.get("nbbm_eq").toString(); | |
| 645 | + String sxtj = map.get("sxtj").toString(); | |
| 646 | + String type = map.get("type").toString(); | |
| 647 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 648 | + try { | |
| 649 | + if (nbbm.trim() != "") { | |
| 650 | + stringList.add(nbbm); | |
| 651 | + if (type.equals("1")) | |
| 652 | + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 653 | + else | |
| 654 | + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 655 | + | |
| 656 | + } else { | |
| 657 | + // 全部 | |
| 658 | + if (sxtj.equals("0")) { | |
| 659 | + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 660 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 661 | + String clbm = objectLists.get(i)[0].toString(); | |
| 662 | + stringList.add(clbm); | |
| 663 | + } | |
| 664 | + if (stringList.size() > 0) { | |
| 665 | + if (type.equals("1")) | |
| 666 | + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 667 | + else | |
| 668 | + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 669 | + } | |
| 670 | + } else { | |
| 671 | + List<Object[]> objectLists; | |
| 672 | + if (sxtj.equals("3")) { | |
| 673 | + // 有加油没里程 | |
| 674 | + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 675 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 676 | + String clbm = objectLists.get(i)[0].toString(); | |
| 677 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 678 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 679 | + if (jzl > 0 && zlc <= 0) { | |
| 680 | + stringList.add(clbm); | |
| 681 | + } | |
| 682 | + | |
| 683 | + } | |
| 684 | + | |
| 685 | + } else if (sxtj.equals("4")) { | |
| 686 | + // 有里程没加油 | |
| 687 | + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 688 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 689 | + String clbm = objectLists.get(i)[0].toString(); | |
| 690 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 691 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 692 | + if (zlc > 0 && jzl <= 0) { | |
| 693 | + stringList.add(clbm); | |
| 694 | + } | |
| 695 | + | |
| 696 | + } | |
| 697 | + } else { | |
| 698 | + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 699 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 700 | + String clbm = objectLists.get(i)[0].toString(); | |
| 701 | + int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | |
| 702 | + // 一车一单 | |
| 703 | + if (sxtj.equals("1")) { | |
| 704 | + if (cs == 1) { | |
| 705 | + stringList.add(clbm); | |
| 706 | + } | |
| 707 | + } | |
| 708 | + // 一车多单 | |
| 709 | + if (sxtj.equals("2")) { | |
| 710 | + if (cs > 1) { | |
| 711 | + stringList.add(clbm); | |
| 712 | + } | |
| 713 | + } | |
| 714 | + } | |
| 715 | + } | |
| 716 | + | |
| 717 | + if (stringList.size() > 0) { | |
| 718 | + if (type.equals("1")) | |
| 719 | + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 720 | + else | |
| 721 | + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 722 | + } | |
| 723 | + } | |
| 724 | + } | |
| 725 | + } catch (ParseException e) { | |
| 726 | + // TODO Auto-generated catch block | |
| 727 | + e.printStackTrace(); | |
| 728 | + } | |
| 729 | + return listDlb; | |
| 730 | + } | |
| 731 | + | |
| 732 | + @Override | |
| 733 | + public Map<String, Object> sumYlb(Map<String, Object> map) { | |
| 734 | + // TODO Auto-generated method stub | |
| 735 | + List<String> stringList = new ArrayList<String>(); | |
| 736 | + String rq = map.get("rq").toString(); | |
| 737 | + String gsbm = map.get("ssgsdm_like").toString(); | |
| 738 | + String fgsbm = map.get("fgsdm_like").toString(); | |
| 739 | + String xlbm = map.get("xlbm_like").toString().trim(); | |
| 740 | + String nbbm = map.get("nbbm_eq").toString(); | |
| 741 | + String sxtj = map.get("sxtj").toString(); | |
| 742 | + String type = map.get("type").toString(); | |
| 743 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 744 | + List<Object[]> sumYlbList = new ArrayList<Object[]>(); | |
| 745 | + try { | |
| 746 | + if (nbbm.trim() != "") { | |
| 747 | + stringList.add(nbbm); | |
| 748 | + } else { | |
| 749 | + if (!sxtj.equals("0")) { | |
| 750 | + List<Object[]> objectLists; | |
| 751 | + if (sxtj.equals("3")) { | |
| 752 | + // 有加油没里程 | |
| 753 | + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 754 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 755 | + String clbm = objectLists.get(i)[0].toString(); | |
| 756 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 757 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 758 | + if (jzl > 0 && zlc <= 0) { | |
| 759 | + stringList.add(clbm); | |
| 760 | + } | |
| 761 | + | |
| 762 | + } | |
| 763 | + | |
| 764 | + } else if (sxtj.equals("4")) { | |
| 765 | + // 有里程没加油 | |
| 766 | + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 767 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 768 | + String clbm = objectLists.get(i)[0].toString(); | |
| 769 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | |
| 770 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | |
| 771 | + if (zlc > 0 && jzl <= 0) { | |
| 772 | + stringList.add(clbm); | |
| 773 | + } | |
| 774 | + | |
| 775 | + } | |
| 776 | + } else { | |
| 777 | + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 778 | + for (int i = 0; i < objectLists.size(); i++) { | |
| 779 | + String clbm = objectLists.get(i)[0].toString(); | |
| 780 | + int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | |
| 781 | + // 一车一单 | |
| 782 | + | |
| 783 | + if (sxtj.equals("1")) { | |
| 784 | + if (cs == 1) { | |
| 785 | + stringList.add(clbm); | |
| 786 | + } | |
| 787 | + } | |
| 788 | + // 一车多单 | |
| 789 | + if (sxtj.equals("2")) { | |
| 790 | + if (cs > 1) { | |
| 791 | + stringList.add(clbm); | |
| 792 | + } | |
| 793 | + } | |
| 794 | + } | |
| 795 | + } | |
| 796 | + } | |
| 797 | + } | |
| 798 | + if (sxtj.equals("0")) { | |
| 799 | + sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 800 | + } else { | |
| 801 | + if (stringList.size() > 0) { | |
| 802 | + | |
| 803 | + // String strings[]=new String[stringList.size()]; | |
| 804 | + // for(int i=0;i<stringList.size();i++){ | |
| 805 | + // strings[i]=stringList.get(i); | |
| 806 | + // } | |
| 807 | + if (type.equals("1")) | |
| 808 | + sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList); | |
| 809 | + else | |
| 810 | + sumYlbList = repository.sumDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList); | |
| 811 | + | |
| 812 | + } | |
| 813 | + // else { | |
| 814 | + // sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); | |
| 815 | + // } | |
| 816 | + } | |
| 817 | + } catch (ParseException e) { | |
| 818 | + // TODO Auto-generated catch block | |
| 819 | + e.printStackTrace(); | |
| 820 | + } | |
| 821 | + Double jzl = 0.0, yh = 0.0, sh = 0.0; | |
| 822 | + for (int i = 0; i < sumYlbList.size(); i++) { | |
| 823 | + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString())); | |
| 824 | + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString())); | |
| 825 | + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString())); | |
| 826 | + } | |
| 827 | + | |
| 828 | + Map<String, Object> sumMap = new HashMap<String, Object>(); | |
| 829 | + sumMap.put("jzl", jzl); | |
| 830 | + sumMap.put("yh", yh); | |
| 831 | + sumMap.put("sh", sh); | |
| 832 | + return sumMap; | |
| 833 | + } | |
| 834 | + | |
| 835 | + | |
| 836 | + @Transactional | |
| 837 | + @Override | |
| 838 | + public Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception { | |
| 839 | + // TODO Auto-generated method stub | |
| 840 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 841 | + try{ | |
| 842 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 843 | + String json =StringEscapeUtils.unescapeHtml4(map.get("dlbList").toString()); | |
| 844 | + JSONArray jsonArray=JSONArray.parseArray(json); | |
| 845 | + JSONObject jsonObject; | |
| 846 | + // 获取车辆存油信息 | |
| 847 | +// List<Cyl> cylList = cylRepository.obtainCyl("",""); | |
| 848 | + for (int i = 0; i < jsonArray.size(); i++) { | |
| 849 | +// Ylb t=new Ylb(); | |
| 850 | + jsonObject=jsonArray.getJSONObject(i); | |
| 851 | + double czcd = jsonObject.getDoubleValue("czcd"); | |
| 852 | + double cdl =jsonObject.getDoubleValue("cdl"); | |
| 853 | + double jzcd =jsonObject.getDoubleValue("jzcd"); | |
| 854 | + double sh =jsonObject.getDoubleValue("sh"); | |
| 855 | + String shyy =jsonObject.getString("shyy"); | |
| 856 | + double hd = jsonObject.getDoubleValue("hd"); | |
| 857 | + int yhlx =jsonObject.getIntValue("yhlx"); | |
| 858 | + Integer id =jsonObject.getInteger("id"); | |
| 859 | +// String nbbm =jsonObject.getString("nbbm"); | |
| 860 | +// String rq=jsonObject.getString("rq"); | |
| 861 | + repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx); | |
| 862 | + | |
| 863 | + } | |
| 864 | + | |
| 865 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 866 | + Nylog nylog=new Nylog(); | |
| 867 | + nylog.setCreatedate(new Date()); | |
| 868 | + nylog.setCzmc("保存全部"); | |
| 869 | + nylog.setNylx("电"); | |
| 870 | + nylog.setUserid(user.getUserName()); | |
| 871 | + nylog.setUsername(user.getName()); | |
| 872 | + nylog.setCxtj(""); | |
| 873 | + nylogRepository.save(nylog); | |
| 874 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 875 | + }catch(Exception e){ | |
| 876 | + newMap.put("status", ResponseCode.ERROR); | |
| 877 | + logger.error("save erro.", e); | |
| 878 | + throw e; | |
| 879 | + } | |
| 880 | + return newMap; | |
| 881 | + } | |
| 882 | + | |
| 883 | + public List<Dlb> listOrderBy(String rq,String gsdm, | |
| 884 | + String fgsdm,String xlbm,String nbbm, | |
| 885 | + String px) { | |
| 886 | + // TODO Auto-generated method stub | |
| 887 | + String sql="SELECT * FROM bsth_c_dlb " | |
| 888 | + + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' " | |
| 889 | + + " and fgsdm like '%"+fgsdm+"%'"; | |
| 890 | + if(xlbm.equals("")){ | |
| 891 | + sql+= " and xlbm like '%"+xlbm+"%' "; | |
| 892 | + }else{ | |
| 893 | + sql+= " and xlbm = '"+xlbm+"' "; | |
| 894 | + } | |
| 895 | + | |
| 896 | + sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | |
| 897 | + | |
| 898 | + List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() { | |
| 899 | + @Override | |
| 900 | + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 901 | + Dlb y = new Dlb(); | |
| 902 | + y.setId(arg0.getInt("id")); | |
| 903 | + return y; | |
| 904 | + } | |
| 905 | + }); | |
| 906 | + List<Dlb> lists=new ArrayList<Dlb>(); | |
| 907 | + List<Dlb> dlbLists=repository.obtainDl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx"); | |
| 908 | + for (int i = 0; i < list.size(); i++) { | |
| 909 | + Dlb t=list.get(i); | |
| 910 | + for (int j = 0; j < dlbLists.size(); j++) { | |
| 911 | + Dlb t2=dlbLists.get(j); | |
| 912 | + if(t.getId().intValue()==t2.getId().intValue()){ | |
| 913 | + lists.add(t2); | |
| 914 | + break; | |
| 915 | + } | |
| 916 | + } | |
| 917 | + } | |
| 918 | + | |
| 919 | + return lists; | |
| 920 | + } | |
| 921 | + | |
| 922 | + | |
| 923 | + @Override | |
| 924 | + public String checkJsy(Map<String, Object> map) { | |
| 925 | + // TODO Auto-generated method stub | |
| 926 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 927 | + String rq=map.get("date").toString(); | |
| 928 | + String nbbm=map.get("nbbm").toString(); | |
| 929 | + String jsy =map.get("jsy").toString(); | |
| 930 | + String xlbm=map.get("xlbm").toString(); | |
| 931 | + List<Dlb> list= repository.queryListDlb(rq, nbbm, jsy, xlbm); | |
| 932 | + String type="1"; | |
| 933 | + if(list.size()>0){ | |
| 934 | + type="0"; | |
| 935 | + } | |
| 936 | + return type; | |
| 937 | + } | |
| 938 | + | |
| 939 | + @Override | |
| 940 | + public Map<String, Object> saveDlb(Dlb t) { | |
| 941 | + // TODO Auto-generated method stub | |
| 942 | + Map<String, Object> map = new HashMap<>(); | |
| 943 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 944 | + String rq=sdf.format(t.getRq()); | |
| 945 | + String gsdm=t.getSsgsdm(); | |
| 946 | + String fgsdm=t.getFgsdm(); | |
| 947 | + String xlbm=t.getXlbm(); | |
| 948 | + String jhsj=t.getJhsj(); | |
| 949 | + String jsy=t.getJsy(); | |
| 950 | + String nbbm=t.getNbbm(); | |
| 951 | + int sfkt=t.getSfkt(); | |
| 952 | + t.setCreatetime(new Date()); | |
| 953 | + String[] jhsjStr = jhsj.split(":"); | |
| 954 | + long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]); | |
| 955 | + List<Dlb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | |
| 956 | +// repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | |
| 957 | + int jcsx=1; | |
| 958 | + if(list.size()>0){ | |
| 959 | + for (int i = 0; i < list.size(); i++) { | |
| 960 | + Dlb y=list.get(i); | |
| 961 | + String[] fcsjStr = y.getJhsj().split(":"); | |
| 962 | + long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | |
| 963 | + if(fcsjL>fcsj){ | |
| 964 | + jcsx=jcsx+y.getJcsx(); | |
| 965 | + }else{ | |
| 966 | + y.setJcsx(y.getJcsx()+1); | |
| 967 | + repository.save(y); | |
| 968 | + } | |
| 969 | + } | |
| 970 | + | |
| 971 | + } | |
| 972 | + t.setJcsx(jcsx); | |
| 973 | + repository.save(t); | |
| 974 | + | |
| 975 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 976 | + Nylog nylog=new Nylog(); | |
| 977 | + nylog.setCreatedate(new Date()); | |
| 978 | + nylog.setCzmc("手动添加"); | |
| 979 | + nylog.setNylx("电"); | |
| 980 | + nylog.setUserid(user.getUserName()); | |
| 981 | + nylog.setUsername(user.getName()); | |
| 982 | + nylog.setCxtj(""); | |
| 983 | + nylogRepository.save(nylog); | |
| 984 | + map.put("status", ResponseCode.SUCCESS); | |
| 985 | + map.put("t", t); | |
| 986 | + return map; | |
| 987 | + } | |
| 988 | + | |
| 989 | + @Transactional | |
| 990 | + @Override | |
| 991 | + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{ | |
| 992 | + // TODO Auto-generated method stub | |
| 993 | + Map<String, Object> maps = new HashMap<>(); | |
| 994 | + try{ | |
| 995 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString()); | |
| 996 | + JSONArray jsonArray=JSONArray.parseArray(json); | |
| 997 | + JSONObject jsonObject; | |
| 998 | + for (int x = 0; x < jsonArray.size(); x++) { | |
| 999 | + jsonObject=jsonArray.getJSONObject(x); | |
| 1000 | + Integer id =jsonObject.getInteger("id"); | |
| 1001 | + repository.deleteById(id); | |
| 1002 | + } | |
| 1003 | + | |
| 1004 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 1005 | + Nylog nylog=new Nylog(); | |
| 1006 | + nylog.setCreatedate(new Date()); | |
| 1007 | + nylog.setCzmc("删除"); | |
| 1008 | + nylog.setNylx("电"); | |
| 1009 | + nylog.setUserid(user.getUserName()); | |
| 1010 | + nylog.setUsername(user.getName()); | |
| 1011 | + nylog.setCxtj(""); | |
| 1012 | + nylogRepository.save(nylog); | |
| 1013 | + maps.put("status", ResponseCode.SUCCESS); | |
| 1014 | + } catch (Exception e) { | |
| 1015 | + maps.put("status", ResponseCode.ERROR); | |
| 1016 | + logger.error("save erro.", e); | |
| 1017 | + throw e; | |
| 1018 | + } | |
| 1019 | + return maps; | |
| 1020 | + } | |
| 1021 | + | |
| 1022 | + @Override | |
| 1023 | + public Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> listpbDc,String date, | |
| 1024 | + String gsdm,String fgsdm,String line) { | |
| 1025 | + // TODO Auto-generated method stub | |
| 1026 | + Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>(); | |
| 1027 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 1028 | + // 保留两位小数 | |
| 1029 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 1030 | + List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | |
| 1031 | + List<Dlb> dlbList_upd=new ArrayList<Dlb>(); | |
| 1032 | + List<Dlb> dlbList_del=new ArrayList<Dlb>(); | |
| 1033 | + try{ | |
| 1034 | + for (int j = 0; j < dlbList.size(); j++) { | |
| 1035 | + Dlb t=dlbList.get(j); | |
| 1036 | + boolean fage=true; | |
| 1037 | + if(StringUtils.isEmpty(t.getLp())){ | |
| 1038 | + fage=false; | |
| 1039 | + }else{ | |
| 1040 | + for (int i = 0; i < listpbDc.size(); i++) { | |
| 1041 | + Map<String, Object> m = listpbDc.get(i); | |
| 1042 | + if(t.getNbbm().equals(m.get("clZbh").toString()) | |
| 1043 | + &&t.getJsy().equals(m.get("jGh").toString()) | |
| 1044 | + &&t.getXlbm().equals(m.get("xlBm").toString()) | |
| 1045 | + &&t.getLp().equals(m.get("lpName").toString())){ | |
| 1046 | + //该条记录不用删除 | |
| 1047 | + fage =false; | |
| 1048 | + dlbList_upd.add(t); | |
| 1049 | + } | |
| 1050 | + } | |
| 1051 | + } | |
| 1052 | + | |
| 1053 | + if(fage){ | |
| 1054 | + if(t.getXlbm().equals(line)){ | |
| 1055 | + dlbList_del.add(t); | |
| 1056 | + } | |
| 1057 | + } | |
| 1058 | + } | |
| 1059 | + mapList.put("delList", dlbList_del); | |
| 1060 | + Map<String, Double> lcMap=new HashMap<String,Double>(); | |
| 1061 | + for (int i = 0; i < listpbDc.size(); i++) { | |
| 1062 | + String cl=listpbDc.get(i).get("clZbh").toString(); | |
| 1063 | + Double lc= listpbDc.get(i).get("totalKilometers") == null ? 0.0 | |
| 1064 | + : Double.parseDouble(listpbDc.get(i).get("totalKilometers").toString()); | |
| 1065 | + if(lcMap.get(cl)==null){ | |
| 1066 | + lcMap.put(cl, lc); | |
| 1067 | + }else{ | |
| 1068 | + double lc_=lcMap.get(cl); | |
| 1069 | + lcMap.remove(cl); | |
| 1070 | + lcMap.put(cl, Arith.add(lc, lc_)); | |
| 1071 | + } | |
| 1072 | + } | |
| 1073 | + Map<String, Double> shMap=new HashMap<String,Double>(); | |
| 1074 | + for (int i = 0; i < dlbList_upd.size(); i++) { | |
| 1075 | + Dlb dlb=dlbList_upd.get(i); | |
| 1076 | + String cl=dlb.getNbbm(); | |
| 1077 | + if(shMap.get(cl)==null){ | |
| 1078 | + shMap.put(cl, dlb.getSh()); | |
| 1079 | + }else{ | |
| 1080 | + double sh=shMap.get(cl); | |
| 1081 | + shMap.remove(cl); | |
| 1082 | + shMap.put(cl, Arith.add(sh, dlb.getSh())); | |
| 1083 | + } | |
| 1084 | + } | |
| 1085 | + List<Jdl> jdlList=jdlRepository.JdlList(date); | |
| 1086 | + Map<String, Object> newMap_=new HashMap<String,Object>(); | |
| 1087 | + Map<String, Object> cMap=new HashMap<String, Object>(); | |
| 1088 | + List<Map<String, Object>> listpb_=listpbDc; | |
| 1089 | + Collections.sort(listpbDc,new NbbmJcsxMap()); | |
| 1090 | + List<Dlb> updateDlb=new ArrayList<Dlb>(); | |
| 1091 | + for (int x = 0; x < listpb_.size(); x++) { | |
| 1092 | + String type = "add"; | |
| 1093 | + Map<String, Object> map_ = listpb_.get(x); | |
| 1094 | + if(newMap_.get(map_.get("clZbh").toString())==null){ | |
| 1095 | + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | |
| 1096 | + //车辆总里程 | |
| 1097 | + double zlc =lcMap.get(map_.get("clZbh").toString()); | |
| 1098 | + //车辆总加电量 | |
| 1099 | + double zjzl = 0.0; | |
| 1100 | + for (int i = 0; i < jdlList.size(); i++) { | |
| 1101 | + Jdl jdl=jdlList.get(i); | |
| 1102 | + if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 1103 | + &&map_.get("company").toString().equals(jdl.getGsBm()) | |
| 1104 | + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | |
| 1105 | + zjzl = Arith.add(zjzl,jdl.getJdl()); | |
| 1106 | + } | |
| 1107 | + } | |
| 1108 | + double clsh=0.0; | |
| 1109 | + if(shMap.get(map_.get("clZbh").toString())==null){ | |
| 1110 | + clsh=0.0; | |
| 1111 | + }else{ | |
| 1112 | + clsh=shMap.get(map_.get("clZbh").toString()); | |
| 1113 | + } | |
| 1114 | + zjzl =Arith.sub(zjzl, clsh); | |
| 1115 | + Double nextJzyl = 0.0; | |
| 1116 | + for (int i = 0; i < listpbDc.size(); i++) { | |
| 1117 | + Map<String, Object> map = listpbDc.get(i); | |
| 1118 | + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 1119 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 1120 | + Dlb t = new Dlb(); | |
| 1121 | + for (int k = 0; k < dlbList_upd.size(); k++) { | |
| 1122 | + Dlb t1 = dlbList_upd.get(k); | |
| 1123 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 1124 | + && t1.getJsy().equals(map.get("jGh").toString()) | |
| 1125 | + && t1.getXlbm().equals(map.get("xlBm").toString()) | |
| 1126 | + && t1.getLp().equals(map.get("lpName").toString())) { | |
| 1127 | + t = t1; | |
| 1128 | + type = "update"; | |
| 1129 | + } | |
| 1130 | + | |
| 1131 | + } | |
| 1132 | + Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | |
| 1133 | + if(map.get("seqNumber").toString().equals("1")){ | |
| 1134 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 1135 | + Double dh=0.0; | |
| 1136 | + if(zlc>0){ | |
| 1137 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 1138 | + } | |
| 1139 | + nextJzyl =Arith.sub(zjzl,dh); | |
| 1140 | + if(zlc>0){ | |
| 1141 | +// long l=Math.round(nextJzyl); | |
| 1142 | + double ylxs=nextJzyl; | |
| 1143 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 1144 | + if(dh<0){ | |
| 1145 | + t.setHd(0.0); | |
| 1146 | + t.setCdl(0.0); | |
| 1147 | + nextJzyl=Arith.add(ylxs, dh); | |
| 1148 | + }else{ | |
| 1149 | + t.setHd(dh); | |
| 1150 | + t.setCdl(dh); | |
| 1151 | + nextJzyl=ylxs; | |
| 1152 | + } | |
| 1153 | + }else{ | |
| 1154 | + t.setHd(0.0); | |
| 1155 | + t.setCdl(0.0); | |
| 1156 | + } | |
| 1157 | + }else{ | |
| 1158 | + Double dh=0.0; | |
| 1159 | + if(zlc>0){ | |
| 1160 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 1161 | + } | |
| 1162 | + nextJzyl =Arith.sub( nextJzyl,dh); | |
| 1163 | + if(zlc>0){ | |
| 1164 | +// long l=0l; | |
| 1165 | + double ylxs=0.0; | |
| 1166 | + if(i==listpbDc.size()-1){ | |
| 1167 | +// ylxs=czyl; | |
| 1168 | + }else{ | |
| 1169 | + if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 1170 | +// l=Math.round(nextJzyl); | |
| 1171 | + ylxs=nextJzyl; | |
| 1172 | + } | |
| 1173 | + | |
| 1174 | + } | |
| 1175 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 1176 | + if(dh<0){ | |
| 1177 | + t.setHd(0.0); | |
| 1178 | + t.setCdl(0.0); | |
| 1179 | + nextJzyl=Arith.add(ylxs, dh); | |
| 1180 | + }else{ | |
| 1181 | + t.setHd(dh); | |
| 1182 | + t.setCdl(dh); | |
| 1183 | + nextJzyl=ylxs; | |
| 1184 | + } | |
| 1185 | + }else{ | |
| 1186 | + t.setHd(0.0); | |
| 1187 | + t.setCdl(0.0); | |
| 1188 | + } | |
| 1189 | + } | |
| 1190 | + t.setCzcd(100.0); | |
| 1191 | + t.setJzcd(100.0); | |
| 1192 | + t.setNbbm(map.get("clZbh").toString()); | |
| 1193 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | |
| 1194 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | |
| 1195 | + : Double.parseDouble(map.get("totalKilometers").toString())); | |
| 1196 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | |
| 1197 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 1198 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | |
| 1199 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | |
| 1200 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 1201 | + t.setRq(sdf.parse(date)); | |
| 1202 | + t.setLp(map.get("lpName").toString()); | |
| 1203 | + t.setCdl(Arith.add(t.getCdl(), t.getSh())); | |
| 1204 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | |
| 1205 | + if(type.equals("add")){ | |
| 1206 | + t.setCreatetime(new Date()); | |
| 1207 | + }else{ | |
| 1208 | + t.setUpdatetime(new Date()); | |
| 1209 | + } | |
| 1210 | + } | |
| 1211 | + | |
| 1212 | + if(t.getHd()<0){ | |
| 1213 | + t.setHd(0.0); | |
| 1214 | + } | |
| 1215 | + if(t.getCdl()<0){ | |
| 1216 | + t.setCdl(0.0); | |
| 1217 | + } | |
| 1218 | + updateDlb.add(t); | |
| 1219 | + } | |
| 1220 | + } | |
| 1221 | + } | |
| 1222 | + } | |
| 1223 | + mapList.put("updList", updateDlb); | |
| 1224 | + }catch(Exception e){ | |
| 1225 | + logger.error("save erro.", e); | |
| 1226 | + } | |
| 1227 | + return mapList; | |
| 1228 | + } | |
| 1229 | + | |
| 1230 | + @Override | |
| 1231 | + public Map<String, Object> update(Map<String, Object> map) { | |
| 1232 | + if(map.get("id")!=null){ | |
| 1233 | + if(map.get("id").toString().length()>0){ | |
| 1234 | + Integer id=Integer.parseInt(map.get("id").toString()); | |
| 1235 | + String jsy=map.get("jsy").toString(); | |
| 1236 | + Dlb t=repository.findById(id).get(); | |
| 1237 | + t.setJsy(jsy); | |
| 1238 | + repository.save(t); | |
| 1239 | + map.put("status", ResponseCode.SUCCESS); | |
| 1240 | + } | |
| 1241 | + } | |
| 1242 | + return map; | |
| 1243 | + } | |
| 1244 | + | |
| 1245 | +} | |
| 1246 | + | |
| 1247 | +class NbbmJcsxMap implements Comparator<Map<String, Object>>{ | |
| 1248 | + @Override | |
| 1249 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 1250 | + // TODO Auto-generated method stub | |
| 1251 | + return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString())); | |
| 1252 | + } | |
| 1253 | +} | ... | ... |
src/main/java/com/bsth/service/oil/impl/QlbServiceImpl.java
| ... | ... | @@ -96,8 +96,6 @@ public class QlbServiceImpl extends BaseServiceImpl<Qlb,Integer> implements QlbS |
| 96 | 96 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 97 | 97 | //当天QLB信息 |
| 98 | 98 | List<Qlb> qlList=repository.obtainQl(rq, "", "", line, "", "nbbm"); |
| 99 | - //当天YLXXB信息 | |
| 100 | - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,""); | |
| 101 | 99 | //当天加氢信息表 |
| 102 | 100 | List<Jql> jqlList=jqlRepository.JqlList(rq); |
| 103 | 101 | //前一天所有车辆最后进场班次信息 |
| ... | ... | @@ -233,8 +231,6 @@ public class QlbServiceImpl extends BaseServiceImpl<Qlb,Integer> implements QlbS |
| 233 | 231 | // TODO Auto-generated method stub |
| 234 | 232 | // 当天QLB信息 |
| 235 | 233 | List<Qlb> qlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); |
| 236 | - // 当天YLXXB信息 | |
| 237 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0, gsbm); | |
| 238 | 234 | // 从排班表中计算出行驶的总里程 |
| 239 | 235 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); |
| 240 | 236 | List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); |
| ... | ... | @@ -1041,7 +1037,6 @@ public class QlbServiceImpl extends BaseServiceImpl<Qlb,Integer> implements QlbS |
| 1041 | 1037 | } |
| 1042 | 1038 | } |
| 1043 | 1039 | List<Jql> jqlList=jqlRepository.JqlList(date); |
| 1044 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0, gsdm); | |
| 1045 | 1040 | Map<String, Object> newMap_=new HashMap<String,Object>(); |
| 1046 | 1041 | Map<String, Object> cMap=new HashMap<String, Object>(); |
| 1047 | 1042 | List<Map<String, Object>> listpb_=listpbQc; | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -109,7 +109,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 109 | 109 | Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); |
| 110 | 110 | for (int i = 0; i < carsList.size(); i++) { |
| 111 | 111 | Cars c=carsList.get(i); |
| 112 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 112 | + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false) | |
| 113 | + || (c.getHydrogen()!=null?c.getHydrogen():false));//电车或氢能源车,排除这些类型就都是油车 | |
| 113 | 114 | } |
| 114 | 115 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| 115 | 116 | Date dNow = new Date(); //当前时间 |
| ... | ... | @@ -136,14 +137,13 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 136 | 137 | List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", ""); |
| 137 | 138 | |
| 138 | 139 | for(int x=0;x<listpb.size();x++){ |
| 139 | - boolean sfdc=true; | |
| 140 | - Map<String, Object> map=listpb.get(x); | |
| 141 | - if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 142 | - sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 143 | - }else{ | |
| 144 | - sfdc=true; | |
| 140 | + boolean sfyc = true;//是否油车 | |
| 141 | + Map<String, Object> map = listpb.get(x); | |
| 142 | + if (carsMap.get(map.get("clZbh").toString()) != null | |
| 143 | + && carsMap.get(map.get("clZbh").toString())) { | |
| 144 | + sfyc = false; | |
| 145 | 145 | } |
| 146 | - if(!sfdc){ | |
| 146 | + if(sfyc){ | |
| 147 | 147 | //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) |
| 148 | 148 | Ylb t=new Ylb(); |
| 149 | 149 | for(int k=0;k<ylList.size();k++){ |
| ... | ... | @@ -249,7 +249,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 249 | 249 | Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); |
| 250 | 250 | for (int i = 0; i < carsList.size(); i++) { |
| 251 | 251 | Cars c = carsList.get(i); |
| 252 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 252 | + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false) | |
| 253 | + || (c.getHydrogen()!=null?c.getHydrogen():false));//电车或氢能源车,排除这些类型就都是油车 | |
| 253 | 254 | } |
| 254 | 255 | String rq = map2.get("rq").toString(); |
| 255 | 256 | String line = ""; |
| ... | ... | @@ -348,14 +349,13 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 348 | 349 | Map<String, Object> cMap=new HashMap<String, Object>(); |
| 349 | 350 | for (int x = 0; x < listpb.size(); x++) { |
| 350 | 351 | String type = "add"; |
| 351 | - boolean sfdc = true; | |
| 352 | + boolean sfyc = true;//是否油车 | |
| 352 | 353 | Map<String, Object> map = listpb.get(x); |
| 353 | - if (carsMap.get(map.get("clZbh").toString()) != null) { | |
| 354 | - sfdc = carsMap.get(map.get("clZbh").toString()); | |
| 355 | - } else { | |
| 356 | - sfdc = true; | |
| 354 | + if (carsMap.get(map.get("clZbh").toString()) != null | |
| 355 | + && carsMap.get(map.get("clZbh").toString())) { | |
| 356 | + sfyc = false; | |
| 357 | 357 | } |
| 358 | - if (!sfdc) { | |
| 358 | + if (sfyc) { | |
| 359 | 359 | // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) |
| 360 | 360 | Ylb t = new Ylb(); |
| 361 | 361 | for (int k = 0; k < ylList.size(); k++) { | ... | ... |