Commit 852234780cf18362c7b3f8e1ca6ed096297bca9d

Authored by 娄高锋
1 parent 51470411

浦东公交线路调查表,报表页面

src/main/java/com/bsth/controller/calc/CalcMixController.java
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
9 import org.springframework.web.bind.annotation.RequestParam; 9 import org.springframework.web.bind.annotation.RequestParam;
10 import org.springframework.web.bind.annotation.RestController; 10 import org.springframework.web.bind.annotation.RestController;
11 11
  12 +import com.bsth.entity.calc.CalcInvestigateMonth;
12 import com.bsth.service.calc.CalcMixService; 13 import com.bsth.service.calc.CalcMixService;
13 14
14 @RestController 15 @RestController
@@ -87,5 +88,39 @@ public class CalcMixController { @@ -87,5 +88,39 @@ public class CalcMixController {
87 } 88 }
88 return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing, sfdc); 89 return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing, sfdc);
89 } 90 }
  91 +
  92 + //浦东公交线路调查表
  93 + @RequestMapping(value = "/calcInvestigateMonth", method = RequestMethod.GET)
  94 + public List<CalcInvestigateMonth> calcInvestigateMonth(@RequestParam Map<String, Object> map) {
  95 + String gsbm="";
  96 + if(map.get("gsbm")!=null){
  97 + gsbm=map.get("gsbm").toString().trim();
  98 + }
  99 + String fgsbm="";
  100 + if(map.get("fgsbm")!=null){
  101 + fgsbm=map.get("fgsbm").toString().trim();
  102 + }
  103 + String month="";
  104 + if(map.get("month")!=null){
  105 + month=map.get("month").toString().trim();
  106 + }
  107 + String line="";
  108 + if(map.get("line")!=null){
  109 + line=map.get("line").toString().trim();
  110 + }
  111 + String xlName="";
  112 + if(map.get("xlName")!=null){
  113 + xlName=map.get("xlName").toString().trim();
  114 + }
  115 + String nature="";
  116 + if(map.get("nature")!=null){
  117 + nature=map.get("nature").toString().trim();
  118 + }
  119 + String type="";
  120 + if(map.get("type")!=null){
  121 + type=map.get("type").toString().trim();
  122 + }
  123 + return service.calcInvestigateMonth(gsbm, fgsbm, month, line, xlName, nature, type);
  124 + }
90 125
91 } 126 }
src/main/java/com/bsth/entity/calc/CalcInvestigateMonth.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.*;
  6 +
  7 +@Entity
  8 +@Table(name = "bsth_c_calc_investigate_month")
  9 +public class CalcInvestigateMonth {
  10 + /* 主键*/
  11 + @Id
  12 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  13 + private Long id;
  14 + /* 月(yyyy-MM)*/
  15 + private String month;
  16 + /* 线路*/
  17 + private String xl;
  18 + /* 公司编码*/
  19 + private String gsbm;
  20 + /* 分公司编码*/
  21 + private String fgsbm;
  22 + /* 线路名称*/
  23 + private String xlmc;
  24 + /* 权证配车数*/
  25 + private String qzpcs;
  26 + /* 线路属性*/
  27 + private String xlsx;
  28 + /* 线路类型*/
  29 + private String xllx;
  30 + /* 线路长度*/
  31 + private String xlcd;
  32 + /* 是否挂牌*/
  33 + private String sfgp;
  34 + /* 是否冷僻线路*/
  35 + private String sflpxl;
  36 + /* 首末班时间*/
  37 + private String smbsj;
  38 + /* 调度方式(常规、多样化)*/
  39 + private String ddfs;
  40 + /* 高峰间隔时间*/
  41 + private String gfjgsj;
  42 + /* 低谷间隔时间*/
  43 + private String dgjgsj;
  44 + /* 是否衔接轨交末班*/
  45 + private String sfxjgj;
  46 + /* 日均里程*/
  47 + private String rjlc;
  48 + /* 日均班次*/
  49 + private String rjbc;
  50 + /* 日均人次*/
  51 + private String rjrc;
  52 + /* 日均单车人次*/
  53 + private String rjdcrc;
  54 + /* 每班车人次*/
  55 + private String mbcrc;
  56 + /* 计划总公里*/
  57 + private String jhzgl;
  58 + /* 实际总公里*/
  59 + private String sjzgl;
  60 + /* 实际营运里程*/
  61 + private String sjyylc;
  62 + /* 里程利用率*/
  63 + private String lclyl;
  64 + /* 百公里人次*/
  65 + private String bglrc;
  66 + /* 月人次*/
  67 + private String yrc;
  68 + /* 月营收*/
  69 + private String yys;
  70 + /* 票价*/
  71 + private String pj;
  72 + /* 百公里营收*/
  73 + private String bglys;
  74 + /* 途径轨交站*/
  75 + private String tjgjz;
  76 + /* 途径三级医院*/
  77 + private String tjsjyy;
  78 + /* 唯一线*/
  79 + private String wyx;
  80 + /* 线路走向*/
  81 + private String xlzx;
  82 + /* 线路站点*/
  83 + private String xlzd;
  84 + /* 备注*/
  85 + private String bz;
  86 + /* 创建时间(更新时间)*/
  87 + private Date createDate;
  88 +
  89 + public Long getId() {
  90 + return id;
  91 + }
  92 + public void setId(Long id) {
  93 + this.id = id;
  94 + }
  95 + public String getMonth() {
  96 + return month;
  97 + }
  98 + public void setMonth(String month) {
  99 + this.month = month;
  100 + }
  101 + public String getGsbm() {
  102 + return gsbm;
  103 + }
  104 + public void setGsbm(String gsbm) {
  105 + this.gsbm = gsbm;
  106 + }
  107 + public String getFgsbm() {
  108 + return fgsbm;
  109 + }
  110 + public void setFgsbm(String fgsbm) {
  111 + this.fgsbm = fgsbm;
  112 + }
  113 + public String getXl() {
  114 + return xl;
  115 + }
  116 + public void setXl(String xl) {
  117 + this.xl = xl;
  118 + }
  119 + public String getXlmc() {
  120 + return xlmc;
  121 + }
  122 + public void setXlmc(String xlmc) {
  123 + this.xlmc = xlmc;
  124 + }
  125 + public String getQzpcs() {
  126 + return qzpcs;
  127 + }
  128 + public void setQzpcs(String qzpcs) {
  129 + this.qzpcs = qzpcs;
  130 + }
  131 + public String getXlsx() {
  132 + return xlsx;
  133 + }
  134 + public void setXlsx(String xlsx) {
  135 + this.xlsx = xlsx;
  136 + }
  137 + public String getXllx() {
  138 + return xllx;
  139 + }
  140 + public void setXllx(String xllx) {
  141 + this.xllx = xllx;
  142 + }
  143 + public String getXlcd() {
  144 + return xlcd;
  145 + }
  146 + public void setXlcd(String xlcd) {
  147 + this.xlcd = xlcd;
  148 + }
  149 + public String getSfgp() {
  150 + return sfgp;
  151 + }
  152 + public void setSfgp(String sfgp) {
  153 + this.sfgp = sfgp;
  154 + }
  155 + public String getSflpxl() {
  156 + return sflpxl;
  157 + }
  158 + public void setSflpxl(String sflpxl) {
  159 + this.sflpxl = sflpxl;
  160 + }
  161 + public String getSmbsj() {
  162 + return smbsj;
  163 + }
  164 + public void setSmbsj(String smbsj) {
  165 + this.smbsj = smbsj;
  166 + }
  167 + public String getDdfs() {
  168 + return ddfs;
  169 + }
  170 + public void setDdfs(String ddfs) {
  171 + this.ddfs = ddfs;
  172 + }
  173 + public String getGfjgsj() {
  174 + return gfjgsj;
  175 + }
  176 + public void setGfjgsj(String gfjgsj) {
  177 + this.gfjgsj = gfjgsj;
  178 + }
  179 + public String getDgjgsj() {
  180 + return dgjgsj;
  181 + }
  182 + public void setDgjgsj(String dgjgsj) {
  183 + this.dgjgsj = dgjgsj;
  184 + }
  185 + public String getSfxjgj() {
  186 + return sfxjgj;
  187 + }
  188 + public void setSfxjgj(String sfxjgj) {
  189 + this.sfxjgj = sfxjgj;
  190 + }
  191 + public String getRjlc() {
  192 + return rjlc;
  193 + }
  194 + public void setRjlc(String rjlc) {
  195 + this.rjlc = rjlc;
  196 + }
  197 + public String getRjbc() {
  198 + return rjbc;
  199 + }
  200 + public void setRjbc(String rjbc) {
  201 + this.rjbc = rjbc;
  202 + }
  203 + public String getRjrc() {
  204 + return rjrc;
  205 + }
  206 + public void setRjrc(String rjrc) {
  207 + this.rjrc = rjrc;
  208 + }
  209 + public String getRjdcrc() {
  210 + return rjdcrc;
  211 + }
  212 + public void setRjdcrc(String rjdcrc) {
  213 + this.rjdcrc = rjdcrc;
  214 + }
  215 + public String getMbcrc() {
  216 + return mbcrc;
  217 + }
  218 + public void setMbcrc(String mbcrc) {
  219 + this.mbcrc = mbcrc;
  220 + }
  221 + public String getJhzgl() {
  222 + return jhzgl;
  223 + }
  224 + public void setJhzgl(String jhzgl) {
  225 + this.jhzgl = jhzgl;
  226 + }
  227 + public String getSjzgl() {
  228 + return sjzgl;
  229 + }
  230 + public void setSjzgl(String sjzgl) {
  231 + this.sjzgl = sjzgl;
  232 + }
  233 + public String getSjyylc() {
  234 + return sjyylc;
  235 + }
  236 + public void setSjyylc(String sjyylc) {
  237 + this.sjyylc = sjyylc;
  238 + }
  239 + public String getLclyl() {
  240 + return lclyl;
  241 + }
  242 + public void setLclyl(String lclyl) {
  243 + this.lclyl = lclyl;
  244 + }
  245 + public String getBglrc() {
  246 + return bglrc;
  247 + }
  248 + public void setBglrc(String bglrc) {
  249 + this.bglrc = bglrc;
  250 + }
  251 + public String getYrc() {
  252 + return yrc;
  253 + }
  254 + public void setYrc(String yrc) {
  255 + this.yrc = yrc;
  256 + }
  257 + public String getYys() {
  258 + return yys;
  259 + }
  260 + public void setYys(String yys) {
  261 + this.yys = yys;
  262 + }
  263 + public String getPj() {
  264 + return pj;
  265 + }
  266 + public void setPj(String pj) {
  267 + this.pj = pj;
  268 + }
  269 + public String getBglys() {
  270 + return bglys;
  271 + }
  272 + public void setBglys(String bglys) {
  273 + this.bglys = bglys;
  274 + }
  275 + public String getTjgjz() {
  276 + return tjgjz;
  277 + }
  278 + public void setTjgjz(String tjgjz) {
  279 + this.tjgjz = tjgjz;
  280 + }
  281 + public String getTjsjyy() {
  282 + return tjsjyy;
  283 + }
  284 + public void setTjsjyy(String tjsjyy) {
  285 + this.tjsjyy = tjsjyy;
  286 + }
  287 + public String getWyx() {
  288 + return wyx;
  289 + }
  290 + public void setWyx(String wyx) {
  291 + this.wyx = wyx;
  292 + }
  293 + public String getXlzx() {
  294 + return xlzx;
  295 + }
  296 + public void setXlzx(String xlzx) {
  297 + this.xlzx = xlzx;
  298 + }
  299 + public String getXlzd() {
  300 + return xlzd;
  301 + }
  302 + public void setXlzd(String xlzd) {
  303 + this.xlzd = xlzd;
  304 + }
  305 + public String getBz() {
  306 + return bz;
  307 + }
  308 + public void setBz(String bz) {
  309 + this.bz = bz;
  310 + }
  311 + public Date getCreateDate() {
  312 + return createDate;
  313 + }
  314 + public void setCreateDate(Date createDate) {
  315 + this.createDate = createDate;
  316 + }
  317 +
  318 +}
