Commit 2e21b287f67d1ed5796e9e7972cf3962588de9a5

Authored by ljq
1 parent 3dab8c1c

1

Showing 33 changed files with 3343 additions and 112 deletions

Too many changes to show.

To preserve performance only 33 of 65 files are displayed.

.gitignore
... ... @@ -11,7 +11,7 @@ test_coverage/
11 11 npm-debug.log
12 12 *.iml
13 13 tmp
14   -E:/
  14 +D:/
15 15  
16 16 # git忽略空文件夹,按照惯例,空文件夹下放置.gitkeep文件避免文件夹被忽略不上传。
17 17 !.gitkeep
... ...
... ... @@ -396,6 +396,12 @@
396 396 <artifactId>wsdl4j</artifactId>
397 397 </dependency>
398 398  
  399 + <dependency>
  400 + <groupId>net.sf.json-lib</groupId>
  401 + <artifactId>json-lib</artifactId>
  402 + <version>2.4</version>
  403 + <classifier>jdk15</classifier>
  404 + </dependency>
399 405 </dependencies>
400 406  
401 407 <dependencyManagement>
... ...
src/main/java/com/bsth/XDApplication.java
... ... @@ -4,6 +4,7 @@ import com.bsth.data.BasicData;
4 4 import com.bsth.data.LineVersionsData;
5 5 import com.bsth.data.ThreadMonotor;
6 6 import com.bsth.data.car_out_info.UpdateDBThread;
  7 +import com.bsth.data.ddexam.DdexamThread;
