Commit eb6a93a80ec79f6904be66d4794985064194e262

Authored by 潘钊
1 parent d4dbb074

早晚班类型, 和 人车配置

src/main/java/com/bsth/server_rs/schedule/dto/ScheduleCcInfoConfig.java 0 → 100644
  1 +package com.bsth.server_rs.schedule.dto;
  2 +
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +import com.bsth.util.ConvertUtil;
  5 +import com.google.common.collect.ArrayListMultimap;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +
  9 +import java.util.ArrayList;
  10 +import java.util.List;
  11 +import java.util.Set;
  12 +
  13 +/**
  14 + * 实际排班的人车配置信息
  15 + * Created by panzhao on 2017/11/8.
  16 + */
  17 +public class ScheduleCcInfoConfig {
  18 +
  19 + Logger logger = LoggerFactory.getLogger(this.getClass());
  20 +
  21 + public static List<ScheduleCcInfoConfig> getMultiInstance(List<ScheduleRealInfo> list) {
  22 + List<ScheduleCcInfoConfig> rs = new ArrayList<>();
  23 + //按人车分组
  24 + Class clazz = ScheduleRealInfo.class;
  25 + try {
  26 + ArrayListMultimap<String, ScheduleRealInfo> multimap =
  27 + new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, ",", clazz.getDeclaredField("jGh"), clazz.getDeclaredField("clZbh"));
  28 +
  29 + ScheduleCcInfoConfig cc ;
  30 + Set<String> ks = multimap.keySet();
  31 + ScheduleRealInfo sch;
  32 + for(String k : ks){
  33 + sch = multimap.get(k).get(0);
  34 +
  35 + cc = new ScheduleCcInfoConfig();
  36 + cc.setJsy(sch.getjGh() + "/" + sch.getjName());
  37 + cc.setClZhb(sch.getClZbh());
  38 + cc.setLineCode(sch.getXlBm());
  39 + cc.setLineName(sch.getXlName());
  40 + cc.setGsBm(sch.getGsBm());
  41 + cc.setFgsBm(sch.getFgsBm());
  42 +
  43 + rs.add(cc);
  44 + }
  45 + } catch (NoSuchFieldException e) {
  46 + e.printStackTrace();
  47 + }
  48 + return rs;
  49 + }
  50 +
  51 + private String jsy;
  52 +
  53 + private String clZhb;
  54 +
  55 + private String lineCode;
  56 +
  57 + private String lineName;
  58 +
  59 + private String fgsBm;
  60 +
  61 + private String gsBm;
  62 +
  63 + public String getJsy() {
  64 + return jsy;
  65 + }
  66 +
  67 + public void setJsy(String jsy) {
  68 + this.jsy = jsy;
  69 + }
  70 +
  71 + public String getClZhb() {
  72 + return clZhb;
  73 + }
  74 +
  75 + public void setClZhb(String clZhb) {
  76 + this.clZhb = clZhb;
  77 + }
  78 +
  79 + public String getLineCode() {
  80 + return lineCode;
  81 + }
  82 +
  83 + public void setLineCode(String lineCode) {
  84 + this.lineCode = lineCode;
  85 + }
  86 +
  87 + public String getLineName() {
  88 + return lineName;
  89 + }
  90 +
  91 + public void setLineName(String lineName) {
  92 + this.lineName = lineName;
  93 + }
  94 +
  95 + public String getFgsBm() {
  96 + return fgsBm;
  97 + }
  98 +
  99 + public void setFgsBm(String fgsBm) {
  100 + this.fgsBm = fgsBm;
  101 + }
  102 +
  103 + public String getGsBm() {
  104 + return gsBm;
  105 + }
  106 +
  107 + public void setGsBm(String gsBm) {
  108 + this.gsBm = gsBm;
  109 + }
  110 +}
... ...
src/main/java/com/bsth/server_rs/schedule/real/ScheduleRealService.java
... ... @@ -4,6 +4,7 @@ import com.bsth.common.BasicData;
4 4 import com.bsth.redis.ScheduleRedisService;
5 5 import com.bsth.server_rs.base_info.line.Line;
6 6 import com.bsth.server_rs.base_info.line.buffer.LineBufferData;
  7 +import com.bsth.server_rs.schedule.dto.ScheduleCcInfoConfig;