src/main/java/com/bsth/repository/calc/CalcInvestigateMonthRepository.java 0 → 100644
  1 +package com.bsth.repository.calc;
  2 +
  3 +
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import com.bsth.entity.calc.CalcInvestigateMonth;
  10 +import com.bsth.repository.BaseRepository;
  11 +
  12 +@Repository
  13 +public interface CalcInvestigateMonthRepository extends BaseRepository<CalcInvestigateMonth, Integer>{
  14 +
  15 + @Query(value="select c from CalcInvestigateMonth c where month = ?1")
  16 + List<CalcInvestigateMonth> findByMonth(String month);
  17 +
  18 + @Query(value="select c from CalcInvestigateMonth c where month = ?1 and gsbm like %?2% and fgsbm like %?3%")
  19 + List<CalcInvestigateMonth> findByMonth(String month, String gsbm, String fgsbm);
  20 +
  21 + @Query(value="select c from CalcInvestigateMonth c where month = ?1 and xl = ?2")
  22 + List<CalcInvestigateMonth> findByMonthAndLine(String month, String line);
  23 +
  24 +}
src/main/java/com/bsth/service/calc/CalcMixService.java
@@ -3,6 +3,8 @@ package com.bsth.service.calc; @@ -3,6 +3,8 @@ package com.bsth.service.calc;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
  6 +import com.bsth.entity.calc.CalcInvestigateMonth;
  7 +
6 /** 8 /**
7 * Created by 19/02/28. 9 * Created by 19/02/28.
8 */ 10 */
@@ -12,4 +14,7 @@ public interface CalcMixService { @@ -12,4 +14,7 @@ public interface CalcMixService {
12 14
13 List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing, String sfdc); 15 List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing, String sfdc);
14 16
  17 + //浦东公交线路调查表
  18 + List<CalcInvestigateMonth> calcInvestigateMonth(String gsbm, String fgsbm, String month, String line, String xlName, String nature, String type);
  19 +
15 } 20 }
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java
@@ -2,17 +2,23 @@ package com.bsth.service.calc.impl; @@ -2,17 +2,23 @@ package com.bsth.service.calc.impl;
2 2
3 import java.sql.ResultSet; 3 import java.sql.ResultSet;
4 import java.sql.SQLException; 4 import java.sql.SQLException;
  5 +import java.text.SimpleDateFormat;
5 import java.util.ArrayList; 6 import java.util.ArrayList;
6 import java.util.HashMap; 7 import java.util.HashMap;
  8 +import java.util.Iterator;
7 import java.util.List; 9 import java.util.List;
8 import java.util.Map; 10 import java.util.Map;
9 11
10 import com.bsth.data.BasicData; 12 import com.bsth.data.BasicData;
11 import com.bsth.entity.calc.CalcWaybill; 13 import com.bsth.entity.calc.CalcWaybill;
  14 +import com.bsth.entity.calc.CalcInvestigateMonth;
12 import com.bsth.entity.mcy_forms.Singledata; 15 import com.bsth.entity.mcy_forms.Singledata;
  16 +import com.bsth.repository.calc.CalcInvestigateMonthRepository;
13 import com.bsth.repository.calc.CalcWaybillRepository; 17 import com.bsth.repository.calc.CalcWaybillRepository;
  18 +import com.bsth.service.LineService;
14 import com.bsth.service.calc.CalcMixService; 19 import com.bsth.service.calc.CalcMixService;
15 import com.bsth.util.Arith; 20 import com.bsth.util.Arith;
  21 +import com.bsth.util.ReportUtils;