7 8 import com.bsth.data.directive.DirectivesPstThread;
8 9 import com.bsth.data.forecast.SampleTimeDataLoader;
9 10 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
... ... @@ -85,13 +86,16 @@ public class XDApplication implements CommandLineRunner {
85 86  
86 87 @Autowired
87 88 FixedCheckStationCodeThread fixedCheckStationCodeThread;
  89 +
  90 + @Autowired
  91 + DdexamThread ddexamThread;
88 92  
89 93 private static long timeDiff;
90 94 private static long timeDiffTraffic;
91 95  
92 96 static {
93   - // 早上2:20
94   - timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis();
  97 + // 早上2:20 ---- 0点10分
  98 + timeDiff = (DateUtils.getTimestamp() + 1000 * 60 * 10) - System.currentTimeMillis();
95 99 if (timeDiff < 0)
96 100 timeDiff += (1000 * 60 * 60 * 24);
97 101 // 早上07:00
... ... @@ -139,7 +143,7 @@ public class XDApplication implements CommandLineRunner {
139 143 //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 180, 10, TimeUnit.SECONDS);
140 144  
141 145 /** 线调业务 */
142   - sexec.scheduleWithFixedDelay(scheduleRefreshThread, 1, 120, TimeUnit.SECONDS);//班次更新线程
  146 + sexec.scheduleWithFixedDelay(scheduleRefreshThread, 30, 120, TimeUnit.SECONDS);//班次更新线程
143 147 sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点
144 148 //sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据
145 149 //sexec.scheduleWithFixedDelay(rfidDataLoader, 5, 5, TimeUnit.SECONDS);//抓取RFID数据
... ... @@ -157,17 +161,19 @@ public class XDApplication implements CommandLineRunner {
157 161 WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
158 162  
159 163 /** 线调为其他程序提供的数据 --写入数据库 */
160   - sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布)
  164 + //sexec.scheduleWithFixedDelay(fcxxUpdateThread, 160, 30, TimeUnit.SECONDS);//发车信息(发车屏、信息发布)
161 165 //线路首末班数据(网关用,班次更新时写入)
162 166 //com.bsth.data.schedule.f_a_l.FirstAndLastHandler
163   - sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号)
164   -
  167 + //sexec.scheduleWithFixedDelay(schSiginUpdateDBThread, 160, 60 * 30, TimeUnit.SECONDS);//无法自动完成的班次信息(网关用,补信号)
  168 + /******************************************************/
  169 + sexec.scheduleAtFixedRate(ddexamThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  170 +
165 171 //运管处静态数据提交
166 172 //log.info(timeDiff / 1000 / 60 + "分钟之后提交到运管处");
167 173 //sexec.scheduleAtFixedRate(submitToTrafficManage, timeDiffTraffic / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
168 174  
169 175 //线路版本更新
170   - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
  176 + //sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
171 177  
172 178 //线路版本更新
173 179 //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
... ...
src/main/java/com/bsth/controller/ddexam/DdexamController.java
1 1 package com.bsth.controller.ddexam;
2 2  
  3 +import com.bsth.entity.sys.SysUser;
3 4 import com.bsth.service.ddexam.DdexamService;
4 5 import org.springframework.beans.factory.annotation.Autowired;
5 6 import org.springframework.web.bind.annotation.RequestMapping;
6 7 import org.springframework.web.bind.annotation.RequestParam;
7 8 import org.springframework.web.bind.annotation.RestController;
8 9  
  10 +import java.util.Date;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
9 14 @RestController
10 15 @RequestMapping("ddexam")
11 16 public class DdexamController {
12 17 @Autowired
13 18 DdexamService ddexamService;
14 19  
15   - //初始化
  20 + //创建账号
16 21 @RequestMapping("initialization")
17   - public int initializationAll(@RequestParam Integer rs){
18   - return ddexamService.initializationAll(rs);
  22 + public Map initializationAll(@RequestParam Integer rs ,@RequestParam Long userName){
  23 + return ddexamService.initializationAll(rs,userName);
  24 + }
  25 + //初始化
  26 + @RequestMapping("initialization2")
  27 + public Map initializationAll2(@RequestParam Long userName){
  28 + return ddexamService.initializationAll2(userName);
  29 + }
  30 + //恢复系统时间
  31 + @RequestMapping("hftime")
  32 + public int hftime(){
  33 + return ddexamService.hftime();
  34 + }
  35 +
  36 + @RequestMapping("initDate")
  37 + //修改系統时间
  38 + public int initDate(String date){
  39 +
  40 + return ddexamService.initDate(date);
19 41 }
  42 +
  43 + @RequestMapping("userAll")
  44 + //修改系統时间
  45 + public List<SysUser> userAll(){
  46 + return ddexamService.userAll();
  47 + }
  48 + @RequestMapping("getTime")
  49 + //修改系統时间
  50 + public Date getTime(){
  51 + return new Date();
  52 + }
  53 +
  54 +
  55 +
  56 +
20 57 }
... ...
src/main/java/com/bsth/controller/forms/ExportController.java 0 → 100644
  1 +package com.bsth.controller.forms;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.entity.mcy_forms.*;
  5 +import com.bsth.service.forms.ExportService;
  6 +import com.bsth.service.forms.FormsService;
  7 +import com.bsth.util.Arith;
  8 +import com.bsth.util.ReportUtils;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.text.SimpleDateFormat;
  16 +import java.util.*;
  17 +
  18 +@RestController
  19 +@RequestMapping("mcy_export")
  20 +public class ExportController {
  21 +
  22 +
  23 + @Autowired
  24 + FormsService formsService;
  25 +
  26 + @Autowired
  27 + ExportService exportService;
  28 +
  29 + // 行车路单日报表
  30 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.POST)
  31 + public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map) {
  32 + List<Waybillday> waybillday = formsService.waybillday(map);
  33 + exportService.waybillday(map.get("date").toString(),
  34 + map.get("lineName").toString(), waybillday);
  35 + return waybillday;
  36 + }
  37 +
  38 + // 线路客流量报表
  39 + @RequestMapping(value = "/linepasswengerflowExport", method = RequestMethod.POST)
  40 + public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map) {
  41 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  42 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  43 + ReportUtils ee = new ReportUtils();
  44 + List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map);
  45 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  46 + int i = 1;
  47 + for (Linepasswengerflow l : linepasswengerflow) {
  48 + Map<String, Object> m = new HashMap<String, Object>();
  49 + m.put("i", i);
  50 + m.put("stationName", l.getStationName());
  51 + m.put("1", " ");
  52 + m.put("2", " ");
  53 + resList.add(m);
  54 + i++;
  55 + }
  56 +
  57 +
  58 +
  59 + try {
  60 + listI.add(resList.iterator());
  61 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  62 + ee.excelReplace(listI, new Object[] { map }, path + "mould/linepasswengerflow.xls",
  63 + path + "export/线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  64 + } catch (Exception e) {
  65 + e.printStackTrace();
  66 + }
  67 + return resList;
  68 + }
  69 +
  70 + // 班次车辆人员日统计
  71 + @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET)
  72 + public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) {
  73 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  74 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  75 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  76 + Map<String, Object> map2 = new HashMap<String, Object>();
  77 + ReportUtils ee = new ReportUtils();
  78 + List<Shifday> shifday = formsService.shifday(map);
  79 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  80 + for (Shifday l : shifday) {
  81 + Map<String, Object> m = new HashMap<String, Object>();
  82 + m.put("jName", l.getjName());
  83 + m.put("sName", l.getsName());
  84 + m.put("lpName", l.getLpName());
  85 + m.put("carPlate", l.getCarPlate());
  86 + m.put("jhlc", l.getJhlc());
  87 + m.put("sjjhlc", l.getSjjhlc());
  88 + m.put("yygl", l.getYygl());
  89 + m.put("emptMileage", l.getEmptMileage());
  90 + m.put("remMileage", l.getRemMileage());
  91 + m.put("addMileage", l.getAddMileage());
  92 + m.put("totalm", l.getTotalm());
  93 + m.put("jhbc", l.getJhbc());
  94 + m.put("sjjhbc", l.getSjjhbc());
  95 + m.put("cjbc", l.getCjbc());
  96 + m.put("ljbc", l.getLjbc());
  97 + m.put("sjbc", l.getSjbc());
  98 + resList.add(m);
  99 + }
  100 + if(resList.size() > 0){
  101 + map2 = resList.get(resList.size() - 1);
  102 + resList.remove(map2);
  103 + }
  104 +
  105 + try {
  106 + String lineName = "";
  107 + if(map.containsKey("lineName"))
  108 + lineName = map.get("lineName").toString();
  109 + listI.add(resList.iterator());
  110 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  111 + ee.excelReplace(listI, new Object[] { map2 }, path + "mould/shifday.xls",
  112 + path + "export/" + sdfSimple.format(sdfMonth.parse(map.get("date").toString()))
  113 + + "-" + lineName + "-班次车辆人员日报表.xls");
  114 + } catch (Exception e) {
  115 + e.printStackTrace();
  116 + }
  117 + return resList;
  118 + }
  119 +
  120 + // 班次车辆人员月统计
  121 + @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET)
  122 + public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) {
  123 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  124 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  125 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  126 + ReportUtils ee = new ReportUtils();
  127 + List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map);
  128 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  129 + int i = 1;
  130 + for (Shiftuehiclemanth l : shiftuehiclemanth) {
  131 + Map<String, Object> m = new HashMap<String, Object>();
  132 + m.put("i", i);
  133 + m.put("jName", l.getjName());
  134 + m.put("jhlc", l.getJhlc());
  135 + m.put("emptMileage", l.getEmptMileage());
  136 + m.put("remMileage", l.getRemMileage());
  137 + m.put("addMileage", l.getAddMileage());
  138 + m.put("totalm", l.getTotalm());
  139 + m.put("cjbc", l.getCjbc());
  140 + m.put("ljbc", l.getLjbc());
  141 + m.put("sjbc", l.getSjbc());
  142 + resList.add(m);
  143 + i++;
  144 + }
  145 +
  146 + try {
  147 + String mouldurl = null, lineName = "", dateTime = ""
  148 + , startDate = "", endDate = "";
  149 + if(map.containsKey("lineName"))
  150 + lineName = map.get("lineName").toString();
  151 + if(map.containsKey("startDate"))
  152 + startDate = map.get("startDate").toString();
  153 + if(map.containsKey("endDate"))
  154 + endDate = map.get("endDate").toString();
  155 + if(startDate.equals(endDate)){
  156 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  157 + } else {
  158 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  159 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  160 + }
  161 + if(map.get("empnames").equals("驾驶员")){
  162 + mouldurl="mould/shiftuehiclemanth.xls";
  163 + }else if(map.get("empnames").equals("售票员")){
  164 + mouldurl="mould/shiftuehiclemanthspy.xls";
  165 + }else if(map.get("empnames").equals("车辆自编号")){
  166 + mouldurl="mould/shiftuehiclemanthclzbh.xls";
  167 + }
  168 + listI.add(resList.iterator());
  169 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  170 + ee.excelReplace(listI, new Object[] { map }, path +mouldurl,
  171 + path + "export/" + dateTime + "-" + lineName + "-班次车辆人员月报表.xls");
  172 + } catch (Exception e) {
  173 + e.printStackTrace();
  174 + }
  175 +
  176 + return resList;
  177 + }
  178 +
  179 + // 班次车辆人员月统计
  180 + @RequestMapping(value = "/shiftuehiclemanthExport2", method = RequestMethod.GET)
  181 + public List<Map<String, Object>> shiftuehiclemanthExport2(@RequestParam Map<String, Object> map) {
  182 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  183 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  184 + ReportUtils ee = new ReportUtils();
  185 + List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth2(map);
  186 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  187 + int i = 1;
  188 + for (Shiftuehiclemanth l : shiftuehiclemanth) {
  189 + Map<String, Object> m = new HashMap<String, Object>();
  190 + m.put("i", i);
  191 + m.put("jName", l.getjName());
  192 + m.put("jhlc", l.getJhlc());
  193 + m.put("emptMileage", l.getEmptMileage());
  194 + m.put("remMileage", l.getRemMileage());
  195 + m.put("addMileage", l.getAddMileage());
  196 + m.put("totalm", l.getTotalm());
  197 + m.put("cjbc", l.getCjbc());
  198 + m.put("ljbc", l.getLjbc());
  199 + m.put("sjbc", l.getSjbc());
  200 + resList.add(m);
  201 + i++;
  202 + }
  203 +
  204 + try {
  205 + String mouldurl = null;
  206 + if(map.get("empnames").equals("驾驶员")){
  207 + mouldurl="mould/shiftuehiclemanth.xls";
  208 + }else if(map.get("empnames").equals("售票员")){
  209 + mouldurl="mould/shiftuehiclemanthspy.xls";
  210 + }else if(map.get("empnames").equals("车辆自编号")){
  211 + mouldurl="mould/shiftuehiclemanthclzbh.xls";
  212 + }
  213 + listI.add(resList.iterator());
  214 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  215 + ee.excelReplace(listI, new Object[] { map }, path +mouldurl,
  216 + path + "export/班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  217 + } catch (Exception e) {
  218 + e.printStackTrace();
  219 + }
  220 +
  221 + return resList;
  222 + }
  223 +
  224 + // 路单数据报表
  225 + @RequestMapping(value = "/singledataExport", method = RequestMethod.GET)
  226 + public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) {
  227 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  228 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  229 + ReportUtils ee = new ReportUtils();
  230 + List<Singledata> singledata = formsService.singledata(map);
  231 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  232 + int i = 1;
  233 + for (Singledata l : singledata) {
  234 + Map<String, Object> m = new HashMap<String, Object>();
  235 + m.put("i", i);
  236 + m.put("rQ", l.getrQ());
  237 + m.put("gS", l.getgS());
  238 + m.put("xL", l.getXlmc());
  239 + m.put("clzbh", l.getClzbh());
  240 + m.put("jsy", l.getJsy());
  241 + m.put("jName", l.getjName());
  242 + m.put("sgh", l.getSgh());
  243 + m.put("sName", l.getsName());
  244 + m.put("jhlc", l.getJhlc());
  245 + m.put("emptMileage", l.getEmptMileage());
  246 + m.put("hyl", l.getHyl());
  247 + m.put("jzl", l.getJzl());
  248 + m.put("unyyyl", l.getUnyyyl());
  249 + m.put("jhjl", l.getJhjl());
  250 + resList.add(m);
  251 +
  252 + i++;
  253 + }
  254 +
  255 + try {
  256 + listI.add(resList.iterator());
  257 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  258 + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
  259 + path + "export/路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  260 + } catch (Exception e) {
  261 + e.printStackTrace();
  262 + }
  263 +
  264 + return resList;
  265 + }
  266 +
  267 + // 路单数据报表
  268 + @RequestMapping(value = "/singledataExport2", method = RequestMethod.GET)
  269 + public List<Map<String, Object>> singledataExport2(@RequestParam Map<String, Object> map) {
  270 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  271 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  272 + ReportUtils ee = new ReportUtils();
  273 + List<Singledata> singledata = formsService.singledata2(map);
  274 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  275 + int i = 1;
  276 + for (Singledata l : singledata) {
  277 + Map<String, Object> m = new HashMap<String, Object>();
  278 + m.put("i", i);
  279 + m.put("rQ", l.getrQ());
  280 + m.put("gS", l.getgS());
  281 + m.put("xL", l.getXlmc());
  282 + m.put("clzbh", l.getClzbh());
  283 + m.put("jsy", l.getJsy());
  284 + m.put("jName", l.getjName());
  285 + m.put("sgh", l.getSgh());
  286 + m.put("sName", l.getsName());
  287 + m.put("jhlc", l.getJhlc());
  288 + m.put("emptMileage", l.getEmptMileage());
  289 + m.put("hyl", l.getHyl());
  290 + m.put("jzl", l.getJzl());
  291 + m.put("unyyyl", l.getUnyyyl());
  292 + m.put("jhjl", l.getJhjl());
  293 + resList.add(m);
  294 +
  295 + i++;
  296 + }
  297 +
  298 + try {
  299 + listI.add(resList.iterator());
  300 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  301 + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
  302 + path + "export/路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  303 + } catch (Exception e) {
  304 + e.printStackTrace();
  305 + }
  306 +
  307 + return resList;
  308 + }
  309 + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
  310 + public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) {
  311 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  312 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  313 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  314 + ReportUtils ee = new ReportUtils();
  315 + List<Singledata> singledata = formsService.singledatatj(map);
  316 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  317 + int i = 1;
  318 + for (Singledata l : singledata) {
  319 + Map<String, Object> m = new HashMap<String, Object>();
  320 + m.put("i", i);
  321 + m.put("rQ", l.getrQ());
  322 + m.put("gS", l.getgS());
  323 + m.put("xL", l.getXlmc());
  324 + m.put("clzbh", l.getClzbh());
  325 + m.put("jsy", l.getJsy());
  326 + m.put("jName", l.getjName());
  327 + m.put("sgh", l.getSgh());
  328 + m.put("sName", l.getsName());
  329 + m.put("jhlc", l.getJhlc());
  330 + m.put("emptMileage", l.getEmptMileage());
  331 + m.put("hyl", l.getHyl());
  332 + m.put("jzl", l.getJzl());
  333 + m.put("unyyyl", l.getUnyyyl());
  334 + m.put("jhjl", l.getJhjl());
  335 + resList.add(m);
  336 +
  337 + i++;
  338 + }
  339 +
  340 + try {
  341 + String startDate = "", lineName = "";
  342 + if(map.containsKey("startDate"))
  343 + startDate = map.get("startDate").toString();
  344 + if(map.containsKey("lineName"))
  345 + lineName = map.get("lineName").toString();
  346 + listI.add(resList.iterator());
  347 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  348 + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
  349 + path + "export/" + sdfSimple.format(sdfMonth.parse(startDate))
  350 + + "-" + lineName + "-路单数据.xls");
  351 + } catch (Exception e) {
  352 + e.printStackTrace();
  353 + }
  354 +
  355 + return resList;
  356 + }
  357 +
  358 + @RequestMapping(value = "/singledataExportTj2", method = RequestMethod.GET)
  359 + public List<Map<String, Object>> singledataExportTj2(@RequestParam Map<String, Object> map) {
  360 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  361 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  362 + ReportUtils ee = new ReportUtils();
  363 + List<Singledata> singledata = formsService.singledatatj2(map);
  364 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  365 + int i = 1;
  366 + for (Singledata l : singledata) {
  367 + Map<String, Object> m = new HashMap<String, Object>();
  368 + m.put("i", i);
  369 + m.put("rQ", l.getrQ());
  370 + m.put("gS", l.getgS());
  371 + m.put("xL", l.getXlmc());
  372 + m.put("clzbh", l.getClzbh());
  373 + m.put("jsy", l.getJsy());
  374 + m.put("jName", l.getjName());
  375 + m.put("sgh", l.getSgh());
  376 + m.put("sName", l.getsName());
  377 + m.put("jhlc", l.getJhlc());
  378 + m.put("emptMileage", l.getEmptMileage());
  379 + m.put("hyl", l.getHyl());
  380 + m.put("jzl", l.getJzl());
  381 + m.put("unyyyl", l.getUnyyyl());
  382 + m.put("jhjl", l.getJhjl());
  383 + resList.add(m);
  384 +
  385 + i++;
  386 + }
  387 +
  388 + try {
  389 + listI.add(resList.iterator());
  390 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  391 + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
  392 + path + "export/路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  393 + } catch (Exception e) {
  394 + e.printStackTrace();
  395 + }
  396 +
  397 + return resList;
  398 + }
  399 + // 车辆加注
  400 + @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET)
  401 + public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
  402 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  403 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  404 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  405 + ReportUtils ee = new ReportUtils();
  406 + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(),
  407 + map.get("data").toString());
  408 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  409 + int i = 1;
  410 + for (Vehicleloading l : vehicleloading) {
  411 + Map<String, Object> m = new HashMap<String, Object>();
  412 + m.put("i", i);
  413 + m.put("rQ", l.getrQ());
  414 + m.put("gS", l.getgS());
  415 + m.put("xL", l.getxL());
  416 + m.put("clzbh", l.getClzbh());
  417 + m.put("jzl", l.getJzl());
  418 + m.put("hyl", l.getHyl());
  419 + m.put("ls", l.getLs());
  420 + m.put("jhlc", l.getJhlc());
  421 + m.put("unyyyl", l.getUnyyyl());
  422 + m.put("jhbc", l.getJhbc());
  423 + m.put("sjbc", l.getSjbc());
  424 + resList.add(m);
  425 + i++;
  426 + }
  427 +
  428 + try {
  429 + String date = "", lineName = "";
  430 + if(map.containsKey("data"))
  431 + date = map.get("data").toString();
  432 + if(map.containsKey("lineName"))
  433 + lineName = map.get("lineName").toString();
  434 + listI.add(resList.iterator());
  435 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  436 + ee.excelReplace(listI, new Object[] { map }, path + "mould/vehicleloading.xls",
  437 + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + "-" + lineName + "-车辆加注.xls");
  438 + } catch (Exception e) {
  439 + e.printStackTrace();
  440 + }
  441 + return resList;
  442 + }
  443 +
  444 + // 运营服务阶段报表
  445 + @RequestMapping(value = "/operationserviceExport", method = RequestMethod.GET)
  446 + public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) {
  447 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  448 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  449 + ReportUtils ee = new ReportUtils();
  450 + List<Operationservice> operationservice = formsService.operationservice(map);
  451 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  452 + int i = 1;
  453 + for (Operationservice l : operationservice) {
  454 + Map<String, Object> m = new HashMap<String, Object>();
  455 + m.put("i", i);
  456 + m.put("fgs", l.getFgs()!=null?l.getFgs():"");
  457 + m.put("xlName", l.getXlName()!=null?l.getXlName():"");
  458 + m.put("jzl", l.getJzl()!=null?l.getJzl():"");
  459 + m.put("xhl", l.getXhl()!=null?l.getXhl():"");
  460 + m.put("xsgl", l.getXsgl()!=null?l.getXsgl():"");
  461 + m.put("emptMileage", l.getEmptMileage()!=null?l.getEmptMileage():"");
  462 + m.put("sjbc", l.getSjbc()!=null?l.getSjbc():"");
  463 + resList.add(m);
  464 + i++;
  465 + }
  466 +
  467 + try {
  468 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  469 + if(map.containsKey("startDate"))
  470 + startDate = map.get("startDate").toString();
  471 + if(map.containsKey("endDate"))
  472 + endDate = map.get("endDate").toString();
  473 + if(map.containsKey("lineName"))
  474 + lineName = map.get("lineName").toString();
  475 + if(startDate.equals(endDate)){
  476 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  477 + } else {
  478 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  479 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  480 + }
  481 + listI.add(resList.iterator());
  482 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  483 + ee.excelReplace(listI, new Object[] { map }, path + "mould/operationservice.xls", path + "export/"
  484 + + dateTime + "-" + lineName + "-运营服务阶段报表.xls");
  485 + } catch (Exception e) {
  486 + e.printStackTrace();
  487 + }
  488 + return resList;
  489 + }
  490 +
  491 + // 换人换车情况日统计
  492 + @RequestMapping(value = "/changetochangeExport", method = RequestMethod.POST)
  493 + public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map) {
  494 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  495 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  496 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  497 + ReportUtils ee = new ReportUtils();
  498 + List<Changetochange> changetochange = formsService.changetochange(map);
  499 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  500 + for (Changetochange l : changetochange) {
  501 + Map<String, Object> m = new HashMap<String, Object>();
  502 + m.put("rq", l.getRq());
  503 + m.put("gs", l.getGs());
  504 + m.put("fgs", l.getFgs());
  505 + m.put("xl", l.getXl());
  506 + m.put("lp", l.getLp());
  507 + m.put("fssj", l.getFssj());
  508 + m.put("xgsj", l.getXgsj());
  509 + m.put("pcch", l.getPcch());
  510 + m.put("sjch", l.getSjch());
  511 + m.put("fcgh", l.getPcry());
  512 + m.put("sjgh", l.getSjgh());
  513 + m.put("yy", l.getYy()==null?"":l.getYy());
  514 + m.put("xgr", l.getXgr());
  515 + resList.add(m);
  516 + }
  517 +
  518 + try {
  519 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  520 + if(map.containsKey("startDate"))
  521 + startDate = map.get("startDate").toString();
  522 + if(map.containsKey("endDate"))
  523 + endDate = map.get("endDate").toString();
  524 + if(map.containsKey("lineName"))
  525 + lineName = map.get("lineName").toString();
  526 + if(startDate.equals(endDate)){
  527 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  528 + } else {
  529 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  530 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  531 + }
  532 + listI.add(resList.iterator());
  533 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  534 + ee.excelReplace(listI, new Object[] { map }, path + "mould/changetochange.xls", path + "export/"
  535 + + dateTime + "-" + lineName + "-换人换车情况日统计.xls");
  536 + } catch (Exception e) {
  537 + e.printStackTrace();
  538 + }
  539 + return resList;
  540 + }
  541 +
  542 + // 营运线路出车率统计表
  543 + @RequestMapping(value = "/turnoutrateExport", method = RequestMethod.POST)
  544 + public List<Map<String, Object>> turnoutrateExport(@RequestParam Map<String, Object> map) {
  545 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  546 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  547 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  548 + ReportUtils ee = new ReportUtils();
  549 + Map<String, Object> map1 = new HashMap<String, Object>();
  550 +
  551 + List<Map<String, Object>> resList = formsService.turnoutrate(map);
  552 + Map<String, Object> m = resList.get(resList.size() - 1);
  553 + map1.put("line", m.get("line"));
  554 + map1.put("jhcc", m.get("jhcc"));
  555 + map1.put("sjcc", m.get("sjcc"));
  556 + map1.put("jhbc", m.get("jhbc"));
  557 + map1.put("sjbc", m.get("sjbc"));
  558 + map1.put("ccl", m.get("ccl"));
  559 + map1.put("zxl", m.get("zxl"));
  560 + map1.put("qz", m.get("qz"));
  561 + map1.put("sm", m.get("sm"));
  562 +
  563 + resList.remove(m);
  564 +
  565 + try {
  566 + String dateTime = "", startDate = "", endDate = "", lineName = "";
  567 + if(map.containsKey("startDate"))
  568 + startDate = map.get("startDate").toString();
  569 + if(map.containsKey("endDate"))
  570 + endDate = map.get("endDate").toString();
  571 + if(map.containsKey("lineName"))
  572 + lineName = map.get("lineName").toString();
  573 + if(startDate.equals(endDate)){
  574 + dateTime = sdfSimple.format(sdfMonth.parse(startDate));
  575 + } else {
  576 + dateTime = sdfSimple.format(sdfMonth.parse(startDate))
  577 + +"-"+sdfSimple.format(sdfMonth.parse(endDate));
  578 + }
  579 + listI.add(resList.iterator());
  580 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  581 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/turnoutrate.xls", path + "export/"
  582 + + dateTime + "-" + lineName + "-营运线路出车率统计表.xls");
  583 + } catch (Exception e) {
  584 + e.printStackTrace();
  585 + }
  586 + return resList;
  587 + }
  588 +
  589 + //班次执行率统计表
  590 + @RequestMapping(value = "/executionrateExport", method = RequestMethod.POST)
  591 + public List<Map<String, Object>> executionrateExport(@RequestParam Map<String, Object> map) {
  592 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  593 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  594 + ReportUtils ee = new ReportUtils();
  595 + List<Executionrate> executionrate = formsService.executionrate(map);
  596 + Map<String, Object> map1 = new HashMap<String, Object>();
  597 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  598 + String xlts="";
  599 + String zsgs="";
  600 + String jh="";
  601 + Float sj=0f;
  602 + Float ccl=0f;
  603 + Float bcjh=0f;
  604 + String bcsj="";
  605 + Float bczxl=0f;
  606 + String gs="";
  607 + String zhgs="";
  608 +
  609 + Map<String, Object> m = new HashMap<String, Object>();
  610 +
  611 + for (Executionrate l : executionrate) {
  612 +
  613 + xlts +=l.getGsgs()==""?0:String.valueOf(l.getGsgs());
  614 + zsgs +=l.getFgsgs()==""?0:String.valueOf(l.getFgsgs());
  615 + jh +=l.getXl()==""?0:String.valueOf(l.getXl());
  616 + sj +=l.getCchjh()==""?0f:Float.valueOf(l.getCchjh());
  617 + ccl +=l.getCchsj()==""?0f:Float.valueOf(l.getCchsj());
  618 + bcsj +=l.getChl()==""?0:String.valueOf(l.getChl());
  619 + bczxl +=l.getBcjh()==""?0f:Float.valueOf(l.getBcjh());
  620 + gs +=l.getBcsj()==""?0:String.valueOf(l.getBcsj());
  621 + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl());
  622 +
  623 +
  624 +
  625 + m.put("rq", l.getRq());
  626 + m.put("gs", l.getGs());
  627 + m.put("zhgs", l.getZhgs());
  628 + m.put("xl", l.getXl());
  629 + m.put("cchjh", l.getCchjh());
  630 + m.put("cchsj", l.getCchsj());
  631 + m.put("chl", l.getChl());
  632 + m.put("bcjh", l.getBcjh());
  633 + m.put("bcsj", l.getBcsj());
  634 + m.put("bbzxl", l.getBbzxl());
  635 + m.put("sm", l.getSm());
  636 + resList.add(m);
  637 +
  638 +
  639 + m=new HashMap<String,Object>();
  640 + m.put("total_gs", xlts);
  641 + m.put("total_zhgs", zsgs);
  642 + m.put("total_xlts", jh);
  643 + m.put("total_jh", sj);
  644 + m.put("total_sj", ccl);
  645 + m.put("total_ccl",bcsj);
  646 + m.put("total_bcjh", bczxl);
  647 + m.put("total_bcsj", gs);
  648 + m.put("total_bczxl", zhgs);
  649 +
  650 + map1 = m;
  651 + }
  652 +
  653 + try {
  654 + listI.add(resList.iterator());
  655 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  656 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/executionrate.xls", path + "export/班次执行率统计表"
  657 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  658 + } catch (Exception e) {
  659 + e.printStackTrace();
  660 + }
  661 + return resList;
  662 + }
  663 +
  664 +
  665 + ////营运线路名称统计表
  666 + @RequestMapping(value = "/alllineExport", method = RequestMethod.POST)
  667 + public List<Map<String, Object>> alllineExport(@RequestParam Map<String, Object> map) {
  668 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  669 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  670 + ReportUtils ee = new ReportUtils();
  671 + List<Allline> allline = formsService.allline(map);
  672 + Map<String, Object> map1 = new HashMap<String, Object>();
  673 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  674 + Integer jh=0;
  675 + Integer sj=0;
  676 + Integer ccl=0;
  677 + Double bcjh=0.0;
  678 + String bcsj="";
  679 + Integer bczxl=0;
  680 + String gs="";
  681 + String zhgs="";
  682 + Map<String, Object> m ;
  683 + for (Allline l : allline) {
  684 + m = new HashMap<String, Object>();
  685 +
  686 + jh +=l.getGsgs()=="" ? 0: Integer.valueOf(l.getGsgs());
  687 + sj +=l.getFgsgs()==""?0: Integer.valueOf(l.getFgsgs());
  688 + ccl +=l.getCchjh()==""?0: Integer.valueOf(l.getCchjh());
  689 + bcjh +=l.getCchsj()==""?0: Double.valueOf(l.getCchsj());
  690 +
  691 + bcsj +=l.getChl()==""? 0:String.valueOf(l.getChl());
  692 + bczxl +=l.getBcjh()==""?0: Integer.valueOf(l.getBcjh());
  693 + gs +=l.getBcsj()==""?0: String.valueOf(l.getBcsj());
  694 + zhgs +=l.getBbzxl()==""?0:String.valueOf(l.getBbzxl());
  695 +
  696 + m.put("rq", l.getRq());
  697 + m.put("gs", l.getGs());
  698 + m.put("zhgs", l.getZhgs());
  699 + m.put("xl", l.getXl());
  700 + m.put("cchjh", l.getCchjh());
  701 + m.put("cchsj", l.getCchsj());
  702 + m.put("chl", l.getChl());
  703 + m.put("bcjh", l.getBcjh());
  704 + m.put("bcsj", l.getBcsj());
  705 + m.put("bbzxl", l.getBbzxl());
  706 + m.put("sm", l.getSm());
  707 + resList.add(m);
  708 +
  709 + m=new HashMap<String,Object>();
  710 + m.put("total_jh", jh);
  711 + m.put("total_sj", sj);
  712 + m.put("total_ccl", ccl);
  713 + m.put("total_bcjh", bcjh);
  714 + m.put("total_bcsj", bcsj);
  715 + m.put("total_bczxl", bczxl);
  716 + m.put("total_gs", gs);
  717 + m.put("total_zhgs", zhgs);
  718 + map1 = m;
  719 +
  720 + }
  721 +
  722 + try {
  723 + listI.add(resList.iterator());
  724 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  725 + ee.excelReplace(listI, new Object[] { map1 }, path + "mould/allline.xls", path + "export/营运线路名称统计表"
  726 + + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  727 + } catch (Exception e) {
  728 + e.printStackTrace();
  729 + }
  730 + return resList;
  731 + }
  732 +
  733 +
  734 +
  735 + //班次日报表
  736 + @RequestMapping(value = "/dailyExport", method = RequestMethod.POST)
  737 + public List<Map<String, Object>> dailyExport(@RequestParam Map<String, Object> map) {
  738 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  739 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  740 + ReportUtils ee = new ReportUtils();
  741 + List<Daily> allline = formsService.daily(map);
  742 +
  743 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  744 + double zgl=0.0;
  745 + double ks=0.0;
  746 + double yh=0.0;
  747 + int bc=0;
  748 + Map<String, Object> m ;
  749 + for (Daily d : allline) {
  750 + m = new HashMap<String, Object>();
  751 + m.put("zbh", d.getZbh());
  752 + m.put("jgh",d.getJgh());
  753 + m.put("jName", d.getjName());
  754 + m.put("zlc", d.getZlc());
  755 + m.put("jzl1", d.getJzl1());
  756 + m.put("yh", d.getYh());
  757 + m.put("bc", d.getBc());
  758 + zgl =Arith.add(zgl, d.getZlc());
  759 + ks =Arith.add(ks, d.getJzl1());
  760 + yh =Arith.add(yh, d.getYh());
  761 + bc +=Integer.parseInt(d.getBc());
  762 +
  763 + resList.add(m);
  764 + }
  765 +
  766 + m=new HashMap<String,Object>();
  767 + m.put("total_zgl", zgl);
  768 + m.put("total_ks", ks);
  769 + m.put("total_yh", yh);
  770 + m.put("total_bc", bc);
  771 +
  772 + m.put("line", BasicData.lineCode2NameMap.get(map.get("line").toString()));
  773 + m.put("date", map.get("date").toString());
  774 + try {
  775 + String lineName = map.get("lineName").toString();
  776 + String date = map.get("date").toString();
  777 + listI.add(resList.iterator());
  778 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  779 + ee.excelReplace(listI, new Object[] { m }, path + "mould/daily.xls",
  780 + path + "export/" + sdfSimple.format(sdfMonth.parse(date))
  781 + + "-" + lineName + "-班次日报表.xls");
  782 + } catch (Exception e) {
  783 + e.printStackTrace();
  784 + }
  785 + return resList;
  786 + }
  787 +
  788 +
  789 +
  790 +}
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java 0 → 100644
  1 +package com.bsth.controller.forms;
  2 +
  3 +import com.bsth.entity.mcy_forms.*;
  4 +import com.bsth.service.forms.FormsService;
  5 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +@RestController
  16 +@RequestMapping("mcy_forms")
  17 +public class MCY_FormsController {
  18 +
  19 + @Autowired
  20 + FormsService formsService;
  21 +
  22 + @Autowired
  23 + ScheduleRealInfoService scheduleRealInfoService;
  24 +
  25 + // 行车路单日报表
  26 +
  27 + @RequestMapping(value = "/waybillday", method = RequestMethod.POST)
  28 + public List<Waybillday> waybillday(@RequestParam Map<String, Object> map) {
  29 +
  30 + // scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date)
  31 + return formsService.waybillday(map);
  32 + }
  33 +
  34 + // 线路客流量报表
  35 +
  36 + @RequestMapping(value = "/linepasswengerflow", method = RequestMethod.POST)
  37 + public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map) {
  38 +
  39 + return formsService.linepasswengerflow(map);
  40 + }
  41 +
  42 + // 班次车辆人员月报表
  43 + @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.GET)
  44 + public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map) {
  45 +
  46 + return formsService.shiftuehiclemanth(map);
  47 + }
  48 +
  49 + // 班次车辆人员月报表
  50 + @RequestMapping(value = "/shiftuehiclemanth2", method = RequestMethod.GET)
  51 + public List<Shiftuehiclemanth> shiftuehiclemanth2(@RequestParam Map<String, Object> map) {
  52 +
  53 + return formsService.shiftuehiclemanth2(map);
  54 + }
  55 +
  56 + // 班次车辆人员日统计
  57 + @RequestMapping(value = "/shifday", method = RequestMethod.GET)
  58 + public List<Shifday> shifday(@RequestParam Map<String, Object> map) {
  59 +
  60 + return formsService.shifday(map);
  61 + }
  62 +
  63 + // 换人换车情况统计表
  64 + @RequestMapping(value = "/changetochange", method = RequestMethod.GET)
  65 + public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) {
  66 +
  67 + return formsService.changetochange(map);
  68 + }
  69 +
  70 + // 路单数据
  71 + @RequestMapping(value = "/singledata", method = RequestMethod.GET)
  72 + public List<Singledata> singledata(@RequestParam Map<String, Object> map) {
  73 +
  74 + return formsService.singledata(map);
  75 + }
  76 +
  77 + // 路单数据
  78 + @RequestMapping(value = "/singledata2", method = RequestMethod.GET)
  79 + public List<Singledata> singledata2(@RequestParam Map<String, Object> map) {
  80 +
  81 + return formsService.singledata2(map);
  82 + }
  83 +
  84 + // 路单数据
  85 + @RequestMapping(value = "/singledatanew", method = RequestMethod.GET)
  86 + public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) {
  87 +
  88 + return formsService.singledatanew(map);
  89 + }
  90 +
  91 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  92 + public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) {
  93 +
  94 + return formsService.singledatatj(map);
  95 + }
  96 +
  97 +
  98 + @RequestMapping(value = "/singledatatj2", method = RequestMethod.GET)
  99 + public List<Singledata> singledatatj2(@RequestParam Map<String, Object> map) {
  100 +
  101 + return formsService.singledatatj2(map);
  102 + }
  103 + // 车辆加注
  104 + @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET)
  105 + public List<Vehicleloading> vehicleloading(@RequestParam String line, @RequestParam String data) {
  106 + return formsService.vehicleloading(line, data);
  107 + }
  108 +
  109 + // 运营服务阶段报表
  110 + @RequestMapping(value = "/operationservice", method = RequestMethod.GET)
  111 + public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) {
  112 +
  113 + return formsService.operationservice(map);
  114 + }
  115 +
  116 + // 营运线路出车率统计表
  117 + @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST)
  118 + public List<Map<String, Object>> turnoutrate(@RequestParam Map<String, Object> map) {
  119 +
  120 + return formsService.turnoutrate(map);
  121 + }
  122 +
  123 + // 班次执行率统计表
  124 + @RequestMapping(value = "/executionrate", method = RequestMethod.POST)
  125 + public List<Executionrate> executionrate(@RequestParam Map<String, Object> map) {
  126 +
  127 + return formsService.executionrate(map);
  128 + }
  129 +
  130 + // 营运线路名称统计表
  131 + @RequestMapping(value = "/allline", method = RequestMethod.POST)
  132 + public List<Allline> allline(@RequestParam Map<String, Object> map) {
  133 +
  134 + return formsService.allline(map);
  135 + }
  136 +
  137 + // 营运线路名称统计表
  138 + @RequestMapping(value = "/daily", method = RequestMethod.GET)
  139 + public List<Daily> daily(@RequestParam Map<String, Object> map) {
  140 +
  141 + return formsService.daily(map);
  142 + }
  143 +
  144 +}
