SchedulePlanInfoService.java 13.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
package com.bsth.service.schedule;

import com.bsth.entity.schedule.SchedulePlanInfo;
import com.bsth.service.BaseService;
import org.joda.time.DateTime;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by xu on 16/6/16.
 */
public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, Long> {
    /**
     * 查找分组排班信息。
     * @param xlid 线路Id
     * @param scheduleDate 排班日期
     * @return
     */
    List<GroupInfo> findGroupInfo(Integer xlid, Date scheduleDate);

    /**
     * 更新分组信息。
     * type=1,替换车辆
     * type=2,修改出场班次1时间(首班车时间)
     * type=3,替换分组人员(驾驶员1和售票员1)
     * type=4,如果分班,修改出场班次2时间(分班后的第一个出场班次时间)
     * type=5,如果分班,修改分组人员(驾驶员2和售票员2)
     * @param groupInfoUpdate 分组更新信息,包含类型,更新前的信息,更新后的信息
     * @return
     */
    int updateGroupInfo(GroupInfoUpdate groupInfoUpdate);

    /**
     * 分组更新信息。
     */
    static class GroupInfoUpdate {
        /** 类型 */
        private int type;
        /** 原始分组值 */
        private GroupInfo src;
        /** 更新分组值 */
        private GroupInfo update;

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public GroupInfo getSrc() {
            return src;
        }

        public void setSrc(GroupInfo src) {
            this.src = src;
        }

        public GroupInfo getUpdate() {
            return update;
        }

        public void setUpdate(GroupInfo update) {
            this.update = update;
        }
    }

    /**
     * 分组信息。
     */
    static class GroupInfo {
        /** 线路Id */
        private Integer xlId;
        /** 线路名称 */
        private String xlName;
        /** 排班时间 */
        private Date scheduleDate;
        /** 路牌名字 */
        private String lpName;
        /** 车辆Id */
        private Integer clId;
        /** 车辆自编号 */
        private String clZbh;
        /** 出场班次1时间 */
        private String ccsj1;
        /** 出场班次2时间 */
        private String ccsj2;

        /** 驾驶员1id */
        private Integer jsy1Id;
        /** 驾驶员1工号 */
        private String jsy1Gh;
        /** 驾驶员1姓名 */
        private String jsy1Name;
        /** 驾驶员1id */
        private Integer jsy2Id;
        /** 驾驶员1工号 */
        private String jsy2Gh;
        /** 驾驶员1姓名 */
        private String jsy2Name;

        /** 售票员1id */
        private Integer spy1Id;
        /** 售票员1工号 */
        private String spy1Gh;
        /** 售票员1姓名 */
        private String spy1Name;
        /** 售票员1id */
        private Integer spy2Id;
        /** 售票员1工号 */
        private String spy2Gh;
        /** 售票员1姓名 */
        private String spy2Name;

        /** 修改时间 */
        private Date updateDate;
        /** 修改人名 */
        private String updateByName;
        /** 时刻表名字 */
        private String ttInfoName;

        /** 出场班次1发车的顺序号 */
        private Integer fcno1;
        /** 出场班次2发车的顺序号 */
        private Integer fcno2;

        public GroupInfo() {}

        public GroupInfo(Object[] datas) {
            // 线路Id
            this.xlId = Integer.valueOf(String.valueOf(datas[0]));
            // 线路名称
            this.xlName = String.valueOf(datas[1]);
            // 排班时间
            this.scheduleDate = new DateTime(datas[2]).toDate();
            // 路牌名字
            this.lpName = String.valueOf(datas[3]);
            // 车辆id
            this.clId = Integer.valueOf(String.valueOf(datas[4]));
            // 车辆自编号
            this.clZbh = String.valueOf(datas[5]);
            // 出场时间,出场班次,如果有多个,需要分开
            Object ccsj = datas[6];
            Object bctype = datas[7];
            Object fcno = datas[14];

            if (ccsj != null) {
                String[] ccsj_array = ((String) ccsj).split(",");
                String[] bctype_array = ((String) bctype).split(",");
                String[] fcno_array = ((String) fcno).split(",");
                List<Integer> bctype_index = new ArrayList<>();

                for (int i = 0; i < bctype_array.length; i++) {
                    if (bctype_index.size() == 2) { // 只记录2个出场
                        break;
                    }
                    if (bctype_array[i].equals("out")) {
                        bctype_index.add(i);
                    }
                }

                if (bctype_index.size() == 1) {
                    this.ccsj1 = String.valueOf(ccsj_array[bctype_index.get(0)]);
                    this.fcno1 = Integer.valueOf(fcno_array[bctype_index.get(0)]);
                } else if (bctype_index.size() == 2) {
                    this.ccsj1 = String.valueOf(ccsj_array[bctype_index.get(0)]);
                    this.ccsj2 = String.valueOf(ccsj_array[bctype_index.get(1)]);

                    this.fcno1 = Integer.valueOf(fcno_array[bctype_index.get(0)]);
                    this.fcno2 = Integer.valueOf(fcno_array[bctype_index.get(1)]);
                }

            }
            // 驾驶员id,如果有多个,需要分开
            Object jsyId = datas[8];
            if (jsyId != null) {
                String[] jsyId_array = ((String) jsyId).split(",");
                if (jsyId_array.length > 1) {
                    this.jsy1Id = Integer.valueOf(String.valueOf(jsyId_array[0]));
                    this.jsy2Id = Integer.valueOf(String.valueOf(jsyId_array[1]));
                } else {
                    this.jsy1Id = Integer.valueOf(String.valueOf(jsyId_array[0]));
                }
            }
            // 驾驶员工号,如果有多个,需要分开
            Object jsyGh = datas[9];
            if (jsyGh != null) {
                String[] jsyGh_array = ((String) jsyGh).split(",");
                if (jsyGh_array.length > 1) {
                    this.jsy1Gh = String.valueOf(jsyGh_array[0]);
                    this.jsy2Gh = String.valueOf(jsyGh_array[1]);
                } else {
                    this.jsy1Gh = String.valueOf(jsyGh_array[0]);
                }
            }
            // 驾驶员名字,如果有多个,需要分开
            Object jsyName = datas[10];
            if (jsyName != null) {
                String[] jsyName_array = ((String) jsyName).split(",");
                if (jsyName_array.length > 1) {
                    this.jsy1Name = String.valueOf(jsyName_array[0]);
                    this.jsy2Name = String.valueOf(jsyName_array[1]);
                } else {
                    this.jsy1Name = String.valueOf(jsyName_array[0]);
                }
            }

            // 售票员id,如果有多个,需要分开
            Object spyId = datas[11];
            if (spyId != null) {
                String[] spyId_array = ((String) spyId).split(",");
                if (spyId_array.length > 1) {
                    this.spy1Id = Integer.valueOf(String.valueOf(spyId_array[0]));
                    this.spy2Id = Integer.valueOf(String.valueOf(spyId_array[1]));
                } else {
                    this.spy1Id = Integer.valueOf(String.valueOf(spyId_array[0]));
                }
            }

            // 售票员工号,如果有多个,需要分开
            Object spyGh = datas[12];
            if (spyGh != null) {
                String[] spyGh_array = ((String) spyGh).split(",");
                if (spyGh_array.length > 1) {
                    this.spy1Gh = String.valueOf(spyGh_array[0]);
                    this.spy2Gh = String.valueOf(spyGh_array[1]);
                } else {
                    this.spy1Gh = String.valueOf(spyGh_array[0]);
                }
            }
            // 售票员名字,如果有多个,需要分开
            Object spyName = datas[13];
            if (spyName != null) {
                String[] spyName_array = ((String) spyName).split(",");
                if (spyName_array.length > 1) {
                    this.spy1Name = String.valueOf(spyName_array[0]);
                    this.spy2Name = String.valueOf(spyName_array[1]);
                } else {
                    this.spy1Name = String.valueOf(spyName_array[0]);
                }
            }
            // 修改时间
            this.updateDate = new DateTime(datas[15]).toDate();
            // 修改人
            this.updateByName = String.valueOf(datas[16]);
            // 时刻表名字
            this.ttInfoName = String.valueOf(datas[17]);

            // TODO:可能还有其他字段
        }

        public Date getUpdateDate() {
            return updateDate;
        }

        public void setUpdateDate(Date updateDate) {
            this.updateDate = updateDate;
        }

        public String getUpdateByName() {
            return updateByName;
        }

        public void setUpdateByName(String updateByName) {
            this.updateByName = updateByName;
        }

        public String getXlName() {
            return xlName;
        }

        public void setXlName(String xlName) {
            this.xlName = xlName;
        }

        public Date getScheduleDate() {
            return scheduleDate;
        }

        public void setScheduleDate(Date scheduleDate) {
            this.scheduleDate = scheduleDate;
        }

        public String getLpName() {
            return lpName;
        }

        public void setLpName(String lpName) {
            this.lpName = lpName;
        }

        public Integer getClId() {
            return clId;
        }

        public void setClId(Integer clId) {
            this.clId = clId;
        }

        public String getClZbh() {
            return clZbh;
        }

        public void setClZbh(String clZbh) {
            this.clZbh = clZbh;
        }

        public String getCcsj1() {
            return ccsj1;
        }

        public void setCcsj1(String ccsj1) {
            this.ccsj1 = ccsj1;
        }

        public String getCcsj2() {
            return ccsj2;
        }

        public void setCcsj2(String ccsj2) {
            this.ccsj2 = ccsj2;
        }

        public Integer getJsy1Id() {
            return jsy1Id;
        }

        public void setJsy1Id(Integer jsy1Id) {
            this.jsy1Id = jsy1Id;
        }

        public String getJsy1Gh() {
            return jsy1Gh;
        }

        public void setJsy1Gh(String jsy1Gh) {
            this.jsy1Gh = jsy1Gh;
        }

        public String getJsy1Name() {
            return jsy1Name;
        }

        public void setJsy1Name(String jsy1Name) {
            this.jsy1Name = jsy1Name;
        }

        public Integer getJsy2Id() {
            return jsy2Id;
        }

        public void setJsy2Id(Integer jsy2Id) {
            this.jsy2Id = jsy2Id;
        }

        public String getJsy2Gh() {
            return jsy2Gh;
        }

        public void setJsy2Gh(String jsy2Gh) {
            this.jsy2Gh = jsy2Gh;
        }

        public String getJsy2Name() {
            return jsy2Name;
        }

        public void setJsy2Name(String jsy2Name) {
            this.jsy2Name = jsy2Name;
        }

        public Integer getSpy1Id() {
            return spy1Id;
        }

        public void setSpy1Id(Integer spy1Id) {
            this.spy1Id = spy1Id;
        }

        public String getSpy1Gh() {
            return spy1Gh;
        }

        public void setSpy1Gh(String spy1Gh) {
            this.spy1Gh = spy1Gh;
        }

        public String getSpy1Name() {
            return spy1Name;
        }

        public void setSpy1Name(String spy1Name) {
            this.spy1Name = spy1Name;
        }

        public Integer getSpy2Id() {
            return spy2Id;
        }

        public void setSpy2Id(Integer spy2Id) {
            this.spy2Id = spy2Id;
        }

        public String getSpy2Gh() {
            return spy2Gh;
        }

        public void setSpy2Gh(String spy2Gh) {
            this.spy2Gh = spy2Gh;
        }

        public String getSpy2Name() {
            return spy2Name;
        }

        public void setSpy2Name(String spy2Name) {
            this.spy2Name = spy2Name;
        }

        public Integer getXlId() {
            return xlId;
        }

        public void setXlId(Integer xlId) {
            this.xlId = xlId;
        }

        public Integer getFcno1() {
            return fcno1;
        }

        public void setFcno1(Integer fcno1) {
            this.fcno1 = fcno1;
        }

        public Integer getFcno2() {
            return fcno2;
        }

        public void setFcno2(Integer fcno2) {
            this.fcno2 = fcno2;
        }

        public String getTtInfoName() {
            return ttInfoName;
        }

        public void setTtInfoName(String ttInfoName) {
            this.ttInfoName = ttInfoName;
        }
    }
}