16 22
17 import org.slf4j.Logger; 23 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 24 import org.slf4j.LoggerFactory;
@@ -29,6 +35,12 @@ public class CalcMixServiceImpl implements CalcMixService { @@ -29,6 +35,12 @@ public class CalcMixServiceImpl implements CalcMixService {
29 35
30 @Autowired 36 @Autowired
31 private CalcWaybillRepository calcRepository; 37 private CalcWaybillRepository calcRepository;
  38 +
  39 + @Autowired
  40 + private CalcInvestigateMonthRepository calcInvestigateMonthRepository;
  41 +
  42 + @Autowired
  43 + private LineService lineService;
32 44
33 @Autowired 45 @Autowired
34 JdbcTemplate jdbcTemplate; 46 JdbcTemplate jdbcTemplate;
@@ -341,4 +353,104 @@ public class CalcMixServiceImpl implements CalcMixService { @@ -341,4 +353,104 @@ public class CalcMixServiceImpl implements CalcMixService {
341 return resList; 353 return resList;
342 } 354 }
343 355
  356 + //浦东公交线路调查表
  357 + @Override
  358 + public List<CalcInvestigateMonth> calcInvestigateMonth(String gsbm, String fgsbm, String month, String line,
  359 + String xlName, String nature, String type) {
  360 + List<CalcInvestigateMonth> resList = new ArrayList<CalcInvestigateMonth>();
  361 +
  362 + Map<String, Boolean> lineNature = lineService.lineNature();
  363 +
  364 + List<CalcInvestigateMonth> list = new ArrayList<CalcInvestigateMonth>();
  365 + if(line != null && line.length() > 0){
  366 + list = calcInvestigateMonthRepository.findByMonthAndLine(month, line);
  367 + } else if(gsbm != null && gsbm.length() > 0){
  368 + list = calcInvestigateMonthRepository.findByMonth(month, gsbm, fgsbm);
  369 + } else {
  370 + list = calcInvestigateMonthRepository.findByMonth(month);
  371 + }
  372 +
  373 + for(CalcInvestigateMonth c : list){
  374 + if("1".equals(nature)){
  375 + if(lineNature.containsKey(c.getXl()) && lineNature.get(c.getXl())){
  376 + resList.add(c);
  377 + }
  378 + } else if("2".equals(nature)){
  379 + if(!lineNature.containsKey(c.getXl()) || !lineNature.get(c.getXl())){
  380 + resList.add(c);
  381 + }
  382 + } else {
  383 + resList.add(c);
  384 + }
  385 + }
  386 +
  387 + if (type != null && type.length() != 0 && type.equals("export")) {
  388 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  389 + sdfSimple = new SimpleDateFormat("yyyyMMdd"),
  390 + monSimple = new SimpleDateFormat("yyyy-MM");
  391 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  392 + Map<String, Object> m = new HashMap<String, Object>();
  393 + m.put("date", month);
  394 + m.put("currMonth", "(" + month + ")");
  395 + ReportUtils ee = new ReportUtils();
  396 + try {
  397 + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
  398 + for(CalcInvestigateMonth c : resList){
  399 + Map<String, Object> map = new HashMap<String, Object>();
  400 + map.put("xlmc", c.getXlmc()!=null?c.getXlmc():"");
  401 + map.put("qzpcs", c.getQzpcs()!=null?c.getQzpcs():"");
  402 + map.put("xlsx", c.getXlsx()!=null?c.getXlsx():"");
  403 + map.put("xllx", c.getXllx()!=null?c.getXllx():"");
  404 + map.put("xlcd", c.getXlcd()!=null?c.getXlcd():"");
  405 + map.put("sfgp", c.getSfgp()!=null?c.getSfgp():"");
  406 + map.put("sflpxl", c.getSflpxl()!=null?c.getSflpxl():"");
  407 + map.put("smbsj", c.getSmbsj()!=null?c.getSmbsj():"");
  408 + if("常规".equals(c.getDdfs())){
  409 + map.put("ddfsCg", "√");
  410 + map.put("ddfsDyh", "");
  411 + } else if("多样化".equals(c.getDdfs())){
  412 + map.put("ddfsCg", "");
  413 + map.put("ddfsDyh", "√");
  414 + } else {
  415 + map.put("ddfsCg", "");
  416 + map.put("ddfsDyh", "");
  417 + }
  418 + map.put("gfjgsj", c.getGfjgsj()!=null?c.getGfjgsj():"");
  419 + map.put("dgjgsj", c.getDgjgsj()!=null?c.getDgjgsj():"");
  420 + map.put("sfxjgj", c.getSfxjgj()!=null?c.getSfxjgj():"");
  421 + map.put("rjlc", c.getRjlc()!=null?c.getRjlc():"");
  422 + map.put("rjbc", c.getRjbc()!=null?c.getRjbc():"");
  423 + map.put("rjrc", c.getRjrc()!=null?c.getRjrc():"");
  424 + map.put("rjdcrc", c.getRjdcrc()!=null?c.getRjdcrc():"");
  425 + map.put("mbcrc", c.getMbcrc()!=null?c.getMbcrc():"");
  426 + map.put("jhzgl", c.getJhzgl()!=null?c.getJhzgl():"");
  427 + map.put("sjzgl", c.getSjzgl()!=null?c.getSjzgl():"");
  428 + map.put("sjyylc", c.getSjyylc()!=null?c.getSjyylc():"");
  429 + map.put("lclyl", c.getLclyl()!=null?c.getLclyl():"");
  430 + map.put("bglrc", c.getBglrc()!=null?c.getBglrc():"");
  431 + map.put("yrc", c.getYrc()!=null?c.getYys():"");
  432 + map.put("yys", c.getYys()!=null?c.getYys():"");
  433 + map.put("pj", c.getPj()!=null?c.getPj():"");
  434 + map.put("bglys", c.getBglys()!=null?c.getBglys():"");
  435 + map.put("tjgjz", c.getTjgjz()!=null?c.getTjgjz():"");
  436 + map.put("tjsjyy", c.getTjsjyy()!=null?c.getTjsjyy():"");
  437 + map.put("wyx", c.getWyx()!=null?c.getWyx():"");
  438 + map.put("xlzx", c.getXlzx()!=null?c.getXlzx():"");
  439 + map.put("xlzd", c.getXlzd()!=null?c.getXlzd():"");
  440 + map.put("bz", c.getBz()!=null?c.getBz():"");
  441 + mapList.add(map);
  442 + }
  443 + listI.add(mapList.iterator());
  444 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  445 + ee.excelReplace(listI, new Object[]{m}, path + "mould/calcInvestigateMonth.xls",
  446 + path + "export/" + "浦东公交线路调查表"+month+".xls");
  447 + } catch (Exception e) {
  448 + // TODO: handle exception
  449 + e.printStackTrace();
  450 + logger.info("" , e);
  451 + }
  452 + }
  453 + return resList;
  454 + }
  455 +
344 } 456 }
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -1269,6 +1269,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1269,6 +1269,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1269 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1269 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1270 NumberFormat nf = NumberFormat.getNumberInstance(); 1270 NumberFormat nf = NumberFormat.getNumberInstance();
1271 nf.setMinimumFractionDigits(2); 1271 nf.setMinimumFractionDigits(2);
  1272 + Map<Long, String> spMap = new HashMap<Long, String>();