... ...
src/main/java/com/bsth/controller/gps/GpsController.java
1 1 package com.bsth.controller.gps;
2 2  
  3 +import com.alibaba.fastjson.JSONObject;
3 4 import com.bsth.data.BasicData;
4 5 import com.bsth.data.gpsdata_v2.GpsRealData;
5 6 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
... ... @@ -7,18 +8,22 @@ import com.bsth.data.gpsdata_v2.handlers.overspeed.GpsOverspeed;
7 8 import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess;
8 9 import com.bsth.data.schedule.e_state_check.ScheduleStationCodeChecker;
9 10 import com.bsth.data.schedule.e_state_check.entity.SCodeInfo;
  11 +import com.bsth.entity.Line;
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import com.bsth.repository.LineRepository;
  14 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 15 import com.bsth.service.gps.GpsService;
11 16 import com.bsth.service.gps.entity.GpsSpeed;
12 17 import com.google.common.base.Splitter;
  18 +import org.hibernate.validator.constraints.Length;
  19 +import org.springframework.beans.BeanUtils;
13 20 import org.springframework.beans.factory.annotation.Autowired;
14 21 import org.springframework.web.bind.annotation.*;
15 22  
16 23 import javax.servlet.http.HttpServletResponse;
17 24 import java.text.ParseException;
18   -import java.util.ArrayList;
19   -import java.util.HashMap;
20   -import java.util.List;
21   -import java.util.Map;
  25 +import java.text.SimpleDateFormat;
  26 +import java.util.*;
