Commit 05d526fbade4e29abee9e2ba17c4f61fdab58ce3

Authored by 王通
1 parent c7f1586e

1.zyl接口加入电量信息

src/main/java/com/bsth/entity/Waybill.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4 +import com.fasterxml.jackson.annotation.JsonProperty;
  5 +import org.joda.time.format.DateTimeFormat;
  6 +import org.joda.time.format.DateTimeFormatter;
  7 +
  8 +import javax.persistence.*;
  9 +import java.io.Serializable;
  10 +import java.util.Date;
  11 +import java.util.HashSet;
  12 +import java.util.Set;
  13 +
  14 +/**
  15 + * 实际排班计划明细。
  16 + */
  17 +@JsonIgnoreProperties(ignoreUnknown = true)
  18 +public class Waybill {
  19 +
  20 + /** 主键Id */
  21 + private Long id;
  22 +
  23 + /** 计划ID */
  24 + private Long spId = -1L;
  25 +
  26 + /** 排班计划日期 */
  27 + private Date scheduleDate;
  28 + private String scheduleDateStr;
  29 +
  30 + /** 真实执行时间 yyyy-MM-dd */
  31 + private String realExecDate;
  32 +
  33 + /** 线路名称 */
  34 + private String xlName;
  35 + /** 线路编码 */
  36 + private String xlBm;
  37 +
  38 + /** 路牌名称 */
  39 + private String lpName;
  40 +
  41 + /** 车辆自编号 */
  42 + private String clZbh;
  43 +
  44 + private String jsy;
  45 + /** 驾驶员工号 */
  46 + private String jGh;
  47 + /** 驾驶员名字 */
  48 + private String jName;
  49 +
  50 + private String spy;
  51 + /** 售票员工号 */
  52 + private String sGh;
  53 + /** 售票员名字 */
  54 + private String sName;
  55 +
  56 + /** 线路方向 */
  57 + private String xlDir;
  58 + /** 起点站code*/
  59 + private String qdzCode;
  60 + /** 起点站名字 */
  61 + private String qdzName;
  62 +
  63 + /** 终点站code*/
  64 + private String zdzCode;
  65 + /** 终点站名字 */
  66 + private String zdzName;
  67 +
  68 + /** 计划发车时间(格式 HH:mm) */
  69 + private String fcsj;
  70 + /** 计划发车时间戳*/
  71 + @Transient
  72 + private Long fcsjT;
  73 +
  74 + /** 计划终点时间(格式 HH:mm) */
  75 + private String zdsj;
  76 + /** 计划终点时间戳*/
  77 + @Transient
  78 + private Long zdsjT;
  79 +
  80 + /** 发车顺序号 */
  81 + private Integer fcno;
  82 + /** 对应班次数 */
  83 + private Integer bcs;
  84 + /** 计划里程 */
  85 + private Double jhlc;
  86 +
  87 + /** 原始计划里程 (原计调的数据) */
  88 + private Double jhlcOrig;
  89 +
  90 + /** 班次历时 */
  91 + private Integer bcsj;
  92 +
  93 + /**
  94 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  95 + */
  96 + private String bcType;
  97 +
  98 + /** 创建日期 */
  99 + @Column(name = "create_date")
  100 + private Date createDate;
  101 + /** 修改日期 */
  102 + @Column(name = "update_date")
  103 + private Date updateDate;
  104 +
  105 + /** 实际发车时间*/
  106 + private String fcsjActual;
  107 + /** 实际发车时间戳*/
  108 + @Transient
  109 + private Long fcsjActualTime;
  110 + /**实际终点时间 */
  111 + private String zdsjActual;
  112 + /** 实际终点时间戳*/
  113 + @Transient
  114 + private Long zdsjActualTime;
  115 +
  116 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  117 + private int status;
  118 +
  119 + private String adjustExps;
  120 +
  121 + /** 是否是临加班次 */
  122 + private boolean sflj;
  123 +
  124 + /** 是否误点*/
  125 + @Transient
  126 + private boolean late;
  127 +
  128 + /** 备注*/
  129 + private String remarks;
  130 +
  131 + /**待发时间(格式 HH:mm) */
  132 + private String dfsj;
  133 +
  134 + /**待发时间戳 */
  135 + @Transient
  136 + private Long dfsjT;
  137 +
  138 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  139 + private Integer directiveState = -1;
  140 +
  141 + /** 起点站计划到达时间 */
  142 + @Transient
  143 + private String qdzArrDatejh;
  144 +
  145 + /** 起点站实际到达时间 */
  146 + @Transient
  147 + private String qdzArrDatesj;
  148 +
  149 + /** 子任务 */
  150 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
  151 + private Set<ChildTaskPlan> cTasks = new HashSet<>();
  152 +
  153 + /** 关联的公司名称 */
  154 + private String gsName;
  155 + /** 关联的公司编码 */
  156 + private String gsBm;
  157 + /** 关联的分公司名称 */
  158 + private String fgsName;
  159 + /** 关联的分公司编码 */
  160 + private String fgsBm;
  161 + /** 出场顺序号 */
  162 + private Integer ccno;
  163 +
  164 + //待发调试(是否自动调整)
  165 + private boolean dfAuto;
  166 + //是否有GPS信号
  167 + private boolean online;
  168 +
  169 + /** 是否有补发GPS信号 */
  170 + private boolean reissue;
  171 +
  172 +
  173 +
  174 + /**
  175 + * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
  176 + */
  177 + private boolean ccService;
  178 + private Integer lpChange;
  179 +
  180 + /**
  181 + * rfid状态
  182 + */
  183 + private int rfidState;
  184 +
  185 + /**
  186 + * 起点站rfid状态
  187 + */
  188 + private int firstRfidState;
  189 +
  190 + @Override
  191 + public int hashCode() {
  192 + return (this.id + this.scheduleDateStr + this.xlBm + this.fcsj).hashCode();
  193 + }
  194 +
  195 + @Override
  196 + public boolean equals(Object obj) {
  197 + return this.id.equals(((Waybill)obj).getId());
  198 + }
  199 +
  200 + public Long getId() {
  201 + return id;
  202 + }
  203 +
  204 + public void setId(Long id) {
  205 + this.id = id;
  206 + }
  207 +
  208 + public Long getSpId() {
  209 + return spId;
  210 + }
  211 +
  212 + public void setSpId(Long spId) {
  213 + this.spId = spId;
  214 + }
  215 +
  216 + public Date getScheduleDate() {
  217 + return scheduleDate;
  218 + }
  219 +
  220 + public void setScheduleDate(Date scheduleDate) {
  221 + this.scheduleDate = scheduleDate;
  222 + }
  223 +
  224 + public String getScheduleDateStr() {
  225 + return scheduleDateStr;
  226 + }
  227 +
  228 + public void setScheduleDateStr(String scheduleDateStr) {
  229 + this.scheduleDateStr = scheduleDateStr;
  230 + }
  231 +
  232 + public String getRealExecDate() {
  233 + return realExecDate;
  234 + }
  235 +
  236 + public void setRealExecDate(String realExecDate) {
  237 + this.realExecDate = realExecDate;
  238 + }
  239 +
  240 + public String getXlName() {
  241 + return xlName;
  242 + }
  243 +
  244 + public void setXlName(String xlName) {
  245 + this.xlName = xlName;
  246 + }
  247 +
  248 + public String getXlBm() {
  249 + return xlBm;
  250 + }
  251 +
  252 + public void setXlBm(String xlBm) {
  253 + this.xlBm = xlBm;
  254 + }
  255 +
  256 + public String getLpName() {
  257 + return lpName;
  258 + }
  259 +
  260 + public void setLpName(String lpName) {
  261 + this.lpName = lpName;
  262 + }
  263 +
  264 + public String getClZbh() {
  265 + return clZbh;
  266 + }
  267 +
  268 + public void setClZbh(String clZbh) {
  269 + this.clZbh = clZbh;
  270 + }
  271 +
  272 + public String getjGh() {
  273 + return jGh;
  274 + }
  275 +
  276 + public void setjGh(String jGh) {
  277 + this.jGh = jGh;
  278 + }
  279 +
  280 + public String getjName() {
  281 + return jName;
  282 + }
  283 +
  284 + public void setjName(String jName) {
  285 + this.jName = jName;
  286 + }
  287 +
  288 + public String getsGh() {
  289 + return sGh;
  290 + }
  291 +
  292 + public void setsGh(String sGh) {
  293 + this.sGh = sGh;
  294 + }
  295 +
  296 + public String getsName() {
  297 + return sName;
  298 + }
  299 +
  300 + public void setsName(String sName) {
  301 + this.sName = sName;
  302 + }
  303 +
  304 + public String getXlDir() {
  305 + return xlDir;
  306 + }
  307 +
  308 + public void setXlDir(String xlDir) {
  309 + this.xlDir = xlDir;
  310 + }
  311 +
  312 + public String getQdzCode() {
  313 + return qdzCode;
  314 + }
  315 +
  316 + public void setQdzCode(String qdzCode) {
  317 + this.qdzCode = qdzCode;
  318 + }
  319 +
  320 + public String getQdzName() {
  321 + return qdzName;
  322 + }
  323 +
  324 + public void setQdzName(String qdzName) {
  325 + this.qdzName = qdzName;
  326 + }
  327 +
  328 + public String getZdzCode() {
  329 + return zdzCode;
  330 + }
  331 +
  332 + public void setZdzCode(String zdzCode) {
  333 + this.zdzCode = zdzCode;
  334 + }
  335 +
  336 + public String getZdzName() {
  337 + return zdzName;
  338 + }
  339 +
  340 + public void setZdzName(String zdzName) {
  341 + this.zdzName = zdzName;
  342 + }
  343 +
  344 + public String getFcsj() {
  345 + return fcsj;
  346 + }
  347 +
  348 + public void setFcsj(String fcsj) {
  349 + this.fcsj = fcsj;
  350 + }
  351 +
  352 + public Long getFcsjT() {
  353 + return fcsjT;
  354 + }
  355 +
  356 + public void setFcsjT(Long fcsjT) {
  357 + this.fcsjT = fcsjT;
  358 + }
  359 +
  360 + public String getZdsj() {
  361 + return zdsj;
  362 + }
  363 +
  364 + public void setZdsj(String zdsj) {
  365 + this.zdsj = zdsj;
  366 + }
  367 +
  368 + public Long getZdsjT() {
  369 + return zdsjT;
  370 + }
  371 +
  372 + public void setZdsjT(Long zdsjT) {
  373 + this.zdsjT = zdsjT;
  374 + }
  375 +
  376 + public Integer getFcno() {
  377 + return fcno;
  378 + }
  379 +
  380 + public void setFcno(Integer fcno) {
  381 + this.fcno = fcno;
  382 + }
  383 +
  384 + public Integer getBcs() {
  385 + return bcs;
  386 + }
  387 +
  388 + public void setBcs(Integer bcs) {
  389 + this.bcs = bcs;
  390 + }
  391 +
  392 + public Double getJhlc() {
  393 + return jhlc;
  394 + }
  395 +
  396 + public void setJhlc(Double jhlc) {
  397 + this.jhlc = jhlc;
  398 + }
  399 +
  400 + public Integer getBcsj() {
  401 + return bcsj;
  402 + }
  403 +
  404 + public void setBcsj(Integer bcsj) {
  405 + this.bcsj = bcsj;
  406 + }
  407 +
  408 + public String getBcType() {
  409 + return bcType;
  410 + }
  411 +
  412 + public void setBcType(String bcType) {
  413 + this.bcType = bcType;
  414 + }
  415 +
  416 + public Date getCreateDate() {
  417 + return createDate;
  418 + }
  419 +
  420 + public void setCreateDate(Date createDate) {
  421 + this.createDate = createDate;
  422 + }
  423 +
  424 + public Date getUpdateDate() {
  425 + return updateDate;
  426 + }
  427 +
  428 + public void setUpdateDate(Date updateDate) {
  429 + this.updateDate = updateDate;
  430 + }
  431 +
  432 + public String getFcsjActual() {
  433 + return fcsjActual;
  434 + }
  435 +
  436 + public void setFcsjActual(String fcsjActual) {
  437 + this.fcsjActual = fcsjActual;
  438 + }
  439 +
  440 + public Long getFcsjActualTime() {
  441 + return fcsjActualTime;
  442 + }
  443 +
  444 + public void setFcsjActualTime(Long fcsjActualTime) {
  445 + this.fcsjActualTime = fcsjActualTime;
  446 + }
  447 +
  448 + public String getZdsjActual() {
  449 + return zdsjActual;
  450 + }
  451 +
  452 + public void setZdsjActual(String zdsjActual) {
  453 + this.zdsjActual = zdsjActual;
  454 + }
  455 +
  456 + public Long getZdsjActualTime() {
  457 + return zdsjActualTime;
  458 + }
  459 +
  460 + public void setZdsjActualTime(Long zdsjActualTime) {
  461 + this.zdsjActualTime = zdsjActualTime;
  462 + }
  463 +
  464 + public int getStatus() {
  465 + return status;
  466 + }
  467 +
  468 + public void setStatus(int status) {
  469 + this.status = status;
  470 + }
  471 +
  472 + public String getAdjustExps() {
  473 + return adjustExps;
  474 + }
  475 +
  476 + public void setAdjustExps(String adjustExps) {
  477 + this.adjustExps = adjustExps;
  478 + }
  479 +
  480 + public boolean isSflj() {
  481 + return sflj;
  482 + }
  483 +
  484 + public void setSflj(boolean sflj) {
  485 + this.sflj = sflj;
  486 + }
  487 +
  488 + public boolean isLate() {
  489 + return late;
  490 + }
  491 +
  492 + public void setLate(boolean late) {
  493 + this.late = late;
  494 + }
  495 +
  496 + public String getRemarks() {
  497 + return remarks;
  498 + }
  499 +
  500 + public void setRemarks(String remarks) {
  501 + this.remarks = remarks;
  502 + }
  503 +
  504 + public String getDfsj() {
  505 + return dfsj;
  506 + }
  507 +
  508 + public void setDfsj(String dfsj) {
  509 + this.dfsj = dfsj;
  510 + }
  511 +
  512 + public Long getDfsjT() {
  513 + return dfsjT;
  514 + }
  515 +
  516 + public void setDfsjT(Long dfsjT) {
  517 + this.dfsjT = dfsjT;
  518 + }
  519 +
  520 + public Integer getDirectiveState() {
  521 + return directiveState;
  522 + }
  523 +
  524 + public void setDirectiveState(Integer directiveState) {
  525 + this.directiveState = directiveState;
  526 + }
  527 +
  528 + public String getQdzArrDatejh() {
  529 + return qdzArrDatejh;
  530 + }
  531 +
  532 + public void setQdzArrDatejh(String qdzArrDatejh) {
  533 + this.qdzArrDatejh = qdzArrDatejh;
  534 + }
  535 +
  536 + public String getQdzArrDatesj() {
  537 + return qdzArrDatesj;
  538 + }
  539 +
  540 + public void setQdzArrDatesj(String qdzArrDatesj) {
  541 + this.qdzArrDatesj = qdzArrDatesj;
  542 + }
  543 +
  544 + public Set<ChildTaskPlan> getcTasks() {
  545 + return cTasks;
  546 + }
  547 +
  548 + public void setcTasks(Set<ChildTaskPlan> cTasks) {
  549 + this.cTasks = cTasks;
  550 + }
  551 +
  552 + public String getGsName() {
  553 + return gsName;
  554 + }
  555 +
  556 + public void setGsName(String gsName) {
  557 + this.gsName = gsName;
  558 + }
  559 +
  560 + public String getGsBm() {
  561 + return gsBm;
  562 + }
  563 +
  564 + public void setGsBm(String gsBm) {
  565 + this.gsBm = gsBm;
  566 + }
  567 +
  568 + public String getFgsName() {
  569 + return fgsName;
  570 + }
  571 +
  572 + public void setFgsName(String fgsName) {
  573 + this.fgsName = fgsName;
  574 + }
  575 +
  576 + public String getFgsBm() {
  577 + return fgsBm;
  578 + }
  579 +
  580 + public void setFgsBm(String fgsBm) {
  581 + this.fgsBm = fgsBm;
  582 + }
  583 +
  584 + public Integer getCcno() {
  585 + return ccno;
  586 + }
  587 +
  588 + public void setCcno(Integer ccno) {
  589 + this.ccno = ccno;
  590 + }
  591 +
  592 + public boolean isDfAuto() {
  593 + return dfAuto;
  594 + }
  595 +
  596 + public void setDfAuto(boolean dfAuto) {
  597 + this.dfAuto = dfAuto;
  598 + }
  599 +
  600 + public boolean isOnline() {
  601 + return online;
  602 + }
  603 +
  604 + public void setOnline(boolean online) {
  605 + this.online = online;
  606 + }
  607 +
  608 + public boolean isReissue() {
  609 + return reissue;
  610 + }
  611 +
  612 + public void setReissue(boolean reissue) {
  613 + this.reissue = reissue;
  614 + }
  615 +
  616 + public boolean isCcService() {
  617 + return ccService;
  618 + }
  619 +
  620 + public void setCcService(boolean ccService) {
  621 + this.ccService = ccService;
  622 + }
  623 +
  624 + public Integer getLpChange() {
  625 + return lpChange;
  626 + }
  627 +
  628 + public void setLpChange(Integer lpChange) {
  629 + this.lpChange = lpChange;
  630 + }
  631 +
  632 + public Double getJhlcOrig() {
  633 + return jhlcOrig;
  634 + }
  635 +
  636 + public void setJhlcOrig(Double jhlcOrig) {
  637 + this.jhlcOrig = jhlcOrig;
  638 + }
  639 +
  640 + public int getRfidState() {
  641 + return rfidState;
  642 + }
  643 +
  644 + public void setRfidState(int rfidState) {
  645 + this.rfidState = rfidState;
  646 + }
  647 +
  648 + public int getFirstRfidState() {
  649 + return firstRfidState;
  650 + }
  651 +
  652 + public void setFirstRfidState(int firstRfidState) {
  653 + this.firstRfidState = firstRfidState;
  654 + }
  655 +
  656 + @Transient
  657 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  658 + /**
  659 + *
  660 + * @Title: setFcsjActualAll
  661 + * @Description: TODO(设置实际发车时间 时间戳)
  662 + * @throws
  663 + */
  664 + public void setFcsjActualAll(Long t){
  665 + this.fcsjActualTime = t;
  666 + this.fcsjActual = fmtHHmm.print(t);
  667 + }
  668 +
  669 + /**
  670 + *
  671 + * @Title: setFcsjActualAll
  672 + * @Description: TODO(设置实际终点时间)
  673 + * @throws
  674 + */
  675 + public void setZdsjActualAll(Long t){
  676 + this.zdsjActualTime = t;
  677 + this.zdsjActual = fmtHHmm.print(t);
  678 + }
  679 +
  680 + public String getJsy() {
  681 + return jsy;
  682 + }
  683 +
  684 + public void setJsy(String jsy) {
  685 + this.jsy = jsy;
  686 + }
  687 +
  688 + public String getSpy() {
  689 + return spy;
  690 + }
  691 +
  692 + public void setSpy(String spy) {
  693 + this.spy = spy;
  694 + }
  695 +}