1272 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 1273 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1273 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1274 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1274 1275
@@ -1287,19 +1288,70 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1287,19 +1288,70 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1287 date = sdf.format(new Date()); 1288 date = sdf.format(new Date());
1288 1289
1289 try { 1290 try {
1290 - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name,"  
1291 - + " a.xl_bm, a.fgs_bm, a.cc_service, (select start_opt from bsth_c_line_config where id =" 1291 + List<SchedulePlanInfo> listSp = new ArrayList<SchedulePlanInfo>();
  1292 +
  1293 + ArrayList<String> objList = new ArrayList<String>();
  1294 + String sql = "select a.id, a.bc_type"
  1295 + + " from bsth_c_s_sp_info a where schedule_date = ?";
  1296 + objList.add(date);
  1297 + if(line.trim().length() != 0){
  1298 + sql += " and xl_bm = ?";
  1299 + objList.add(line);
  1300 + }
  1301 + if(company.length() != 0){
  1302 + sql += " and gs_bm = ?";
  1303 + objList.add(company);
  1304 + }
  1305 + if(subCompany.length() != 0){
  1306 + sql += " and fgs_bm = ?";
  1307 + objList.add(subCompany);
  1308 + }
  1309 +
  1310 + listSp = jdbcTemplate.query(sql,
  1311 + objList.toArray(),
  1312 + new RowMapper<SchedulePlanInfo>(){
  1313 + @Override
  1314 + public SchedulePlanInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1315 + SchedulePlanInfo schedule = new SchedulePlanInfo();
  1316 + schedule.setId(rs.getLong("id"));
  1317 + schedule.setBcType(rs.getString("bc_type"));
  1318 +
  1319 + return schedule;
  1320 + }
  1321 + });
  1322 +
  1323 + for(SchedulePlanInfo sp : listSp){
  1324 + spMap.put(sp.getId(), sp.getBcType());
  1325 + }
  1326 +
  1327 + } catch (Exception e) {
  1328 + // TODO: handle exception
  1329 + e.printStackTrace();
  1330 + }
  1331 +
  1332 + try {
  1333 + ArrayList<String> objList = new ArrayList<String>();
  1334 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.bc_type, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status,"
  1335 + + " a.xl_bm, a.gs_name, a.fgs_name, a.fgs_bm, a.sp_id, a.cc_service, (select start_opt from bsth_c_line_config where id ="
1292 + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt" 1336 + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt"
1293 - + " from bsth_c_s_sp_info_real a where schedule_date_str = '"+date+"'" 1337 + + " from bsth_c_s_sp_info_real a where schedule_date_str = ?"
1294 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; 1338 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
1295 - if(line.trim().length() != 0)  
1296 - sql += " and xl_bm = '"+line+"'";  
1297 - if(company.length() != 0)  
1298 - sql += " and gs_bm = '"+company+"'";  
1299 - if(subCompany.length() != 0)  
1300 - sql += " and fgs_bm = '"+subCompany+"'"; 1339 + objList.add(date);
  1340 + if(line.trim().length() != 0){
  1341 + sql += " and xl_bm = ?";
  1342 + objList.add(line);
  1343 + }
  1344 + if(company.length() != 0){
  1345 + sql += " and gs_bm = ?";
  1346 + objList.add(company);
  1347 + }
  1348 + if(subCompany.length() != 0){
  1349 + sql += " and fgs_bm = ?";
  1350 + objList.add(subCompany);
  1351 + }
1301 1352
1302 list = jdbcTemplate.query(sql, 1353 list = jdbcTemplate.query(sql,
  1354 + objList.toArray(),
1303 new RowMapper<ScheduleRealInfo>(){ 1355 new RowMapper<ScheduleRealInfo>(){
1304 @Override 1356 @Override
1305 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { 1357 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -1308,6 +1360,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1308,6 +1360,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1308 schedule.setRealExecDate(rs.getString("real_exec_date")); 1360 schedule.setRealExecDate(rs.getString("real_exec_date"));
1309 schedule.setXlName(rs.getString("xl_name")); 1361 schedule.setXlName(rs.getString("xl_name"));
1310 schedule.setXlBm(rs.getString("xl_Bm")); 1362 schedule.setXlBm(rs.getString("xl_Bm"));
  1363 + schedule.setBcType(rs.getString("bc_type"));
1311 schedule.setFcsj(rs.getString("fcsj")); 1364 schedule.setFcsj(rs.getString("fcsj"));
1312 schedule.setFcsjActual(rs.getString("fcsj_actual")); 1365 schedule.setFcsjActual(rs.getString("fcsj_actual"));
1313 schedule.setZdsj(rs.getString("zdsj")); 1366 schedule.setZdsj(rs.getString("zdsj"));
@@ -1319,6 +1372,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1319,6 +1372,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1319 schedule.setGsName(rs.getString("gs_name")); 1372 schedule.setGsName(rs.getString("gs_name"));
1320 schedule.setFgsName(rs.getString("fgs_name")); 1373 schedule.setFgsName(rs.getString("fgs_name"));
1321 schedule.setFgsBm(rs.getString("fgs_bm")); 1374 schedule.setFgsBm(rs.getString("fgs_bm"));
  1375 + schedule.setSpId(rs.getLong("sp_id"));
1322 schedule.setCcService(rs.getBoolean("cc_service")); 1376 schedule.setCcService(rs.getBoolean("cc_service"));
1323 1377
1324 int startOpt = 120; 1378 int startOpt = 120;
@@ -1440,11 +1494,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1440,11 +1494,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1440 Collections.sort(up1); 1494 Collections.sort(up1);
1441 Collections.sort(up2); 1495 Collections.sort(up2);
1442 ScheduleRealInfo s1 = up1Map.get(up1.get(0)); 1496 ScheduleRealInfo s1 = up1Map.get(up1.get(0));
  1497 + for(Long jhfcsj : up1){
  1498 + s1 = up1Map.get(jhfcsj);
  1499 + String bcType = s1.getBcType();
  1500 + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){
  1501 + bcType = spMap.get(s1.getSpId());
  1502 + }
  1503 + if(bcType.equals("region") || bcType.equals("venting")
  1504 + || bcType.equals("major")){
  1505 + continue;
  1506 + }
  1507 + break;
  1508 + }
1443 ScheduleRealInfo s2 = up2Map.get(up2.get(0)); 1509 ScheduleRealInfo s2 = up2Map.get(up2.get(0));
  1510 + for(Long sjfcsj : up2){
  1511 + ScheduleRealInfo temp2 = up2Map.get(sjfcsj);
  1512 + String bcType = temp2.getBcType();
  1513 + if(bcType.equals("region") || bcType.equals("venting")
  1514 + || bcType.equals("major")){
  1515 + continue;
  1516 + }
  1517 + long delayFirst0 = s1.getFcsjT() - temp2.getFcsjActualTime();
  1518 + if(delayFirst0 <= 1l && delayFirst0 >= -2l){
  1519 + s2 = temp2;
  1520 + break;
  1521 + }
  1522 + }
1444 ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); 1523 ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1));
  1524 + for(int i = up1.size() - 1; i >= 0; i--){
  1525 + s3 = up1Map.get(up1.get(i));
  1526 + String bcType = s3.getBcType();
  1527 + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){
  1528 + bcType = spMap.get(s3.getSpId());
  1529 + }
  1530 + if(bcType.equals("region") || bcType.equals("venting")
  1531 + || bcType.equals("major")){
  1532 + continue;
  1533 + }
  1534 + break;
  1535 + }
1445 ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); 1536 ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1));
1446 - long delayFirst0 = up1.get(0) - up2.get(0);  
1447 - long delayLast0 = up1.get(up1.size()-1) - up2.get(up2.size()-1); 1537 + for(int i = up2.size() - 1; i >= 0; i--){
  1538 + ScheduleRealInfo temp4 = up2Map.get(up2.get(i));
  1539 + String bcType = temp4.getBcType();
  1540 + if(bcType.equals("region") || bcType.equals("venting")
  1541 + || bcType.equals("major")){
  1542 + continue;
  1543 + }
  1544 + long delayLast0 = s3.getFcsjT() - temp4.getFcsjActualTime();
  1545 + if(delayLast0 <= 1l && delayLast0 >= -2l){
  1546 + s4 = temp4;
  1547 + break;
  1548 + }
  1549 + break;
  1550 + }
  1551 + long delayFirst0 = s1.getFcsjT() - s2.getFcsjActualTime();
  1552 + long delayLast0 = s3.getFcsjT() - s4.getFcsjActualTime();