22 27  
23 28 @RestController
24 29 @RequestMapping("gps")
... ... @@ -32,7 +37,14 @@ public class GpsController {
32 37  
33 38 @Autowired
34 39 OverspeedProcess overspeedProcess;
  40 +
  41 + @Autowired
  42 + LineRepository lineRepository;
  43 + @Autowired
  44 + ScheduleRealInfoRepository scheduleRealInfoRepository;
35 45  
  46 + // 格式化 年月日
  47 + private SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd");
36 48 @RequestMapping(value = "/real/all")
37 49 public Map<String, Object> search(@RequestParam Map<String, Object> map,
38 50 @RequestParam(defaultValue = "0") int page,
... ... @@ -51,11 +63,31 @@ public class GpsController {
51 63  
52 64 @RequestMapping(value = "/real/line")
53 65 public Map<String, Object> findByLineCodes(@RequestParam String lineCodes) {
  66 +
  67 + String json ="{\"lineId\":\"90018\",\"deviceId\":\"05S0Q141\",\"carparkNo\":\"\",\"stopNo\":\"119734\",\"stationName\":\"张江地铁站\",\"lon\":121.582085,\"lat\":31.203028,\"timestamp\":1637659686000,\"serverTimestamp\":1637659686742,\"speed\":0.0,\"direction\":0.0,\"state\":0,\"upDown\":0,\"origStateStr\":null,\"nbbm\":\"Q4A-009\",\"expectStopTime\":null,\"schId\":1040196467,\"version\":152,\"instation\":1,\"signalState\":\"normal\",\"abnormalStatus\":null,\"outOfBoundDistance\":0.0,\"valid\":0,\"source\":-1,\"remark\":null,\"planCode\":null,\"dvrcode\":null,\"offline\":false,\"service\":true}";
  68 + GpsEntity res = JSONObject.parseObject(json, GpsEntity.class);
54 69 Map<String, Object> rs = new HashMap();
55 70 List<String> lineArray = Splitter.on(",").splitToList(lineCodes);
56 71 //实时gps
57 72 List<GpsEntity> gpsList = gpsRealData.get(lineArray);
58   -
  73 + String[] t = lineCodes.split(",");
  74 + List<Map<String, Object>> clZbhMap = new ArrayList<>();
  75 + clZbhMap= scheduleRealInfoRepository.selectclZbhGroup(sdfnyr.format(new Date()),t);
  76 + for (int i = 0 ; i< t.length;i++){
  77 + for(Map clm : clZbhMap){
  78 + if(clm.get("xlBm").equals(t[i])){
  79 + String lineName = BasicData.lineCode2NameMap.get(t[i]);
  80 + GpsEntity snt = new GpsEntity();
  81 + BeanUtils.copyProperties(res,snt);
  82 + snt.setLineId(t[i]);
  83 + snt.setNbbm(clm.get("clZbh")+"-"+lineName);
  84 + snt.setDeviceId(clm.get("clZbh") +","+lineName);
  85 + gpsList.add(snt);
  86 + }
  87 + }
  88 +
  89 +
  90 + }
59 91 //超速信息
60 92 List<GpsOverspeed> overspeedList = overspeedProcess.findByLines(lineArray);
61 93  
... ...
src/main/java/com/bsth/data/LineConfigData.java
... ... @@ -54,6 +54,13 @@ public class LineConfigData implements CommandLineRunner {
54 54 //异步入库
55 55 Application.mainServices.scheduleWithFixedDelay(configPersistThread, 60, 60, TimeUnit.SECONDS);
56 56 }
  57 +
  58 + public void lineAll(){
  59 + lineConfMap = new HashMap<>();
  60 + Iterator<LineConfig> itr = lineConfigService.findAll().iterator();
  61 + while (itr.hasNext())
  62 + setBuffer(itr.next());
  63 + }
57 64  
58 65 /**
59 66 * 起点发出,应用缓冲区设置参数
... ...
src/main/java/com/bsth/data/ddexam/DdexamThread.java 0 → 100644
  1 +package com.bsth.data.ddexam;
  2 +
  3 +import com.bsth.repository.sys.SysRepository;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Component;
  6 +
  7 +/**
  8 + * 每日把所有账号变为未考试状态
  9 + */
  10 +@Component
  11 +public class DdexamThread extends Thread{
  12 + @Autowired
  13 + SysUserRepository sysUserRepository;
  14 +
  15 + //每日把所有账号变为未考试状态
  16 + @Override
  17 + public void run() {
  18 + sysUserRepository.changeKsStatusAll();
  19 + }
  20 +}
... ...
src/main/java/com/bsth/data/directive/DirectiveCreator.java
... ... @@ -45,7 +45,7 @@ public class DirectiveCreator {
45 45 public D60 createD60(String nbbm, String text, Short dispatchInstruct, int upDown, int state,String lineCode) {
46 46 Long timestamp = System.currentTimeMillis();
47 47  
48   - Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm));
  48 + //Short company = Short.parseShort(BasicData.nbbm2CompanyCodeMap.get(nbbm));
49 49 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
50 50  
51 51 int msgId = MsgIdGenerator.getMsgId();
... ... @@ -55,15 +55,15 @@ public class DirectiveCreator {
55 55 // 一级协议
56 56 directive.setOperCode((short) 0x60);
57 57 // 设备号
58   - directive.setDeviceId(deviceId);
  58 + directive.setDeviceId(nbbm);
59 59 // 时间戳
60 60 directive.setTimestamp(timestamp);
61 61 directive.setMsgId(msgId);
62 62 // 构造数据
63   - data.setDeviceId(deviceId);
  63 + data.setDeviceId(nbbm);
64 64 data.setDispatchInstruct(dispatchInstruct);
65 65 data.setTimestamp(timestamp);
66   - data.setCompanyCode(company);
  66 + //data.setCompanyCode(company);
67 67 data.setMsgId(msgId);
68 68 directive.setData(data);
69 69 directive.setLineCode(lineCode);
... ...
src/main/java/com/bsth/data/gpsdata_v2/entity/GpsEntity.java
... ... @@ -293,13 +293,13 @@ public class GpsEntity implements Cloneable{
293 293  
294 294  
295 295  
296   - public short getCompanyCode() {
  296 +/* public short getCompanyCode() {
297 297 return companyCode;
298 298 }
299 299  
300 300 public void setCompanyCode(short companyCode) {
301 301 this.companyCode = companyCode;
302   - }
  302 + }*/
303 303  
304 304 public Byte getUpDown() {
305 305 return upDown;
... ...
src/main/java/com/bsth/data/msg_queue/WebSocketPushQueue.java
... ... @@ -46,7 +46,7 @@ public class WebSocketPushQueue {
46 46 }
47 47 linkedList.clear();
48 48 thread = new DataPushThread();
49   - thread.start();
  49 + //thread.start();
50 50 }
51 51  
52 52 public static int size(){
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -155,6 +155,10 @@ public class DayOfSchedule {
155 155 return currSchDateMap;
156 156 }
157 157  
  158 + public void lineAll(){
  159 + currSchDateMap = new HashMap<>();
  160 + }
  161 +
158 162 /**
159 163 * @Title: calcSchDateB
160 164 * @Description: TODO(计算线路当前应该使用的排班日期)
... ... @@ -189,8 +193,9 @@ public class DayOfSchedule {
189 193 else
190 194 clearRAMData(lineCode);
191 195  
192   - if (existRealSch(lineCode, schDate))
  196 + if (existRealSch(lineCode, schDate))
193 197 list = loadRealSch(lineCode, schDate);// 从实际排班表加载
  198 +
194 199 else {
195 200 list = loadPlanSch(lineCode, schDate);// 从计划排班表加载
196 201 // 写入数据库
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
... ... @@ -47,8 +47,10 @@ public class ScheduleRefreshThread extends Thread{
47 47  
48 48 String currSchDate, oldSchDate;
49 49 String lineCode = null;
  50 + String lineName = null;
50 51 for(LineConfig conf : confs){
51 52 try{
  53 + lineName = conf.getLine().getName();
52 54 lineCode = conf.getLine().getLineCode();
53 55 oldSchDate = dayOfSchedule.getCurrSchDate().get(lineCode);
54 56 currSchDate = dayOfSchedule.calcSchDate(lineCode);
... ... @@ -71,7 +73,7 @@ public class ScheduleRefreshThread extends Thread{
71 73  
72 74 //重载排班数据
73 75 dayOfSchedule.reloadSch(lineCode, currSchDate, false);
74   - logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
  76 + logger.info(lineName + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
75 77 }
76 78 }catch (Exception e){
77 79 logger.error("班次更新失败!! -" + lineCode, e);
... ...
src/main/java/com/bsth/entity/StationRouteSt.java
... ... @@ -18,10 +18,9 @@ import java.util.Date;
18 18 */
19 19  
20 20 @Entity
21   -@Table(name = "bsth_c_stationroute")
  21 +@Table(name = "bsth_c_stationroute_st")
22 22 @NamedEntityGraphs({
23   - @NamedEntityGraph(name = "stationRoute_station", attributeNodes = {
24   - @NamedAttributeNode("station"),
  23 + @NamedEntityGraph(name = "stationRoute_station_st", attributeNodes = {
25 24 @NamedAttributeNode("line")
26 25 })
27 26 })
... ... @@ -102,13 +101,13 @@ public class StationRouteSt {
102 101 @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
103 102 private Date updateDate;
104 103  
105   - // 站点信息
  104 + /*// 站点信息
106 105 @ManyToOne(fetch = FetchType.LAZY)
107 106 private Station station;
108   -
  107 + */
109 108 // 线路信息
110 109 @ManyToOne
111   - private Line line;
  110 + private LineSt line;
112 111  
113 112 public Integer getId() {
114 113 return id;
... ... @@ -270,19 +269,12 @@ public class StationRouteSt {
270 269 this.updateDate = updateDate;
271 270 }
272 271  
273   - public Station getStation() {
274   - return station;
275   - }
276   -
277   - public void setStation(Station station) {
278   - this.station = station;
279   - }
280 272  
281   - public Line getLine() {
  273 + public LineSt getLine() {
282 274 return line;
283 275 }
284 276  
285   - public void setLine(Line line) {
  277 + public void setLine(LineSt line) {
286 278 this.line = line;
287 279 }
288 280 }
289 281 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
... ... @@ -109,10 +109,7 @@ public class ChildTaskPlan {
109 109 */
110 110 private boolean noClerk;
111 111  
112   - /** 创建日期 */
113   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
114   - private Date createDate;
115   -
  112 +
116 113 /**
117 114 * 主排班计划
118 115 */
... ... @@ -251,14 +248,7 @@ public class ChildTaskPlan {
251 248 public boolean equals(Object obj) {
252 249 return this.id.equals(((ChildTaskPlan)obj).getId());
253 250 }
254   -
255   - public Date getCreateDate() {
256   - return createDate;
257   - }
258   -
259   - public void setCreateDate(Date createDate) {
260   - this.createDate = createDate;
261   - }
  251 +
262 252  
263 253 public String getReason() {
264 254 return reason;
... ...
src/main/java/com/bsth/entity/realcontrol/LineConfigSt.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.LineSt;
  5 +import com.google.common.base.Splitter;
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +
  10 +import javax.persistence.*;
  11 +import java.util.List;
  12 +
  13 +/**
  14 + *
  15 + * @ClassName: LineConfig
  16 + * @Description: TODO(线调 线路相关配置信息)
  17 + * @author PanZhao
  18 + * @date 2016年8月15日 下午1:57:56
  19 + *
  20 + */
  21 +@Entity
  22 +@Table(name = "bsth_c_line_config_st")
  23 +public class LineConfigSt {
  24 +
  25 + @Id
  26 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  27 + private Integer id;
  28 +
  29 + @OneToOne
  30 + private LineSt line;
  31 +
  32 + /** 开始运营时间 HH:mm */
  33 + private String startOpt;
  34 +
  35 + /** 出场时间设置 0:真实出场(设备离开缓冲区时间) 1:请求出场时间 2:出站即出场 */
  36 + private int outConfig;
  37 +
  38 + /** 出站既出场 对应的停车场 , 号分割多个*/
  39 + private String twinsParks;
  40 +
  41 + /** 出站既出场 对应的起点站 */
  42 + private String twinsStations;
  43 +
  44 + /** 调度指令模板 */
  45 + private String schDirectiveTemp;
  46 +
  47 + /** 识别区间调头 */
  48 + private boolean readReverse;
  49 +
  50 + /** 原线路回场 */
  51 + private boolean inParkForSource;
  52 +
  53 + /** 自动执行 */
  54 + private boolean autoExec;
  55 +
  56 + /**
  57 + * 到离站偏移值
  58 + */
  59 +
  60 + //上行进站
  61 + private int upInDiff;
  62 + //上行出站
  63 + private int upOutDiff;
  64 + //下行进站
  65 + private int downInDiff;
  66 + //下行出站
  67 + private int downOutDiff;
  68 +
  69 + /**
  70 + * 应急停靠
  71 + */
  72 + private boolean enableYjtk;
  73 + /** HH:mm */
  74 + private String yjtkStart;
  75 + /** HH:mm */
  76 + private String yjtkEnd;
  77 + private int upStopMinute;
  78 + private int downStopMinute;
  79 +
  80 + /**
  81 + * 使用第一个发车时间,不匹配最佳时间
  82 + */
  83 + private boolean lockFirstOutTime;
  84 +
  85 + public Integer getId() {
  86 + return id;
  87 + }
  88 +
  89 + public void setId(Integer id) {
  90 + this.id = id;
  91 + }
  92 +
  93 + public LineSt getLine() {
  94 + return line;
  95 + }
  96 +
  97 + public void setLine(LineSt line) {
  98 + this.line = line;
  99 + }
  100 +
  101 + public String getStartOpt() {
  102 + return startOpt;
  103 + }
  104 +
  105 + public void setStartOpt(String startOpt) {
  106 + this.startOpt = startOpt;
  107 + }
  108 +
  109 + public int getOutConfig() {
  110 + return outConfig;
  111 + }
  112 +
  113 + public void setOutConfig(int outConfig) {
  114 + this.outConfig = outConfig;
  115 + }
  116 +
  117 + public String getSchDirectiveTemp() {
  118 + return schDirectiveTemp;
  119 + }
  120 +
  121 + public void setSchDirectiveTemp(String schDirectiveTemp) {
  122 + this.schDirectiveTemp = schDirectiveTemp;
  123 + }
  124 +
  125 + public boolean isReadReverse() {
  126 + return readReverse;
  127 + }
  128 +
  129 + public void setReadReverse(boolean readReverse) {
  130 + this.readReverse = readReverse;
  131 + }
  132 +
  133 + public boolean isInParkForSource() {
  134 + return inParkForSource;
  135 + }
  136 +
  137 + public void setInParkForSource(boolean inParkForSource) {
  138 + this.inParkForSource = inParkForSource;
  139 + }
  140 +
  141 + public int getUpInDiff() {
  142 + return upInDiff;
  143 + }
  144 +
  145 + public void setUpInDiff(int upInDiff) {
  146 + this.upInDiff = upInDiff;
  147 + }
  148 +
  149 + public int getUpOutDiff() {
  150 + return upOutDiff;
  151 + }
  152 +
  153 + public void setUpOutDiff(int upOutDiff) {
  154 + this.upOutDiff = upOutDiff;
  155 + }
  156 +
  157 + public int getDownInDiff() {
  158 + return downInDiff;
  159 + }
  160 +
  161 + public void setDownInDiff(int downInDiff) {
  162 + this.downInDiff = downInDiff;
  163 + }
  164 +
  165 + public int getDownOutDiff() {
  166 + return downOutDiff;
  167 + }
  168 +
  169 + public void setDownOutDiff(int downOutDiff) {
  170 + this.downOutDiff = downOutDiff;
  171 + }
  172 +
  173 +
  174 + public String getYjtkStart() {
  175 + return yjtkStart;
  176 + }
  177 +
  178 + public void setYjtkStart(String yjtkStart) {
  179 + this.yjtkStart = yjtkStart;
  180 + }
  181 +
  182 + public String getYjtkEnd() {
  183 + return yjtkEnd;
  184 + }
  185 +
  186 + public void setYjtkEnd(String yjtkEnd) {
  187 + this.yjtkEnd = yjtkEnd;
  188 + }
  189 +
  190 + public int getUpStopMinute() {
  191 + return upStopMinute;
  192 + }
  193 +
  194 + public void setUpStopMinute(int upStopMinute) {
  195 + this.upStopMinute = upStopMinute;
  196 + }
  197 +
  198 + public int getDownStopMinute() {
  199 + return downStopMinute;
  200 + }
  201 +
  202 + public void setDownStopMinute(int downStopMinute) {
  203 + this.downStopMinute = downStopMinute;
  204 + }
  205 +
  206 + public boolean isEnableYjtk() {
  207 + return enableYjtk;
  208 + }
  209 +
  210 + public void setEnableYjtk(boolean enableYjtk) {
  211 + this.enableYjtk = enableYjtk;
  212 + }
  213 +
  214 +
  215 + public boolean isLockFirstOutTime() {
  216 + return lockFirstOutTime;
  217 + }
  218 +
  219 + public void setLockFirstOutTime(boolean lockFirstOutTime) {
  220 + this.lockFirstOutTime = lockFirstOutTime;
  221 + }
  222 +
  223 + public boolean isAutoExec() {
  224 + return autoExec;
  225 + }
  226 +
  227 + public void setAutoExec(boolean autoExec) {
  228 + this.autoExec = autoExec;
  229 + }
  230 +
  231 + public String getTwinsParks() {
  232 + return twinsParks;
  233 + }
  234 +
  235 + public void setTwinsParks(String twinsParks) {
  236 + this.twinsParks = twinsParks;
  237 + }
  238 +
  239 + public String getTwinsStations() {
  240 + return twinsStations;
  241 + }
  242 +
  243 + public void setTwinsStations(String twinsStations) {
  244 + this.twinsStations = twinsStations;
  245 + }
  246 +
  247 +
  248 + @Transient
  249 + Logger logger = LoggerFactory.getLogger(this.getClass());
  250 +
  251 +
  252 + public List<String> findTwinsParkList() {
  253 + try{
  254 + if(StringUtils.isEmpty(this.twinsParks))
  255 + return null;
  256 + return Splitter.on(",").splitToList(this.twinsParks);
  257 + }catch (Exception e){
  258 + logger.error("", e);
  259 + return null;
  260 + }
  261 + }
  262 +}
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -24,6 +24,7 @@ import java.util.Set;
24 24 public class ScheduleRealInfo {
25 25 /** 主键Id */
26 26 @Id
  27 + @GeneratedValue(strategy = GenerationType.IDENTITY)
27 28 private Long id;
28 29  
29 30 /** 计划ID */
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfoSt.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import com.bsth.entity.sys.SysUser;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.joda.time.format.DateTimeFormat;
  7 +import org.joda.time.format.DateTimeFormatter;
  8 +
  9 +import javax.persistence.*;
  10 +import java.util.Date;
  11 +import java.util.HashSet;
  12 +import java.util.Set;
  13 +
  14 +/**
  15 + * 实际排班计划明细。
  16 + */
  17 +@Entity
  18 +@Table(name = "bsth_c_s_sp_info_real_st")
  19 +public class ScheduleRealInfoSt {
  20 + /** 主键Id */
  21 + @Id
  22 + private Long id;
  23 +
  24 + /** 计划ID */
  25 + private Long spId;
  26 +
  27 + /** 排班计划日期 --no webSocket */
  28 + private Date scheduleDate;
  29 + /** 排班日期字符串 YYYY-MM-DD */
  30 + private String scheduleDateStr;
  31 +
  32 + /** 真实执行时间 yyyy-MM-dd */
  33 + private String realExecDate;
  34 +
  35 + /** 线路名称 */
  36 + private String xlName;
  37 + /** 线路编码 */
  38 + private String xlBm;
  39 +
  40 + /** 路牌名称 */
  41 + private String lpName;
  42 +
  43 + /** 车辆自编号 */
  44 + private String clZbh;
  45 +
  46 + /** 驾驶员工号 */
  47 + private String jGh;
  48 + /** 驾驶员名字 */
  49 + private String jName;
  50 + /** 售票员工号 */
  51 + private String sGh;
  52 + /** 售票员名字 */
  53 + private String sName;
  54 +
  55 + /** 线路方向 */
  56 + private String xlDir;
  57 + /** 起点站code*/
  58 + private String qdzCode;
  59 + /** 起点站名字 */
  60 + private String qdzName;
  61 +
  62 + /** 终点站code*/
  63 + private String zdzCode;
  64 + /** 终点站名字 */
  65 + private String zdzName;
  66 +
  67 + /** 计划发车时间(格式 HH:mm) */
  68 + private String fcsj;
  69 + /** 计划发车时间戳*/
  70 + @Transient
  71 + private Long fcsjT;
  72 +
  73 + /** 计划终点时间(格式 HH:mm) */
  74 + private String zdsj;
  75 + /** 计划终点时间戳*/
  76 + @Transient
  77 + private Long zdsjT;
  78 +
  79 + /** 发车顺序号 --no webSocket*/
  80 + private Integer fcno;
  81 + /** 对应班次数 --no webSocket*/
  82 + private Integer bcs;
  83 + /** 计划里程 */
  84 + private Double jhlc;
  85 +
  86 + /** 原始计划里程 (原计调的数据) */
  87 + private Double jhlcOrig;
  88 +
  89 + /** 实际里程 --no webSocket*/
  90 + @Transient
  91 + @JsonIgnore
  92 + private Double realMileage;
  93 +
  94 + /** 实际里程 --no webSocket */
  95 + @Transient
  96 + private String sjlc;
  97 + /** 班次历时 */
  98 + private Integer bcsj;
  99 +
  100 + /**
  101 + * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶
  102 + */
  103 + private String bcType;
  104 +
  105 + //放站班次 站点名称
  106 + private String majorStationName;
  107 +
  108 + /** 创建人 */
  109 + @JsonIgnore
  110 + @ManyToOne(fetch = FetchType.LAZY)
  111 + private SysUser createBy;
  112 + /** 修改人 */
  113 + @JsonIgnore
  114 + @ManyToOne(fetch = FetchType.LAZY)
  115 + private SysUser updateBy;
  116 + /** 创建日期 */
  117 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  118 + private Date createDate;
  119 + /** 修改日期 */
  120 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  121 + private Date updateDate;
  122 +
  123 + /** 实际发车时间*/
  124 + private String fcsjActual;
  125 + /** 实际发车时间戳*/
  126 + @Transient
  127 + private Long fcsjActualTime;
  128 + /**实际终点时间 */
  129 + private String zdsjActual;
  130 + /** 实际终点时间戳*/
  131 + @Transient
  132 + private Long zdsjActualTime;
  133 +
  134 + /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */
  135 + private int status;
  136 +
  137 + private String adjustExps;
  138 +
  139 + /** 是否是临加班次 */
  140 + private boolean sflj;
  141 +
  142 + /** 是否误点 (应发未发)*/
  143 + @Transient
  144 + private boolean late;
  145 +
  146 + /** 是否误点 (应发未到) */
  147 + @Transient
  148 + private boolean late2;
  149 + /** 误点停靠时间 */
  150 + @Transient
  151 + private float lateMinute;
  152 +
  153 + /** 备注*/
  154 + private String remarks;
  155 +
  156 + /** 原计划排班备注 --no webSocket */
  157 + @Transient
  158 + private String remark;
  159 +
  160 + /**待发时间(格式 HH:mm) */
  161 + private String dfsj;
  162 +
  163 + /**待发时间戳 */
  164 + @Transient
  165 + private Long dfsjT;
  166 +
  167 + /** 指令下发状态 60: 已发送, 100: 设备确认收到, 200:驾驶员确认 0:失败 */
  168 + private Integer directiveState = -1;
  169 +
  170 + /** 起点站计划到达时间 */
  171 + @Transient
  172 + private String qdzArrDatejh;
  173 +
  174 + /** 起点站实际到达时间 */
  175 + @Transient
  176 + private String qdzArrDatesj;
  177 +
  178 + /** 子任务 */
  179 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
  180 + private Set<ChildTaskPlan> cTasks = new HashSet<>();
  181 +
  182 + /** 关联的公司名称 */
  183 + private String gsName;
  184 + /** 关联的公司编码 */
  185 + private String gsBm;
  186 + /** 关联的分公司名称 */
  187 + private String fgsName;
  188 + /** 关联的分公司编码 */
  189 + private String fgsBm;
  190 + /** 出场顺序号 */
  191 + private Integer ccno;
  192 +
  193 + //待发调试(是否自动调整)
  194 + private boolean dfAuto;
  195 + //是否有GPS信号
  196 + private boolean online;
  197 +
  198 + /** 是否有补发GPS信号 */
  199 + private boolean reissue;
  200 +
  201 + /** 发车屏 发车顺序号,不持久化,会动态变化 --no webSocket*/
  202 + @Transient
  203 + private int fcpSn;
  204 +
  205 + /** 标记班次已被删除 */
  206 + @Transient
  207 + @JsonIgnore
  208 + private boolean deleted;
  209 +
  210 + @Transient
  211 + @JsonIgnore
  212 + private int saveFailCount=0;
  213 +
  214 + /** 是否需要补充GPS信号 (网关提交至运管处动态数据用) 1: 能发车, 2:能到达 3: 补发过*/
  215 + private int siginCompate;
  216 +
  217 + /**
  218 + * 漂移状态
  219 + * 1: 发车漂移
  220 + * 2:到站漂移
  221 + * 3:中途漂移
  222 + */
  223 + private Integer driftStatus = 0;
  224 +
  225 + /**
  226 + * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
  227 + */
  228 + private boolean ccService;
  229 + private Integer lpChange;
  230 +
  231 + /**
  232 + * rfid状态
  233 + */
  234 + private int rfidState;
  235 +
  236 + /**
  237 + * 起点站rfid状态
  238 + */
  239 + private int firstRfidState;
  240 +
  241 + public Integer getLpChange() {
  242 + return lpChange;
  243 + }
  244 +
  245 + public void setLpChange(Integer lpChange) {
  246 + this.lpChange = lpChange;
  247 + }
  248 +
  249 + public boolean isDfAuto() {
  250 + return dfAuto;
  251 + }
  252 +
  253 + public void setDfAuto(boolean dfAuto) {
  254 + this.dfAuto = dfAuto;
  255 + }
  256 +
  257 + public boolean isOnline() {
  258 + return online;
  259 + }
  260 +
  261 + public void setOnline(boolean online) {
  262 + this.online = online;
  263 + }
  264 +
  265 + public String getQdzArrDatejh() {
  266 + return qdzArrDatejh;
  267 + }
  268 +
  269 + public void setQdzArrDatejh(String qdzArrDatejh) {
  270 + this.qdzArrDatejh = qdzArrDatejh;
  271 + }
  272 +
  273 + public String getQdzArrDatesj() {
  274 + return qdzArrDatesj;
  275 + }
  276 +
  277 + public void setQdzArrDatesj(String qdzArrDatesj) {
  278 + this.qdzArrDatesj = qdzArrDatesj;
  279 + }
  280 +
  281 + public void setcTasks(Set<ChildTaskPlan> cTasks) {
  282 + this.cTasks = cTasks;
  283 + }
  284 +
  285 + public String getGsName() {
  286 + return gsName;
  287 + }
  288 +
  289 + public void setGsName(String gsName) {
  290 + this.gsName = gsName;
  291 + }
  292 +
  293 + public String getGsBm() {
  294 + return gsBm;
  295 + }
  296 +
  297 + public void setGsBm(String gsBm) {
  298 + this.gsBm = gsBm;
  299 + }
  300 +
  301 + public String getFgsName() {
  302 + return fgsName;
  303 + }
  304 +
  305 + public void setFgsName(String fgsName) {
  306 + this.fgsName = fgsName;
  307 + }
  308 +
  309 + public String getFgsBm() {
  310 + return fgsBm;
  311 + }
  312 +
  313 + public void setFgsBm(String fgsBm) {
  314 + this.fgsBm = fgsBm;
  315 + }
  316 +
  317 + public Integer getCcno() {
  318 + return ccno;
  319 + }
  320 +
  321 + public void setCcno(Integer ccno) {
  322 + this.ccno = ccno;
  323 + }
  324 +
  325 +
  326 + /** ----------------
  327 + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  328 + private RealTimeModel sjfcModel;
  329 + @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  330 + private RealTimeModel sjddModel;
  331 + */
  332 + public void addRemarks(String remark){
  333 + if(StringUtils.isBlank(remark))
  334 + return;
  335 + String old = this.getRemarks();
  336 + if(StringUtils.isBlank(old))
  337 + old = "";
  338 +
  339 + old += remark + ";";
  340 + this.setRemarks(old);
  341 +
  342 + }
  343 +
  344 + public Long getId() {
  345 + return id;
  346 + }
  347 +
  348 + public void setId(Long id) {
  349 + this.id = id;
  350 + }
  351 +
  352 + public Date getScheduleDate() {
  353 + return scheduleDate;
  354 + }
  355 +
  356 + public void setScheduleDate(Date scheduleDate) {
  357 + this.scheduleDate = scheduleDate;
  358 + }
  359 +
  360 + public String getXlName() {
  361 + return xlName;
  362 + }
  363 +
  364 + public void setXlName(String xlName) {
  365 + this.xlName = xlName;
  366 + }
  367 +
  368 + public String getXlBm() {
  369 + return xlBm;
  370 + }
  371 +
  372 + public void setXlBm(String xlBm) {
  373 + this.xlBm = xlBm;
  374 + }
  375 +
  376 + public String getLpName() {
  377 + return lpName;
  378 + }
  379 +
  380 + public void setLpName(String lpName) {
  381 + this.lpName = lpName;
  382 + }
  383 +
  384 + public String getClZbh() {
  385 + return clZbh;
  386 + }
  387 +
  388 + public void setClZbh(String clZbh) {
  389 + this.clZbh = clZbh;
  390 + }
  391 +
  392 + public String getjGh() {
  393 + return jGh;
  394 + }
  395 +
  396 + public void setjGh(String jGh) {
  397 + this.jGh = jGh;
  398 + }
  399 +
  400 + public String getjName() {
  401 + return jName;
  402 + }
  403 +
  404 + public void setjName(String jName) {
  405 + this.jName = jName;
  406 + }
  407 +
  408 + public String getsGh() {
  409 + if(sGh == null)
  410 + return "";
  411 + return sGh;
  412 + }
  413 +
  414 + public void setsGh(String sGh) {
  415 + this.sGh = sGh;
  416 + }
  417 +
  418 + public String getsName() {
  419 + if(sGh == null)
  420 + return "";
  421 + return sName;
  422 + }
  423 +
  424 + public void setsName(String sName) {
  425 + this.sName = sName;
  426 + }
  427 +
  428 + public String getXlDir() {
  429 + return xlDir;
  430 + }
  431 +
  432 + public void setXlDir(String xlDir) {
  433 + this.xlDir = xlDir;
  434 + }
  435 +
  436 + public String getQdzCode() {
  437 + return qdzCode;
  438 + }
  439 +
  440 + public void setQdzCode(String qdzCode) {
  441 + this.qdzCode = qdzCode;
  442 + }
  443 +
  444 + public String getQdzName() {
  445 + return qdzName;
  446 + }
  447 +
  448 + public void setQdzName(String qdzName) {
  449 + this.qdzName = qdzName;
  450 + }
  451 +
  452 + public String getZdzCode() {
  453 + return zdzCode;
  454 + }
  455 +
  456 + public void setZdzCode(String zdzCode) {
  457 + this.zdzCode = zdzCode;
  458 + }
  459 +
  460 + public String getZdzName() {
  461 + return zdzName;
  462 + }
  463 +
  464 + public void setZdzName(String zdzName) {
  465 + this.zdzName = zdzName;
  466 + }
  467 +
  468 + public String getFcsj() {
  469 + return fcsj;
  470 + }
  471 +
  472 + public void setFcsj(String fcsj) {
  473 + this.fcsj = fcsj;
  474 + }
  475 +
  476 + public Long getFcsjT() {
  477 + return fcsjT;
  478 + }
  479 +
  480 + public void setFcsjT(Long fcsjT) {
  481 + this.fcsjT = fcsjT;
  482 + }
  483 +
  484 + public String getZdsj() {
  485 + return zdsj;
  486 + }
  487 +
  488 + public void setZdsj(String zdsj) {
  489 + this.zdsj = zdsj;
  490 + }
  491 +
  492 + public Long getZdsjT() {
  493 + return zdsjT;
  494 + }
  495 +
  496 + public void setZdsjT(Long zdsjT) {
  497 + this.zdsjT = zdsjT;
  498 + }
  499 +
  500 + public Integer getFcno() {
  501 + return fcno;
  502 + }
  503 +
  504 + public void setFcno(Integer fcno) {
  505 + this.fcno = fcno;
  506 + }
  507 +
  508 + public Integer getBcs() {
  509 + return bcs;
  510 + }
  511 +
  512 + public void setBcs(Integer bcs) {
  513 + this.bcs = bcs;
  514 + }
  515 +
  516 + public Double getJhlc() {
  517 + return jhlc;
  518 + }
  519 +
  520 + public void setJhlc(Double jhlc) {
  521 + this.jhlc = jhlc;
  522 + //临加班次 计划公里 和 实际计划公里一样
  523 + if(this.isSflj())
  524 + this.setJhlcOrig(this.getJhlc());
  525 + }
  526 +
  527 + public String getSjlc() {
  528 + return sjlc;
  529 + }
  530 +
  531 + public void setSjlc(String sjlc) {
  532 + this.sjlc = sjlc;
  533 + }
  534 +
  535 + public Integer getBcsj() {
  536 + return bcsj;
  537 + }
  538 +
  539 + public void setBcsj(Integer bcsj) {
  540 + this.bcsj = bcsj;
  541 + }
  542 +
  543 + public String getBcType() {
  544 + return bcType;
  545 + }
  546 +
  547 + public void setBcType(String bcType) {
  548 + this.bcType = bcType;
  549 + }
  550 +
  551 + public SysUser getCreateBy() {
  552 + return createBy;
  553 + }
  554 +
  555 + public void setCreateBy(SysUser createBy) {
  556 + this.createBy = createBy;
  557 + }
  558 +
  559 + public SysUser getUpdateBy() {
  560 + return updateBy;
  561 + }
  562 +
  563 + public void setUpdateBy(SysUser updateBy) {
  564 + this.updateBy = updateBy;
  565 + }
  566 +
  567 + public Date getCreateDate() {
  568 + return createDate;
  569 + }
  570 +
  571 + public void setCreateDate(Date createDate) {
  572 + this.createDate = createDate;
  573 + }
  574 +
  575 + public Date getUpdateDate() {
  576 + return updateDate;
  577 + }
  578 +
  579 + public void setUpdateDate(Date updateDate) {
  580 + this.updateDate = updateDate;
  581 + }
  582 +
  583 + public String getFcsjActual() {
  584 + return fcsjActual;
  585 + }
  586 +
  587 + public void setFcsjActual(String fcsjActual) {
  588 + this.fcsjActual = fcsjActual;
  589 + }
  590 +
  591 + public Long getFcsjActualTime() {
  592 + return fcsjActualTime;
  593 + }
  594 +
  595 + public void setFcsjActualTime(Long fcsjActualTime) {
  596 + this.fcsjActualTime = fcsjActualTime;
  597 + }
  598 +
  599 + public String getZdsjActual() {
  600 + return zdsjActual;
  601 + }
  602 +
  603 + public void setZdsjActual(String zdsjActual) {
  604 + this.zdsjActual = zdsjActual;
  605 + }
  606 +
  607 + public Long getZdsjActualTime() {
  608 + return zdsjActualTime;
  609 + }
  610 +
  611 + public void setZdsjActualTime(Long zdsjActualTime) {
  612 + this.zdsjActualTime = zdsjActualTime;
  613 + }
  614 +
  615 + public int getStatus() {
  616 + return status;
  617 + }
  618 +
  619 + public void setStatus(int status) {
  620 + this.status = status;
  621 + }
  622 +
  623 + public String getRemarks() {
  624 + return remarks;
  625 + }
  626 +
  627 + public void setRemarks(String remarks) {
  628 + this.remarks = remarks;
  629 + }
  630 +
  631 + public String getDfsj() {
  632 + return dfsj;
  633 + }
  634 +
  635 + public void setDfsj(String dfsj) {
  636 + this.dfsj = dfsj;
  637 + }
  638 +
  639 + public Long getDfsjT() {
  640 + return dfsjT;
  641 + }
  642 +
  643 + public void setDfsjT(Long dfsjT) {
  644 + this.dfsjT = dfsjT;
  645 + }
  646 +
  647 +
  648 + @Transient
  649 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  650 + @Transient
  651 + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  652 +
  653 + public void setDfsjAll(Long dfsjT) {
  654 + this.dfsjT = dfsjT;
  655 + this.dfsj = fmtHHmm.print(this.dfsjT);
  656 + }
  657 +
  658 + public void setDfsjAll(String dfsj) {
  659 + this.dfsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + dfsj);
  660 + this.dfsj = dfsj;
  661 + }
  662 +
  663 + public void calcEndTime(){
  664 + //计划终点时间
  665 + if(this.getBcsj() != null){
  666 + //this.setZdsjT(this.getDfsjT() + (this.getBcsj() * 60 * 1000));
  667 + this.setZdsjT(this.getFcsjT() + (this.getBcsj() * 60 * 1000));//计划终点时间不变
  668 + this.setZdsj(fmtHHmm.print(this.zdsjT));
  669 + }
  670 + }
  671 +
  672 + public Integer getDirectiveState() {
  673 + return directiveState;
  674 + }
  675 +
  676 + public void setDirectiveState(Integer directiveState) {
  677 + this.directiveState = directiveState;
  678 + }
  679 +
  680 + @Override
  681 + public boolean equals(Object obj) {
  682 + try{
  683 + return this.id.equals(((ScheduleRealInfoSt)obj).getId());
  684 + }catch(Exception e){
  685 + return false;
  686 + }
  687 + }
  688 +
  689 + @Override
  690 + public int hashCode() {
  691 + return ("schedule_" + this.id).hashCode();
  692 + }
  693 +
  694 + public boolean isSflj() {
  695 + return sflj;
  696 + }
  697 +
  698 + public void setSflj(boolean sflj) {
  699 + this.sflj = sflj;
  700 + }
  701 +
  702 + /**
  703 + *
  704 + * @Title: setFcsjAll
  705 + * @Description: TODO(设置计划发车时间)
  706 + * @throws
  707 + */
  708 + public void setFcsjAll(String fcsj){
  709 + this.fcsjT = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsj);
  710 + this.fcsj = fcsj;
  711 + }
  712 +
  713 + /**
  714 + *
  715 + * @Title: setFcsjAll
  716 + * @Description: TODO(设置计划发车时间)
  717 + * @throws
  718 + */
  719 + public void setFcsjAll(Long fcsjT){
  720 + this.fcsjT = fcsjT;
  721 + this.fcsj = fmtHHmm.print(fcsjT);
  722 + }
  723 +
  724 + /**
  725 + *
  726 + * @Title: setFcsjActualAll
  727 + * @Description: TODO(设置实际发车时间 字符串)
  728 + * @throws
  729 + */
  730 + public void setFcsjActualAll(String fcsjActual){
  731 + this.fcsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + fcsjActual);
  732 + this.fcsjActual = fcsjActual;
  733 + calcStatus();
  734 + }
  735 +
  736 + /**
  737 + *
  738 + * @Title: setFcsjActualAll
  739 + * @Description: TODO(设置实际发车时间 时间戳)
  740 + * @throws
  741 + */
  742 + public void setFcsjActualAll(Long t){
  743 +
  744 + this.fcsjActualTime = t;
  745 + if(null == t)
  746 + this.fcsjActual = null;
  747 + else
  748 + this.fcsjActual = fmtHHmm.print(t);
  749 +
  750 + //更新班次状态
  751 + calcStatus();
  752 + }
  753 +
  754 + /**
  755 + *
  756 + * @Title: setFcsjActualAll
  757 + * @Description: TODO(设置实际终点时间)
  758 + * @throws
  759 + */
  760 + public void setZdsjActualAll(Long t){
  761 + this.zdsjActualTime = t;
  762 +
  763 + if(null == t)
  764 + this.zdsjActual = null;
  765 + else
  766 + this.zdsjActual = fmtHHmm.print(t);
  767 +
  768 + //更新班次状态
  769 + calcStatus();
  770 + }
  771 +
  772 + /**
  773 + *
  774 + * @Title: setFcsjActualAll
  775 + * @Description: TODO(设置实际终点时间)
  776 + * @throws
  777 + */
  778 + public void setZdsjActualAll(String zdsjActual){
  779 + this.zdsjActualTime = fmtyyyyMMddHHmm.parseMillis(this.realExecDate + zdsjActual);
  780 + this.zdsjActual = zdsjActual;
  781 +
  782 + calcStatus();
  783 + }
  784 +
  785 + public Long getSpId() {
  786 + return spId;
  787 + }
  788 +
  789 + public void setSpId(Long spId) {
  790 + this.spId = spId;
  791 + }
  792 +
  793 + public String getRealExecDate() {
  794 + return realExecDate;
  795 + }
  796 +
  797 + public void setRealExecDate(String realExecDate) {
  798 + this.realExecDate = realExecDate;
  799 + }
  800 +
  801 + public void calcStatus() {
  802 + if(this.status == -1)
  803 + return;
  804 +
  805 + this.status = 0;
  806 + if(StringUtils.isNotBlank(this.fcsjActual)){
  807 + this.status = 1;
  808 +
  809 + //进出场班次并且没有计划里程的
  810 + if((this.bcType.equals("out") || this.bcType.equals("in"))
  811 + && this.jhlc == null){
  812 + this.status = 2;
  813 + }
  814 + }
  815 + if(StringUtils.isNotBlank(this.zdsjActual))
  816 + this.status = 2;
  817 + }
  818 +
  819 + public void destroy(){
  820 + this.jhlc = 0.0;
  821 + if(this.isSflj())
  822 + this.jhlcOrig = 0.0;
  823 + this.status = -1;
  824 + this.clearFcsjActual();
  825 + }
  826 +
  827 + public boolean isDestroy(){
  828 + return this.status == -1;
  829 + }
  830 +
  831 +/* public boolean isNotDestroy(){
  832 + return this.status != -1;
  833 + }*/
  834 +
  835 + public Set<ChildTaskPlan> getcTasks() {
  836 + return cTasks;
  837 + }
  838 +
  839 +/* public void setcTasks(Set<ChildTaskPlan> cTasks) {
  840 + this.cTasks = cTasks;
  841 + }*/
  842 +
  843 + public String getScheduleDateStr() {
  844 + return scheduleDateStr;
  845 + }
  846 +
  847 + public void setScheduleDateStr(String scheduleDateStr) {
  848 + this.scheduleDateStr = scheduleDateStr;
  849 + }
  850 +
  851 + public void clearFcsjActual(){
  852 + this.setFcsjActual(null);
  853 + this.setFcsjActualTime(null);
  854 + this.calcStatus();
  855 + }
  856 +
  857 + //清除实际终点时间
  858 + public void clearZdsjActual(){
  859 + this.setZdsjActual(null);
  860 + this.setZdsjActualTime(null);
  861 +
  862 + calcStatus();
  863 + }
  864 +
  865 + public boolean isLate() {
  866 + return late;
  867 + }
  868 +
  869 + public void setLate(boolean late) {
  870 + this.late = late;
  871 + }
  872 +
  873 + public String getAdjustExps() {
  874 + return adjustExps;
  875 + }
  876 +
  877 + public void setAdjustExps(String adjustExps) {
  878 + this.adjustExps = adjustExps;
  879 + }
  880 +
  881 + public boolean isReissue() {
  882 + return reissue;
  883 + }
  884 +
  885 + public void setReissue(boolean reissue) {
  886 + this.reissue = reissue;
  887 + }
  888 +
  889 + public Double getRealMileage() {
  890 + return realMileage;
  891 + }
  892 +
  893 + public void setRealMileage(Double realMileage) {
  894 + this.realMileage = realMileage;
  895 + }
  896 +
  897 + public Double getJhlcOrig() {
  898 + return jhlcOrig;
  899 + }
  900 +
  901 + public void setJhlcOrig(Double jhlcOrig) {
  902 + this.jhlcOrig = jhlcOrig;
  903 + }
  904 +
  905 + public void reCalcLate() {
  906 + if(this.getStatus() == 0
  907 + && this.getFcsjActual() == null
  908 + && this.dfsjT < System.currentTimeMillis()){
  909 + this.setLate(true);
  910 + }
  911 + else
  912 + this.setLate(false);
  913 + }
  914 +
  915 + public String getRemark() {
  916 + return remark;
  917 + }
  918 +
  919 + public void setRemark(String remark) {
  920 + this.remark = remark;
  921 + }
  922 +
  923 + public float getLateMinute() {
  924 + return lateMinute;
  925 + }
  926 +
  927 + public void setLateMinute(float lateMinute) {
  928 + this.lateMinute = lateMinute;
  929 + }
  930 +
  931 + public boolean isLate2() {
  932 + return late2;
  933 + }
  934 +
  935 + public void setLate2(boolean late2) {
  936 + this.late2 = late2;
  937 + }
  938 +
  939 + public int getFcpSn() {
  940 + return fcpSn;
  941 + }
  942 +
  943 + public void setFcpSn(int fcpSn) {
  944 + this.fcpSn = fcpSn;
  945 + }
  946 +
  947 + public boolean _isInout(){
  948 + return this.getBcType().equals("out") || this.getBcType().equals("in");
  949 + }
  950 +
  951 + public boolean isDeleted() {
  952 + return deleted;
  953 + }
  954 +
  955 + public void setDeleted(boolean deleted) {
  956 + this.deleted = deleted;
  957 + }
  958 +
  959 + public int getSaveFailCount() {
  960 + return saveFailCount;
  961 + }
  962 +
  963 + public void setSaveFailCount(int saveFailCount) {
  964 + this.saveFailCount = saveFailCount;
  965 + }
  966 +
  967 + public int getSiginCompate() {
  968 + return siginCompate;
  969 + }
  970 +
  971 + public void setSiginCompate(int siginCompate) {
  972 + this.siginCompate = siginCompate;
  973 + }
  974 +
  975 + public Integer getDriftStatus() {
  976 + return driftStatus;
  977 + }
  978 +
  979 + public void setDriftStatus(Integer driftStatus) {
  980 + this.driftStatus = driftStatus;
  981 + }
  982 +
  983 + public boolean isCcService() {
  984 + return ccService;
  985 + }
  986 +
  987 + public void setCcService(boolean ccService) {
  988 + this.ccService = ccService;
  989 + }
  990 +
  991 + public String getMajorStationName() {
  992 + return majorStationName;
  993 + }
  994 +
  995 + public void setMajorStationName(String majorStationName) {
  996 + this.majorStationName = majorStationName;
  997 + }
  998 +
  999 + public int getRfidState() {
  1000 + return rfidState;
  1001 + }
  1002 +
  1003 + public void setRfidState(int rfidState) {
  1004 + this.rfidState = rfidState;
  1005 + }
  1006 +
  1007 + public int getFirstRfidState() {
  1008 + return firstRfidState;
  1009 + }
  1010 +
  1011 + public void setFirstRfidState(int firstRfidState) {
  1012 + this.firstRfidState = firstRfidState;
  1013 + }
  1014 +}
... ...
src/main/java/com/bsth/entity/sys/SysUser.java
... ... @@ -40,6 +40,8 @@ public class SysUser implements Serializable {
40 40  
41 41 private String status;
42 42  
  43 + private String ksstatus;
  44 +
43 45 @ManyToMany(fetch = FetchType.EAGER)
44 46 private Set<Role> roles = new LinkedHashSet<>();
45 47  
... ... @@ -123,4 +125,12 @@ public class SysUser implements Serializable {
123 125 public void setStatus(String status) {
124 126 this.status = status;
125 127 }
  128 +
  129 + public String getKsstatus() {
  130 + return ksstatus;
  131 + }
  132 +
  133 + public void setKsstatus(String ksstatus) {
  134 + this.ksstatus = ksstatus;
  135 + }
126 136 }
... ...
src/main/java/com/bsth/repository/StationRouteStRepository.java
... ... @@ -2,6 +2,7 @@ package com.bsth.repository;
2 2  
3 3 import com.bsth.entity.Line;
4 4 import com.bsth.entity.StationRoute;
  5 +import com.bsth.entity.StationRouteSt;
5 6 import org.springframework.data.domain.Page;
6 7 import org.springframework.data.domain.Pageable;
7 8 import org.springframework.data.domain.Sort;
... ... @@ -32,6 +33,10 @@ import java.util.Map;
32 33 */
33 34  
34 35 @Repository
35   -public interface StationRouteStRepository extends BaseRepository<StationRoute, Integer> {
  36 +public interface StationRouteStRepository extends BaseRepository<StationRouteSt, Integer> {
  37 +
  38 +
  39 + @Query("select r from StationRouteSt r where r.lineCode=?1 and r.destroy=0 order by r.stationRouteCode")
  40 + List<StationRouteSt> findByLine(String lineCode);
36 41  
37 42 }
... ...
src/main/java/com/bsth/repository/realcontrol/LineConfigStRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.realcontrol.LineConfig;
  5 +import com.bsth.entity.realcontrol.LineConfigSt;
  6 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +import com.bsth.repository.BaseRepository;
  8 +import org.springframework.data.domain.Page;
  9 +import org.springframework.data.domain.Pageable;
  10 +import org.springframework.data.jpa.domain.Specification;
  11 +import org.springframework.data.jpa.repository.EntityGraph;
  12 +import org.springframework.data.jpa.repository.Query;
  13 +import org.springframework.stereotype.Repository;
  14 +
  15 +import java.util.List;
  16 +
  17 +@Repository
  18 +public interface LineConfigStRepository extends BaseRepository<LineConfigSt, Integer>{
  19 +
  20 + @Query("SELECT L FROM LineConfigSt L")
  21 + List<LineConfigSt> findAll();
  22 +
  23 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -219,6 +219,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
219 219 @Override
220 220 List<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec);
221 221  
  222 +
222 223 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
223 224 @Override
224 225 List<ScheduleRealInfo> findAll();
... ... @@ -231,4 +232,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
231 232 @Query(value = "select count (s.id) from ScheduleRealInfo s where s.clZbh=?1 and s.scheduleDateStr=?2 and s.xlBm=?3 and s.qdzCode=?4")
232 233 Long isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);
233 234  
  235 +
  236 +
  237 + @Query(value="select s.xlBm as xlBm,s.clZbh as clZbh from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.xlBm in (?2) GROUP BY s.xlBm, s.clZbh")
  238 + List<Map<String, Object>> selectclZbhGroup(String date, String[] t);
  239 +
  240 +
234 241 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoStRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfoSt;
  5 +import com.bsth.repository.BaseRepository;
  6 +import org.springframework.data.domain.Page;
  7 +import org.springframework.data.domain.Pageable;
  8 +import org.springframework.data.jpa.domain.Specification;
  9 +import org.springframework.data.jpa.repository.EntityGraph;
  10 +import org.springframework.data.jpa.repository.Modifying;
  11 +import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.stereotype.Repository;
  13 +
  14 +import javax.transaction.Transactional;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +@Repository
  19 +public interface ScheduleRealInfoStRepository extends BaseRepository<ScheduleRealInfoSt, Long>{
  20 +
  21 + @Query("select s from ScheduleRealInfo s where s.xlBm in ?1")
  22 + List<ScheduleRealInfoSt> findByLines(List<String> lines);
  23 +
  24 +
  25 + @Query(value="select s from ScheduleRealInfoSt s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)")
  26 + List<ScheduleRealInfoSt> queryUserInfo(String line,String date);
  27 +}
... ...
src/main/java/com/bsth/repository/sys/SysUserRepository.java
... ... @@ -25,12 +25,28 @@ public interface SysUserRepository extends BaseRepository&lt;SysUser, Integer&gt;{
25 25 @Query(value="update bsth_c_sys_user set password=?2 where id=?1",nativeQuery=true)
26 26 int changePWD(int id,String newPWD);
27 27  
  28 +
  29 + @Transactional
  30 + @Modifying
  31 + @Query(value="update bsth_c_sys_user set ksstatus='1' where id=?1",nativeQuery=true)
  32 + int changeKsStatus(int id);
  33 +
  34 + @Transactional
  35 + @Modifying
  36 + @Query(value="update bsth_c_sys_user set ksstatus='0'",nativeQuery=true)
  37 + int changeKsStatusAll( );
  38 +
  39 +
28 40 @EntityGraph(value = "sysUser_role", type = EntityGraph.EntityGraphType.FETCH)
29 41 @Query(value = "select DISTINCT u from SysUser u")
30 42 List<SysUser> findAll_distinct();
31 43  
32 44  
33   - @Query("SELECT u FROM SysUser u where u.userName like 'ks%'")
34   - List<SysUser> findBySusUser( );
  45 + @Query("SELECT u FROM SysUser u where u.userName like %?1% and u.ksstatus = 0")
  46 + List<SysUser> findBySusUser(String t );
  47 +
  48 +
  49 + @Query("SELECT u FROM SysUser u where u.status is null")
  50 + List<SysUser> findBySusUserAll();
35 51  
36 52 }
... ...
src/main/java/com/bsth/service/ddexam/DdexamService.java
1 1 package com.bsth.service.ddexam;
2 2  
  3 +import com.bsth.entity.sys.SysUser;
  4 +
  5 +import java.io.IOException;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
3 9 public interface DdexamService {
4 10  
5   - public int initializationAll(Integer rs);
  11 + public Map initializationAll(Integer rs,Long userName);
  12 +
  13 + public Map initializationAll2(Long userName);
  14 +
  15 +
  16 + public int hftime();
  17 +
  18 + public int initDate(String date);
  19 +
  20 + public List<SysUser> userAll();
  21 +
6 22 }
... ...
src/main/java/com/bsth/service/ddexam/impl/DdexamServiceImpl.java
1 1 package com.bsth.service.ddexam.impl;
2 2  
3   -import com.bsth.entity.Line;
4   -import com.bsth.entity.LineInformation;
5   -import com.bsth.entity.LineInformationSt;
6   -import com.bsth.entity.LineSt;
  3 +import com.alibaba.dubbo.common.URL;
  4 +import com.bsth.data.BasicData;
  5 +import com.bsth.data.LineConfigData;
  6 +import com.bsth.data.schedule.DayOfSchedule;
  7 +import com.bsth.data.schedule.thread.ScheduleRefreshThread;
  8 +import com.bsth.entity.*;
  9 +import com.bsth.entity.realcontrol.LineConfig;
  10 +import com.bsth.entity.realcontrol.LineConfigSt;
  11 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfoSt;
7 13 import com.bsth.entity.sys.BsthCSysUserRoles;
8 14 import com.bsth.entity.sys.RealControAuthority;
9 15 import com.bsth.entity.sys.SysUser;
10   -import com.bsth.repository.LineInformationRepository;
11   -import com.bsth.repository.LineInformationStRepository;
12   -import com.bsth.repository.LineRepository;
13   -import com.bsth.repository.LineStRepository;
  16 +import com.bsth.repository.*;
  17 +import com.bsth.repository.realcontrol.LineConfigRepository;
  18 +import com.bsth.repository.realcontrol.LineConfigStRepository;
  19 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  20 +import com.bsth.repository.realcontrol.ScheduleRealInfoStRepository;
14 21 import com.bsth.repository.sys.BsthCSysUserRolesRepository;
15 22 import com.bsth.repository.sys.RealControAuthorityRepository;
16 23 import com.bsth.repository.sys.SysUserRepository;
17 24 import com.bsth.service.ddexam.DdexamService;
  25 +import com.bsth.util.ConfigUtil;
  26 +import org.junit.Test;
18 27 import org.slf4j.Logger;
19 28 import org.slf4j.LoggerFactory;
20 29 import org.springframework.beans.BeanUtils;
... ... @@ -23,8 +32,11 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
23 32 import org.springframework.stereotype.Service;
24 33 import org.springframework.transaction.annotation.Transactional;
25 34  
26   -import java.util.Date;
27   -import java.util.List;
  35 +import java.io.IOException;
  36 +import java.net.URLConnection;
  37 +import java.text.SimpleDateFormat;
  38 +import java.util.*;
  39 +
28 40  
29 41 @Service
30 42 public class DdexamServiceImpl implements DdexamService {
... ... @@ -44,54 +56,297 @@ public class DdexamServiceImpl implements DdexamService {
44 56 LineInformationStRepository LineInformationStRepository;
45 57 @Autowired
46 58 LineInformationRepository lineInformationRepository;
  59 + @Autowired
  60 + StationRouteStRepository stationRouteStRepository;
  61 + @Autowired
  62 + StationRouteRepository stationRouteRepository;
  63 + @Autowired
  64 + ScheduleRealInfoStRepository ScheduleRealInfoStRepository;
  65 + @Autowired
  66 + ScheduleRealInfoRepository ScheduleRealInfoRepository;
  67 + @Autowired
  68 + BasicData.BasicDataLoader basicDataLoader;
  69 + @Autowired
  70 + ScheduleRefreshThread scheduleRefreshThread;
  71 + @Autowired
  72 + DayOfSchedule dayOfSchedule;
  73 + @Autowired
  74 + LineConfigStRepository lineConfigStRepository;
  75 + @Autowired
  76 + LineConfigData lineConfigData;
  77 +
  78 +
  79 +
  80 + @Autowired
  81 + LineConfigRepository lineConfigRepository;
47 82  
48   - //考生人初始化
  83 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  84 + SimpleDateFormat sdfhms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  85 + public List<SysUser> userAll(){
  86 + return sysUserRepository.findBySusUserAll();
  87 + }
  88 +
49 89 @Override
50   - @Transactional //事务
51   - public int initializationAll(Integer rs) {
52   -
  90 + public int hftime(){
  91 + URLConnection url = null;
53 92 try {
54   - List<SysUser> userList = sysUserRepository.findBySusUser(); //已有的用户 不考虑用户角色表 正常情况下创建必分配
55   - if (userList.size() >= rs) { //满足考试人数 检查是否分配线路
56   - for (SysUser user : userList) {
57   - if (realControAuthorityRepository.findByUserId(user.getId()) == null) { //检查未分配线路
  93 + java.net.URL baseUrl;
  94 + baseUrl = com.bsth.webService.trafficManage.geotool.services.Internal.class.getResource(".");
  95 + url = new java.net.URL(baseUrl,
  96 + "http://time.tianqi.com/").openConnection();
58 97  
59   - }
  98 + url.connect(); //发出连接
  99 + long ld = url.getDate(); //取得网站日期时间
  100 + Date date = new Date(ld); //转换为标准时间对象
  101 + /* Calendar calendar = Calendar.getInstance();
  102 + calendar.setTime(date);
  103 + calendar.add(Calendar.YEAR, -1);//当前时间减去一年,即一年前的时间
  104 + //(时间校准网上快了一年,减去一年)*/
  105 + String data = sdfhms.format(date.getTime());
  106 + String[] lk = data.split(" ");
  107 + if(lk.length == 2){
  108 + Runtime.getRuntime().exec(ConfigUtil.get("jp.date") +" " +lk[0]);//Windows 系统
  109 + Runtime.getRuntime().exec(ConfigUtil.get("jp.time") +" " +lk[1]);//Windows 系统
  110 + }
  111 + } catch (IOException e) {
  112 + e.printStackTrace();
  113 + }
  114 + return 0;
  115 + }
  116 +
  117 +
  118 +
  119 + @Override
  120 + public int initDate(String date) {
  121 + try {
  122 + Runtime.getRuntime().exec(ConfigUtil.get("jp.time") +" " +date);//Windows 系统
  123 + }catch (Exception e){
  124 + log.error("修改系统时间失败",e);
  125 + }
  126 + return 1;
  127 + }
  128 +
  129 +
  130 +/* //考生人初始化 无线程
  131 + @Override
  132 + public Map initializationAll(Integer rs) {
  133 + Long start = System.currentTimeMillis();
  134 + Map m = new HashMap<>();
  135 + try { //用户当天分配完直接改状态 无二次分配的可能
  136 + List<SysUser> userList = sysUserRepository.findBySusUser(); //已有的用户 不考虑用户角色表 正常情况下创建必分配
  137 + if (userList.size() >= rs) { //满足考试人数 默认配置都是全的
  138 + for (int i = 0 ; i < rs ; i++ ){ //已rs人数为准
  139 + SysUser user = userList.get(i);
  140 + useryType(user);
  141 + sysUserRepository.changeKsStatus(user.getId()); ////状态 表示今日账户已用
60 142 }
  143 +
61 144 } else {
62 145 if (userList.size() == 0) { //考试人数 全部重新创建
63   -
  146 + if(usercreateType(rs)){
  147 + log.info("考试初始化创建成功");
  148 + }
64 149 } else { //已有的人检查分配线路 不够的创建
65   - for (SysUser user : userList) {
66   - if (realControAuthorityRepository.findByUserId(8) == null) { //检查未分配线路
67   -
68   - //未分配的创建线路并分配
69   - System.out.println("1");
  150 +
  151 + for (SysUser user : userList) { //已有的分配班次
  152 + if (realControAuthorityRepository.findByUserId(user.getId()) == null) { //检查未分配线路
70 153 } else { //已分配线路的分配班次
71 154 System.out.println("分配班次...");
  155 + sysUserRepository.changeKsStatus(user.getId()); ////状态 表示今日账户已用
  156 + useryType(user);
72 157 }
73 158 }
  159 +
74 160 int st = rs - userList.size(); //未创建考试人数
  161 + //未分配的创建线路并分配
75 162 if(usercreateType(st)){
76 163 log.info("考试初始化创建成功");
77   - }else{
78   - log.error("-------------1.模板线路大于6条"); //如果情况多了 可以switch
79   - return 0;
80 164 }
81 165  
  166 +
  167 +
82 168 }
83 169 }
84 170 }catch (Exception e){
85 171 log.error("-----考试初始化失败------",e);
86   - return 1;
  172 + m.put("code","创建失败");
  173 + return m;
87 174 }
88   - return 0;
  175 + //调用排班初始话功能
  176 + m.put("code","创建成功");
  177 + System.out.println("----------创建时间--------------"+(System.currentTimeMillis() - start));
  178 + dayOfSchedule.lineAll(); //查询所有线路
  179 + basicDataLoader.loadAllData(); //加载所有数据
  180 +
  181 + lineConfigData.lineAll();
  182 + scheduleRefreshThread.run();
  183 + System.out.println("-------------本次执行时间-----------"+(System.currentTimeMillis() - start));
  184 + return m;
  185 +
  186 + }
  187 + */
  188 + //考生人初始化 单线程 测试1:执行中途再次执行是否同步 测试2:
  189 + @Override
  190 + @Transactional //事务
  191 + public synchronized Map initializationAll(Integer rs,Long userName) {
  192 + Long start = System.currentTimeMillis();
  193 + Map m = new HashMap<>();
  194 + try { //用户当天分配完直接改状态 无二次分配的可能
  195 + List<SysUser> userList = sysUserRepository.findBySusUserAll(); //已有的用户 不考虑用户角色表 正常情况下创建必分配
  196 + Map suerMap = new HashMap();
  197 + for (SysUser s :userList){
  198 + if(Long.parseLong(s.getUserName()) == userName ){
  199 + m.put("code","创建失败 账号重复");
  200 + return m;
  201 + }
  202 + }
  203 +
  204 + new Thread() {
  205 + public synchronized void run() {
  206 + if(usercreateType(rs,userName)){
  207 + log.info("考试初始化创建成功");
  208 + kk();
  209 + }
  210 + }
  211 + }.start();
  212 +
  213 + }catch (Exception e){
  214 + log.error("-----考试初始化失败------",e);
  215 + m.put("code","创建失败");
  216 + return m;
  217 + }
  218 + //调用排班初始话功能
  219 + m.put("code","创建成功");
  220 + System.out.println("-------------本次执行时间-----------"+(System.currentTimeMillis() - start));
  221 + return m;
89 222  
  223 + }
  224 +
  225 +
  226 + public Map initializationAll2(Long userName){
  227 + Long start = System.currentTimeMillis();
  228 + Map m = new HashMap<>();
  229 + String t = String.valueOf(userName).substring(0,8);
90 230  
  231 + try { //用户当天分配完直接改状态 无二次分配的可能
  232 + List<SysUser> userList = sysUserRepository.findBySusUser(t); //已有的用户 不考虑用户角色表 正常情况下创建必分配
  233 + if (userList.size() > 0) {
  234 + //已有的人检查分配线路
  235 + new Thread() {
  236 + public synchronized void run() {
  237 + if (snt(userList)) {
  238 + kk();
  239 + }
  240 + }
  241 + }.start();
  242 + }
  243 + }catch (Exception e){
  244 + log.error("-----考试初始化失败------",e);
  245 + m.put("code","创建失败");
  246 + return m;
  247 + }
  248 + //调用排班初始话功能
  249 + m.put("code","初始化成功");
  250 + System.out.println("-------------本次执行时间-----------"+(System.currentTimeMillis() - start));
  251 + return m;
91 252  
92 253 }
  254 + /*public void aa(){
  255 + Long start = System.currentTimeMillis();
  256 + Map m = new HashMap<>();
  257 + try { //用户当天分配完直接改状态 无二次分配的可能
  258 + List<SysUser> userList = sysUserRepository.findBySusUser(); //已有的用户 不考虑用户角色表 正常情况下创建必分配
  259 + if (userList.size() >= rs) { //满足考试人数 默认配置都是全的
  260 + new Thread() {
  261 + public synchronized void run() {
  262 + if(snt(rs,userList,0)){
  263 + log.info("考试初始化创建成功");
  264 + kk();
  265 + }
  266 + }
  267 + }.start();
  268 + } else {
  269 + if (userList.size() == 0) { //考试人数 全部重新创建
  270 + new Thread() {
  271 + public synchronized void run() {
  272 + if(usercreateType(rs)){
  273 + log.info("考试初始化创建成功");
  274 + kk();
  275 + }
  276 + }
  277 + }.start();
  278 +
  279 + } else { //已有的人检查分配线路 不够的创建
  280 +
  281 + new Thread() {
  282 + public synchronized void run() {
  283 + if(snt(rs,userList,1)){
  284 + kk();
  285 + }
  286 + }
  287 + }.start();
  288 +
  289 + int st = rs - userList.size(); //未创建考试人数
  290 + //* //未分配的创建线路并分配
  291 + if(usercreateType(st)){ //暂无问题
  292 + log.info("考试初始化创建成功");
  293 + kk();
  294 + }//*
  295 + new Thread() {
  296 + public synchronized void run() {
  297 + if(usercreateType(st)){
  298 + log.info("考试初始化创建成功");
  299 + kk();
  300 + }
  301 + }
  302 + }.start();
  303 +
  304 + }
  305 + }
  306 + }catch (Exception e){
  307 + log.error("-----考试初始化失败------",e);
  308 + m.put("code","创建失败");
  309 + return m;
  310 + }
  311 + //调用排班初始话功能
  312 + m.put("code","创建成功");
  313 + System.out.println("-------------本次执行时间-----------"+(System.currentTimeMillis() - start));
  314 + return m;
  315 + }
  316 + */
  317 + public void kk(){
  318 + basicDataLoader.loadAllData(); //加载所有数据
  319 + dayOfSchedule.lineAll(); //查询所有线路
  320 + lineConfigData.lineAll();
  321 + scheduleRefreshThread.run();
  322 + }
  323 + //已创建好的用户分配排班
  324 +
  325 + public Boolean snt(List<SysUser> userList){
  326 + for (int i = 0 ; i < userList.size() ; i++ ){ //已rs人数为准
  327 + SysUser user = userList.get(i);
  328 + if (realControAuthorityRepository.findByUserId(user.getId()) != null) {
  329 + useryType(user);
  330 + System.out.println("分配班次...");
  331 + sysUserRepository.changeKsStatus(user.getId()); ////状态 表示今日账户已用
  332 + }
  333 + }
  334 + return true;
  335 + }
  336 +
  337 +
  338 + public Boolean useryType(SysUser user){
  339 + RealControAuthority hoit = realControAuthorityRepository.findByUserId(user.getId());
  340 + String[] st = hoit.getLineCodeStr().split(",");
  341 + for (int k = 0 ; k < st.length ; k++){
  342 + Line l = lineRepository.findById(Integer.parseInt(st[k])).get();
  343 + inforealType(l);
  344 + }
  345 + return true;
  346 + }
  347 +
93 348 //创建考试人数 并分配线路信息
94   - public Boolean usercreateType(int st){
  349 + public Boolean usercreateType(int st,Long userName){
95 350 int usernum = sysUserRepository.findAll_distinct().size();
96 351 SysUser user = new SysUser();//总人数
97 352 for (int i = 0; i < st; i++) { //创建考试人数
... ... @@ -99,26 +354,27 @@ public class DdexamServiceImpl implements DdexamService {
99 354 user = new SysUser();
100 355 user.setCreateDate(new Date());
101 356 user.setEnabled(true);
102   - user.setName("ks00"+username);
103   - user.setPassword(new BCryptPasswordEncoder(4).encode("Aa123456"));
104   - user.setUserName("ks00"+username);
105   - // sysUserRepository.save(user);添加 -------**--
106   - user.setId(2); //------暂用
  357 + user.setName(String.valueOf(userName + i));
  358 + user.setPassword(new BCryptPasswordEncoder(4).encode("123456"));
  359 + user.setUserName(String.valueOf(userName + i));
  360 + user.setKsstatus("1"); //状态 表示今日账户已用
  361 + sysUserRepository.save(user); //添加 -------**--
  362 +
107 363 BsthCSysUserRoles userRoles = new BsthCSysUserRoles();
108 364 userRoles.setUsers(user.getId());
109 365 userRoles.setRoles(73); //统一用73考生
110   - // bsthCSysUserRolesRepository.save(userRoles);添加 -------**--
111   -
112   - //List<LineSt> lineStList = lineStRepository.findStAll();//所有模板线路
  366 + bsthCSysUserRolesRepository.save(userRoles); //添加 -------**--
  367 + List<LineConfigSt> lineConfigList = lineConfigStRepository.findAll(); //线调 线路相关配置信息
113 368 Integer linebumber = lineRepository.findAll().size(); //线路数量 线路code
114 369 String [] mtline = {"A线","B线","C线","D线","E线","F线"}; //对应模板6条线 换成线路name
115 370 List<LineInformationSt> litst = (List<LineInformationSt>) LineInformationStRepository.findAll(); //所有模板线路标准和线路
116 371 if(litst.size() != 6){
117 372 return false;
118 373 }
119   - for(int j = 0 ; j <= litst.size() ; j++){
120   - LineSt linest = litst.get(j).getLine();
121   - LineInformationSt Limst = litst.get(j);
  374 + String lineCodeStr = "";
  375 + for(int j = 0 ; j < litst.size() ; j++){ //6个 <6
  376 + LineSt linest = litst.get(j).getLine(); //旧line
  377 + LineInformationSt Limst = litst.get(j);
122 378 Line line = new Line();
123 379 BeanUtils.copyProperties(linest,line); //copy
124 380 Integer linecodeId = linebumber++ ;
... ... @@ -127,20 +383,64 @@ public class DdexamServiceImpl implements DdexamService {
127 383 line.setName(mtline[j]+"+"+user.getName());
128 384 line.setCoLineCode(linest.getLineCode());
129 385 lineRepository.save(line); //线路添加
  386 + //----------------线路--------------------------//
130 387 LineInformation lifat = new LineInformation(); //线路标准
131 388 BeanUtils.copyProperties(Limst,lifat);
132 389 lifat.setLine(line);
133 390 lineInformationRepository.save(lifat); //线路标准信息条件
134   - inforealType(linest.getLineCode());
  391 + //-------------------线路标准-----------------------//
  392 + for(LineConfigSt cfgt : lineConfigList){
  393 + if(cfgt.getLine().getLineCode().equals(linest.getLineCode())){
  394 + LineConfig config = new LineConfig();
  395 + BeanUtils.copyProperties(cfgt,config); //copy
  396 + config.setLine(line);
  397 + lineConfigRepository.save(config);
  398 + }
  399 + }
  400 + //-------------------线调 线路相关配置信息-----------------------//
  401 +
  402 + List<StationRouteSt> srstList = stationRouteStRepository.findByLine(linest.getLineCode());
  403 + List<StationRoute> srstListAll = new ArrayList<>();
  404 + for(StationRouteSt route : srstList){
  405 + StationRoute srt = new StationRoute();
  406 + BeanUtils.copyProperties(route,srt); //copy
  407 + srt.setLine(line);
  408 + srt.setLineCode(linecodeId.toString());
  409 + srstListAll.add(srt);
  410 + }
  411 + stationRouteRepository.saveAll(srstListAll);//添加站点
  412 + //-------------------站点-----------------------//
  413 + lineCodeStr += linecodeId.toString()+","; //线调线路
  414 + inforealType(line);
135 415 }
  416 + RealControAuthority raty = new RealControAuthority();
  417 + raty.setUserId(user.getId());
  418 + raty.setLineCodeStr(lineCodeStr);
  419 + raty.setPattern(1); //可用
  420 + realControAuthorityRepository.save(raty);
  421 + //-------------------分配本次线调权限-----------------------//
136 422 }
137 423 return true;
138   -
139 424 }
140 425  
141   -
142   - public void inforealType(String lineCode){
143   -
  426 + //添加排班
  427 + public void inforealType(Line line){
  428 + //用旧线路code查出模板排班表
  429 + List<ScheduleRealInfoSt> sristList = ScheduleRealInfoStRepository.queryUserInfo(line.getCoLineCode(),"2021-11-18");//模板固定日期
  430 + List<ScheduleRealInfo> sriList = new ArrayList<>();
  431 + for(ScheduleRealInfoSt st : sristList){
  432 + ScheduleRealInfo sri = new ScheduleRealInfo();
  433 + BeanUtils.copyProperties(st,sri); //copy
  434 + sri.setScheduleDate(new Date());
  435 + sri.setScheduleDateStr(sdf.format(new Date()));
  436 + sri.setXlBm(line.getLineCode());
  437 + sri.setXlName(line.getName());
  438 + sriList.add(sri);
  439 + }
  440 + ScheduleRealInfoRepository.saveAll(sriList);
144 441 }
145   -
  442 +
  443 +
  444 +
  445 +
146 446 }
... ...
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
... ... @@ -87,6 +87,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
87 87 return -1;
88 88 }
89 89  
  90 +/*
90 91 if (null == d60)
91 92 return -1;
92 93  
... ... @@ -95,12 +96,13 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
95 96 if (null != sender)
96 97 d60.setSender(sender);
97 98 d60.setHttpCode(code);
  99 +*/
98 100  
99   - if (code != 0)
  101 + /* if (code != 0)
100 102 d60.setErrorText("网关通讯失败, code: " + code);
101   -
  103 +*/
102 104 dayOfDirectives.put60(d60);
103   - return code;
  105 + return 0;
104 106 }
105 107  
106 108 @Override
... ... @@ -272,13 +274,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
272 274  
273 275 public D60 create60Data(String nbbm, String text, Short dispatchInstruct, ScheduleRealInfo sch) {
274 276  
275   - String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  277 + // String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
276 278 String lineCode = null;
277   - if (null == deviceId) {
  279 + /* if (null == deviceId) {
278 280 logger.error("没有设备号对照的车辆:" + nbbm);
279 281 return null;
280   - }
  282 + }*/
281 283 // 根据当前GPS确定 上下行和营运状态
  284 + String deviceId = "111";
282 285 Byte upDown = null;
283 286 Integer state = null;
284 287 if (null == sch) {
... ... @@ -390,7 +393,6 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
390 393 //调度指令
391 394 Collection<D60> dptArray = dayOfDirectives.all60();
392 395 for (D60 d60 : dptArray) {
393   - if (d60.isDispatch())
394 396 list.add(d60);
395 397 }
396 398 break;
... ... @@ -433,7 +435,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl&lt;D60, Integer&gt; implemen
433 435  
434 436 for(Directive d : list){
435 437 d.setTimeHHmm(fmtHHmm.print(d.getTimestamp()));
436   - d.setNbbm(BasicData.deviceId2NbbmMap.get(d.getDeviceId()));
  438 + d.setNbbm(d.getDeviceId());
437 439 }
438 440  
439 441 int count = list.size();
... ...
src/main/java/com/bsth/service/forms/CommonService.java 0 → 100644
  1 +package com.bsth.service.forms;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +
  5 +import java.util.Map;
  6 +
  7 +@Service
  8 +public interface CommonService{
  9 +
  10 + Map<String,Object> findKMBC1(String jName,String clZbh, String date,String enddate);
  11 +
  12 + Map<String,Object> findKMBC2(String jName,String clZbh,String date);
  13 +}
... ...
src/main/java/com/bsth/service/forms/ExportService.java 0 → 100644
  1 +package com.bsth.service.forms;
  2 +
  3 +import com.bsth.entity.mcy_forms.*;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface ExportService {
  8 +
  9 + public void waybillday(String date, String linaName, List<Waybillday> resList);
  10 +
  11 + public void linepasswengerflow(String date,List<Linepasswengerflow> resList);
  12 +
  13 + public void shifday(String date, List<Shifday> resList);
  14 +
  15 + public void shiftuehiclemanth(String startDate, String endDate, String lpName,
  16 + List<Shiftuehiclemanth> resList);
  17 +
  18 + public void singledata(String startDate, String endDate, String lpName, List<Singledata> resList);
  19 +
  20 + public void vehicleloading(String date, List<Vehicleloading> resList);
  21 +
  22 + public void operationservice(String startDate, String endDate, String lpName,
  23 + List<Operationservice> resList);
  24 +
  25 +
  26 +
  27 +}
... ...
src/main/java/com/bsth/service/forms/FormsService.java 0 → 100644
  1 +package com.bsth.service.forms;
  2 +
  3 +import com.bsth.entity.mcy_forms.*;
  4 +
  5 +import java.util.List;
  6 +import java.util.Map;
  7 +
  8 +
  9 +public interface FormsService {
  10 +
  11 + public List<Waybillday> waybillday(Map<String, Object> map);
  12 +
  13 + public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map);
  14 +
  15 + public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map);
  16 + public List<Shiftuehiclemanth> shiftuehiclemanth2(Map<String, Object> map);
  17 +
  18 + public List<Changetochange> changetochange(Map<String, Object> map);
  19 +
  20 + public List<Shifday> shifday(Map<String, Object> map);
  21 +
  22 + public List<Singledata> singledata(Map<String, Object> map);
  23 + public List<Singledata> singledata2(Map<String, Object> map);
  24 +
  25 + public List<Singledata> singledatanew(Map<String, Object> map);
  26 + public List<Singledata> singledatatj(Map<String, Object> map);
  27 + public List<Singledata> singledatatj2(Map<String, Object> map);
  28 +
  29 +
  30 + public List<Vehicleloading> vehicleloading(String line,String data);
  31 +
  32 + public List<Operationservice> operationservice(Map<String, Object> map);
  33 +
  34 + public List<Map<String, Object>> turnoutrate(Map<String, Object> map);
  35 +
  36 + public List<Executionrate> executionrate(Map<String, Object> map);
  37 +
  38 + public List<Allline> allline(Map<String, Object> map);
  39 +
  40 + public List<Daily> daily(Map<String, Object> map);
  41 +}
... ...
src/main/java/com/bsth/service/forms/impl/CommonServiceImpl.java 0 → 100644
  1 +package com.bsth.service.forms.impl;
  2 +
  3 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  6 +import com.bsth.service.forms.CommonService;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.text.DecimalFormat;
  11 +import java.util.*;
  12 +
  13 +@Service
  14 +public class CommonServiceImpl implements CommonService{
  15 +
  16 +
  17 + @Autowired
  18 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  19 +
  20 + @Override
  21 + public Map<String, Object> findKMBC1(String jName, String clZbh,
  22 + String date, String enddate) {
  23 +
  24 + String sql=" select s from s "
  25 + + " where s.j_gh ='" + jName + "' and s.cl_zbh ='" + clZbh + "' and "
  26 + + " to_days(s.schedule_date) BETWEEN to_days('" + date + "') and to_days('" + enddate + "')"
  27 + + " order by bcs";
  28 +
  29 +
  30 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
  31 + DecimalFormat format = new DecimalFormat("0.00");
  32 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  33 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  34 + int jhbc = 0,cjbc = 0,ljbc = 0;
  35 + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
  36 + float addMileage = 0l,remMileage = 0l;
  37 + Map<String,Object> map = new HashMap<String, Object>();
  38 + for(ScheduleRealInfo scheduleRealInfo : list){
  39 + if(scheduleRealInfo != null){
  40 + //计划里程(主任务过滤掉临加班次),
  41 + //烂班里程(主任务烂班),
  42 + //临加里程(主任务临加),
  43 + //计划班次,烂班班次,增加班次
  44 + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  45 + if(scheduleRealInfo.isSflj()){
  46 + addMileage += tempJhlc;
  47 + ljbc++;
  48 + }else{
  49 + jhlc += tempJhlc;
  50 + jhbc++;
  51 + if(scheduleRealInfo.getStatus() == -1){
  52 + remMileage += tempJhlc;
  53 + cjbc++;
  54 + }
  55 + }
  56 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  57 + //计算营运里程,空驶里程
  58 + if(childTaskPlans.isEmpty()){
  59 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  60 + || scheduleRealInfo.getBcType().equals("venting")){
  61 + ksgl += tempJhlc;
  62 + }else{
  63 + yygl += tempJhlc;
  64 + }
  65 + }else{
  66 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  67 + while(it.hasNext()){
  68 + ChildTaskPlan childTaskPlan = it.next();
  69 + if(childTaskPlan.getMileageType().equals("empty")){
  70 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  71 + }else{
  72 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  73 + }
  74 + }
  75 + }
  76 + }
  77 + }
  78 + map.put("jhlc", format.format(jhlc));
  79 + map.put("remMileage", format.format(remMileage));
  80 + map.put("addMileage", format.format(addMileage));
  81 + map.put("yygl", format.format(yygl));
  82 + map.put("ksgl", format.format(ksgl));
  83 + map.put("realMileage", format.format(yygl+ksgl));
  84 + map.put("jhbc", jhbc);
  85 + map.put("cjbc", cjbc);
  86 + map.put("ljbc", ljbc);
  87 + map.put("sjbc", jhbc-cjbc+ljbc);
  88 + return map;
  89 + }
  90 +
  91 +
  92 + @Override
  93 + public Map<String, Object> findKMBC2(String jName, String clZbh,String date) {
  94 +
  95 + String sql=" select s from bsth_c_s_sp_info_real s "
  96 + + " where s.j_gh ='" + jName + "' and s.cl_zbh ='" + clZbh + "' and "
  97 + + " to_days(s.schedule_date) =to_days('" + date + "')"
  98 + + " order by bcs";
  99 +
  100 +
  101 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date,"","");
  102 +
  103 + DecimalFormat format = new DecimalFormat("0.00");
  104 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  105 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  106 + int jhbc = 0,cjbc = 0,ljbc = 0;
  107 + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
  108 + float addMileage = 0l,remMileage = 0l;
  109 + String j_Name="";
  110 + Map<String,Object> map = new HashMap<String, Object>();
  111 + for(ScheduleRealInfo scheduleRealInfo : list){
  112 + if(scheduleRealInfo != null){
  113 + j_Name=scheduleRealInfo.getjName();
  114 + //计划里程(主任务过滤掉临加班次),
  115 + //烂班里程(主任务烂班),
  116 + //临加里程(主任务临加),
  117 + //计划班次,烂班班次,增加班次
  118 + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  119 + if(scheduleRealInfo.isSflj()){
  120 + addMileage += tempJhlc;
  121 + ljbc++;
  122 + }else{
  123 + jhlc += tempJhlc;
  124 + jhbc++;
  125 + if(scheduleRealInfo.getStatus() == -1){
  126 + remMileage += tempJhlc;
  127 + cjbc++;
  128 + }
  129 + }
  130 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  131 + //计算营运里程,空驶里程
  132 + if(childTaskPlans.isEmpty()){
  133 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  134 + || scheduleRealInfo.getBcType().equals("venting")){
  135 + ksgl += tempJhlc;
  136 + }else{
  137 + yygl += tempJhlc;
  138 + }
  139 + }else{
  140 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  141 + while(it.hasNext()){
  142 + ChildTaskPlan childTaskPlan = it.next();
  143 + if(childTaskPlan.getMileageType().equals("empty")){
  144 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  145 + }else{
  146 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  147 + }
  148 + }
  149 + }
  150 + }
  151 + }
  152 + map.put("j_name", j_Name);
  153 + map.put("jhlc", format.format(jhlc));
  154 + map.put("remMileage", format.format(remMileage));
  155 + map.put("addMileage", format.format(addMileage));
  156 + map.put("yygl", format.format(yygl));
  157 + map.put("ksgl", format.format(ksgl));
  158 + map.put("realMileage", format.format(yygl+ksgl));
  159 + map.put("jhbc", jhbc);
  160 + map.put("cjbc", cjbc);
  161 + map.put("ljbc", ljbc);
  162 + map.put("sjbc", jhbc-cjbc+ljbc);
  163 + return map;
  164 + }
  165 +
  166 +
  167 +
  168 +
  169 +}
... ...
src/main/java/com/bsth/service/forms/impl/ExportServiceImpl.java 0 → 100644
  1 +package com.bsth.service.forms.impl;
  2 +
  3 +import com.bsth.entity.mcy_forms.*;
  4 +import com.bsth.service.forms.ExportService;
  5 +import com.bsth.util.ReportUtils;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.*;
  10 +
  11 +@Service
  12 +public class ExportServiceImpl implements ExportService{
  13 +
  14 +
  15 + //行车路单日报表
  16 + @Override
  17 + public void waybillday(String date, String lineName, List<Waybillday> list) {
  18 +
  19 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  20 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  21 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  22 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  23 + Map<String,Object> map = new HashMap<String, Object>();
  24 + ReportUtils ee = new ReportUtils();
  25 +
  26 + for(Waybillday w : list){
  27 + Map<String, Object> m = new HashMap<String, Object>();
  28 + m.put("carPlate", w.getNbbm());
  29 + m.put("jzl1", w.getJzl1());
  30 + m.put("jzl", w.getJzl());
  31 + m.put("yh", w.getYh());
  32 + m.put("sh", w.getSh());
  33 + m.put("jName", w.getjName());
  34 + m.put("zlc", w.getZlc());
  35 + m.put("jy", "");
  36 + resList.add(m);
  37 + }
  38 +
  39 + try {
  40 + listI.add(resList.iterator());
  41 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  42 + ee.excelReplace(listI, new Object[] { map }, path+"mould/waybillday.xls",
  43 + path+"export/"+sdfSimple.format(sdfMonth.parse(date))
  44 + +"-"+lineName+"-行车路单日报表.xls");
  45 + } catch (Exception e) {
  46 + e.printStackTrace();
  47 + }
  48 + }
  49 +
  50 + //线路客流量报表
  51 + @Override
  52 + public void linepasswengerflow(String date, List<Linepasswengerflow> list) {
  53 +
  54 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  55 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  56 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  57 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  58 + Map<String,Object> map = new HashMap<String, Object>();
  59 + ReportUtils ee = new ReportUtils();
  60 + for(Linepasswengerflow l : list){
  61 + Map<String, Object> m = new HashMap<String, Object>();
  62 + m.put("stationName", l.getStationName());
  63 + resList.add(m);
  64 + }
  65 +
  66 + try {
  67 + listI.add(resList.iterator());
  68 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  69 + ee.excelReplace(listI, new Object[] { map }, path+"mould/linepasswengerflow.xls",
  70 + path+"export/线路客流量报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  71 + } catch (Exception e) {
  72 + e.printStackTrace();
  73 + }
  74 +
  75 + }
  76 +
  77 +
  78 + //班次车辆人员日统计
  79 + @Override
  80 + public void shifday(String date,List<Shifday> list) {
  81 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  82 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  83 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  84 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  85 + Map<String,Object> map = new HashMap<String, Object>();
  86 + ReportUtils ee = new ReportUtils();
  87 +
  88 + for(Shifday l : list){
  89 + Map<String, Object> m = new HashMap<String, Object>();
  90 + m.put("jName",l.getjName());
  91 + m.put("sName", l.getsName());
  92 + m.put("lpName", l.getLpName());
  93 + m.put("carPlate", l.getCarPlate());
  94 + m.put("jhlc", l.getJhlc());
  95 + m.put("sjjhlc", l.getSjjhlc());
  96 + m.put("yygl", l.getYygl());
  97 + m.put("emptMileage", l.getEmptMileage());
  98 + m.put("remMileage", l.getRemMileage());
  99 + m.put("addMileage", l.getAddMileage());
  100 + m.put("totalm", l.getTotalm());
  101 + m.put("jhbc", l.getJhbc());
  102 + m.put("sjjhbc", l.getSjjhbc());
  103 + m.put("cjbc", l.getCjbc());
  104 + m.put("ljbc", l.getLjbc());
  105 + m.put("sjbc", l.getSjbc());
  106 + resList.add(m);
  107 + }
  108 +
  109 + try {
  110 + listI.add(resList.iterator());
  111 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  112 + ee.excelReplace(listI, new Object[] { map }, path+"mould/shifday.xls",
  113 + path+"export/班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  114 + } catch (Exception e) {
  115 + e.printStackTrace();
  116 + }
  117 +
  118 + }
  119 +
  120 + //班次车辆人员月统计
  121 + @Override
  122 + public void shiftuehiclemanth(String startDate,String endDate,String lpName, List<Shiftuehiclemanth> list) {
  123 +
  124 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  125 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  126 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  127 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  128 + Map<String,Object> map = new HashMap<String, Object>();
  129 + ReportUtils ee = new ReportUtils();
  130 +
  131 + for(Shiftuehiclemanth l : list){
  132 + Map<String, Object> m = new HashMap<String, Object>();
  133 + m.put("jName",l.getjName() );
  134 + m.put("jhlc", l.getJhlc());
  135 + m.put("emptMileage",l.getEmptMileage() );
  136 + m.put("remMileage", l.getRemMileage());
  137 + m.put("addMileage", l.getAddMileage());
  138 + m.put("totalm", l.getTotalm());
  139 + m.put("cjbc", l.getCjbc());
  140 + m.put("ljbc", l.getLjbc());
  141 + m.put("sjbc", l.getSjbc());
  142 + resList.add(m);
  143 + }
  144 +
  145 + try {
  146 + listI.add(resList.iterator());
  147 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  148 + ee.excelReplace(listI, new Object[] { map }, path+"mould/shiftuehiclemanth.xls",
  149 + path+"export/班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(startDate)) + ".xls");
  150 + } catch (Exception e) {
  151 + e.printStackTrace();
  152 + }
  153 +
  154 + }
  155 +
  156 + //路单报表
  157 + @Override
  158 + public void singledata(String startDate,String endDate,String lpName, List<Singledata> list) {
  159 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  160 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  161 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  162 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  163 + Map<String,Object> map = new HashMap<String, Object>();
  164 + ReportUtils ee = new ReportUtils();
  165 +
  166 + for(Singledata l : list){
  167 + Map<String, Object> m = new HashMap<String, Object>();
  168 + m.put("rQ",l.getrQ());
  169 + m.put("gS", l.getgS());
  170 + m.put("xL",l.getxL() );
  171 + m.put("clzbh", l.getClzbh());
  172 + m.put("jsy", l.getJsy());
  173 + m.put("jName", l.getjName());
  174 + m.put("sgh", l.getSgh());
  175 + m.put("sName", l.getsName());
  176 + m.put("jhlc", l.getJhlc());
  177 + m.put("emptMileage", l.getEmptMileage());
  178 + m.put("hyl", l.getHyl());
  179 + m.put("jzl", l.getJzl());
  180 + m.put("unyyyl",l.getUnyyyl());
  181 + m.put("jhjl", l.getJhjl());
  182 + resList.add(m);
  183 + }
  184 +
  185 + try {
  186 + listI.add(resList.iterator());
  187 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  188 + ee.excelReplace(listI, new Object[] { map }, path+"mould/singledata.xls",
  189 + path+"export/路单日报表" + sdfSimple.format(sdfMonth.parse(startDate)) + ".xls");
  190 + } catch (Exception e) {
  191 + e.printStackTrace();
  192 + }
  193 +
  194 +
  195 + }
  196 +
  197 +
  198 + //车辆加注
  199 + @Override
  200 + public void vehicleloading(String date, List<Vehicleloading> list) {
  201 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  202 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  203 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  204 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  205 + Map<String,Object> map = new HashMap<String, Object>();
  206 + ReportUtils ee = new ReportUtils();
  207 +
  208 + for(Vehicleloading l : list){
  209 + Map<String, Object> m = new HashMap<String, Object>();
  210 + m.put("rQ", l.getrQ());
  211 + m.put("gS", l.getgS());
  212 + m.put("xL", l.getxL());
  213 + m.put("clzbh", l.getClzbh());
  214 + m.put("hyl", l.getHyl());
  215 + m.put("jzl", l.getJzl());
  216 + m.put("ls", l.getLs());
  217 + m.put("jhlc", l.getJhlc());
  218 + m.put("unyyyl", l.getUnyyyl());
  219 + m.put("jhbc", l.getJhbc());
  220 + m.put("sjbc", l.getSjbc());
  221 + resList.add(m);
  222 + }
  223 +
  224 + try {
  225 + listI.add(resList.iterator());
  226 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  227 + ee.excelReplace(listI, new Object[] { map }, path+"mould/vehicleloading.xls",
  228 + path+"export/车辆加注" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  229 + } catch (Exception e) {
  230 + e.printStackTrace();
  231 + }
  232 + }
  233 +
  234 + //运营服务阶段报表
  235 + @Override
  236 + public void operationservice(String startDate,String endDate,String lpName,List<Operationservice> list) {
  237 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  238 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  239 +
  240 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  241 + Map<String,Object> map = new HashMap<String, Object>();
  242 + ReportUtils ee = new ReportUtils();
  243 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  244 + for(Operationservice l : list){
  245 + Map<String, Object> m = new HashMap<String, Object>();
  246 + m.put("xlName", l.getXlName());
  247 + m.put("jzl", l.getJzl());
  248 + m.put("xhl", l.getXhl());
  249 + m.put("xsgl", l.getXsgl());
  250 + m.put("emptMileage", l.getEmptMileage());
  251 + m.put("sjbc", l.getSjbc());
  252 + resList.add(m);
  253 + }
  254 +
  255 + try {
  256 + listI.add(resList.iterator());
  257 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  258 + ee.excelReplace(listI, new Object[] { map }, path+"mould/operationservice.xls",
  259 + path+"export/运营服务阶段报表" + sdfSimple.format(sdfMonth.parse(startDate)) + ".xls");
  260 + } catch (Exception e) {
  261 + e.printStackTrace();
  262 + }
  263 + }
  264 +
  265 +
  266 +
  267 +}
... ...