src/main/java/com/bsth/server_rs/schedule/WaybillService.java 0 → 100644
  1 +package com.bsth.server_rs.schedule;
  2 +
  3 +import com.bsth.entity.Waybill;
  4 +import com.fasterxml.jackson.core.JsonProcessingException;
  5 +import com.fasterxml.jackson.databind.ObjectMapper;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  10 +import org.springframework.jdbc.core.JdbcTemplate;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +import javax.ws.rs.POST;
  14 +import javax.ws.rs.Path;
  15 +import javax.ws.rs.Produces;
  16 +import javax.ws.rs.core.MediaType;
  17 +import java.sql.PreparedStatement;
  18 +import java.sql.SQLException;
  19 +import java.util.HashMap;
  20 +import java.util.List;
  21 +import java.util.Map;
  22 +
  23 +@Component
  24 +@Path("/waybill")
  25 +@Produces({MediaType.APPLICATION_JSON})
  26 +public class WaybillService {
  27 +
  28 + private final static Logger log = LoggerFactory.getLogger(WaybillService.class);
  29 +
  30 + private ObjectMapper mapper = new ObjectMapper();
  31 +
  32 + @Autowired
  33 + private JdbcTemplate jdbcTemplate;
  34 +
  35 + @POST
  36 + public Map<String, Object> save(final List<Waybill> waybills) throws JsonProcessingException {
  37 + Map<String, Object> result = new HashMap<>();
  38 + log.error(mapper.writeValueAsString(waybills));
  39 + jdbcTemplate.batchUpdate("insert into zyl.bsth_c_s_sp_real_info (schedule_date_str,real_exec_date,xl_name,lp_name,cl_zbh,j_gh,j_name,s_gh,s_name," +
  40 + "xl_dir,qdz_name,qdz_code,zdz_name,zdz_code,fcsj,zdsj,fcno,bcs,jhlc,bcsj,bc_type,fcsj_actual,zdsj_actual,status,dfsj,gs_bm,fgs_bm,remarks) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  41 + @Override
  42 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  43 + Waybill sri = waybills.get(i);
  44 + ps.setString(1, sri.getScheduleDateStr());
  45 + ps.setString(2, sri.getRealExecDate());
  46 + ps.setString(3, sri.getXlName());
  47 + ps.setString(4, sri.getLpName());
  48 + ps.setString(5, sri.getClZbh());
  49 + ps.setString(6, sri.getjGh());
  50 + ps.setString(7, sri.getjName());
  51 + ps.setString(8, sri.getsGh());
  52 + ps.setString(9, sri.getsName());
  53 + ps.setString(10, sri.getXlDir());
  54 + ps.setString(11, sri.getQdzName());
  55 + ps.setString(12, sri.getQdzCode());
  56 + ps.setString(13, sri.getZdzName());
  57 + ps.setString(14, sri.getZdzCode());
  58 + ps.setString(15, sri.getFcsj());
  59 + ps.setString(16, sri.getZdsj());
  60 + ps.setInt(17, sri.getFcno());
  61 + ps.setInt(18, sri.getBcs());
  62 + ps.setDouble(19, sri.getJhlc());
  63 + ps.setInt(20, sri.getBcsj());
  64 + ps.setString(21, sri.getBcType());
  65 + ps.setString(22, sri.getFcsjActual());
  66 + ps.setString(23, sri.getZdsjActual());
  67 + ps.setInt(24, sri.getStatus());
  68 + ps.setString(25, sri.getDfsj());
  69 + ps.setString(26, sri.getGsBm());
  70 + ps.setString(27, sri.getFgsBm());
  71 + ps.setString(28, sri.getRemarks());
  72 + }
  73 +
  74 + @Override
  75 + public int getBatchSize() {
  76 + return waybills.size();
  77 + }
  78 + });
  79 + result.put("code", 0);
  80 + result.put("msg", "ok");
  81 +
  82 + return result;
  83 + }
  84 +}