1448 tempMap.put("qdzFirst0", s1.getQdzName()); 1553 tempMap.put("qdzFirst0", s1.getQdzName());
1449 tempMap.put("jhfcFirst0", s1.getFcsj()); 1554 tempMap.put("jhfcFirst0", s1.getFcsj());
1450 tempMap.put("sjfcFirst0", s2.getFcsjActual()); 1555 tempMap.put("sjfcFirst0", s2.getFcsjActual());
@@ -1467,11 +1572,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1467,11 +1572,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1467 Collections.sort(dn1); 1572 Collections.sort(dn1);
1468 Collections.sort(dn2); 1573 Collections.sort(dn2);
1469 ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); 1574 ScheduleRealInfo s1 = dn1Map.get(dn1.get(0));
  1575 + for(Long jhfcsj : dn1){
  1576 + s1 = dn1Map.get(jhfcsj);
  1577 + String bcType = s1.getBcType();
  1578 + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){
  1579 + bcType = spMap.get(s1.getSpId());
  1580 + }
  1581 + if(bcType.equals("region") || bcType.equals("venting")
  1582 + || bcType.equals("major")){
  1583 + continue;
  1584 + }
  1585 + break;
  1586 + }
1470 ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); 1587 ScheduleRealInfo s2 = dn2Map.get(dn2.get(0));
  1588 + for(Long sjfcsj : dn2){
  1589 + ScheduleRealInfo temp2 = dn2Map.get(sjfcsj);
  1590 + String bcType = temp2.getBcType();
  1591 + if(bcType.equals("region") || bcType.equals("venting")
  1592 + || bcType.equals("major")){
  1593 + continue;
  1594 + }
  1595 + long delayFirst1 = s1.getFcsjT() - temp2.getFcsjActualTime();
  1596 + if(delayFirst1 <= 1l && delayFirst1 >= -2l){
  1597 + s2 = temp2;
  1598 + break;
  1599 + }
  1600 + break;
  1601 + }
1471 ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); 1602 ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1));
  1603 + for(int i = dn1.size() - 1; i >= 0; i--){
  1604 + s3 = dn1Map.get(dn1.get(i));
  1605 + String bcType = s3.getBcType();
  1606 + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){
  1607 + bcType = spMap.get(s3.getSpId());
  1608 + }
  1609 + if(bcType.equals("region") || bcType.equals("venting")
  1610 + || bcType.equals("major")){
  1611 + continue;
  1612 + }
  1613 + break;
  1614 + }
1472 ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); 1615 ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1));
1473 - long delayFirst1 = dn1.get(0) - dn2.get(0);  
1474 - long delayLast1 = dn1.get(dn1.size()-1) - dn2.get(dn2.size()-1); 1616 + for(int i = dn2.size() - 1; i >= 0; i--){
  1617 + ScheduleRealInfo temp4 = dn2Map.get(dn2.get(i));
  1618 + String bcType = temp4.getBcType();
  1619 + if(bcType.equals("region") || bcType.equals("venting")
  1620 + || bcType.equals("major")){
  1621 + continue;
  1622 + }
  1623 + long delayLast1 = s3.getFcsjT() - temp4.getFcsjActualTime();
  1624 + if(delayLast1 <= 1l && delayLast1 >= -2l){
  1625 + s4 = temp4;
  1626 + break;
  1627 + }
  1628 + break;
  1629 + }
  1630 + long delayFirst1 = s1.getFcsjT() - s2.getFcsjActualTime();
  1631 + long delayLast1 = s3.getFcsjT() - s4.getFcsjActualTime();
1475 tempMap.put("qdzFirst1", s1.getQdzName()); 1632 tempMap.put("qdzFirst1", s1.getQdzName());
1476 tempMap.put("jhfcFirst1", s1.getFcsj()); 1633 tempMap.put("jhfcFirst1", s1.getFcsj());
1477 tempMap.put("sjfcFirst1", s2.getFcsjActual()); 1634 tempMap.put("sjfcFirst1", s2.getFcsjActual());
@@ -1526,6 +1683,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1526,6 +1683,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1526 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1683 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1527 NumberFormat nf = NumberFormat.getNumberInstance(); 1684 NumberFormat nf = NumberFormat.getNumberInstance();
1528 nf.setMinimumFractionDigits(2); 1685 nf.setMinimumFractionDigits(2);
  1686 + Map<Long, String> spMap = new HashMap<Long, String>();
1529 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 1687 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1530 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1688 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1531 1689
@@ -1558,13 +1716,57 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1558,13 +1716,57 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1558 +split2[0]+"年"+split2[1]+"月"+split2[2]+"日"; 1716 +split2[0]+"年"+split2[1]+"月"+split2[2]+"日";
1559 } 1717 }
1560 1718
  1719 + try {
  1720 + List<SchedulePlanInfo> listSp = new ArrayList<SchedulePlanInfo>();
  1721 +
  1722 + ArrayList<String> objList = new ArrayList<String>();
  1723 + String sql = "select a.id, a.bc_type"
  1724 + + " from bsth_c_s_sp_info a where"
  1725 + + " schedule_date >= ? and schedule_date <= ?";
  1726 + objList.add(startDate);
  1727 + objList.add(endDate);
  1728 + if(line.trim().length() != 0){
  1729 + sql += " and xl_bm = ?";
  1730 + objList.add(line);
  1731 + }
  1732 + if(company.length() != 0){
  1733 + sql += " and gs_bm = ?";
  1734 + objList.add(company);
  1735 + }
  1736 + if(subCompany.length() != 0){
  1737 + sql += " and fgs_bm = ?";
  1738 + objList.add(subCompany);
  1739 + }
  1740 +
  1741 + listSp = jdbcTemplate.query(sql,
  1742 + objList.toArray(),
  1743 + new RowMapper<SchedulePlanInfo>(){
  1744 + @Override
  1745 + public SchedulePlanInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1746 + SchedulePlanInfo schedule = new SchedulePlanInfo();
  1747 + schedule.setId(rs.getLong("id"));
  1748 + schedule.setBcType(rs.getString("bc_type"));
  1749 +
  1750 + return schedule;
  1751 + }
  1752 + });
  1753 +
  1754 + for(SchedulePlanInfo sp : listSp){
  1755 + spMap.put(sp.getId(), sp.getBcType());
  1756 + }
  1757 +
  1758 + } catch (Exception e) {
  1759 + // TODO: handle exception
  1760 + e.printStackTrace();
  1761 + }
  1762 +