7 8 import com.bsth.server_rs.schedule.dto.ScheduleInOut;
8 9 import com.bsth.server_rs.schedule.dto.ScheduleRealInfoDTO_JK;
9 10 import org.slf4j.Logger;
... ... @@ -54,6 +55,24 @@ public class ScheduleRealService {
54 55 }
55 56  
56 57 /**
  58 + * 获取指定日期,指定公司的人员车辆配置情况(实际排班)
  59 + * @param code
  60 + * @param rq
  61 + * @return
  62 + */
  63 + @GET
  64 + @Path("/ccConfig/{code}/{rq}")
  65 + public List<ScheduleCcInfoConfig> ccInfoConfig(@PathParam("code") String code, @PathParam("rq") String rq){
  66 + Set<String> lineArray = BasicData.lineDateMap.keySet();
  67 +
  68 + List<ScheduleCcInfoConfig> all = new ArrayList<>();
  69 + for (String lineCode : lineArray) {
  70 + all.addAll(ScheduleCcInfoConfig.getMultiInstance(redisService.read(rq, lineCode)));
  71 + }
  72 + return all;
  73 + }
  74 +
  75 + /**
57 76 * 获取当天指定停车场的进出场排班数据(潘钊场站VIP特供版 -高实时)
58 77 *
59 78 * @return
... ...
src/main/java/com/bsth/server_ws/attendance/entity/Jsy_attendance.java
1 1 package com.bsth.server_ws.attendance.entity;
2 2  
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +
  5 +import java.util.Collections;
  6 +import java.util.Comparator;
  7 +import java.util.List;
  8 +
3 9 /**
4 10 * 南汇驾驶员考勤
5 11 * Created by panzhao on 2017/3/27.
... ... @@ -44,6 +50,63 @@ public class Jsy_attendance {
44 50 */
45 51 private String status;
46 52  
  53 + /**
  54 + * 路牌
  55 + */
  56 + private String lpNames;
  57 +
  58 + /** 车辆 */
  59 + private String cls;
  60 +
  61 + /**
  62 + * 早夜班类型
  63 + *
  64 + * 早班:上班时间五点之前;
  65 + * 中班:下班时间为22点之后到24点之间;
  66 + * 晚班:下班时间24点之后为深夜班
  67 + *
  68 + * 1、早班
  69 + 2、中班
  70 + 3、晚班
  71 + 4、早中班
  72 + 5、早晚班
  73 + */
  74 + private int zybType;
  75 +
  76 +
  77 + public void calcZybType(List<ScheduleRealInfo> list){
  78 + ScheduleRealInfo s,e;
  79 + Collections.sort(list, new Comparator<ScheduleRealInfo>() {
  80 + @Override
  81 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  82 + return (int) (o1.getFcsjT() - o2.getFcsjT());
  83 + }
  84 + });
  85 +
  86 + s = list.get(0);
  87 + e = list.get(list.size() - 1);
  88 +
  89 + if(s.getFcsj().compareTo("05:00") <= 0)
  90 + this.zybType=1;//早班
  91 + else if(e.getZdsj().compareTo("05:00") > 0)
  92 + this.zybType=2;//中班
  93 + else if(e.getZdsj().compareTo("05:00") < 0)
  94 + this.zybType=3;//晚班
  95 +
  96 + //早中班
  97 + if(this.zybType==1 && e.getZdsj().compareTo("22:00") >=0 && e.getZdsj().compareTo("23:59") <= 0){
  98 + this.zybType = 4;
  99 + }
  100 +
  101 + //早晚班
  102 + if(this.zybType==1 && e.getZdsj().compareTo(s.getFcsj()) < 0){
  103 + this.zybType = 5;
  104 + }
  105 + }
  106 +
  107 + public Jsy_attendance() {
  108 + }
  109 +
47 110 public String getRq() {
48 111 return rq;
49 112 }
... ... @@ -131,4 +194,45 @@ public class Jsy_attendance {
131 194 public void setFgsCompany(String fgsCompany) {
132 195 this.fgsCompany = fgsCompany;
133 196 }
  197 +
  198 + public String getLpNames() {
  199 + return lpNames;
  200 + }
  201 +
  202 + public void setLpNames(String lpNames) {
  203 + this.lpNames = lpNames;
  204 + }
  205 +
  206 + public String getCls() {
  207 + return cls;
  208 + }
  209 +
  210 + public void setCls(String cls) {
  211 + this.cls = cls;
  212 + }
  213 +
  214 + public void addLpName(String name){
  215 + if(null==this.lpNames)
  216 + this.lpNames="";
  217 + else
  218 + this.lpNames+=",";
  219 + this.lpNames+=name;
  220 + }
  221 +
  222 + public void addCl(String nbbm){
  223 + if(null==this.cls)
  224 + this.cls="";
  225 + else
  226 + this.cls+=",";
  227 +
  228 + this.cls+=nbbm;
  229 + }
  230 +
  231 + public int getZybType() {
  232 + return zybType;
  233 + }
  234 +
  235 + public void setZybType(int zybType) {
  236 + this.zybType = zybType;
  237 + }
134 238 }
... ...
src/main/java/com/bsth/server_ws/util/WSDataConver.java
... ... @@ -548,9 +548,6 @@ public class WSDataConver {
548 548  
549 549 int i = 0;
550 550 for(String jGh : jsySet){
551   - //for(int i = 0; i < ghArray.size(); i ++){
552   - //jGh = ghArray.get(i);
553   -
554 551 attendance = new Jsy_attendance();
555 552 attendance.setRq(rq);
556 553 //计划
... ... @@ -563,7 +560,10 @@ public class WSDataConver {
563 560 attendance.setPlanType(types.get(jGh)==null?"1":types.get(jGh));
564 561 //驾驶员工号
565 562 attendance.setjGh(jGh);
  563 + //早晚班类型
  564 + attendance.calcZybType(reals);
566 565  
  566 + //实际计划
567 567 if(real != null){
568 568 attendance.setXlBm(real.getXlBm());
569 569 attendance.setXlName(real.getXlName());
... ... @@ -572,7 +572,10 @@ public class WSDataConver {
572 572 attendance.setsName(real.getsName());
573 573 attendance.setCompany(real.getGsBm());
574 574 attendance.setFgsCompany(real.getFgsBm());
  575 + attendance.addLpName(real.getLpName());
  576 + attendance.addCl(real.getClZbh());
575 577 }
  578 + //计划
576 579 else if(plan != null){
577 580 attendance.setXlBm(plan.getXlBm());
578 581 attendance.setXlName(plan.getXlName());
... ... @@ -581,6 +584,8 @@ public class WSDataConver {
581 584 attendance.setsName(plan.getsName());
582 585 attendance.setCompany(plan.getGsBm());
583 586 attendance.setFgsCompany(plan.getFgsBm());
  587 + attendance.addLpName(plan.getLpName());
  588 + attendance.addCl(plan.getClZbh());
584 589 }
585 590  
586 591 rs[i] = attendance;
... ... @@ -614,4 +619,6 @@ public class WSDataConver {
614 619 return o1.getJcsx() - o2.getJcsx();
615 620 }
616 621 }
  622 +
  623 +
617 624 }
... ...