1561 List<String> objList = new ArrayList<String>(); 1763 List<String> objList = new ArrayList<String>();
1562 objList.add(startDate); 1764 objList.add(startDate);
1563 objList.add(endDate); 1765 objList.add(endDate);
1564 1766
1565 try { 1767 try {
1566 - String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, "  
1567 - + " a.gs_name, a.fgs_name, a.gs_bm, a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = " 1768 + String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.bc_type, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, "
  1769 + + " a.gs_name, a.fgs_name, a.gs_bm, a.fgs_bm, a.sp_id, a.cc_service, a.remarks, a.adjust_exps, (select start_opt from bsth_c_line_config where id = "
1568 + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt " 1770 + " (select max(id) from bsth_c_line_config where line = (select id from bsth_c_line where line_code = a.xl_bm))) start_opt "
1569 + " from bsth_c_s_sp_info_real a where schedule_date_str >= ? and schedule_date_str <= ? " 1771 + " from bsth_c_s_sp_info_real a where schedule_date_str >= ? and schedule_date_str <= ? "
1570 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; 1772 + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'";
@@ -1591,6 +1793,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1591,6 +1793,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1591 schedule.setRealExecDate(rs.getString("real_exec_date")); 1793 schedule.setRealExecDate(rs.getString("real_exec_date"));
1592 schedule.setXlName(rs.getString("xl_name")); 1794 schedule.setXlName(rs.getString("xl_name"));
1593 schedule.setXlBm(rs.getString("xl_bm")); 1795 schedule.setXlBm(rs.getString("xl_bm"));
  1796 + schedule.setBcType(rs.getString("bc_type"));
1594 schedule.setFcsj(rs.getString("fcsj")); 1797 schedule.setFcsj(rs.getString("fcsj"));
1595 schedule.setFcsjActual(rs.getString("fcsj_actual")); 1798 schedule.setFcsjActual(rs.getString("fcsj_actual"));
1596 schedule.setZdsj(rs.getString("zdsj")); 1799 schedule.setZdsj(rs.getString("zdsj"));
@@ -1603,6 +1806,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1603,6 +1806,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1603 schedule.setFgsName(rs.getString("fgs_name")); 1806 schedule.setFgsName(rs.getString("fgs_name"));
1604 schedule.setGsBm(rs.getString("gs_bm")); 1807 schedule.setGsBm(rs.getString("gs_bm"));
1605 schedule.setFgsBm(rs.getString("fgs_bm")); 1808 schedule.setFgsBm(rs.getString("fgs_bm"));
  1809 + schedule.setSpId(rs.getLong("sp_id"));
1606 schedule.setCcService(rs.getBoolean("cc_service")); 1810 schedule.setCcService(rs.getBoolean("cc_service"));
1607 schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):""); 1811 schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):"");
1608 schedule.setAdjustExps(rs.getString("adjust_exps")!=null?rs.getString("adjust_exps"):""); 1812 schedule.setAdjustExps(rs.getString("adjust_exps")!=null?rs.getString("adjust_exps"):"");
@@ -1752,11 +1956,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1752,11 +1956,62 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1752 Collections.sort(up1); 1956 Collections.sort(up1);
1753 Collections.sort(up2); 1957 Collections.sort(up2);
1754 ScheduleRealInfo s1 = up1Map.get(up1.get(0)); 1958 ScheduleRealInfo s1 = up1Map.get(up1.get(0));
  1959 + for(Long jhfcsj : up1){
  1960 + s1 = up1Map.get(jhfcsj);
  1961 + String bcType = s1.getBcType();
  1962 + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){
  1963 + bcType = spMap.get(s1.getSpId());
  1964 + }
  1965 + if(bcType.equals("region") || bcType.equals("venting")
  1966 + || bcType.equals("major")){
  1967 + continue;
  1968 + }
  1969 + break;
  1970 + }
1755 ScheduleRealInfo s2 = up2Map.get(up2.get(0)); 1971 ScheduleRealInfo s2 = up2Map.get(up2.get(0));
  1972 + for(Long sjfcsj : up2){
  1973 + ScheduleRealInfo temp2 = up2Map.get(sjfcsj);
  1974 + String bcType = temp2.getBcType();
  1975 + if(bcType.equals("region") || bcType.equals("venting")
  1976 + || bcType.equals("major")){
  1977 + continue;
  1978 + }
  1979 + long delayFirst0 = s1.getFcsjT() - temp2.getFcsjActualTime();
  1980 + if(delayFirst0 <= 1l && delayFirst0 >= -2l){
  1981 + s2 = temp2;
  1982 + break;
  1983 + }
  1984 + }
1756 ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); 1985 ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1));
  1986 + for(int i = up1.size() - 1; i >= 0; i--){
  1987 + s3 = up1Map.get(up1.get(i));
  1988 + String bcType = s3.getBcType();
  1989 + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){
  1990 + bcType = spMap.get(s3.getSpId());
  1991 + }
  1992 + if(bcType.equals("region") || bcType.equals("venting")
  1993 + || bcType.equals("major")){
  1994 + continue;
  1995 + }
  1996 + break;
  1997 + }
1757 ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); 1998 ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1));
1758 - long delayFirst0 = up1.get(0) - up2.get(0);  
1759 - long delayLast0 = up1.get(up1.size()-1) - up2.get(up2.size()-1); 1999 + for(int i = up2.size() - 1; i >= 0; i--){
  2000 + ScheduleRealInfo temp4 = up2Map.get(up2.get(i));
  2001 + String bcType = temp4.getBcType();
  2002 + if(bcType.equals("region") || bcType.equals("venting")
  2003 + || bcType.equals("major")){
  2004 + continue;
  2005 + }
  2006 + long delayLast0 = s3.getFcsjT() - temp4.getFcsjActualTime();
  2007 + if(delayLast0 <= 1l && delayLast0 >= -2l){
  2008 + s4 = temp4;
  2009 + break;
  2010 + }
  2011 + break;
  2012 + }
  2013 + long delayFirst0 = s1.getFcsjT() - s2.getFcsjActualTime();
  2014 + long delayLast0 = s3.getFcsjT() - s4.getFcsjActualTime();
1760 temp.put("qdzFirst0", s1.getQdzName()); 2015 temp.put("qdzFirst0", s1.getQdzName());
1761 temp.put("jhfcFirst0", s1.getFcsj()); 2016 temp.put("jhfcFirst0", s1.getFcsj());
1762 temp.put("sjfcFirst0", s2.getFcsjActual()); 2017 temp.put("sjfcFirst0", s2.getFcsjActual());
@@ -1818,11 +2073,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1818,11 +2073,63 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1818 Collections.sort(dn1); 2073 Collections.sort(dn1);
1819 Collections.sort(dn2); 2074 Collections.sort(dn2);
1820 ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); 2075 ScheduleRealInfo s1 = dn1Map.get(dn1.get(0));
  2076 + for(Long jhfcsj : dn1){
  2077 + s1 = dn1Map.get(jhfcsj);
  2078 + String bcType = s1.getBcType();
  2079 + if(s1.getSpId() != null && spMap.containsKey(s1.getSpId())){
  2080 + bcType = spMap.get(s1.getSpId());
  2081 + }
  2082 + if(bcType.equals("region") || bcType.equals("venting")
  2083 + || bcType.equals("major")){
  2084 + continue;
  2085 + }
  2086 + break;
  2087 + }
1821 ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); 2088 ScheduleRealInfo s2 = dn2Map.get(dn2.get(0));
  2089 + for(Long sjfcsj : dn2){
  2090 + ScheduleRealInfo temp2 = dn2Map.get(sjfcsj);
  2091 + String bcType = temp2.getBcType();
  2092 + if(bcType.equals("region") || bcType.equals("venting")
  2093 + || bcType.equals("major")){
  2094 + continue;
  2095 + }
  2096 + long delayFirst1 = s1.getFcsjT() - temp2.getFcsjActualTime();
  2097 + if(delayFirst1 <= 1l && delayFirst1 >= -2l){
  2098 + s2 = temp2;
  2099 + break;
  2100 + }
  2101 + break;
  2102 + }
1822 ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); 2103 ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1));
  2104 + for(int i = dn1.size() - 1; i >= 0; i--){
  2105 + s3 = dn1Map.get(dn1.get(i));
  2106 + String bcType = s3.getBcType();
  2107 + if(s3.getSpId() != null && spMap.containsKey(s3.getSpId())){
  2108 + bcType = spMap.get(s3.getSpId());
  2109 + }
  2110 + if(bcType.equals("region") || bcType.equals("venting")
  2111 + || bcType.equals("major")){
  2112 + continue;
  2113 + }
  2114 + break;
  2115 + }
1823 ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); 2116 ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1));
1824 - long delayFirst1 = dn1.get(0) - dn2.get(0);  
1825 - long delayLast1 = dn1.get(dn1.size()-1) - dn2.get(dn2.size()-1); 2117 + for(int i = dn2.size() - 1; i >= 0; i--){
  2118 + ScheduleRealInfo temp4 = dn2Map.get(dn2.get(i));
  2119 + String bcType = temp4.getBcType();
  2120 + if(bcType.equals("region") || bcType.equals("venting")
  2121 + || bcType.equals("major")){
  2122 + continue;
  2123 + }
  2124 + long delayLast1 = s3.getFcsjT() - temp4.getFcsjActualTime();
  2125 + if(delayLast1 <= 1l && delayLast1 >= -2l){
  2126 + s4 = temp4;
  2127 + break;
  2128 + }
  2129 + break;
  2130 + }
  2131 + long delayFirst1 = s1.getFcsjT() - s2.getFcsjActualTime();
  2132 + long delayLast1 = s3.getFcsjT() - s4.getFcsjActualTime();
1826 temp.put("qdzFirst1", s1.getQdzName()); 2133 temp.put("qdzFirst1", s1.getQdzName());
1827 temp.put("jhfcFirst1", s1.getFcsj()); 2134 temp.put("jhfcFirst1", s1.getFcsj());
1828 temp.put("sjfcFirst1", s2.getFcsjActual()); 2135 temp.put("sjfcFirst1", s2.getFcsjActual());
src/main/resources/static/pages/forms/calc/calcInvestigateMonth.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +
  18 + #forms > thead > tr> td >span{
  19 + width: 5px;
  20 + word-wrap: break-word;
  21 + letter-spacing: 20px;
  22 + }
  23 +
  24 + #forms > thead > tr> td >label{
  25 + word-break: keep-all;white-space:nowrap;
  26 + }
  27 +
  28 + .table > thead > tr > td{
  29 + min-width: 80px;
  30 + text-align:center;
  31 + }
  32 + .table > tbody > tr > td{
  33 + text-align:center;
  34 + }
  35 +</style>
  36 +
  37 +<div class="page-head">
  38 + <div class="page-title">
  39 + <h1>浦东公交线路调查表</h1>
  40 + </div>
  41 +</div>
  42 +
  43 +<!-- <div class="row"> -->
  44 + <div class="col-md-12 portlet light porttlet-fit bordered" style="height:calc(100% - 56px)">
  45 +<!-- <div> -->
  46 + <div class="portlet-title">
  47 + <form class="form-inline" action="">
  48 + <div style="display: inline-block;margin-left: 15px;" id="gsbmDiv">
  49 + <span class="item-label" style="width: 80px;">公司: </span>
  50 + <select class="form-control" name="company" id="gsbm" style="width: 180px;"></select>
  51 + </div>
  52 + <div style="display: inline-block; margin-left: 9px;" id="fgsbmDiv">
  53 + <span class="item-label" style="width: 80px;">分公司: </span>
  54 + <select class="form-control" name="subCompany" id="fgsbm" style="width: 180px;"></select>
  55 + </div>
  56 + <div style="margin-top: 2px"></div>
  57 + <div style="display: inline-block;margin-left: 15px;">
  58 + <span class="item-label" style="width: 80px;">月份: </span>
  59 + <input class="form-control" type="text" id="month" style="width: 180px;"/>
  60 + </div>
  61 + <div style="display: inline-block; margin-left: 23px;">
  62 + <span class="item-label" style="width: 80px;">线路: </span>
  63 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  64 + </div>
  65 + <div style="display: inline-block;">
  66 + <span class="item-label" style="width: 80px;">线路性质: </span>
  67 + <select
  68 + class="form-control" name="nature" id="nature" style="width: 180px;">
  69 + <option value="0" selected="selected">全部线路</option>
  70 + <option value="1">营运线路</option>
  71 + <option value="2">非营运线路</option>
  72 + </select>
  73 + </div>
  74 + <div class="form-group">
  75 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  76 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  77 + </div>
  78 + </form>
  79 + </div>
  80 + <label><b id="currMonth"></b></label>
  81 + <div class="portlet-body" id="tjrbBody" style="overflow:auto;height: calc(100% - 80px)">
  82 + <div class="table-container" style="margin-top: 10px;min-width: 906px">
  83 + <table class="table table-bordered table-hover table-checkable" id="forms">
  84 + <thead>
  85 + <tr>
  86 + <th colspan="34"><label id="tjrq"></label>浦东公交线路调查表</th>
  87 + </tr>
  88 + <tr>
  89 + <td rowspan="2" style="min-width:90px">线路</td>
  90 + <td rowspan="2" style="min-width:90px">权证配车数</td>
  91 + <td rowspan="2">线路属性</td>
  92 + <td rowspan="2">线路类型</td>
  93 + <td rowspan="2">线路长度</td>
  94 + <td rowspan="2">是否挂牌线路</td>
  95 + <td rowspan="2">是否冷僻线路</td>
  96 + <td rowspan="2" style="min-width:175px">首末班时间</td>
  97 +
  98 + <td colspan="2">调度方式</td>
  99 + <td colspan="2">间隔时间</td>
  100 +
  101 + <td rowspan="2">是否衔接轨交末班</td>
  102 + <td rowspan="2">日均里程</td>
  103 + <td rowspan="2">日均班次</td>
  104 + <td rowspan="2">日均人次</td>
  105 + <td rowspan="2">日均单车人次</td>
  106 + <td rowspan="2">每班次单车人次</td>
  107 +
  108 + <td colspan="3">里程</td>
  109 +
  110 + <td rowspan="2" style="min-width:104px">里程利用率%</td>
  111 + <td rowspan="2" style="min-width:104px">百公里人次(载客公里)</td>
  112 + <td rowspan="2">月人次(票务)</td>
  113 + <td rowspan="2">月营收(票务)</td>
  114 + <td rowspan="2">票价(元)</td>
  115 + <td rowspan="2" style="min-width:104px">百公里营收(元)</td>
  116 +
  117 + <td colspan="3">线路特征</td>
  118 +
  119 + <td rowspan="2" style="min-width:400px">线路走向</td>
  120 + <td rowspan="2" style="min-width:600px">线路站点</td>
  121 + <td rowspan="2" style="min-width:160px">备注</td>
  122 + </tr>
  123 + <tr>
  124 + <td rowspan="1" style="min-width:60px">常规</td>
  125 + <td rowspan="1" style="min-width:60px">多样化</td>
  126 + <td rowspan="1">高峰</td>
  127 + <td rowspan="1">低谷</td>
  128 + <td rowspan="1" style="min-width:104px">运营总公里(含空驶)</td>
  129 + <td rowspan="1" style="min-width:104px">集调实际公里(含空驶)</td>
  130 + <td rowspan="1" style="min-width:104px">集调营运公里(载客公里)</td>
  131 + <td rowspan="1">途径轨交站</td>
  132 + <td rowspan="1">途径三级医院</td>
  133 + <td rowspan="1">唯一线</td>
  134 + </tr>
  135 + </thead>
  136 + <tbody class="calcInvestigateMonth">
  137 +
  138 + </tbody>
  139 + </table>
  140 + </div>
  141 + </div>
  142 + </div>
  143 +<!-- </div> -->
  144 +<!-- </div> -->
  145 +
  146 +<script>
  147 + $(function(){
  148 + $('#export').attr('disabled', "true");
  149 +
  150 + // 关闭左侧栏
  151 + if (!$('body').hasClass('page-sidebar-closed'))
  152 + $('.menu-toggler.sidebar-toggler').click();
  153 +
  154 + var d = new Date();
  155 + d.setTime(d.getTime() - 4*1000*60*60*24);
  156 + var year = d.getFullYear();
  157 + var month = d.getMonth() + 1;
  158 + var day = d.getDate();
  159 + if(month < 10)
  160 + month = "0" + month;
  161 + if(day < 10)
  162 + day = "0" + day;
  163 + var dateTime = year + "-" + month + "-" + day;
  164 + var initMonth = year + "-" + month;
  165 + $("#month").datetimepicker({
  166 + format : 'YYYY-MM',
  167 + locale : 'zh-cn',
  168 + maxDate : initMonth
  169 + });
  170 + $("#month").val(initMonth);
  171 +
  172 +
  173 + var fage=false;
  174 + var obj = [];
  175 + var xlList;
  176 + $.get('/report/lineList',function(result){
  177 + xlList=result;
  178 + $.get('/user/companyData', function(result){
  179 + obj = result;
  180 + var options = '<option value="">全部公司</option>';
  181 + for(var i = 0; i < obj.length; i++){
  182 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  183 + }
  184 +
  185 + if(obj.length ==0){
  186 + $("#gsbmDiv").css('display','none');
  187 + }else if(obj.length ==1){
  188 + $("#gsbmDiv").css('display','none');
  189 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  190 + $('#fgsbmDiv').css('display','none');
  191 + }
  192 + $('#gsbm').html(options);
  193 + updateCompany();
  194 + });
  195 + })
  196 + $("#gsbm").on("change",updateCompany);
  197 + function updateCompany(){
  198 + var company = $('#gsbm').val();
  199 + var options = '<option value="">全部分公司</option>';
  200 + for(var i = 0; i < obj.length; i++){
  201 + if(obj[i].companyCode == company){
  202 + var children = obj[i].children;
  203 + for(var j = 0; j < children.length; j++){
  204 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  205 + }
  206 + }
  207 + }
  208 + $('#fgsbm').html(options);
  209 +// initXl();
  210 + }
  211 +
  212 + var tempData = {};
  213 + $.get('/report/lineList',function(xlList){
  214 + var data = [];
  215 + data.push({id: " ", text: "全部线路"});
  216 + $.get('/user/companyData', function(result){
  217 + for(var i = 0; i < result.length; i++){
  218 + var companyCode = result[i].companyCode;
  219 + var children = result[i].children;
  220 + for(var j = 0; j < children.length; j++){
  221 + var code = children[j].code;
  222 + for(var k=0;k < xlList.length;k++ ){
  223 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  224 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  225 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  226 + }
  227 + }
  228 + }
  229 + }
  230 + initPinYinSelect2('#line',data,'');
  231 +
  232 + });
  233 + });
  234 +
  235 + $("#line").on("change", function(){
  236 + if($("#line").val() == " "){
  237 + $("#gsbm").attr("disabled", false);
  238 + $("#fgsbm").attr("disabled", false);
  239 + } else {
  240 + var temp = tempData[$("#line").val()].split(":");
  241 + $("#gsbm").val(temp[0]);
  242 + updateCompany();
  243 + $("#fgsbm").val(temp[1]);
  244 + $("#gsbm").attr("disabled", true);
  245 + $("#fgsbm").attr("disabled", true);
  246 + $("#nature").val(0);
  247 + }
  248 + });
  249 +
  250 +
  251 + var line ="";
  252 + var xlName ="";
  253 + var nature ="";
  254 + var month = "";
  255 + var gsbm = "";
  256 + var fgsbm = "";
  257 + $("#query").on("click",function(){
  258 + if($("#month").val() == null || $("#month").val().trim().length == 0){
  259 + layer.msg("请选择月份!");
  260 + return;
  261 + }
  262 +// $("#tjrbBody").height($(window).height()-100);
  263 + line = $("#line").val();
  264 + xlName = $("#select2-line-container").html();
  265 + nature = $("#nature").val();
  266 + month = $("#month").val();
  267 + gsbm = $("#gsbm").val();
  268 + fgsbm = $("#fgsbm").val();
  269 + if(line=="请选择"){
  270 + line="";
  271 + }
  272 + if(month==null || month ==""){
  273 + layer.msg('请选择月份!');
  274 + }else{
  275 +// $("#tjrq").html(date+"至"+date2);
  276 + var params = {};
  277 + params['gsbm'] = gsbm;
  278 + params['fgsbm'] = fgsbm;
  279 + params['month'] = month;
  280 + params['line'] = line;
  281 + params['xlName'] = xlName;
  282 + params['nature'] = nature;
  283 + params['type'] = "query";
  284 + $get('/calc_mix/calcInvestigateMonth',params,function(result){
  285 + $("#currMonth").html("("+month+")");
  286 + // 把数据填充到模版中
  287 + var tbodyHtml = template('calcInvestigateMonth',{list:result});
  288 + // 把渲染好的模版html文本追加到表格中
  289 + $('#forms .calcInvestigateMonth').html(tbodyHtml);
  290 +
  291 + if(result.length == 0)
  292 + $("#export").attr('disabled',"true");
  293 + else
  294 + $("#export").removeAttr("disabled");
  295 + });
  296 + }
  297 +
  298 + });
  299 +// $("#tjrbBody").height($(window).height()-100);
  300 + $("#export").on("click",function(){
  301 + var params = {};
  302 + params['gsbm'] = gsbm;
  303 + params['fgsbm'] = fgsbm;
  304 + params['month'] = month;
  305 + params['line'] = line;
  306 + params['xlName'] = xlName;
  307 + params['nature'] = nature;
  308 + params['type'] = "export";
  309 + $get('/calc_mix/calcInvestigateMonth',params,function(result){
  310 + window.open("/downloadFile/download?fileName=浦东公交线路调查表"+moment(month).format("YYYY-MM"));
  311 + });
  312 + });
  313 +
  314 + });
  315 +</script>
  316 +<script type="text/html" id="calcInvestigateMonth">
  317 + {{each list as obj i}}
  318 + <tr>
  319 + <td>{{obj.xlmc}}</td>
  320 + <td>{{obj.qzpcs}}</td>
  321 + <td>{{obj.xlsx}}</td>
  322 + <td>{{obj.xllx}}</td>
  323 + <td>{{obj.xlcd}}</td>
  324 + <td>{{obj.sfgp}}</td>
  325 + <td>{{obj.sflpxl}}</td>
  326 + <td>{{obj.smbsj}}</td>
  327 + <td>{{if obj.ddfs == '常规'}}√{{/if}}</td>
  328 + <td>{{if obj.ddfs == '多样化'}}√{{/if}}</td>
  329 + <td>{{obj.gfjgsj}}</td>
  330 + <td>{{obj.dgjgsj}}</td>
  331 + <td>{{obj.sfxjgj}}</td>
  332 + <td>{{obj.rjlc}}</td>
  333 + <td>{{obj.rjbc}}</td>
  334 + <td>{{obj.rjrc}}</td>
  335 + <td>{{obj.rjdcrc}}</td>
  336 + <td>{{obj.mbcrc}}</td>
  337 + <td>{{obj.jhzgl}}</td>
  338 + <td>{{obj.sjzgl}}</td>
  339 + <td>{{obj.sjyylc}}</td>
  340 + <td>{{obj.lclyl}}</td>
  341 + <td>{{obj.bglrc}}</td>
  342 + <td>{{obj.yrc}}</td>
  343 + <td>{{obj.yys}}</td>
  344 + <td>{{obj.pj}}</td>
  345 + <td>{{obj.bglys}}</td>
  346 + <td>{{obj.tjgjz}}</td>
  347 + <td>{{obj.tjsjyy}}</td>
  348 + <td>{{obj.wyx}}</td>
  349 + <td>{{obj.xlzx}}</td>
  350 + <td>{{obj.xlzd}}</td>
  351 + <td>{{obj.bz}}</td>
  352 + </tr>
  353 + {{/each}}
  354 + {{if list.length == 0}}
  355 + <tr>
  356 + <td colspan="34"><h6 class="muted">没有找到相关数据</h6></td>
  357 + </tr>
  358 + {{/if}}
  359 +</script>
0 \ No newline at end of file 360 \ No newline at end of file
src/main/resources/static/pages/forms/mould/calcInvestigateMonth.xls 0 → 100644
No preview for this file type