Commit 560e374749a9156415c7dc55d57cff0bc9cba88d

Authored by 徐烜
2 parents 8bf95921 1c3d2f85

Merge branch 'pudong_test' of 192.168.168.201:panzhaov5/bsth_control into pudong_test

Showing 55 changed files with 3396 additions and 402 deletions

Too many changes to show.

To preserve performance only 55 of 67 files are displayed.

src/main/java/com/bsth/controller/LineController.java
@@ -81,6 +81,10 @@ public class LineController extends BaseController<Line, Integer> { @@ -81,6 +81,10 @@ public class LineController extends BaseController<Line, Integer> {
81 map.put("status", ResponseCode.ERROR); 81 map.put("status", ResponseCode.ERROR);
82 return map; 82 return map;
83 } 83 }
  84 + if(t.getDestroy() == 0){
  85 + t.setInUse(1);
  86 + } else
  87 + t.setInUse(0);
84 // 添加线路版本 88 // 添加线路版本
85 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 89 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
86 try { 90 try {
src/main/java/com/bsth/controller/calc/CalcIntervalController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import com.bsth.controller.BaseController;
  12 +import com.bsth.entity.calc.CalcInterval;
  13 +import com.bsth.service.calc.CalcIntervalService;
  14 +
  15 +@RestController
  16 +@RequestMapping("calcInterval")
  17 +public class CalcIntervalController extends BaseController<CalcInterval,Integer>{
  18 + @Autowired
  19 + CalcIntervalService calcIntervalService;
  20 + @RequestMapping(value="/countList")
  21 + public List<Map<String,Object>> countList(@RequestParam Map<String, Object> map){
  22 + List<Map<String, Object>> list=calcIntervalService.countList(map);
  23 + return list;
  24 + }
  25 +
  26 + @RequestMapping(value="/listInterval")
  27 + public List<Map<String, Object>> listInterval(@RequestParam Map<String, Object> map){
  28 + List<Map<String, Object>>list=calcIntervalService.listInterval(map);
  29 + return list;
  30 + }
  31 +
  32 + @RequestMapping(value="/interval")
  33 + public List<Map<String,Object>> interval(@RequestParam Map<String, Object> map){
  34 + List<Map<String,Object>> list=calcIntervalService.interval(map);
  35 + return list;
  36 + }
  37 +
  38 +
  39 +}
src/main/java/com/bsth/controller/jdtest/JdTestController.java
@@ -40,7 +40,7 @@ public class JdTestController extends BaseController&lt;Ylb, Integer&gt;{ @@ -40,7 +40,7 @@ public class JdTestController extends BaseController&lt;Ylb, Integer&gt;{
40 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 40 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
41 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 41 sdfSimple = new SimpleDateFormat("yyyyMMdd");
42 Map<String, Object> dMap=new HashMap<>(); 42 Map<String, Object> dMap=new HashMap<>();
43 - dMap.put("dGroup", "oilType"); 43 + dMap.put("dGroup_eq", "oilType");
44 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); 44 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator();
45 while (it.hasNext()) { 45 while (it.hasNext()) {
46 Dictionary d=it.next(); 46 Dictionary d=it.next();
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -249,7 +249,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -249,7 +249,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
249 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 249 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
250 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 250 sdfSimple = new SimpleDateFormat("yyyyMMdd");
251 Map<String, Object> dMap=new HashMap<>(); 251 Map<String, Object> dMap=new HashMap<>();
252 - dMap.put("dGroup", "oilType"); 252 + dMap.put("dGroup_eq", "oilType");
253 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); 253 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator();
254 while (it.hasNext()) { 254 while (it.hasNext()) {
255 Dictionary d=it.next(); 255 Dictionary d=it.next();
src/main/java/com/bsth/controller/realcontrol/ReportRegisterController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.data.report_register.ReportRegisterService;
  8 +import com.bsth.data.report_register.entity.ReportRegister;
  9 +import com.bsth.util.HttpClientUtils;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.beans.propertyeditors.CustomDateEditor;
  14 +import org.springframework.web.bind.WebDataBinder;
  15 +import org.springframework.web.bind.annotation.InitBinder;
  16 +import org.springframework.web.bind.annotation.PathVariable;
  17 +import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RequestMethod;
  19 +import org.springframework.web.bind.annotation.RequestParam;
  20 +import org.springframework.web.bind.annotation.RestController;
  21 +import org.springframework.web.context.request.WebRequest;
  22 +
  23 +import java.text.DateFormat;
  24 +import java.text.SimpleDateFormat;
  25 +import java.util.Date;
  26 +import java.util.HashMap;
  27 +import java.util.Map;
  28 +
  29 +/**
  30 + * 报备登记
  31 + * Created by yrf on 2019/12/04.
  32 + */
  33 +@RestController
  34 +@RequestMapping("reportRegister")
  35 +public class ReportRegisterController extends BaseController<ReportRegister, Long>{
  36 +
  37 + Logger log = LoggerFactory.getLogger(this.getClass());
  38 +
  39 + final static String url = "http://114.80.178.13/complaint/TsReport/input.do";
  40 +// final static String url = "http://192.168.168.228:8080/complaint/TsReport/input.do";
  41 +
  42 + @Autowired
  43 + ReportRegisterService reportRegisterService;
  44 +
  45 + @InitBinder
  46 + public void initBinder(WebDataBinder binder, WebRequest request) {
  47 + //转换日期 注意这里的转化要和传进来的字符串的格式一直 如2015-9-9 就应该为yyyy-MM-dd
  48 + DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  49 + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));// CustomDateEditor为自定义日期编辑器
  50 + }
  51 +
  52 +
  53 + @RequestMapping(value = "/findList", method = RequestMethod.GET)
  54 + public Map<String, Object> findList(@RequestParam Map<String, String> map) {
  55 + return reportRegisterService.findList(map);
  56 + }
  57 +
  58 + @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  59 + public ReportRegister findById(@PathVariable("id") Long id) {
  60 + ReportRegister reportRegister = reportRegisterService.findById(id);
  61 + return reportRegister;
  62 + }
  63 +
  64 + @RequestMapping(value = "/delete", method = RequestMethod.POST)
  65 + public Map<String, Object> deleteInfo(ReportRegister t) {
  66 + Map<String, Object> map = new HashMap<>();
  67 + try{
  68 +// map = baseService.delete(id);
  69 + reportRegisterService.deleteInfo(t);
  70 + String data = "{ID:'"+t.getID()+"', STATUS:'2'}";
  71 + StringBuilder sb = HttpClientUtils.post(url,data);
  72 + JSONObject obj = JSON.parseObject(sb.toString());
  73 + map.put("status2", obj);
  74 + } catch (Exception e) {
  75 + log.error(e.toString(), e);
  76 + }
  77 + return map;
  78 + }
  79 +
  80 +
  81 + @RequestMapping(method = RequestMethod.POST)
  82 + public Map<String, Object> save(ReportRegister t) {
  83 + Map<String, Object> map = new HashMap<>();
  84 + try{
  85 + reportRegisterService.save(t);
  86 + map.put("status", ResponseCode.SUCCESS);
  87 + map.put("t", t);
  88 + StringBuilder sb = HttpClientUtils.post(url,t.toString());
  89 + JSONObject obj = JSON.parseObject(sb.toString());
  90 + map.put("status2", obj);
  91 + } catch (Exception e) {
  92 + log.error(e.toString(), e);
  93 + }
  94 + return map;
  95 + }
  96 +}
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
1 package com.bsth.controller.realcontrol; 1 package com.bsth.controller.realcontrol;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
  4 +import java.util.Arrays;
4 import java.util.Collection; 5 import java.util.Collection;
5 import java.util.HashMap; 6 import java.util.HashMap;
6 import java.util.List; 7 import java.util.List;
@@ -134,9 +135,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -134,9 +135,8 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
134 * @throws 135 * @throws
135 */ 136 */
136 @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) 137 @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST)
137 - public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual,  
138 - @RequestParam String remarks) {  
139 - return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); 138 + public Map<String, Object> realOutAdjust(@RequestParam Map<String, String> map) {
  139 + return scheduleRealInfoService.realOutAdjust(map);
140 } 140 }
141 141
142 /** 142 /**
@@ -723,4 +723,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -723,4 +723,9 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
723 public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){ 723 public List<RepairReport> repairReportList(@RequestParam String line, @RequestParam String date, @RequestParam String code, @RequestParam String type){
724 return scheduleRealInfoService.repairReportList(line, date, code, type); 724 return scheduleRealInfoService.repairReportList(line, date, code, type);
725 } 725 }
  726 +
  727 + @RequestMapping(value = "lineLevel", method = RequestMethod.GET)
  728 + public Map<String, String> lineLevel(@RequestParam String idx){
  729 + return scheduleRealInfoService.getLevelsByLines(Arrays.asList(idx.split(",")));
  730 + }
726 } 731 }
src/main/java/com/bsth/controller/report/CalcSheetController.java
@@ -29,6 +29,14 @@ public class CalcSheetController extends BaseController&lt;CalcSheet, Integer&gt;{ @@ -29,6 +29,14 @@ public class CalcSheetController extends BaseController&lt;CalcSheet, Integer&gt;{
29 List<CalcSheet> list=calcSheetService.calcListSheet(map); 29 List<CalcSheet> list=calcSheetService.calcListSheet(map);
30 return list; 30 return list;
31 } 31 }
  32 +
  33 + //D级别线路发车到站准点率列表
  34 + @RequestMapping(value = "/calcListSheet_d",method = RequestMethod.GET)
  35 + public List<CalcSheet> calcListSheet_d(@RequestParam Map<String, Object> map){
  36 + List<CalcSheet> list=calcSheetService.calcListSheet_d(map);
  37 + return list;
  38 + }
  39 +
32 //发车站点准点率详细 40 //发车站点准点率详细
33 @RequestMapping(value = "/calcSheet",method = RequestMethod.GET) 41 @RequestMapping(value = "/calcSheet",method = RequestMethod.GET)
34 public List<Sheet> calcSheet(@RequestParam Map<String, Object> map){ 42 public List<Sheet> calcSheet(@RequestParam Map<String, Object> map){
src/main/java/com/bsth/controller/sys/UserController.java
@@ -118,6 +118,7 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -118,6 +118,7 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
118 118
119 captchaMap.remove(userName); 119 captchaMap.remove(userName);
120 rs.put("status", ResponseCode.SUCCESS); 120 rs.put("status", ResponseCode.SUCCESS);
  121 + logger.error("用户:" + user.getUserName() + "登录");
121 } catch (Exception e) { 122 } catch (Exception e) {
122 logger.error("", e); 123 logger.error("", e);
123 rs.put("msg", "服务器出现异常,请联系管理员"); 124 rs.put("msg", "服务器出现异常,请联系管理员");
src/main/java/com/bsth/data/BasicData.java
1 package com.bsth.data; 1 package com.bsth.data;
2 2
3 -import com.bsth.data.gpsdata_v2.cache.GeoCacheData;  
4 -import com.bsth.data.pinyin.PersionPinYinBuffer;  
5 -import com.bsth.entity.*;  
6 -import com.bsth.entity.schedule.CarConfigInfo;  
7 -import com.bsth.repository.*;  
8 -import com.bsth.repository.schedule.CarConfigInfoRepository;  
9 -import com.google.common.collect.BiMap;  
10 -import com.google.common.collect.HashBiMap; 3 +import java.text.DateFormat;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
  6 +import java.util.Calendar;
  7 +import java.util.Date;
  8 +import java.util.HashMap;
  9 +import java.util.Iterator;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
11 import org.apache.commons.lang3.StringUtils; 13 import org.apache.commons.lang3.StringUtils;
12 import org.slf4j.Logger; 14 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 15 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Component; 17 import org.springframework.stereotype.Component;
16 18
17 -import java.util.*; 19 +import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
  20 +import com.bsth.data.pinyin.PersionPinYinBuffer;
  21 +import com.bsth.entity.Business;
  22 +import com.bsth.entity.CarPark;
  23 +import com.bsth.entity.Cars;
  24 +import com.bsth.entity.Line;
  25 +import com.bsth.entity.Personnel;
  26 +import com.bsth.entity.StationRoute;
  27 +import com.bsth.entity.calc.CalcInterval;
  28 +import com.bsth.entity.schedule.CarConfigInfo;
  29 +import com.bsth.repository.BusinessRepository;
  30 +import com.bsth.repository.CarParkRepository;
  31 +import com.bsth.repository.CarsRepository;
  32 +import com.bsth.repository.LineRepository;
  33 +import com.bsth.repository.PersonnelRepository;
  34 +import com.bsth.repository.StationRepository;
  35 +import com.bsth.repository.StationRouteRepository;
  36 +import com.bsth.repository.calc.CalcIntervalRepository;
  37 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  38 +import com.google.common.collect.BiMap;
  39 +import com.google.common.collect.HashBiMap;
18 40
19 /** 41 /**
20 * @author PanZhao 42 * @author PanZhao
@@ -77,6 +99,8 @@ public class BasicData { @@ -77,6 +99,8 @@ public class BasicData {
77 //站点名和运管处编号 对照 99 //站点名和运管处编号 对照
78 public static Map<String, Integer> stationName2YgcNumber; 100 public static Map<String, Integer> stationName2YgcNumber;
79 101
  102 + // 线路编码_日期 等级
  103 + public static Map<String, String> lineDate2Level;
80 104
81 static Logger logger = LoggerFactory.getLogger(BasicData.class); 105 static Logger logger = LoggerFactory.getLogger(BasicData.class);
82 106
@@ -132,7 +156,9 @@ public class BasicData { @@ -132,7 +156,9 @@ public class BasicData {
132 156
133 @Autowired 157 @Autowired
134 PersionPinYinBuffer persionPinYinBuffer; 158 PersionPinYinBuffer persionPinYinBuffer;
135 - 159 +
  160 + @Autowired
  161 + CalcIntervalRepository calcIntervalRepository;
136 162
137 @Override 163 @Override
138 public void run() { 164 public void run() {
@@ -158,7 +184,9 @@ public class BasicData { @@ -158,7 +184,9 @@ public class BasicData {
158 loadPersonnelInfo(); 184 loadPersonnelInfo();
159 //公司信息 185 //公司信息
160 loadBusinessInfo(); 186 loadBusinessInfo();
161 - 187 + // 线路等级信息
  188 + loadLineLevel();
  189 +
162 logger.info("load geo cache..,"); 190 logger.info("load geo cache..,");
163 geoCacheData.loadData(); 191 geoCacheData.loadData();
164 station2ParkBuffer.saveAll(); 192 station2ParkBuffer.saveAll();
@@ -365,5 +393,30 @@ public class BasicData { @@ -365,5 +393,30 @@ public class BasicData {
365 //人员拼音转换 393 //人员拼音转换
366 persionPinYinBuffer.refresh(); 394 persionPinYinBuffer.refresh();
367 } 395 }
  396 +
  397 + /**
  398 + * 加载线路级别信息 按当前日期取(当前+前后一天)的数据
  399 + */
  400 + public void loadLineLevel() {
  401 + List<String> dates = new ArrayList<>();
  402 + Map<String, String> result = new HashMap<>();
  403 + DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  404 +
  405 + Calendar c = Calendar.getInstance();
  406 + c.setTime(new Date(System.currentTimeMillis() - 86400000));
  407 + dates.add(df.format(c.getTime()));
  408 +
  409 + for (int i = 0;i < 2;i++) {
  410 + c.add(Calendar.DATE, 1);
  411 + dates.add(df.format(c.getTime()));
  412 + }
  413 +
  414 + List<CalcInterval> l = calcIntervalRepository.selectByDates(dates);
  415 + for (CalcInterval ci : l) {
  416 + result.put(ci.getXlBm() + "_" + ci.getDate(), ci.getLevel());
  417 + }
  418 +
  419 + lineDate2Level = result;
  420 + }
368 } 421 }
369 } 422 }
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
@@ -78,7 +78,7 @@ public class DataHandleProcess { @@ -78,7 +78,7 @@ public class DataHandleProcess {
78 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); 78 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
79 count = new CountDownLatch(ks.size()); 79 count = new CountDownLatch(ks.size());
80 80
81 - logger.info(JSON.toJSONString(ks)); 81 + //logger.info(JSON.toJSONString(ks));
82 for (Integer index : ks) { 82 for (Integer index : ks) {
83 threadPool.execute(new SignalHandleThread(dataListMap.get(index), count)); 83 threadPool.execute(new SignalHandleThread(dataListMap.get(index), count));
84 } 84 }
src/main/java/com/bsth/data/gpsdata_v2/load/GatewayHttpLoader.java
@@ -64,6 +64,7 @@ public class GatewayHttpLoader implements ApplicationContextAware{ @@ -64,6 +64,7 @@ public class GatewayHttpLoader implements ApplicationContextAware{
64 response = httpClient.execute(get); 64 response = httpClient.execute(get);
65 entity = response.getEntity(); 65 entity = response.getEntity();
66 66
  67 + logger.info("entity:" + entity + "get:" + get);
67 if(null == entity) 68 if(null == entity)
68 return list; 69 return list;
69 70
@@ -74,6 +75,7 @@ public class GatewayHttpLoader implements ApplicationContextAware{ @@ -74,6 +75,7 @@ public class GatewayHttpLoader implements ApplicationContextAware{
74 while ((str = br.readLine()) != null) 75 while ((str = br.readLine()) != null)
75 sb.append(str); 76 sb.append(str);
76 77
  78 + logger.info("gps:" + sb.toString());
77 list = JSON.parseArray(JSON.parseObject(sb.toString()).getString("data"), GpsEntity.class); 79 list = JSON.parseArray(JSON.parseObject(sb.toString()).getString("data"), GpsEntity.class);
78 //过滤掉无效的点位 80 //过滤掉无效的点位
79 list = GpsDataUtils.clearInvalid(list); 81 list = GpsDataUtils.clearInvalid(list);
src/main/java/com/bsth/data/report_register/ReportRegisterService.java 0 → 100644
  1 +package com.bsth.data.report_register;
  2 +
  3 +import com.bsth.data.report_register.entity.ReportRegister;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.util.Map;
  7 +
  8 +public interface ReportRegisterService extends BaseService<ReportRegister, Long>{
  9 +
  10 + Map<String, Object> findList(Map<String, String> map);
  11 +
  12 + Map<String, Object> deleteInfo( ReportRegister t);
  13 +}
src/main/java/com/bsth/data/report_register/ReportRegisterServiceImpl.java 0 → 100644
  1 +package com.bsth.data.report_register;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.data.report_register.entity.ReportRegister;
  5 +import com.bsth.service.impl.BaseServiceImpl;
  6 +import com.bsth.util.ReportUtils;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.dao.DataIntegrityViolationException;
  11 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import java.text.SimpleDateFormat;
  16 +import java.util.ArrayList;
  17 +import java.util.Date;
  18 +import java.util.HashMap;
  19 +import java.util.Iterator;
  20 +import java.util.List;
  21 +import java.util.Map;
  22 +
  23 +@Service
  24 +public class ReportRegisterServiceImpl extends BaseServiceImpl<ReportRegister, Long> implements ReportRegisterService{
  25 +
  26 + Logger log = LoggerFactory.getLogger(this.getClass());
  27 +
  28 + @Autowired
  29 + JdbcTemplate jdbcTemplate;
  30 +
  31 + @Override
  32 + public Map<String, Object> findList(Map<String, String> map) {
  33 + Map<String, Object> rs = new HashMap();
  34 + try {
  35 +
  36 + String lineCodes = map.get("lineCodes") == null ? "" : map.get("lineCodes").toString();
  37 + String lineName = map.get("lineName") == null ? "" : map.get("lineName").toString();
  38 + String type = map.get("type") == null ? "" : map.get("type").toString();
  39 + String date1 = "",date2 = "";
  40 + String isFindDelete = "";
  41 + if(type!=null && (type.equals("query") || type.equals("export"))){
  42 + // 导出是不要删除的
  43 + if(type.equals("export"))
  44 + isFindDelete = " and STATUS !=2 ";
  45 + date1 = map.get("date1") == null ? "" : map.get("date1").toString()+" 00:00:00";
  46 + date2 = map.get("date2") == null ? "" : map.get("date2").toString()+" 23:59:59";
  47 + } else {
  48 + Date startDate = new Date();
  49 + startDate.setHours(0);
  50 + startDate.setMinutes(0);
  51 + startDate.setSeconds(0);
  52 + Date endDate = new Date();
  53 + endDate.setHours(23);
  54 + endDate.setMinutes(59);
  55 + endDate.setSeconds(59);
  56 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  57 + date1 = sdf.format(startDate);
  58 + date2 = sdf.format(endDate);
  59 + }
  60 + String sql = "select * from bsth_t_report where REPORT_DATE >=\""+date1+"\" and REPORT_DATE <= \""+date2+"\" and REPORT_XL in("+lineCodes+") " + isFindDelete;
  61 + List<ReportRegister> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ReportRegister.class));
  62 +
  63 + if(type!=null && type.equals("export")){
  64 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  65 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  66 + String dateTime = "";
  67 + try {
  68 + String dateStr1 = sdfSimple.format(sdfMonth.parse(date1));
  69 + String dateStr2 = sdfSimple.format(sdfMonth.parse(date2));
  70 + if (dateStr1.equals(dateStr2)) {
  71 + dateTime = dateStr1;
  72 + } else {
  73 + dateTime = dateStr1 + "-" + dateStr2;
  74 + }
  75 + } catch (Exception e) {
  76 + // TODO: handle exception
  77 + e.printStackTrace();
  78 + }
  79 + List<List<Iterator<?>>> lists = new ArrayList<>();
  80 + List<Iterator<?>> list1 = new ArrayList<>();
  81 + List<Iterator<?>> list2 = new ArrayList<>();
  82 + List<Iterator<?>> list3 = new ArrayList<>();
  83 + List<Iterator<?>> list4 = new ArrayList<>();
  84 + List<Iterator<?>> list5 = new ArrayList<>();
  85 + List<Iterator<?>> list6 = new ArrayList<>();
  86 + List<Map<String, Object>> resList1 = new ArrayList<Map<String, Object>>();
  87 + List<Map<String, Object>> resList2 = new ArrayList<Map<String, Object>>();
  88 + List<Map<String, Object>> resList3 = new ArrayList<Map<String, Object>>();
  89 + List<Map<String, Object>> resList4 = new ArrayList<Map<String, Object>>();
  90 + List<Map<String, Object>> resList5 = new ArrayList<Map<String, Object>>();
  91 + List<Map<String, Object>> resList6 = new ArrayList<Map<String, Object>>();
  92 + int i1 =0,i2 =0,i3 =0,i4 =0,i5 =0,i6 =0;
  93 + ReportUtils ee = new ReportUtils();
  94 + for (ReportRegister l : list) {
  95 + Map<String, Object> m = new HashMap<String, Object>();
  96 + String report_type = l.getREPORT_TYPE();
  97 + m.put("REPORT_DATE", l.getREPORT_DATE());
  98 + m.put("REPORT_TYPE", report_type);
  99 + m.put("REPORT_GSNAME", l.getREPORT_GSNAME());
  100 + m.put("REPORT_FGSNAME", l.getREPORT_FGSNAME());
  101 + m.put("REPORT_BBR", l.getREPORT_BBR());
  102 + m.put("REPORT_XL", l.getREPORT_XL());
  103 + m.put("REPORT_XLNAME", l.getREPORT_XLNAME());
  104 + m.put("REPORT_STATION", l.getREPORT_STATION());
  105 + m.put("REPORT_DWSBBM", l.getREPORT_DWSBBM());
  106 + m.put("REPORT_DWSBSJ", l.getREPORT_DWSBSJ());
  107 + m.put("REPORT_YWSJ", l.getREPORT_YWSJ());
  108 + m.put("REPORT_SMBWD", l.getREPORT_SMBWD());
  109 + m.put("REPORT_DJGSJ", l.getREPORT_DJGSJ());
  110 + m.put("REPORT_DJGYY", l.getREPORT_DJGYY());
  111 + m.put("REPORT_TFSJ", l.getREPORT_TFSJ());
  112 + m.put("REPORT_YXSJ", l.getREPORT_YXSJ());
  113 + m.put("REPORT_YXBC", l.getREPORT_YXBC());
  114 + m.put("REPORT_TZCS", l.getREPORT_TZCS());
  115 + m.put("REPORT_SGBH", l.getREPORT_SGBH());
  116 + m.put("REPORT_ZBH", l.getREPORT_ZBH());
  117 + m.put("REPORT_PZH", l.getREPORT_PZH());
  118 + m.put("REPORT_JSY", l.getREPORT_JSY());
  119 + m.put("REPORT_SGSJ", l.getREPORT_SGSJ());
  120 + m.put("REPORT_SGDD", l.getREPORT_SGDD());
  121 + m.put("REPORT_XSFX", l.getREPORT_XSFX());
  122 + m.put("REPORT_SGDX", l.getREPORT_SGDX());
  123 + m.put("REPORT_DXPZH", l.getREPORT_DXPZH());
  124 + m.put("REPORT_SGGK", l.getREPORT_SGGK());
  125 + m.put("REPORT_SSRS", l.getREPORT_SSRS());
  126 + m.put("REPORT_SWRS", l.getREPORT_SWRS());
  127 + m.put("REPORT_BGR", l.getREPORT_BGR());
  128 + m.put("REPORT_BGRDH", l.getREPORT_BGRDH());
  129 + m.put("REPORT_BZ", l.getREPORT_BZ());
  130 + m.put("REPORT_ROAD", l.getREPORT_ROAD());
  131 + if(report_type.equals("1")){
  132 + i1++;
  133 + m.put("i", i1);
  134 + resList1.add(m);
  135 + }else if(report_type.equals("2")){
  136 + i2++;
  137 + m.put("i", i2);
  138 + resList2.add(m);
  139 + }else if(report_type.equals("3")){
  140 + i3++;
  141 + m.put("i", i3);
  142 + resList3.add(m);
  143 + }else if(report_type.equals("4")){
  144 + i4++;
  145 + m.put("i", i4);
  146 + resList4.add(m);
  147 + } else if(report_type.equals("5")){
  148 + i5++;
  149 + m.put("i", i5);
  150 + resList5.add(m);
  151 + }else if(report_type.equals("6")){
  152 + i6++;
  153 + m.put("i", i6);
  154 + resList6.add(m);
  155 + }
  156 + }
  157 + try {
  158 + list1.add(resList1.iterator());
  159 + lists.add(list1);
  160 + list2.add(resList2.iterator());
  161 + lists.add(list2);
  162 + list3.add(resList3.iterator());
  163 + lists.add(list3);
  164 + list4.add(resList4.iterator());
  165 + lists.add(list4);
  166 + list5.add(resList5.iterator());
  167 + lists.add(list5);
  168 + list6.add(resList6.iterator());
  169 + lists.add(list6);
  170 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  171 + ee.excelMoreSheetReplace(lists, new Object[]{map}, path + "mould/report_register.xls",
  172 + path + "export/" + dateTime +"_"+lineName+ "_报备登记.xls");
  173 + } catch (Exception e) {
  174 + // TODO: handle exception
  175 + e.printStackTrace();
  176 + }
  177 + }
  178 + rs.put("status", ResponseCode.SUCCESS);
  179 + rs.put("list", list);
  180 + }
  181 +// catch (ParseException e) {
  182 +// e.printStackTrace();
  183 +// }
  184 + catch (Exception e){
  185 + log.error("", e);
  186 + rs.put("status", ResponseCode.ERROR);
  187 + rs.put("msg", e.getMessage());
  188 + }
  189 + return rs;
  190 + }
  191 +
  192 + @Override
  193 + public Map<String, Object> deleteInfo(ReportRegister rr) {
  194 + Map<String, Object> map = new HashMap<>();
  195 + try{
  196 + Long id = rr.getID();
  197 + String bbr = rr.getREPORT_BBR();
  198 +
  199 + jdbcTemplate.update("UPDATE bsth_t_report SET STATUS = 2,REPORT_BBR = ? WHERE ID = ? ",bbr,id);
  200 + map.put("status", ResponseCode.SUCCESS);
  201 + }catch(DataIntegrityViolationException de){
  202 + map.put("status", ResponseCode.ERROR);
  203 + map.put("msg", "“完整性约束”校验失败,请检查要删除的对象是否存在外键约束");
  204 + }
  205 + return map;
  206 + }
  207 +}
src/main/java/com/bsth/data/report_register/entity/ReportRegister.java 0 → 100644
  1 +package com.bsth.data.report_register.entity;
  2 +
  3 +import javax.persistence.Column;
  4 +import javax.persistence.Entity;
  5 +import javax.persistence.GeneratedValue;
  6 +import javax.persistence.Id;
  7 +import javax.persistence.Table;
  8 +import java.text.DateFormat;
  9 +import java.text.SimpleDateFormat;
  10 +import java.util.Date;
  11 +
  12 +
  13 +@Entity
  14 +@Table(name = "bsth_t_report")
  15 +public class ReportRegister {
  16 +
  17 + @Id
  18 + @GeneratedValue
  19 + private long ID;
  20 +
  21 + /** 类型*/
  22 + private String REPORT_TYPE;
  23 + /** 公司 */
  24 + private String REPORT_GS;
  25 + /** 分公司 */
  26 + private String REPORT_FGS;
  27 + /** 公司名 */
  28 + private String REPORT_GSNAME;
  29 + /** 分公司名 */
  30 + private String REPORT_FGSNAME;
  31 + /** 时间*/
  32 + private Date REPORT_DATE;
  33 + /** 报备人*/
  34 + private String REPORT_BBR;
  35 + /** 线路编码 */
  36 + private String REPORT_XL;
  37 + /** 线路名*/
  38 + private String REPORT_XLNAME;
  39 + /** 站点*/
  40 + private String REPORT_STATION;
  41 + /** 对外上报部门*/
  42 + private String REPORT_DWSBBM;
  43 + /** 对外上报时间*/
  44 + private String REPORT_DWSBSJ;
  45 + /** 延误时间*/
  46 + private String REPORT_YWSJ;
  47 + /** 首末班误点原因*/
  48 + private String REPORT_SMBWD;
  49 + /** 大间隔时间*/
  50 + private String REPORT_DJGSJ;
  51 + /** 大间隔原因*/
  52 + private String REPORT_DJGYY;
  53 + /** 突发事件*/
  54 + private String REPORT_TFSJ;
  55 + /** 影响时间*/
  56 + private String REPORT_YXSJ;
  57 + /** 影响班次数*/
  58 + private String REPORT_YXBC;
  59 + /** 调整措施*/
  60 + private String REPORT_TZCS;
  61 + /** 报案事故编号*/
  62 + private String REPORT_SGBH;
  63 + /** 车辆自编号*/
  64 + private String REPORT_ZBH;
  65 + /** 车辆牌照号*/
  66 + private String REPORT_PZH;
  67 + /** 驾驶员*/
  68 + private String REPORT_JSY;
  69 + /** 事故发生时间*/
  70 + private String REPORT_SGSJ;
  71 + /** 事故发生地点*/
  72 + private String REPORT_SGDD;
  73 + /** 行驶方向*/
  74 + private String REPORT_XSFX;
  75 + /** 事故对象*/
  76 + private String REPORT_SGDX;
  77 + /** 对象车牌照号*/
  78 + private String REPORT_DXPZH;
  79 + /** 事故概况*/
  80 + private String REPORT_SGGK;
  81 + /** 受伤人数*/
  82 + private String REPORT_SSRS;
  83 + /** 死亡人数*/
  84 + private String REPORT_SWRS;
  85 + /** 报告人 */
  86 + private String REPORT_BGR;
  87 + /** 报告人电话 */
  88 + private String REPORT_BGRDH;
  89 + /** 备注 */
  90 + private String REPORT_BZ;
  91 + /** 路段*/
  92 + private String REPORT_ROAD;
  93 + /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */
  94 + private String STATUS;
  95 + /** 创建人*/
  96 + private String CREATE_BY;
  97 + /** 创建时间 */
  98 + @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  99 + private Date CREATE_DATE;
  100 + /** 修改人*/
  101 + private String UPDATE_BY;
  102 + /** 修改时间*/
  103 + @Column(name = "UPDATE_DATE", columnDefinition = "UPDATE_DATE DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  104 + private Date UPDATE_DATE;
  105 +
  106 + public long getID() {
  107 + return ID;
  108 + }
  109 +
  110 + public void setID(long ID) {
  111 + this.ID = ID;
  112 + }
  113 +
  114 + public String getREPORT_TYPE() {
  115 + return REPORT_TYPE;
  116 + }
  117 +
  118 + public void setREPORT_TYPE(String REPORT_TYPE) {
  119 + this.REPORT_TYPE = REPORT_TYPE;
  120 + }
  121 +
  122 + public String getREPORT_GS() {
  123 + return REPORT_GS;
  124 + }
  125 +
  126 + public void setREPORT_GS(String REPORT_GS) {
  127 + this.REPORT_GS = REPORT_GS;
  128 + }
  129 +
  130 + public String getREPORT_FGS() {
  131 + return REPORT_FGS;
  132 + }
  133 +
  134 + public void setREPORT_FGS(String REPORT_FGS) {
  135 + this.REPORT_FGS = REPORT_FGS;
  136 + }
  137 +
  138 + public String getREPORT_GSNAME() {
  139 + return REPORT_GSNAME;
  140 + }
  141 +
  142 + public void setREPORT_GSNAME(String REPORT_GSNAME) {
  143 + this.REPORT_GSNAME = REPORT_GSNAME;
  144 + }
  145 +
  146 + public String getREPORT_FGSNAME() {
  147 + return REPORT_FGSNAME;
  148 + }
  149 +
  150 + public void setREPORT_FGSNAME(String REPORT_FGSNAME) {
  151 + this.REPORT_FGSNAME = REPORT_FGSNAME;
  152 + }
  153 +
  154 + public Date getREPORT_DATE() {
  155 + return REPORT_DATE;
  156 + }
  157 +
  158 + public void setREPORT_DATE(Date REPORT_DATE) {
  159 + this.REPORT_DATE = REPORT_DATE;
  160 + }
  161 +
  162 + public String getREPORT_BBR() {
  163 + return REPORT_BBR;
  164 + }
  165 +
  166 + public void setREPORT_BBR(String REPORT_BBR) {
  167 + this.REPORT_BBR = REPORT_BBR;
  168 + }
  169 +
  170 + public String getREPORT_XL() {
  171 + return REPORT_XL;
  172 + }
  173 +
  174 + public void setREPORT_XL(String REPORT_XL) {
  175 + this.REPORT_XL = REPORT_XL;
  176 + }
  177 +
  178 + public String getREPORT_XLNAME() {
  179 + return REPORT_XLNAME;
  180 + }
  181 +
  182 + public void setREPORT_XLNAME(String REPORT_XLNAME) {
  183 + this.REPORT_XLNAME = REPORT_XLNAME;
  184 + }
  185 +
  186 + public String getREPORT_STATION() {
  187 + return REPORT_STATION;
  188 + }
  189 +
  190 + public void setREPORT_STATION(String REPORT_STATION) {
  191 + this.REPORT_STATION = REPORT_STATION;
  192 + }
  193 +
  194 + public String getREPORT_DWSBBM() {
  195 + return REPORT_DWSBBM;
  196 + }
  197 +
  198 + public void setREPORT_DWSBBM(String REPORT_DWSBBM) {
  199 + this.REPORT_DWSBBM = REPORT_DWSBBM;
  200 + }
  201 +
  202 + public String getREPORT_DWSBSJ() {
  203 + return REPORT_DWSBSJ;
  204 + }
  205 +
  206 + public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) {
  207 + this.REPORT_DWSBSJ = REPORT_DWSBSJ;
  208 + }
  209 +
  210 + public String getREPORT_YWSJ() {
  211 + return REPORT_YWSJ;
  212 + }
  213 +
  214 + public void setREPORT_YWSJ(String REPORT_YWSJ) {
  215 + this.REPORT_YWSJ = REPORT_YWSJ;
  216 + }
  217 +
  218 + public String getREPORT_SMBWD() {
  219 + return REPORT_SMBWD;
  220 + }
  221 +
  222 + public void setREPORT_SMBWD(String REPORT_SMBWD) {
  223 + this.REPORT_SMBWD = REPORT_SMBWD;
  224 + }
  225 +
  226 + public String getREPORT_DJGSJ() {
  227 + return REPORT_DJGSJ;
  228 + }
  229 +
  230 + public void setREPORT_DJGSJ(String REPORT_DJGSJ) {
  231 + this.REPORT_DJGSJ = REPORT_DJGSJ;
  232 + }
  233 +
  234 + public String getREPORT_DJGYY() {
  235 + return REPORT_DJGYY;
  236 + }
  237 +
  238 + public void setREPORT_DJGYY(String REPORT_DJGYY) {
  239 + this.REPORT_DJGYY = REPORT_DJGYY;
  240 + }
  241 +
  242 + public String getREPORT_TFSJ() {
  243 + return REPORT_TFSJ;
  244 + }
  245 +
  246 + public void setREPORT_TFSJ(String REPORT_TFSJ) {
  247 + this.REPORT_TFSJ = REPORT_TFSJ;
  248 + }
  249 +
  250 + public String getREPORT_YXSJ() {
  251 + return REPORT_YXSJ;
  252 + }
  253 +
  254 + public void setREPORT_YXSJ(String REPORT_YXSJ) {
  255 + this.REPORT_YXSJ = REPORT_YXSJ;
  256 + }
  257 +
  258 + public String getREPORT_YXBC() {
  259 + return REPORT_YXBC;
  260 + }
  261 +
  262 + public void setREPORT_YXBC(String REPORT_YXBC) {
  263 + this.REPORT_YXBC = REPORT_YXBC;
  264 + }
  265 +
  266 + public String getREPORT_TZCS() {
  267 + return REPORT_TZCS;
  268 + }
  269 +
  270 + public void setREPORT_TZCS(String REPORT_TZCS) {
  271 + this.REPORT_TZCS = REPORT_TZCS;
  272 + }
  273 +
  274 + public String getREPORT_SGBH() {
  275 + return REPORT_SGBH;
  276 + }
  277 +
  278 + public void setREPORT_SGBH(String REPORT_SGBH) {
  279 + this.REPORT_SGBH = REPORT_SGBH;
  280 + }
  281 +
  282 + public String getREPORT_ZBH() {
  283 + return REPORT_ZBH;
  284 + }
  285 +
  286 + public void setREPORT_ZBH(String REPORT_ZBH) {
  287 + this.REPORT_ZBH = REPORT_ZBH;
  288 + }
  289 +
  290 + public String getREPORT_PZH() {
  291 + return REPORT_PZH;
  292 + }
  293 +
  294 + public void setREPORT_PZH(String REPORT_PZH) {
  295 + this.REPORT_PZH = REPORT_PZH;
  296 + }
  297 +
  298 + public String getREPORT_JSY() {
  299 + return REPORT_JSY;
  300 + }
  301 +
  302 + public void setREPORT_JSY(String REPORT_JSY) {
  303 + this.REPORT_JSY = REPORT_JSY;
  304 + }
  305 +
  306 + public String getREPORT_SGSJ() {
  307 + return REPORT_SGSJ;
  308 + }
  309 +
  310 + public void setREPORT_SGSJ(String REPORT_SGSJ) {
  311 + this.REPORT_SGSJ = REPORT_SGSJ;
  312 + }
  313 +
  314 + public String getREPORT_SGDD() {
  315 + return REPORT_SGDD;
  316 + }
  317 +
  318 + public void setREPORT_SGDD(String REPORT_SGDD) {
  319 + this.REPORT_SGDD = REPORT_SGDD;
  320 + }
  321 +
  322 + public String getREPORT_XSFX() {
  323 + return REPORT_XSFX;
  324 + }
  325 +
  326 + public void setREPORT_XSFX(String REPORT_XSFX) {
  327 + this.REPORT_XSFX = REPORT_XSFX;
  328 + }
  329 +
  330 + public String getREPORT_SGDX() {
  331 + return REPORT_SGDX;
  332 + }
  333 +
  334 + public void setREPORT_SGDX(String REPORT_SGDX) {
  335 + this.REPORT_SGDX = REPORT_SGDX;
  336 + }
  337 +
  338 + public String getREPORT_DXPZH() {
  339 + return REPORT_DXPZH;
  340 + }
  341 +
  342 + public void setREPORT_DXPZH(String REPORT_DXPZH) {
  343 + this.REPORT_DXPZH = REPORT_DXPZH;
  344 + }
  345 +
  346 + public String getREPORT_SGGK() {
  347 + return REPORT_SGGK;
  348 + }
  349 +
  350 + public void setREPORT_SGGK(String REPORT_SGGK) {
  351 + this.REPORT_SGGK = REPORT_SGGK;
  352 + }
  353 +
  354 + public String getREPORT_SSRS() {
  355 + return REPORT_SSRS;
  356 + }
  357 +
  358 + public void setREPORT_SSRS(String REPORT_SSRS) {
  359 + this.REPORT_SSRS = REPORT_SSRS;
  360 + }
  361 +
  362 + public String getREPORT_SWRS() {
  363 + return REPORT_SWRS;
  364 + }
  365 +
  366 + public void setREPORT_SWRS(String REPORT_SWRS) {
  367 + this.REPORT_SWRS = REPORT_SWRS;
  368 + }
  369 +
  370 + public String getREPORT_BGR() {
  371 + return REPORT_BGR;
  372 + }
  373 +
  374 + public void setREPORT_BGR(String REPORT_BGR) {
  375 + this.REPORT_BGR = REPORT_BGR;
  376 + }
  377 +
  378 + public String getREPORT_BGRDH() {
  379 + return REPORT_BGRDH;
  380 + }
  381 +
  382 + public void setREPORT_BGRDH(String REPORT_BGRDH) {
  383 + this.REPORT_BGRDH = REPORT_BGRDH;
  384 + }
  385 +
  386 + public String getREPORT_BZ() {
  387 + return REPORT_BZ;
  388 + }
  389 +
  390 + public void setREPORT_BZ(String REPORT_BZ) {
  391 + this.REPORT_BZ = REPORT_BZ;
  392 + }
  393 +
  394 + public String getCREATE_BY() {
  395 + return CREATE_BY;
  396 + }
  397 +
  398 + public void setCREATE_BY(String CREATE_BY) {
  399 + this.CREATE_BY = CREATE_BY;
  400 + }
  401 +
  402 + public Date getCREATE_DATE() {
  403 + return CREATE_DATE;
  404 + }
  405 +
  406 + public void setCREATE_DATE(Date CREATE_DATE) {
  407 + this.CREATE_DATE = CREATE_DATE;
  408 + }
  409 +
  410 + public String getUPDATE_BY() {
  411 + return UPDATE_BY;
  412 + }
  413 +
  414 + public void setUPDATE_BY(String UPDATE_BY) {
  415 + this.UPDATE_BY = UPDATE_BY;
  416 + }
  417 +
  418 + public Date getUPDATE_DATE() {
  419 + return UPDATE_DATE;
  420 + }
  421 +
  422 + public void setUPDATE_DATE(Date UPDATE_DATE) {
  423 + this.UPDATE_DATE = UPDATE_DATE;
  424 + }
  425 +
  426 + public String getREPORT_ROAD() {
  427 + return REPORT_ROAD;
  428 + }
  429 +
  430 + public void setREPORT_ROAD(String REPORT_ROAD) {
  431 + this.REPORT_ROAD = REPORT_ROAD;
  432 + }
  433 +
  434 + public String getSTATUS() {
  435 + return STATUS;
  436 + }
  437 +
  438 + public void setSTATUS(String STATUS) {
  439 + this.STATUS = STATUS;
  440 + }
  441 +
  442 + @Override
  443 + public String toString() {
  444 + DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  445 + return "{" +
  446 + "ID:'" + ID + '\'' +
  447 + ", REPORT_TYPE:'" + REPORT_TYPE + '\'' +
  448 + ", REPORT_GS:'" + REPORT_GS + '\'' +
  449 + ", REPORT_FGS:'" + REPORT_FGS + '\'' +
  450 + ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' +
  451 + ", REPORT_BBR:'" + REPORT_BBR + '\'' +
  452 + ", REPORT_XL:'" + REPORT_XL + '\'' +
  453 + ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' +
  454 + ", REPORT_STATION:'" + REPORT_STATION + '\'' +
  455 + ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' +
  456 + ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' +
  457 + ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' +
  458 + ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' +
  459 + ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' +
  460 + ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' +
  461 + ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' +
  462 + ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' +
  463 + ", REPORT_YXBC:'" + REPORT_YXBC + '\'' +
  464 + ", REPORT_TZCS:'" + REPORT_TZCS + '\'' +
  465 + ", REPORT_SGBH:'" + REPORT_SGBH + '\'' +
  466 + ", REPORT_ZBH:'" + REPORT_ZBH + '\'' +
  467 + ", REPORT_PZH:'" + REPORT_PZH + '\'' +
  468 + ", REPORT_JSY:'" + REPORT_JSY + '\'' +
  469 + ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' +
  470 + ", REPORT_SGDD:'" + REPORT_SGDD + '\'' +
  471 + ", REPORT_XSFX:'" + REPORT_XSFX + '\'' +
  472 + ", REPORT_SGDX:'" + REPORT_SGDX + '\'' +
  473 + ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' +
  474 + ", REPORT_SGGK:'" + REPORT_SGGK + '\'' +
  475 + ", REPORT_SSRS:'" + REPORT_SSRS + '\'' +
  476 + ", REPORT_SWRS:'" + REPORT_SWRS + '\'' +
  477 + ", REPORT_BGR:'" + REPORT_BGR + '\'' +
  478 + ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' +
  479 + ", REPORT_BZ:'" + REPORT_BZ + '\'' +
  480 + ", CREATE_BY:'" + CREATE_BY + '\'' +
  481 + ", CREATE_DATE:" + CREATE_DATE +
  482 + ", UPDATE_BY:'" + UPDATE_BY + '\'' +
  483 + ", UPDATE_DATE:" + UPDATE_DATE +
  484 + ", REPORT_ROAD:'" + REPORT_ROAD + '\'' +
  485 + ", STATUS:'" + STATUS + '\'' +
  486 + '}';
  487 + }
  488 +}
src/main/java/com/bsth/data/report_register/repository/ReportRegisterRepository.java 0 → 100644
  1 +package com.bsth.data.report_register.repository;
  2 +
  3 +import com.bsth.data.report_register.entity.ReportRegister;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + *
  9 + * @Interface: ReportRegisterRepository(等级报表Repository数据持久层接口)
  10 + *
  11 + * @Author yrf
  12 + *
  13 + * @Date 2019-12-04
  14 + *
  15 + * @Version 公交调度系统BS版 0.1
  16 + *
  17 + */
  18 +
  19 +@Repository
  20 +public interface ReportRegisterRepository extends BaseRepository<ReportRegister, Long> {
  21 +
  22 +}
src/main/java/com/bsth/entity/calc/CalcInterval.java
@@ -6,123 +6,175 @@ import javax.persistence.Entity; @@ -6,123 +6,175 @@ import javax.persistence.Entity;
6 import javax.persistence.GeneratedValue; 6 import javax.persistence.GeneratedValue;
7 import javax.persistence.Id; 7 import javax.persistence.Id;
8 import javax.persistence.Table; 8 import javax.persistence.Table;
  9 +import javax.persistence.Transient;
9 10
  11 +import com.bsth.data.BasicData;
  12 +
  13 +/**
  14 + * @author bsth-a
  15 + *
  16 + */
10 @Entity 17 @Entity
11 -@Table(name = "calc_interval") 18 +@Table(name = "bsth_c_calc_interval")
12 public class CalcInterval { 19 public class CalcInterval {
13 /* 主键*/ 20 /* 主键*/
14 @Id 21 @Id
15 @GeneratedValue 22 @GeneratedValue
16 private Long id; 23 private Long id;
17 /* 公司代码*/ 24 /* 公司代码*/
18 - private String gsdm;  
19 - /* 公司名称*/  
20 - private String gsname; 25 + private String gsbm;
21 /* 分公司代码*/ 26 /* 分公司代码*/
22 - private String fgsdm;  
23 - /* 分公司名称*/  
24 - private String fgsname;  
25 - /* 日期*/  
26 - private Date rq; 27 + private String fgsbm;
27 /* 日期字符串*/ 28 /* 日期字符串*/
28 - private String rqStr; 29 + private String date;
29 /* 线路编码*/ 30 /* 线路编码*/
30 - private String xl; 31 + private String xlBm;
31 /* 线路名称*/ 32 /* 线路名称*/
32 private String xlName; 33 private String xlName;
33 - /* 大间隔次数*/  
34 - private int djg;  
35 - /* 大间隔次数(早高峰)*/  
36 - private int djgM;  
37 - /* 大间隔次数(晚高峰)*/  
38 - private int djgA;  
39 - /* 最大大间隔时间*/  
40 - private int djgTime;  
41 - /* 备注*/  
42 - private String remark; 34 + /*大间隔等级*/
  35 + private String level;
  36 + /*等级具体时间*/
  37 + private Double levelTime;
  38 + /*全日大间隔次数*/
  39 + private Integer djgAll;
  40 + /*高峰大间隔次数*/
  41 + private Integer djgGf;
  42 + /*早高峰大间隔次数*/
  43 + private Integer djgZgf;
  44 + /*晚高峰大间隔次数*/
  45 + private Integer djgWgf;
  46 + /*低谷大间隔次数*/
  47 + private Integer djgDg;
  48 + /*最大间隔时间*/
  49 + private Integer djgTime;
  50 + /*全日班次数*/
  51 + private Integer bcs;
  52 + /*数据创建时间*/
  53 + private Date createtime;
  54 + /*数据修改时间*/
  55 + private Date updatetime;
  56 +
  57 + /*公司名字*/
  58 + @Transient
  59 + private String gsname;
  60 + /*分公司名字*/
  61 + @Transient
  62 + private String fgsname;
43 public Long getId() { 63 public Long getId() {
44 return id; 64 return id;
45 } 65 }
46 public void setId(Long id) { 66 public void setId(Long id) {
47 this.id = id; 67 this.id = id;
48 } 68 }
49 - public String getGsdm() {  
50 - return gsdm; 69 + public String getGsbm() {
  70 + return gsbm;
51 } 71 }
52 - public void setGsdm(String gsdm) {  
53 - this.gsdm = gsdm; 72 + public void setGsbm(String gsbm) {
  73 + this.gsbm = gsbm;
54 } 74 }
55 - public String getGsname() {  
56 - return gsname; 75 + public String getFgsbm() {
  76 + return fgsbm;
57 } 77 }
58 - public void setGsname(String gsname) {  
59 - this.gsname = gsname; 78 + public void setFgsbm(String fgsbm) {
  79 + this.fgsbm = fgsbm;
60 } 80 }
61 - public String getFgsdm() {  
62 - return fgsdm; 81 + public String getDate() {
  82 + return date;
63 } 83 }
64 - public void setFgsdm(String fgsdm) {  
65 - this.fgsdm = fgsdm; 84 + public void setDate(String date) {
  85 + this.date = date;
66 } 86 }
67 - public String getFgsname() {  
68 - return fgsname; 87 + public String getXlBm() {
  88 + return xlBm;
69 } 89 }
70 - public void setFgsname(String fgsname) {  
71 - this.fgsname = fgsname; 90 + public void setXlBm(String xlBm) {
  91 + this.xlBm = xlBm;
72 } 92 }
73 - public Date getRq() {  
74 - return rq; 93 + public String getXlName() {
  94 + return xlName;
75 } 95 }
76 - public void setRq(Date rq) {  
77 - this.rq = rq; 96 + public void setXlName(String xlName) {
  97 + this.xlName = xlName;
78 } 98 }
79 - public String getRqStr() {  
80 - return rqStr; 99 + public String getLevel() {
  100 + return level;
81 } 101 }
82 - public void setRqStr(String rqStr) {  
83 - this.rqStr = rqStr; 102 + public void setLevel(String level) {
  103 + this.level = level;
84 } 104 }
85 - public String getXl() {  
86 - return xl; 105 + public Double getLevelTime() {
  106 + return levelTime;
87 } 107 }
88 - public void setXl(String xl) {  
89 - this.xl = xl; 108 + public void setLevelTime(Double levelTime) {
  109 + this.levelTime = levelTime;
90 } 110 }
91 - public String getXlName() {  
92 - return xlName; 111 + public Integer getDjgAll() {
  112 + return djgAll;
93 } 113 }
94 - public void setXlName(String xlName) {  
95 - this.xlName = xlName; 114 + public void setDjgAll(Integer djgAll) {
  115 + this.djgAll = djgAll;
  116 + }
  117 + public Integer getDjgGf() {
  118 + return djgGf;
96 } 119 }
97 - public int getDjg() {  
98 - return djg; 120 + public void setDjgGf(Integer djgGf) {
  121 + this.djgGf = djgGf;
99 } 122 }
100 - public void setDjg(int djg) {  
101 - this.djg = djg; 123 +
  124 + public Integer getDjgZgf() {
  125 + return djgZgf;
102 } 126 }
103 - public int getDjgM() {  
104 - return djgM; 127 + public void setDjgZgf(Integer djgZgf) {
  128 + this.djgZgf = djgZgf;
105 } 129 }
106 - public void setDjgM(int djgM) {  
107 - this.djgM = djgM; 130 + public Integer getDjgWgf() {
  131 + return djgWgf;
108 } 132 }
109 - public int getDjgA() {  
110 - return djgA; 133 + public void setDjgWgf(Integer djgWgf) {
  134 + this.djgWgf = djgWgf;
111 } 135 }
112 - public void setDjgA(int djgA) {  
113 - this.djgA = djgA; 136 + public Integer getDjgDg() {
  137 + return djgDg;
114 } 138 }
115 - public int getDjgTime() { 139 + public void setDjgDg(Integer djgDg) {
  140 + this.djgDg = djgDg;
  141 + }
  142 + public Integer getDjgTime() {
116 return djgTime; 143 return djgTime;
117 } 144 }
118 - public void setDjgTime(int djgTime) { 145 + public void setDjgTime(Integer djgTime) {
119 this.djgTime = djgTime; 146 this.djgTime = djgTime;
120 } 147 }
121 - public String getRemark() {  
122 - return remark; 148 + public Integer getBcs() {
  149 + return bcs;
  150 + }
  151 + public void setBcs(Integer bcs) {
  152 + this.bcs = bcs;
123 } 153 }
124 - public void setRemark(String remark) {  
125 - this.remark = remark; 154 + public Date getCreatetime() {
  155 + return createtime;
  156 + }
  157 + public void setCreatetime(Date createtime) {
  158 + this.createtime = createtime;
  159 + }
  160 + public Date getUpdatetime() {
  161 + return updatetime;
  162 + }
  163 + public void setUpdatetime(Date updatetime) {
  164 + this.updatetime = updatetime;
  165 + }
  166 + public String getGsname() {
  167 + return BasicData.businessCodeNameMap.get(this.gsbm);
126 } 168 }
  169 + public void setGsname(String gsname) {
  170 + this.gsname = gsname;
  171 + }
  172 + public String getFgsname() {
  173 + return BasicData.businessFgsCodeNameMap.get(this.fgsbm+"_"+this.gsbm);
  174 + }
  175 + public void setFgsname(String fgsname) {
  176 + this.fgsname = fgsname;
  177 + }
  178 +
127 179
128 } 180 }
src/main/java/com/bsth/entity/report/RepairReport.java
@@ -36,6 +36,8 @@ public class RepairReport { @@ -36,6 +36,8 @@ public class RepairReport {
36 private String departureTime; 36 private String departureTime;
37 // 报修类型 37 // 报修类型
38 private String repairType; 38 private String repairType;
  39 + // 业务类型
  40 + private String reportType;
39 // 报修时间 41 // 报修时间
40 private Date reportDate; 42 private Date reportDate;
41 // 格式化的时间字符串 43 // 格式化的时间字符串
@@ -121,6 +123,14 @@ public class RepairReport { @@ -121,6 +123,14 @@ public class RepairReport {
121 this.repairType = repairType; 123 this.repairType = repairType;
122 } 124 }
123 125
  126 + public String getReportType() {
  127 + return reportType;
  128 + }
  129 +
  130 + public void setReportType(String reportType) {
  131 + this.reportType = reportType;
  132 + }
  133 +
124 public Date getReportDate() { 134 public Date getReportDate() {
125 return reportDate; 135 return reportDate;
126 } 136 }
src/main/java/com/bsth/listener/SessionListener.java 0 → 100644
  1 +package com.bsth.listener;
  2 +
  3 +import javax.servlet.http.HttpSessionEvent;
  4 +import javax.servlet.http.HttpSessionListener;
  5 +
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import com.bsth.common.Constants;
  11 +
  12 +@Component
  13 +public class SessionListener implements HttpSessionListener {
  14 +
  15 + private final static Logger log = LoggerFactory.getLogger(SessionListener.class);
  16 +
  17 + @Override
  18 + public void sessionCreated(HttpSessionEvent se) {
  19 + // TODO Auto-generated method stub
  20 +
  21 + }
  22 +
  23 + @Override
  24 + public void sessionDestroyed(HttpSessionEvent se) {
  25 + // TODO Auto-generated method stub
  26 + log.error("用户:" + se.getSession().getAttribute(Constants.SESSION_USERNAME) + "登出");
  27 + }
  28 +}
  29 +
src/main/java/com/bsth/repository/LineRepository.java
@@ -60,14 +60,14 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; { @@ -60,14 +60,14 @@ public interface LineRepository extends BaseRepository&lt;Line, Integer&gt; {
60 + "l.startStationEndTime=?9, l.endStationFirstTime=?10, l.endStationEndTime=?11, l.linePlayType=?12, " 60 + "l.startStationEndTime=?9, l.endStationFirstTime=?10, l.endStationEndTime=?11, l.linePlayType=?12, "
61 + "l.openDate=?13, l.es=?14, l.shortName=?15, l.shanghaiLinecode=?16, l.eqLinecode=?17, l.startPhone=?18, " 61 + "l.openDate=?13, l.es=?14, l.shortName=?15, l.shanghaiLinecode=?16, l.eqLinecode=?17, l.startPhone=?18, "
62 + "l.endPhone=?19, l.carSumNumber=?20, l.hvacCarNumber=?21, l.ordCarNumber=?22, l.history=?23, " 62 + "l.endPhone=?19, l.carSumNumber=?20, l.hvacCarNumber=?21, l.ordCarNumber=?22, l.history=?23, "
63 - + "l.descriptions=?24, l.destroy=?25, l.supperLine=?26, l.spacGrade=?27, l.warrantCar=?28, l.region=?30 where " 63 + + "l.descriptions=?24, l.destroy=?25, l.supperLine=?26, l.spacGrade=?27, l.warrantCar=?28, l.region=?30 , l.inUse=?31 where "
64 + "l.lineCode=?29") 64 + "l.lineCode=?29")
65 - public int update(String name, String company, String brancheCompany, String level, String nature, 65 + int update(String name, String company, String brancheCompany, String level, String nature,
66 String startStationName, String endStationName, String startStationFirstTime, String startStationEndTime, 66 String startStationName, String endStationName, String startStationFirstTime, String startStationEndTime,
67 String endStationFirstTime, String endStationEndTime, Integer linePlayType, Date openDate, String es, 67 String endStationFirstTime, String endStationEndTime, Integer linePlayType, Date openDate, String es,
68 String shortName, String shanghaiLinecode, String eqLinecode, String startPhone, String endPhone, 68 String shortName, String shanghaiLinecode, String eqLinecode, String startPhone, String endPhone,
69 Integer carSumNumber, Integer hvacCarNumber, Integer ordCarNumber, String history, String descriptions, 69 Integer carSumNumber, Integer hvacCarNumber, Integer ordCarNumber, String history, String descriptions,
70 - Integer destroy, Integer supperLine, Integer spacGrade, Integer warrantCar, String lineCode, Integer region); 70 + Integer destroy, Integer supperLine, Integer spacGrade, Integer warrantCar, String lineCode, Integer region, Integer inUser);
71 71
72 /** 72 /**
73 * 查询线路版本文件 73 * 查询线路版本文件
src/main/java/com/bsth/repository/calc/CalcIntervalRepository.java
@@ -2,15 +2,13 @@ package com.bsth.repository.calc; @@ -2,15 +2,13 @@ package com.bsth.repository.calc;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
5 -import javax.transaction.Transactional; 5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.data.repository.query.Param;
  7 +import org.springframework.stereotype.Repository;
6 8
7 import com.bsth.entity.calc.CalcInterval; 9 import com.bsth.entity.calc.CalcInterval;
8 import com.bsth.repository.BaseRepository; 10 import com.bsth.repository.BaseRepository;
9 11
10 -import org.springframework.data.jpa.repository.Modifying;  
11 -import org.springframework.data.jpa.repository.Query;  
12 -import org.springframework.stereotype.Repository;  
13 -  
14 /** 12 /**
15 * 13 *
16 */ 14 */
@@ -18,23 +16,36 @@ import org.springframework.stereotype.Repository; @@ -18,23 +16,36 @@ import org.springframework.stereotype.Repository;
18 public interface CalcIntervalRepository extends BaseRepository<CalcInterval, Integer>{ 16 public interface CalcIntervalRepository extends BaseRepository<CalcInterval, Integer>{
19 17
20 //按照时间段统计,公司下线路 18 //按照时间段统计,公司下线路
21 - @Query(value="select DISTINCT c from CalcInterval c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl")  
22 - List<CalcInterval> selectByDateAndLine(String line,String date,String date2,String gsdm,String fgsdm); 19 + @Query(value="select DISTINCT c from CalcInterval c where c.date >= ?1 and c.date<= ?2 and c.gsbm like %?3% and c.fgsbm like %?4% and c.level like %?5% order by c.xlBm")
  20 + List<CalcInterval> selectByDateAndCompany(String date,String date2,String gsdm,String fgsdm,String level);
23 21
24 - //按照时间段统计,单条线路  
25 - @Query(value="select DISTINCT c from CalcInterval c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl")  
26 - List<CalcInterval> selectByDateAndLine(String line,String date,String date2); 22 + //按照时间,公司下线路
  23 + @Query(value="select DISTINCT c from CalcInterval c where c.date = ?1 and c.gsbm like %?2% and c.fgsbm like %?3% and c.level like %?4% order by c.xlBm")
  24 + List<CalcInterval> selectByDateAndCompany(String date,String gsdm,String fgsdm,String level);
27 25
28 - //按照日期和线路删除数据  
29 - @Modifying  
30 - @Transactional  
31 - @Query(value = "delete CalcInterval c where c.rqStr=?1 and c.xl=?2")  
32 - void deleteByDateAndLine(String date, String line);  
33 26
34 - //按照日期删除数据  
35 - @Modifying  
36 - @Transactional  
37 - @Query(value = "delete CalcInterval c where c.rqStr=?1")  
38 - void deleteByDate(String date); 27 + //按照时间段统计,单条线路
  28 + @Query(value="select DISTINCT c from CalcInterval c where c.xlBm = ?1 and c.date >= ?2 and c.date <=?3 and c.level like %?4% order by c.xlBm")
  29 + List<CalcInterval> selectByDateAndLine(String line,String date,String date2,String level);
  30 +
39 31
  32 + //按照时间,单条线路
  33 + @Query(value="select DISTINCT c from CalcInterval c where c.xlBm = ?1 and c.date = ?2 and c.level like %?3% order by c.xlBm")
  34 + List<CalcInterval> selectByDateAndLine(String line,String date,String level);
  35 +
  36 + //按照时间段,公司统计
  37 + @Query(value="select gsbm,fgsbm,xl_bm,SUM(djg_all) as djgAll,SUM(djg_gf) as djgGf,SUM(djg_dg) as djgDg,SUM(djg_zgf) as djgZgf,SUM(djg_wgf) as djgWgf,MAX(djg_time) as djgTime "
  38 + + " from bsth_c_calc_interval where gsbm like %?1% and fgsbm like %?2% and date >=?3 and date <=?4 "
  39 + + " group by xl_bm,gsbm,fgsbm",nativeQuery=true)
  40 + List<Object[]> countByDateAndLine(String gsbm,String fgsbm,String date,String date2);
  41 +
  42 + //按照时间段,线路统计
  43 + @Query(value="select gsbm,fgsbm,xl_bm,SUM(djg_all) as djgAll,SUM(djg_gf) as djgGf,SUM(djg_dg) as djgDg,SUM(djg_zgf) as djgZgf,SUM(djg_wgf) as djgWgf,MAX(djg_time) as djgTime "
  44 + + " from bsth_c_calc_interval where xl_bm =?1 and date >=?2 and date <=?3 "
  45 + + " group by xl_bm,gsbm,fgsbm",nativeQuery=true)
  46 + List<Object[]> countByDateAndLine(String xlbm,String date,String date2);
  47 +
  48 + // 按日期查询
  49 + @Query(value="select c from CalcInterval c where c.date in (:dates)")
  50 + List<CalcInterval> selectByDates(@Param("dates")List<String> dates);
40 } 51 }
src/main/java/com/bsth/service/calc/CalcIntervalService.java 0 → 100644
  1 +package com.bsth.service.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.calc.CalcInterval;
  7 +import com.bsth.service.BaseService;
  8 +
  9 +/**
  10 + * Created by 17/11/16.
  11 + */
  12 +public interface CalcIntervalService extends BaseService<CalcInterval,Integer> {
  13 +
  14 + List<Map<String,Object>> countList(Map<String, Object> map);
  15 + List<Map<String,Object>> listInterval(Map<String, Object> map);
  16 + List<Map<String,Object>> interval(Map<String, Object> map);
  17 +}
src/main/java/com/bsth/service/calc/impl/CalcIntervalServiceImpl.java 0 → 100644
  1 +package com.bsth.service.calc.impl;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.Calendar;
  10 +import java.util.Collections;
  11 +import java.util.Comparator;
  12 +import java.util.Date;
  13 +import java.util.GregorianCalendar;
  14 +import java.util.HashMap;
  15 +import java.util.Iterator;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +import org.apache.commons.lang3.StringUtils;
  20 +import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.jdbc.core.JdbcTemplate;
  22 +import org.springframework.jdbc.core.RowMapper;
  23 +import org.springframework.stereotype.Service;
  24 +
  25 +import com.bsth.data.BasicData;
  26 +import com.bsth.entity.Line;
  27 +import com.bsth.entity.calc.CalcInterval;
  28 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  29 +import com.bsth.entity.sheet.CalcSheet;
  30 +import com.bsth.entity.sheet.Sheet;
  31 +import com.bsth.repository.LineRepository;
  32 +import com.bsth.repository.calc.CalcIntervalRepository;
  33 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  34 +import com.bsth.service.calc.CalcIntervalService;
  35 +import com.bsth.service.impl.BaseServiceImpl;
  36 +import com.bsth.util.ComparableReal;
  37 +import com.bsth.util.ReportUtils;
  38 +
  39 +@Service
  40 +public class CalcIntervalServiceImpl extends BaseServiceImpl<CalcInterval,Integer> implements CalcIntervalService {
  41 + private static long zgf1 = 6 * 60 + 31,
  42 + zgf2 = 8 * 60 + 30,
  43 + wgf1 = 16 * 60 + 1,
  44 + wgf2 = 18 * 60;
  45 +
  46 + @Autowired
  47 + CalcIntervalRepository calcIntervalRepository;
  48 + @Autowired
  49 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  50 + @Autowired
  51 + LineRepository lineRepository;
  52 + @Autowired
  53 + JdbcTemplate jdbcTemplate;
  54 + @Override
  55 + public List<Map<String, Object>> countList(Map<String, Object> map) {
  56 + // TODO Auto-generated method stub
  57 + final DecimalFormat df = new DecimalFormat("0.00");
  58 + List<Map<String, Object>> list=new ArrayList<>();
  59 + String level=map.get("levelType").toString();
  60 + String line=map.get("line").toString().trim();
  61 + String gs=map.get("gs").toString().trim();
  62 + String fgs=map.get("fgs").toString().trim();
  63 + String sDate=map.get("date").toString();
  64 + String eDate=map.get("endDate").toString();
  65 +
  66 + //D级线路显示发车准点率
  67 + if(level.equals("D")){
  68 + String sql1=" select xl_bm,gsbm,fgsbm,xl_name from bsth_c_calc_interval where date >='"+sDate+"' and date <= '"+eDate+"' and `level`='D'";
  69 + if(line.equals("")){
  70 + if(fgs.equals("")){
  71 + sql1 +=" and gsbm = '"+gs+"'";
  72 + }else{
  73 + sql1 +=" and gsbm = '"+gs+"' and fgsbm = '"+fgs+"'";
  74 + }
  75 + }else{
  76 + sql1 +=" and xl_bm ='"+line+"'";
  77 + }
  78 + sql1+=" group by xl_bm,gsbm,fgsbm,xl_name";
  79 +
  80 + String sql2="select gsdm,fgsdm,xl,xl_name,max(id) as id,sum(jhszfcs) as jhszfcs,"
  81 + + " sum(sjszfczds) as sjszfczds,sum(sjszddzds) as sjszddzds from bsth_c_calc_sheet where date >= '"+sDate+"' and date <= '"+eDate+"'";
  82 + if(line.trim().equals("")){
  83 + if(fgs.equals("")){
  84 + sql2 +=" and gsdm = '"+gs+"'";
  85 + }else{
  86 + sql2 +=" and gsdm = '"+gs+"' and fgsdm = '"+fgs+"'";
  87 + }
  88 + }else{
  89 + sql2 +=" and xl ='"+line+"'";
  90 + }
  91 + sql2 +=" group by gsdm,fgsdm,xl,xl_name";
  92 +
  93 + String sql="select b.* from ("+sql1+") a left join ("+sql2+") b"
  94 + + " on a.xl_bm=b.xl and a.gsbm=b.gsdm and a.fgsbm=b.fgsdm and a.xl_name=b.xl_name";
  95 +
  96 + list=jdbcTemplate.query(sql,
  97 + new RowMapper<Map<String,Object>>(){
  98 + @Override
  99 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  100 + Map<String, Object> m=new HashMap<String,Object>();
  101 + m.put("gs", BasicData.businessCodeNameMap.get(rs.getString("gsdm")));
  102 + m.put("fgs", BasicData.businessFgsCodeNameMap.get(rs.getString("fgsdm")+"_"+rs.getString("gsdm")));
  103 + m.put("xlBm", rs.getString("xl"));
  104 + m.put("line", rs.getString("xl_name"));
  105 + m.put("xlName", rs.getString("xl_name"));//与另一个导出通用
  106 + m.put("id", rs.getInt("id"));
  107 + m.put("bcs", rs.getString("jhszfcs"));
  108 + m.put("zdbcs", rs.getString("sjszfczds"));
  109 + m.put("ddzdbcs", rs.getString("sjszddzds"));
  110 + int jhfc=rs.getInt("jhszfcs");
  111 + int zdfc=rs.getInt("sjszfczds");
  112 + int zddd=rs.getInt("sjszddzds");
  113 + if(jhfc>0){
  114 + double zdl=(zdfc*1.0)/(jhfc*1.0)*100;
  115 + m.put("zdlv", df.format(zdl)+"%");
  116 + zdl=(zddd*1.0)/(jhfc*1.0)*100;
  117 + m.put("ddzdlv", df.format(zdl)+"%");
  118 + }else{
  119 + m.put("zdlv", "0.0%");
  120 + m.put("ddzdlv", "0.0%");
  121 + }
  122 + return m;
  123 + }
  124 + });
  125 + }else{
  126 + String sql="select gsbm,fgsbm,xl_bm,xl_name,SUM(bcs) as bcs,MAX(id) as id,SUM(djg_all) as djgAll,SUM(djg_gf) as djgGf,"
  127 + + "SUM(djg_dg) as djgDg,SUM(djg_zgf) as djgZgf,SUM(djg_wgf) as djgWgf,MAX(djg_time) as djgTime "
  128 + + "from bsth_c_calc_interval where date>= '"+sDate+"' and date<='"+eDate+"' and level <> 'D' and djg_all >0 ";
  129 + if(line.equals("")){
  130 + if(fgs.equals("")){
  131 + sql +=" and gsbm = '"+gs+"'";
  132 + }else{
  133 + sql +=" and gsbm = '"+gs+"' and fgsbm = '"+fgs+"'";
  134 + }
  135 + }else{
  136 + sql +=" and xl_bm ='"+line+"'";
  137 + }
  138 + sql += " group by xl_bm,gsbm,fgsbm,xl_name";
  139 +
  140 + list=jdbcTemplate.query(sql,
  141 + new RowMapper<Map<String,Object>>(){
  142 + @Override
  143 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  144 + Map<String, Object> m=new HashMap<String,Object>();
  145 + m.put("gs", BasicData.businessCodeNameMap.get(rs.getString("gsbm")));
  146 + m.put("fgs", BasicData.businessFgsCodeNameMap.get(rs.getString("fgsbm")+"_"+rs.getString("gsbm")));
  147 + m.put("xlBm", rs.getString("xl_bm"));
  148 + m.put("xlName", rs.getString("xl_name"));
  149 + m.put("bcs", rs.getInt("bcs"));
  150 + m.put("id", rs.getInt("id"));
  151 + int djgAll=rs.getInt("djgAll");
  152 + int bcs=rs.getInt("bcs");
  153 + //全日发生率 (大间隔次数/全日班次数)
  154 + if(bcs>0){
  155 + double fsl=(djgAll*1.0)/(bcs*1.0)*100;
  156 + m.put("fsl", df.format(fsl)+"%");
  157 + }else{
  158 + m.put("fsl", "0.0%");
  159 + }
  160 + m.put("djgAll", rs.getString("djgAll"));
  161 + m.put("djgGf", rs.getString("djgGf"));
  162 + m.put("djgZgf", rs.getString("djgZgf"));
  163 + m.put("djgWgf", rs.getString("djgWgf"));
  164 + m.put("djgDg", rs.getString("djgDg"));
  165 + m.put("djgTime", rs.getString("djgTime"));
  166 + return m;
  167 + }
  168 + });
  169 + }
  170 +
  171 + if(map.get("type").equals("export")){
  172 + String lineName="";
  173 + if(line.equals("")){
  174 + if(fgs.equals("")){
  175 + lineName=list.get(0).get("gs").toString();
  176 + }else{
  177 + lineName=list.get(0).get("fgs").toString();
  178 + }
  179 + }else{
  180 + lineName=list.get(0).get("xlName").toString();
  181 + }
  182 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  183 + Map<String, Object> m = new HashMap<String, Object>();
  184 +
  185 + ReportUtils ee = new ReportUtils();
  186 + try {
  187 + String dateTime = "";
  188 + if(sDate.equals(eDate)){
  189 + dateTime = sDate.replaceAll("-", "");
  190 + } else {
  191 + dateTime = sDate.replaceAll("-", "")+"-"+
  192 + eDate.replaceAll("-", "");
  193 + }
  194 + listI.add(list.iterator());
  195 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  196 + String xls="";
  197 + String xlsName="";
  198 + if(level.equals("D")){
  199 + m.put("date", sDate);
  200 + m.put("endDate", eDate);
  201 + xls="calcSheetList.xls";
  202 + xlsName="发车到站准点率.xls";
  203 + }else{
  204 + m.put("sDate", sDate);
  205 + m.put("eDate", eDate);
  206 + xls="calcIntervalCount.xls";
  207 + xlsName="大间隔汇总表.xls";
  208 + }
  209 +
  210 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + ""+xls,
  211 + path + "export/"+dateTime+"-"+lineName+"-"+xlsName);
  212 + } catch (Exception e) {
  213 + // TODO: handle exception
  214 + e.printStackTrace();
  215 + }
  216 + }
  217 + return list;
  218 + }
  219 + @Override
  220 + public List<Map<String, Object>> listInterval(Map<String, Object> map) {
  221 + // TODO Auto-generated method stub
  222 + final DecimalFormat df = new DecimalFormat("0.00");
  223 +
  224 + String line=map.get("line").toString();
  225 + String date=map.get("date").toString();
  226 + String endDate=map.get("endDate").toString();
  227 + List<CalcInterval> listAll=calcIntervalRepository.selectByDateAndLine(line, date, endDate, "");
  228 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  229 + for (int i = 0; i < listAll.size(); i++) {
  230 + CalcInterval t=listAll.get(i);
  231 + if(!t.getLevel().equals("D") && t.getDjgAll()>0){
  232 + Map<String, Object> m=new HashMap<>();
  233 + m.put("gs", t.getGsname());
  234 + m.put("fgs", t.getFgsname());
  235 + m.put("date", t.getDate());
  236 + m.put("xl", t.getXlName());
  237 + m.put("xlBm", t.getXlBm());
  238 + m.put("level", t.getLevel());
  239 + m.put("djgAll", t.getDjgAll());
  240 + m.put("djgGf", t.getDjgGf());
  241 + m.put("djgZgf", t.getDjgZgf());
  242 + m.put("djgWgf", t.getDjgWgf());
  243 + m.put("djgDg", t.getDjgDg());
  244 + int djgAll=t.getDjgAll();
  245 + int bcs=t.getBcs();
  246 + //全日发生率 (大间隔次数/全日班次数)
  247 + if(bcs>0){
  248 + double fsl=(djgAll*1.0)/(bcs*1.0)*100;
  249 + m.put("fsl", df.format(fsl)+"%");
  250 + }else{
  251 + m.put("fsl", "0.0%");
  252 + }
  253 + m.put("bcs", t.getBcs());
  254 + m.put("djgTime", t.getDjgTime());
  255 + tempList.add(m);
  256 + }
  257 + }
  258 + if(map.get("type").equals("export")){
  259 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  260 + Map<String, Object> m = new HashMap<String, Object>();
  261 + m.put("date", date);
  262 + m.put("endDate", endDate);
  263 + ReportUtils ee = new ReportUtils();
  264 + try {
  265 + listI.add(tempList.iterator());
  266 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  267 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "calcIntervalList1.xls",
  268 + path + "export/大间距汇总表"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  269 + } catch (Exception e) {
  270 + // TODO: handle exception
  271 + e.printStackTrace();
  272 + }
  273 +
  274 + }
  275 + return tempList;
  276 + }
  277 +
  278 + @Override
  279 + public List<Map<String, Object>> interval(Map<String, Object> map) {
  280 + // TODO Auto-generated method stub
  281 + List<Map<String, Object>> list=new ArrayList<>();
  282 + String line=map.get("line").toString();
  283 + String date=map.get("date").toString();
  284 + List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleDaily(line, date);
  285 + List<CalcInterval> listInterval=calcIntervalRepository.selectByDateAndLine(line, date, "");
  286 + String level=listInterval.get(0).getLevel();
  287 + if(listReal.size()>0){
  288 + Line t=lineRepository.findByLineCode(line);
  289 + long minFcsj = minFcsjs(t.getId());
  290 + list=calcIntervalList(listReal, minFcsj,level,t);
  291 + }
  292 + if(map.get("type").toString().equals("export")){
  293 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  294 + Map<String, Object> m = new HashMap<String, Object>();
  295 + m.put("date", date);
  296 + ReportUtils ee = new ReportUtils();
  297 + try {
  298 + listI.add(list.iterator());
  299 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  300 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "interval.xls",
  301 + path + "export/"+date+"大间隔详细.xls");
  302 + } catch (Exception e) {
  303 + // TODO: handle exception
  304 + e.printStackTrace();
  305 + }
  306 + }
  307 + return list;
  308 + }
  309 +
  310 + private List<Map<String, Object>> calcIntervalList(List<ScheduleRealInfo> lists,long minFcsj,String level,Line line) {
  311 + List<ScheduleRealInfo> listjh0 = new ArrayList<ScheduleRealInfo>();
  312 + List<ScheduleRealInfo> listjh1 = new ArrayList<ScheduleRealInfo>();
  313 + List<ScheduleRealInfo> listsj0 = new ArrayList<ScheduleRealInfo>();
  314 + List<ScheduleRealInfo> listsj1 = new ArrayList<ScheduleRealInfo>();
  315 + List<Map<String, Object>> list=new ArrayList<>();
  316 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  317 + SimpleDateFormat sdf_ = new SimpleDateFormat("yyyy-MM-dd");
  318 + String xlName=lists.get(0).getXlName();
  319 + String scheduleDate=lists.get(0).getScheduleDateStr();
  320 + for (int j = 0; j < lists.size(); j++) {
  321 + ScheduleRealInfo s = lists.get(j);
  322 + boolean fage=false;
  323 + if(s.getBcType().equals("normal")){
  324 + fage=true;
  325 + }
  326 + if(s.getBcType().equals("region")){
  327 + if(s.getXlDir().equals("0")){
  328 + if(s.getQdzName().equals(line.getStartStationName())){
  329 + fage=true;
  330 + }
  331 + }else{
  332 + if(s.getQdzName().equals(line.getEndStationName())){
  333 + fage=true;
  334 + }
  335 + }
  336 + }
  337 + if (fage) {
  338 + String[] fcsj = s.getFcsj().split(":");
  339 + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]);
  340 + Long fcsjT = 0L;
  341 + if (fcsjL < minFcsj) {
  342 + Calendar calendar = new GregorianCalendar();
  343 + calendar.setTime(s.getScheduleDate());
  344 + calendar.add(calendar.DATE, 1);
  345 + Date date = calendar.getTime();
  346 + try {
  347 + fcsjT = sdf.parse(sdf_.format(date) + " " + s.getFcsj()).getTime();
  348 + } catch (ParseException e) {
  349 + // TODO Auto-generated catch block
  350 + e.printStackTrace();
  351 + }
  352 + } else {
  353 + try {
  354 + fcsjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime();
  355 + } catch (ParseException e) {
  356 + // TODO Auto-generated catch block
  357 + e.printStackTrace();
  358 + }
  359 + }
  360 + Long fcsjAcual = 0L;
  361 + if (StringUtils.isEmpty(s.getFcsjActual())) {
  362 + s.setFcsjActualTime(0L);
  363 + s.setFcsjT(fcsjT);
  364 + } else {
  365 + try {
  366 + fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  367 + s.setFcsjActualTime(fcsjAcual);
  368 + s.setFcsjT(fcsjT);
  369 + } catch (ParseException e) {
  370 + // TODO Auto-generated catch block
  371 + e.printStackTrace();
  372 + }
  373 + }
  374 +
  375 + if (s.isSflj()) {
  376 + if(StringUtils.isNotEmpty(s.getFcsjActual())){
  377 + if (s.getXlDir().equals("0")) {
  378 + listsj0.add(s);
  379 + } else {
  380 + listsj1.add(s);
  381 + }
  382 + }
  383 + } else {
  384 + if (s.getXlDir().equals("0")) {
  385 + if(StringUtils.isNotEmpty(s.getFcsjActual())){
  386 + listsj0.add(s);
  387 + }
  388 + listjh0.add(s);
  389 + } else {
  390 + if(StringUtils.isNotEmpty(s.getFcsjActual())){
  391 + listsj1.add(s);
  392 + }
  393 + listjh1.add(s);
  394 + }
  395 + }
  396 + }
  397 + }
  398 + /*
  399 + * 所有班次信息按上下行计划实际班次分组和根据计划实际发车时间排序
  400 + */
  401 + Collections.sort(listjh0, new ComparableJhfc());
  402 + Collections.sort(listjh1, new ComparableJhfc());
  403 + Collections.sort(listsj0, new ComparableAcual());
  404 + Collections.sort(listsj1, new ComparableAcual());
  405 +
  406 + long max_time=0;
  407 +
  408 + String jhfc="";
  409 + String sjfc="";
  410 + if(listsj0.size()>2){
  411 + //首班与首二班,末班与末二班中间的间隔不参与到统计
  412 + int p_time=0;
  413 + boolean p_fage=false; //判断两个班次是否为高峰班次,只有前后两个班次都是高峰班次,班次大间隔标准才用高峰标准
  414 + long p_actual_time=0;
  415 + String p_type="";
  416 + for (int j = 1; j < listsj0.size()-1; j++) {
  417 + boolean isAdd=false; //判断是否需要往map里面添加值
  418 + ScheduleRealInfo s =listsj0.get(j);
  419 + Map<String, Object> mm=new HashMap<>();
  420 + String[] fcsj = s.getFcsjActual().split(":");
  421 + int time = Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1]);
  422 + boolean fage=false;
  423 + String type="";
  424 + if (time >= zgf1 && time <= zgf2) {
  425 + fage=true;
  426 + type="zgf";
  427 + } else if (time >= wgf1 && time <= wgf2) {
  428 + fage=true;
  429 + type="wgf";
  430 + } else {
  431 + fage=false;
  432 + }
  433 + long sub_time=(s.getFcsjActualTime()-p_actual_time)/1000/60;
  434 + if(p_time>0){
  435 + if(sub_time>max_time){
  436 + max_time=sub_time;
  437 + }
  438 + if(fage&&p_fage){
  439 + //高峰间隔统计
  440 + if("zgf".equals(type) && type.equals(p_type)){
  441 + if(level.equals("A")){
  442 + if(sub_time >15)
  443 + isAdd=true;
  444 +
  445 + }else if(level.equals("B")){
  446 + if(sub_time >20)
  447 + isAdd=true;
  448 + }else if(level.equals("C")){
  449 + if(sub_time >25)
  450 + isAdd=true;
  451 + }else {
  452 + //D类不计算大间隔时间,通过发车准点率
  453 + }
  454 + }else if("wgf".equals(type) && type.equals(p_type)){
  455 + if(level.equals("A")){
  456 + if(sub_time >15)
  457 + isAdd=true;
  458 + }else if(level.equals("B")){
  459 + if(sub_time >20)
  460 + isAdd=true;
  461 + }else if(level.equals("C")){
  462 + if(sub_time >25)
  463 + isAdd=true;
  464 + }else {
  465 + //D类不计算大间隔时间,通过发车准点率
  466 + }
  467 + }
  468 + }else{
  469 + //平谷间隔统计
  470 + if(level.equals("A")){
  471 + if(sub_time >29)
  472 + isAdd=true;
  473 + }else if(level.equals("B")){
  474 + if(sub_time >29)
  475 + isAdd=true;
  476 + }else if(level.equals("C")){
  477 + if(sub_time >40)
  478 + isAdd=true;
  479 + }else {
  480 + //D类不计算大间隔时间,通过发车准点率
  481 + max_time=0;
  482 + }
  483 + }
  484 + }
  485 + if(isAdd){
  486 + mm.put("xlName", xlName);
  487 + mm.put("level", level);
  488 + mm.put("jhfc1", jhfc);
  489 + mm.put("sjfc1", sjfc);
  490 + mm.put("jhfc2", s.getFcsj());
  491 + mm.put("sjfc2", s.getFcsjActual());
  492 + mm.put("subTime", sub_time);
  493 + mm.put("date", scheduleDate);
  494 + mm.put("station", s.getQdzName());
  495 + list.add(mm);
  496 + }
  497 + p_fage=fage;
  498 + p_type=type;
  499 + p_time =time;
  500 + p_actual_time=s.getFcsjActualTime();
  501 + jhfc=s.getFcsj();
  502 + sjfc=s.getFcsjActual();
  503 + }
  504 + }
  505 +
  506 +
  507 + jhfc="";
  508 + sjfc="";
  509 + if(listsj1.size()>2){
  510 + //首班与首二班,末班与末二班中间的间隔不参与到统计
  511 + int p_time=0;
  512 + boolean p_fage=false; //判断两个班次是否为高峰班次,只有前后两个班次都是高峰班次,班次大间隔标准才用高峰标准
  513 + long p_actual_time=0;
  514 + String p_type="";
  515 + for (int j = 1; j < listsj1.size()-1; j++) {
  516 + boolean isAdd=false; //判断是否需要往map里面添加值
  517 + ScheduleRealInfo s =listsj1.get(j);
  518 + Map<String, Object> mm=new HashMap<>();
  519 + String[] fcsj = s.getFcsjActual().split(":");
  520 + int time = Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1]);
  521 + boolean fage=false;
  522 + String type="";
  523 + if (time >= zgf1 && time <= zgf2) {
  524 + fage=true;
  525 + type="zgf";
  526 + } else if (time >= wgf1 && time <= wgf2) {
  527 + fage=true;
  528 + type="wgf";
  529 + } else {
  530 + fage=false;
  531 + }
  532 + long sub_time=(s.getFcsjActualTime()-p_actual_time)/1000/60;
  533 + if(p_time>0){
  534 + if(sub_time>max_time){
  535 + max_time=sub_time;
  536 + }
  537 + if(fage&&p_fage){
  538 + //高峰间隔统计
  539 + if("zgf".equals(type) && type.equals(p_type)){
  540 + if(level.equals("A")){
  541 + if(sub_time >15)
  542 + isAdd=true;
  543 +
  544 + }else if(level.equals("B")){
  545 + if(sub_time >20)
  546 + isAdd=true;
  547 + }else if(level.equals("C")){
  548 + if(sub_time >25)
  549 + isAdd=true;
  550 + }else {
  551 + //D类不计算大间隔时间,通过发车准点率
  552 + }
  553 + }else if("wgf".equals(type) && type.equals(p_type)){
  554 + if(level.equals("A")){
  555 + if(sub_time >15)
  556 + isAdd=true;
  557 + }else if(level.equals("B")){
  558 + if(sub_time >20)
  559 + isAdd=true;
  560 + }else if(level.equals("C")){
  561 + if(sub_time >25)
  562 + isAdd=true;
  563 + }else {
  564 + //D类不计算大间隔时间,通过发车准点率
  565 + }
  566 + }
  567 + }else{
  568 + //平谷间隔统计
  569 + if(level.equals("A")){
  570 + if(sub_time >29)
  571 + isAdd=true;
  572 + }else if(level.equals("B")){
  573 + if(sub_time >29)
  574 + isAdd=true;
  575 + }else if(level.equals("C")){
  576 + if(sub_time >40)
  577 + isAdd=true;
  578 + }else {
  579 + //D类不计算大间隔时间,通过发车准点率
  580 + max_time=0;
  581 + }
  582 + }
  583 + }
  584 + if(isAdd){
  585 + mm.put("xlName", xlName);
  586 + mm.put("level", level);
  587 + mm.put("jhfc1", jhfc);
  588 + mm.put("sjfc1", sjfc);
  589 + mm.put("jhfc2", s.getFcsj());
  590 + mm.put("sjfc2", s.getFcsjActual());
  591 + mm.put("subTime", sub_time);
  592 + mm.put("date", scheduleDate);
  593 + mm.put("station", s.getQdzName());
  594 +
  595 + list.add(mm);
  596 + }
  597 + p_fage=fage;
  598 + p_type=type;
  599 + p_time =time;
  600 + p_actual_time=s.getFcsjActualTime();
  601 + jhfc=s.getFcsj();
  602 + sjfc=s.getFcsjActual();
  603 + }
  604 + }
  605 + return list;
  606 + }
  607 +
  608 +
  609 + private Long minFcsjs(int id){
  610 + String minfcsj="02:00";
  611 + String sqlMinYysj="select ifnull(max(start_opt),'02:00') as start_opt from bsth_c_line_config where "
  612 + + " id = ("
  613 + + "select max(id) from bsth_c_line_config where line ='"+id +"'"
  614 + + ")";
  615 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  616 + String[] minSjs = minfcsj.split(":");
  617 + //车辆最早发车时间 用了过滤超第二天0点的数据
  618 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  619 + return minSj;
  620 + }
  621 +}
  622 +
  623 +class ComparableJhfc implements Comparator<ScheduleRealInfo>{
  624 + @Override
  625 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  626 + // TODO Auto-generated method stub
  627 + return o1.getFcsjT().compareTo(o2.getFcsjT());
  628 + }
  629 +}
  630 +
  631 +class ComparableAcual implements Comparator<ScheduleRealInfo>{
  632 + @Override
  633 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  634 + // TODO Auto-generated method stub
  635 + return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime());
  636 + }
  637 +}
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
1 package com.bsth.service.calc.impl; 1 package com.bsth.service.calc.impl;
2 2
3 -import java.sql.ResultSet;  
4 -import java.sql.SQLException;  
5 import java.util.ArrayList; 3 import java.util.ArrayList;
6 import java.util.Date; 4 import java.util.Date;
7 import java.util.HashMap; 5 import java.util.HashMap;
@@ -10,7 +8,6 @@ import java.util.List; @@ -10,7 +8,6 @@ import java.util.List;
10 import java.util.Map; 8 import java.util.Map;
11 import java.util.Set; 9 import java.util.Set;
12 10
13 -import com.bsth.entity.calc.CalcInterval;  
14 import com.bsth.entity.calc.CalcWaybill; 11 import com.bsth.entity.calc.CalcWaybill;
15 import com.bsth.entity.realcontrol.ChildTaskPlan; 12 import com.bsth.entity.realcontrol.ChildTaskPlan;
16 import com.bsth.entity.realcontrol.ScheduleRealInfo; 13 import com.bsth.entity.realcontrol.ScheduleRealInfo;
@@ -19,14 +16,12 @@ import com.bsth.repository.calc.CalcIntervalRepository; @@ -19,14 +16,12 @@ import com.bsth.repository.calc.CalcIntervalRepository;
19 import com.bsth.repository.calc.CalcWaybillRepository; 16 import com.bsth.repository.calc.CalcWaybillRepository;
20 import com.bsth.service.calc.CalcToolService; 17 import com.bsth.service.calc.CalcToolService;
21 import com.bsth.service.calc.CalcCulateMileageService; 18 import com.bsth.service.calc.CalcCulateMileageService;
22 -import com.bsth.service.report.CulateMileageService;  
23 import com.bsth.util.Arith; 19 import com.bsth.util.Arith;
24 20
25 import org.slf4j.Logger; 21 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory; 22 import org.slf4j.LoggerFactory;
27 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.jdbc.core.JdbcTemplate; 24 import org.springframework.jdbc.core.JdbcTemplate;
29 -import org.springframework.jdbc.core.RowMapper;  
30 import org.springframework.stereotype.Service; 25 import org.springframework.stereotype.Service;
31 26
32 /** 27 /**
@@ -35,11 +30,6 @@ import org.springframework.stereotype.Service; @@ -35,11 +30,6 @@ import org.springframework.stereotype.Service;
35 @Service 30 @Service
36 public class CalcToolServiceImpl implements CalcToolService { 31 public class CalcToolServiceImpl implements CalcToolService {
37 32
38 - @Autowired  
39 - private CalcWaybillRepository clacRepository;  
40 -  
41 - @Autowired  
42 - private CalcIntervalRepository culcIntervalRepository;  
43 33
44 @Autowired 34 @Autowired
45 private CalcCulateMileageService culateMileageService; 35 private CalcCulateMileageService culateMileageService;
@@ -114,50 +104,6 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -114,50 +104,6 @@ public class CalcToolServiceImpl implements CalcToolService {
114 listCal.addAll(this.cul(list_, lists_, xlList, djgList)); 104 listCal.addAll(this.cul(list_, lists_, xlList, djgList));
115 } 105 }
116 } 106 }
117 -  
118 - //按线路计算大间隔  
119 - if(list.size() > 0){  
120 - ScheduleRealInfo s = list.get(0);  
121 - Map<String, Object> culateDjg = culateMileageService.culateDjg(list, lineCode, xlList, djgList);  
122 - CalcInterval interval = new CalcInterval();  
123 - interval.setGsdm(s.getGsBm());  
124 - interval.setGsname(s.getGsName());  
125 - interval.setFgsdm(s.getFgsBm());  
126 - interval.setFgsname(s.getFgsName());  
127 - interval.setRq(s.getScheduleDate());  
128 - interval.setRqStr(s.getScheduleDateStr());  
129 - interval.setXl(s.getXlBm());  
130 - interval.setXlName(s.getXlName());  
131 - if(culateDjg.keySet().size() > 0){  
132 - if(culateDjg.containsKey("djgcsq")){  
133 - interval.setDjg(Integer.valueOf(culateDjg.get("djgcsq").toString()));  
134 - } else {  
135 - interval.setDjg(0);  
136 - }  
137 - if(culateDjg.containsKey("djgcsz")){  
138 - interval.setDjgM(Integer.valueOf(culateDjg.get("djgcsz").toString()));  
139 - } else {  
140 - interval.setDjgM(0);  
141 - }  
142 - if(culateDjg.containsKey("djgcsw")){  
143 - interval.setDjgA(Integer.valueOf(culateDjg.get("djgcsw").toString()));  
144 - } else {  
145 - interval.setDjgA(0);  
146 - }  
147 - if(culateDjg.containsKey("djgsj")){  
148 - interval.setDjgTime(Integer.valueOf(culateDjg.get("djgsj").toString()));  
149 - } else {  
150 - interval.setDjgTime(0);  
151 - }  
152 - } else {  
153 - interval.setDjg(0);  
154 - interval.setDjgM(0);  
155 - interval.setDjgA(0);  
156 - interval.setDjgTime(0);  
157 - }  
158 - culcIntervalRepository.save(interval);  
159 - }  
160 -  
161 while(true){ 107 while(true){
162 int i = 0, l = 0; 108 int i = 0, l = 0;
163 boolean flag = false; 109 boolean flag = false;
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -68,9 +68,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -68,9 +68,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
68 private CalcWaybillRepository calcRepository; 68 private CalcWaybillRepository calcRepository;
69 69
70 @Autowired 70 @Autowired
71 - private CalcIntervalRepository calcIntervalRepository;  
72 -  
73 - @Autowired  
74 private CalcStatisticsRepository calcStatisticsRepository; 71 private CalcStatisticsRepository calcStatisticsRepository;
75 72
76 @Autowired 73 @Autowired
@@ -92,6 +89,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -92,6 +89,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
92 private ScheduleRealInfoRepository scheduleRealInfoRepository; 89 private ScheduleRealInfoRepository scheduleRealInfoRepository;
93 90
94 @Autowired 91 @Autowired
  92 + private CalcIntervalRepository calcIntervalRepository;
  93 +
  94 + @Autowired
95 private LineRepository lineRepository; 95 private LineRepository lineRepository;
96 @Autowired 96 @Autowired
97 private LineService lineService; 97 private LineService lineService;
@@ -163,10 +163,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -163,10 +163,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
163 } 163 }
164 if(date.length() != 0 && line.length() != 0){ 164 if(date.length() != 0 && line.length() != 0){
165 calcRepository.deleteByDateAndLine(date, line); 165 calcRepository.deleteByDateAndLine(date, line);
166 - calcIntervalRepository.deleteByDateAndLine(date, line);  
167 } else if(date.length() != 0){ 166 } else if(date.length() != 0){
168 calcRepository.deleteByDate(date); 167 calcRepository.deleteByDate(date);
169 - calcIntervalRepository.deleteByDate(date);  
170 } else { 168 } else {
171 newMap.put("status", ResponseCode.ERROR); 169 newMap.put("status", ResponseCode.ERROR);
172 logger.error("save erro.", "日期不能为空"); 170 logger.error("save erro.", "日期不能为空");
@@ -283,19 +281,15 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -283,19 +281,15 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
283 List<String> keyList = new ArrayList<String>(); 281 List<String> keyList = new ArrayList<String>();
284 List<CalcWaybill> list = new ArrayList<CalcWaybill>(); 282 List<CalcWaybill> list = new ArrayList<CalcWaybill>();
285 List<CalcWaybill> lists = new ArrayList<CalcWaybill>(); 283 List<CalcWaybill> lists = new ArrayList<CalcWaybill>();
286 - List<CalcInterval> list_ = new ArrayList<CalcInterval>();  
287 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 284 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
288 Map<String, List<CalcWaybill>> keyMap = new HashMap<String, List<CalcWaybill>>(); 285 Map<String, List<CalcWaybill>> keyMap = new HashMap<String, List<CalcWaybill>>();
289 - Map<String, List<CalcInterval>> keyMap_ = new HashMap<String, List<CalcInterval>>();  
290 286
291 if(line.equals("")){ 287 if(line.equals("")){
292 //查询所有线路 288 //查询所有线路
293 list = calcRepository.scheduleByDateAndLineTj(line,date,date2,gsdm,fgsdm); 289 list = calcRepository.scheduleByDateAndLineTj(line,date,date2,gsdm,fgsdm);
294 - list_ = calcIntervalRepository.selectByDateAndLine(line, date, date2, gsdm, fgsdm);  
295 }else{ 290 }else{
296 //查询单条线路 291 //查询单条线路
297 list = calcRepository.scheduleByDateAndLineTj2(line,date,date2); 292 list = calcRepository.scheduleByDateAndLineTj2(line,date,date2);
298 - list_ = calcIntervalRepository.selectByDateAndLine(line, date, date2);  
299 } 293 }
300 294
301 for(CalcWaybill c : list){ 295 for(CalcWaybill c : list){
@@ -306,12 +300,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -306,12 +300,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
306 } 300 }
307 keyMap.get(key).add(c); 301 keyMap.get(key).add(c);
308 } 302 }
309 - for(CalcInterval c : list_){  
310 - String key = c.getXlName();  
311 - if(!keyMap_.containsKey(key))  
312 - keyMap_.put(key, new ArrayList<CalcInterval>());  
313 - keyMap_.get(key).add(c);  
314 - }  
315 Collections.sort(keyList, new AccountXlbmStr()); 303 Collections.sort(keyList, new AccountXlbmStr());
316 for(String key : keyList){ 304 for(String key : keyList){
317 CalcWaybill calc = keyMap.get(key).get(0); 305 CalcWaybill calc = keyMap.get(key).get(0);
@@ -356,26 +344,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -356,26 +344,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
356 calc.setSjfyylc(Arith.add(calc.getSjfyylc(), calc.getLjfyylc())); 344 calc.setSjfyylc(Arith.add(calc.getSjfyylc(), calc.getLjfyylc()));
357 lists.add(calc); 345 lists.add(calc);
358 } 346 }
359 - CalcInterval sum_ = new CalcInterval();  
360 - sum_.setXlName("合计");  
361 - sum_.setDjgTime(0);  
362 - for(String key : keyMap_.keySet()){  
363 - CalcInterval calc = keyMap_.get(key).get(0);  
364 - for(int i = 1; i < keyMap_.get(key).size(); i++){  
365 - CalcInterval calc_ = keyMap_.get(key).get(i);  
366 - calc.setDjg(calc.getDjg() + calc_.getDjg());  
367 - calc.setDjgM(calc.getDjgM() + calc_.getDjgM());  
368 - calc.setDjgA(calc.getDjgA() + calc_.getDjgA());  
369 - if(calc_.getDjgTime() > calc.getDjgTime())  
370 - calc.setDjgTime(calc_.getDjgTime());  
371 - }  
372 - sum_.setDjg(sum_.getDjg() + calc.getDjg());  
373 - sum_.setDjgM(sum_.getDjgM() + calc.getDjgM());  
374 - sum_.setDjgA(sum_.getDjgA() + calc.getDjgA());  
375 - if(calc.getDjgTime() > sum_.getDjgTime())  
376 - sum_.setDjgTime(calc.getDjgTime());  
377 - }  
378 -  
379 CalcWaybill sum = new CalcWaybill(); 347 CalcWaybill sum = new CalcWaybill();
380 sum.setXlName("合计"); 348 sum.setXlName("合计");
381 for(CalcWaybill c : lists){ 349 for(CalcWaybill c : lists){
@@ -459,22 +427,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -459,22 +427,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
459 m.put("dtbc", c.getDtbc()); 427 m.put("dtbc", c.getDtbc());
460 m.put("dtbc_m", c.getDtbczgf()); 428 m.put("dtbc_m", c.getDtbczgf());
461 m.put("dtbc_a", c.getDtbcwgf()); 429 m.put("dtbc_a", c.getDtbcwgf());
462 - if(keyMap_.containsKey(c.getXlName()) || c.getXlName().equals("合计")){  
463 - CalcInterval calc;  
464 - if(c.getXlName().equals("合计"))  
465 - calc = sum_;  
466 - else  
467 - calc = keyMap_.get(c.getXlName()).get(0);  
468 - m.put("djg", calc.getDjg());  
469 - m.put("djg_m", calc.getDjgM());  
470 - m.put("djg_a", calc.getDjgA());  
471 - m.put("djg_time", calc.getDjgTime());  
472 - } else {  
473 - m.put("djg", 0);  
474 - m.put("djg_m", 0);  
475 - m.put("djg_a", 0);  
476 - m.put("djg_time", 0);  
477 - }  
478 resList.add(m); 430 resList.add(m);
479 } 431 }
480 432
@@ -533,7 +485,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -533,7 +485,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
533 } else { 485 } else {
534 line = line.trim(); 486 line = line.trim();
535 } 487 }
536 -  
537 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); 488 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
538 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 489 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
539 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 490 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
@@ -555,6 +506,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -555,6 +506,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
555 for(Map<String, String> m : gsList){ 506 for(Map<String, String> m : gsList){
556 list.addAll(calcStatisticsRepository.scheduleByDateAndLine(line, rq, rq, m.get("gsdm"), m.get("fgsdm"))); 507 list.addAll(calcStatisticsRepository.scheduleByDateAndLine(line, rq, rq, m.get("gsdm"), m.get("fgsdm")));
557 } 508 }
  509 +
  510 + List<CalcInterval> listInterval=calcIntervalRepository.selectByDateAndCompany(rq, "", "","");
  511 + Map<String,CalcInterval> mapInterval=new HashMap<String,CalcInterval>();
  512 + for (int i = 0; i < listInterval.size(); i++) {
  513 + CalcInterval c=listInterval.get(i);
  514 + mapInterval.put(c.getXlBm(), c);
  515 + }
  516 +
558 517
559 for (int i = 0; i < list.size(); i++) { 518 for (int i = 0; i < list.size(); i++) {
560 ScheduleRealInfo s=list.get(i); 519 ScheduleRealInfo s=list.get(i);
@@ -574,19 +533,32 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -574,19 +533,32 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
574 lists.add(list.get(i)); 533 lists.add(list.get(i));
575 }else{ 534 }else{
576 lists.add(list.get(i)); 535 lists.add(list.get(i));
577 - CalcStatistics s=staticTj(lists); 536 + CalcInterval t=null;
  537 + if(mapInterval.get(lists.get(0).getXlBm())!=null){
  538 + t=mapInterval.get(lists.get(0).getXlBm());
  539 + }
  540 +
  541 + CalcStatistics s=staticTj(lists,t);
578 lMap.add(s); 542 lMap.add(s);
579 lists=new ArrayList<ScheduleRealInfo>(); 543 lists=new ArrayList<ScheduleRealInfo>();
580 } 544 }
581 }else{ 545 }else{
582 if(list.get(i).getXlBm().equals(list.get(i-1).getXlBm())){ 546 if(list.get(i).getXlBm().equals(list.get(i-1).getXlBm())){
583 lists.add(list.get(i)); 547 lists.add(list.get(i));
584 - CalcStatistics s=staticTj(lists); 548 + CalcInterval t=null;
  549 + if(mapInterval.get(lists.get(0).getXlBm())!=null){
  550 + t=mapInterval.get(lists.get(0).getXlBm());
  551 + }
  552 + CalcStatistics s=staticTj(lists,t);
585 lMap.add(s); 553 lMap.add(s);
586 }else{ 554 }else{
587 lists=new ArrayList<ScheduleRealInfo>(); 555 lists=new ArrayList<ScheduleRealInfo>();
588 lists.add(list.get(i)); 556 lists.add(list.get(i));
589 - CalcStatistics s=staticTj(lists); 557 + CalcInterval t=null;
  558 + if(mapInterval.get(lists.get(0).getXlBm())!=null){
  559 + t=mapInterval.get(lists.get(0).getXlBm());
  560 + }
  561 + CalcStatistics s=staticTj(lists,t);
590 lMap.add(s); 562 lMap.add(s);
591 } 563 }
592 } 564 }
@@ -609,7 +581,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -609,7 +581,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
609 return result; 581 return result;
610 } 582 }
611 583
612 - public final CalcStatistics staticTj(List<ScheduleRealInfo> list){ 584 + public final CalcStatistics staticTj(List<ScheduleRealInfo> list,CalcInterval t){
613 585
614 List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); 586 List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
615 for(int i=0;i<list.size();i++){ 587 for(int i=0;i<list.size();i++){
@@ -697,23 +669,30 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -697,23 +669,30 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
697 s.setDtbcq(0); 669 s.setDtbcq(0);
698 s.setDtbcz(0); 670 s.setDtbcz(0);
699 s.setDtbcw(0); 671 s.setDtbcw(0);
700 - Map<String, Object> m_=culateService.culateDjg(lists, list.get(0).getXlBm());  
701 - if(m_.containsKey("djgcsq") && m_.get("djgcsq")!=null)  
702 - s.setDjgq(Integer.valueOf(m_.get("djgcsq").toString()));  
703 - else  
704 - s.setDjgq(0);  
705 - if(m_.containsKey("djgcsz") && m_.get("djgcsz")!=null)  
706 - s.setDjgz(Integer.valueOf(m_.get("djgcsz").toString()));  
707 - else  
708 - s.setDjgz(0);  
709 - if(m_.containsKey("djgcsw") && m_.get("djgcsw")!=null)  
710 - s.setDjgw(Integer.valueOf(m_.get("djgcsw").toString()));  
711 - else  
712 - s.setDjgw(0);  
713 - if(m_.containsKey("djgsj") && m_.get("djgsj")!=null)  
714 - s.setDjgsj(Integer.valueOf(m_.get("djgsj").toString()));  
715 - else  
716 - s.setDjgsj(0); 672 + if(t==null){
  673 + Map<String, Object> m_=culateService.culateDjg(lists, list.get(0).getXlBm());
  674 + if(m_.containsKey("djgcsq") && m_.get("djgcsq")!=null)
  675 + s.setDjgq(Integer.valueOf(m_.get("djgcsq").toString()));
  676 + else
  677 + s.setDjgq(0);
  678 + if(m_.containsKey("djgcsz") && m_.get("djgcsz")!=null)
  679 + s.setDjgz(Integer.valueOf(m_.get("djgcsz").toString()));
  680 + else
  681 + s.setDjgz(0);
  682 + if(m_.containsKey("djgcsw") && m_.get("djgcsw")!=null)
  683 + s.setDjgw(Integer.valueOf(m_.get("djgcsw").toString()));
  684 + else
  685 + s.setDjgw(0);
  686 + if(m_.containsKey("djgsj") && m_.get("djgsj")!=null)
  687 + s.setDjgsj(Integer.valueOf(m_.get("djgsj").toString()));
  688 + else
  689 + s.setDjgsj(0);
  690 + }else{
  691 + s.setDjgq(t.getDjgAll());
  692 + s.setDjgz(t.getDjgZgf());
  693 + s.setDjgw(t.getDjgWgf());
  694 + s.setDjgsj(t.getDjgTime());
  695 + }
717 } 696 }
718 return s; 697 return s;
719 } 698 }
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -2558,7 +2558,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -2558,7 +2558,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
2558 @Override 2558 @Override
2559 public Map<String, Object> exportWaybillMore(Map<String, Object> map) { 2559 public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
2560 Map<String, Object> dMap=new HashMap<>(); 2560 Map<String, Object> dMap=new HashMap<>();
2561 - dMap.put("dGroup", "oilType"); 2561 + dMap.put("dGroup_eq", "oilType");
2562 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); 2562 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator();
2563 while (it.hasNext()) { 2563 while (it.hasNext()) {
2564 Dictionary d=it.next(); 2564 Dictionary d=it.next();
src/main/java/com/bsth/service/impl/LineServiceImpl.java
@@ -77,13 +77,18 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L @@ -77,13 +77,18 @@ public class LineServiceImpl extends BaseServiceImpl&lt;Line, Integer&gt; implements L
77 public Map<String, Object> update(Line l) { 77 public Map<String, Object> update(Line l) {
78 Map<String, Object> map = new HashMap<>(); 78 Map<String, Object> map = new HashMap<>();
79 79
  80 + if(l.getDestroy() == 0){
  81 + l.setInUse(1);
  82 + } else
  83 + l.setInUse(0);
  84 +
80 int status = repository.update(l.getName(), l.getCompany(), l.getBrancheCompany(), l.getLevel(), l.getNature(), 85 int status = repository.update(l.getName(), l.getCompany(), l.getBrancheCompany(), l.getLevel(), l.getNature(),
81 l.getStartStationName(), l.getEndStationName(), l.getStartStationFirstTime(), 86 l.getStartStationName(), l.getEndStationName(), l.getStartStationFirstTime(),
82 l.getStartStationEndTime(), l.getEndStationFirstTime(), l.getEndStationEndTime(), l.getLinePlayType(), 87 l.getStartStationEndTime(), l.getEndStationFirstTime(), l.getEndStationEndTime(), l.getLinePlayType(),
83 l.getOpenDate(), l.getEs(), l.getShortName(), l.getShanghaiLinecode(), l.getEqLinecode(), 88 l.getOpenDate(), l.getEs(), l.getShortName(), l.getShanghaiLinecode(), l.getEqLinecode(),
84 l.getStartPhone(), l.getEndPhone(), l.getCarSumNumber(), l.getHvacCarNumber(), l.getOrdCarNumber(), 89 l.getStartPhone(), l.getEndPhone(), l.getCarSumNumber(), l.getHvacCarNumber(), l.getOrdCarNumber(),
85 l.getHistory(), l.getDescriptions(), l.getDestroy(), l.getSupperLine(), l.getSpacGrade(), 90 l.getHistory(), l.getDescriptions(), l.getDestroy(), l.getSupperLine(), l.getSpacGrade(),
86 - l.getWarrantCar(), l.getLineCode(), l.getRegion()); 91 + l.getWarrantCar(), l.getLineCode(), l.getRegion(),l.getInUse());
87 if (status==1) { 92 if (status==1) {
88 map.put("status", ResponseCode.SUCCESS); 93 map.put("status", ResponseCode.SUCCESS);
89 } else { 94 } else {
src/main/java/com/bsth/service/jdtest/impl/JdtestServiceImpl.java
@@ -147,7 +147,7 @@ public class JdtestServiceImpl implements JdtestService { @@ -147,7 +147,7 @@ public class JdtestServiceImpl implements JdtestService {
147 } 147 }
148 }); 148 });
149 Map<String, Object> dMap=new HashMap<>(); 149 Map<String, Object> dMap=new HashMap<>();
150 - dMap.put("dGroup", "oilType"); 150 + dMap.put("dGroup_eq", "oilType");
151 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); 151 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator();
152 while (it.hasNext()) { 152 while (it.hasNext()) {
153 Dictionary d=it.next(); 153 Dictionary d=it.next();
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -78,7 +78,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -78,7 +78,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
78 78
79 Map<Integer, Integer> trustStatus(String lineCodes); 79 Map<Integer, Integer> trustStatus(String lineCodes);
80 80
81 - Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks); 81 + Map<String, Object> realOutAdjust(Map<String, String> map);
82 82
83 Map<String, Object> revokeDestroy(Long id); 83 Map<String, Object> revokeDestroy(Long id);
84 84
@@ -199,4 +199,6 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -199,4 +199,6 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
199 Map<String, Object> repairReport(Map<String, Object> map, boolean isActive); 199 Map<String, Object> repairReport(Map<String, Object> map, boolean isActive);
200 200
201 List<RepairReport> repairReportList(String line,String date,String code, String type); 201 List<RepairReport> repairReportList(String line,String date,String code, String type);
  202 +
  203 + Map<String, String> getLevelsByLines(List<String> lines);
202 } 204 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
1 package com.bsth.service.realcontrol.impl; 1 package com.bsth.service.realcontrol.impl;
2 2
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.File;
  5 +import java.io.IOException;
  6 +import java.io.InputStream;
  7 +import java.net.HttpURLConnection;
  8 +import java.net.URL;
  9 +import java.sql.ResultSet;
  10 +import java.sql.SQLException;
  11 +import java.text.DecimalFormat;
  12 +import java.text.ParseException;
  13 +import java.text.SimpleDateFormat;
  14 +import java.util.ArrayList;
  15 +import java.util.Calendar;
  16 +import java.util.Collection;
  17 +import java.util.Collections;
  18 +import java.util.Comparator;
  19 +import java.util.Date;
  20 +import java.util.GregorianCalendar;
  21 +import java.util.HashMap;
  22 +import java.util.HashSet;
  23 +import java.util.Iterator;
  24 +import java.util.List;
  25 +import java.util.Map;
  26 +import java.util.Queue;
  27 +import java.util.Set;
  28 +import java.util.concurrent.ConcurrentLinkedQueue;
  29 +import java.util.concurrent.Executors;
  30 +import java.util.concurrent.ScheduledExecutorService;
  31 +import java.util.concurrent.ThreadFactory;
  32 +import java.util.concurrent.TimeUnit;
  33 +import java.util.regex.Pattern;
  34 +
  35 +import org.apache.commons.io.IOUtils;
  36 +import org.apache.commons.lang3.StringEscapeUtils;
  37 +import org.apache.commons.lang3.StringUtils;
  38 +import org.joda.time.format.DateTimeFormat;
  39 +import org.joda.time.format.DateTimeFormatter;
  40 +import org.slf4j.Logger;
  41 +import org.slf4j.LoggerFactory;
  42 +import org.springframework.beans.factory.DisposableBean;
  43 +import org.springframework.beans.factory.InitializingBean;
  44 +import org.springframework.beans.factory.annotation.Autowired;
  45 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  46 +import org.springframework.jdbc.core.JdbcTemplate;
  47 +import org.springframework.jdbc.core.RowMapper;
  48 +import org.springframework.stereotype.Service;
  49 +import org.springframework.transaction.annotation.Transactional;
  50 +
3 import com.alibaba.fastjson.JSON; 51 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONArray; 52 import com.alibaba.fastjson.JSONArray;
5 import com.alibaba.fastjson.JSONObject; 53 import com.alibaba.fastjson.JSONObject;
@@ -25,6 +73,7 @@ import com.bsth.entity.CarDevice; @@ -25,6 +73,7 @@ import com.bsth.entity.CarDevice;
25 import com.bsth.entity.Cars; 73 import com.bsth.entity.Cars;
26 import com.bsth.entity.Line; 74 import com.bsth.entity.Line;
27 import com.bsth.entity.Personnel; 75 import com.bsth.entity.Personnel;
  76 +import com.bsth.entity.calc.CalcInterval;
28 import com.bsth.entity.oil.Dlb; 77 import com.bsth.entity.oil.Dlb;
29 import com.bsth.entity.oil.Ylb; 78 import com.bsth.entity.oil.Ylb;
30 import com.bsth.entity.oil.Ylxxb; 79 import com.bsth.entity.oil.Ylxxb;
@@ -46,6 +95,7 @@ import com.bsth.repository.CarDeviceRepository; @@ -46,6 +95,7 @@ import com.bsth.repository.CarDeviceRepository;
46 import com.bsth.repository.CarsRepository; 95 import com.bsth.repository.CarsRepository;
47 import com.bsth.repository.LineRepository; 96 import com.bsth.repository.LineRepository;
48 import com.bsth.repository.RepairReportRepository; 97 import com.bsth.repository.RepairReportRepository;
  98 +import com.bsth.repository.calc.CalcIntervalRepository;
49 import com.bsth.repository.oil.DlbRepository; 99 import com.bsth.repository.oil.DlbRepository;
50 import com.bsth.repository.oil.YlbRepository; 100 import com.bsth.repository.oil.YlbRepository;
51 import com.bsth.repository.oil.YlxxbRepository; 101 import com.bsth.repository.oil.YlxxbRepository;
@@ -66,7 +116,16 @@ import com.bsth.service.report.ReportService; @@ -66,7 +116,16 @@ import com.bsth.service.report.ReportService;
66 import com.bsth.service.schedule.SchedulePlanInfoService; 116 import com.bsth.service.schedule.SchedulePlanInfoService;
67 import com.bsth.service.sys.DictionaryService; 117 import com.bsth.service.sys.DictionaryService;
68 import com.bsth.service.sys.DutyEmployeeService; 118 import com.bsth.service.sys.DutyEmployeeService;
69 -import com.bsth.util.*; 119 +import com.bsth.util.Arith;
  120 +import com.bsth.util.ComparableChild;
  121 +import com.bsth.util.ComparableLp;
  122 +import com.bsth.util.ComparableReal;
  123 +import com.bsth.util.ConfigUtil;
  124 +import com.bsth.util.DateUtils;
  125 +import com.bsth.util.ReportRelatedUtils;
  126 +import com.bsth.util.ReportUtils;
  127 +import com.bsth.util.TimeUtils;
  128 +import com.bsth.util.TransGPS;
70 import com.bsth.websocket.handler.SendUtils; 129 import com.bsth.websocket.handler.SendUtils;
71 import com.fasterxml.jackson.databind.ObjectMapper; 130 import com.fasterxml.jackson.databind.ObjectMapper;
72 import com.github.stuxuhai.jpinyin.PinyinException; 131 import com.github.stuxuhai.jpinyin.PinyinException;
@@ -75,37 +134,9 @@ import com.github.stuxuhai.jpinyin.PinyinHelper; @@ -75,37 +134,9 @@ import com.github.stuxuhai.jpinyin.PinyinHelper;
75 import com.google.common.base.Splitter; 134 import com.google.common.base.Splitter;
76 import com.google.common.collect.Lists; 135 import com.google.common.collect.Lists;
77 136
78 -import org.apache.commons.io.IOUtils;  
79 -import org.apache.commons.lang3.StringEscapeUtils;  
80 -import org.apache.commons.lang3.StringUtils;  
81 -import org.joda.time.format.DateTimeFormat;  
82 -import org.joda.time.format.DateTimeFormatter;  
83 -import org.slf4j.Logger;  
84 -import org.slf4j.LoggerFactory;  
85 -import org.springframework.beans.factory.annotation.Autowired;  
86 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
87 -import org.springframework.jdbc.core.JdbcTemplate;  
88 -import org.springframework.jdbc.core.RowMapper;  
89 -import org.springframework.stereotype.Service;  
90 -import org.springframework.transaction.annotation.Transactional;  
91 -  
92 -import java.io.ByteArrayOutputStream;  
93 -import java.io.File;  
94 -import java.io.IOException;  
95 -import java.io.InputStream;  
96 -import java.net.HttpURLConnection;  
97 -import java.net.URL;  
98 -import java.sql.ResultSet;  
99 -import java.sql.SQLException;  
100 -import java.text.DecimalFormat;  
101 -import java.text.ParseException;  
102 -import java.text.SimpleDateFormat;  
103 -import java.util.*;  
104 -import java.util.regex.Pattern;  
105 -  
106 @Service 137 @Service
107 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> 138 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
108 - implements ScheduleRealInfoService { 139 + implements ScheduleRealInfoService, InitializingBean, DisposableBean {
109 @Autowired 140 @Autowired
110 JdbcTemplate jdbcTemplate; 141 JdbcTemplate jdbcTemplate;
111 @Autowired 142 @Autowired
@@ -125,6 +156,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -125,6 +156,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
125 156
126 @Autowired 157 @Autowired
127 DictionaryService dictionaryService; 158 DictionaryService dictionaryService;
  159 +
  160 + @Autowired
  161 + CalcIntervalRepository calcIntervalRepository;
128 /*@Autowired 162 /*@Autowired
129 BorrowCenter borrowCenter;*/ 163 BorrowCenter borrowCenter;*/
130 164
@@ -186,6 +220,42 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -186,6 +220,42 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
186 220
187 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 221 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
188 sdfSimple = new SimpleDateFormat("yyyyMMdd"); 222 sdfSimple = new SimpleDateFormat("yyyyMMdd");
  223 +
  224 + private Queue<RepairReport> queue = new ConcurrentLinkedQueue<>();
  225 +
  226 + private ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
  227 +
  228 + @Override
  229 + public Thread newThread(Runnable r) {
  230 + // TODO Auto-generated method stub
  231 + Thread t = new Thread(r);
  232 + t.setName("RepairReportReissuer");
  233 +
  234 + return t;
  235 + }
  236 + });
  237 +
  238 + private static Map<String, String> report2repair = new HashMap<String, String>();
  239 +
  240 + static {
  241 + report2repair.put("9101", "9109");
  242 + report2repair.put("9102", "9102");
  243 + report2repair.put("9103", "9103");
  244 + report2repair.put("9104", "9104");
  245 + report2repair.put("9109", "9109");
  246 + report2repair.put("9201", "9201");
  247 + report2repair.put("9202", "9202");
  248 + report2repair.put("9203", "9203");
  249 + report2repair.put("9204", "9204");
  250 + report2repair.put("9209", "9209");
  251 + report2repair.put("9301", "9301");
  252 + report2repair.put("9302", "9302");
  253 + report2repair.put("9303", "9303");
  254 + report2repair.put("9304", "9304");
  255 + report2repair.put("9305", "9305");
  256 + report2repair.put("9306", "9306");
  257 + report2repair.put("9309", "9309");
  258 + }
189 259
190 260
191 /** 261 /**
@@ -1379,10 +1449,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1379,10 +1449,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1379 } 1449 }
1380 1450
1381 @Override 1451 @Override
1382 - public Map<String, Object> realOutAdjust(Long id, String fcsjActual, String remarks) { 1452 + public Map<String, Object> realOutAdjust(Map<String, String> map) {
1383 Map<String, Object> rs = new HashMap<>(); 1453 Map<String, Object> rs = new HashMap<>();
1384 List<ScheduleRealInfo> ts = new ArrayList<>(); 1454 List<ScheduleRealInfo> ts = new ArrayList<>();
1385 try { 1455 try {
  1456 + // 维修上报
  1457 + if (StringUtils.isNotBlank(map.get("reportTypes"))) {
  1458 + Map<String, Object> param = new HashMap<String, Object>();
  1459 + param.putAll(map);
  1460 + rs = repairReport(param, false);
  1461 + }
  1462 +
  1463 + Long id = Long.parseLong(map.get("id"));
  1464 + String remarks = map.get("remarks"), fcsjActual = map.get("fcsjActual");
  1465 +
1386 ScheduleRealInfo sch = dayOfSchedule.get(id); 1466 ScheduleRealInfo sch = dayOfSchedule.get(id);
1387 1467
1388 LineConfig config = lineConfigData.get(sch.getXlBm()); 1468 LineConfig config = lineConfigData.get(sch.getXlBm());
@@ -1541,7 +1621,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1541,7 +1621,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1541 List<ScheduleRealInfo> ts = new ArrayList<>(); 1621 List<ScheduleRealInfo> ts = new ArrayList<>();
1542 try { 1622 try {
1543 // 维修上报 1623 // 维修上报
1544 - if (StringUtils.isNotBlank(map.get("repairTypes"))) { 1624 + if (StringUtils.isNotBlank(map.get("reportTypes"))) {
1545 Map<String, Object> param = new HashMap<String, Object>(); 1625 Map<String, Object> param = new HashMap<String, Object>();
1546 param.putAll(map); 1626 param.putAll(map);
1547 rs = repairReport(param, false); 1627 rs = repairReport(param, false);
@@ -2627,11 +2707,21 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2627,11 +2707,21 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2627 map.put("dtbc", 0); 2707 map.put("dtbc", 0);
2628 map.put("dtbc_m", 0); 2708 map.put("dtbc_m", 0);
2629 map.put("dtbc_a", 0); 2709 map.put("dtbc_a", 0);
2630 - Map<String, Object> m = culateService.culateDjg(list_s, line);  
2631 - map.put("djg", m.get("djgcsq"));  
2632 - map.put("djg_m", m.get("djgcsz"));  
2633 - map.put("djg_a", m.get("djgcsw"));  
2634 - map.put("djg_time", m.get("djgsj")); 2710 + List<CalcInterval> intervalList=calcIntervalRepository.selectByDateAndLine(line, date,"");
  2711 + if(intervalList.size()>0){
  2712 + CalcInterval c=intervalList.get(0);
  2713 + map.put("djg",c.getDjgAll());
  2714 + map.put("djg_m", c.getDjgZgf());
  2715 + map.put("djg_a", c.getDjgWgf());
  2716 + map.put("djg_time", c.getDjgTime());
  2717 + }else{
  2718 + Map<String, Object> m = culateService.culateDjg(list_s, line);
  2719 + map.put("djg", m.get("djgcsq"));
  2720 + map.put("djg_m", m.get("djgcsz"));
  2721 + map.put("djg_a", m.get("djgcsw"));
  2722 + map.put("djg_time", m.get("djgsj"));
  2723 + }
  2724 +
2635 map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); 2725 map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl));
2636 lMap.add(map); 2726 lMap.add(map);
2637 2727
@@ -2733,7 +2823,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2733,7 +2823,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2733 return lMap; 2823 return lMap;
2734 } 2824 }
2735 2825
2736 - public final Map<String, Object> staticTj(List<ScheduleRealInfo> list) { 2826 + public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,Map<String, Object> m) {
2737 2827
2738 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 2828 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
2739 for (int i = 0; i < list.size(); i++) { 2829 for (int i = 0; i < list.size(); i++) {
@@ -2819,11 +2909,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2819,11 +2909,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2819 map.put("dtbc", 0); 2909 map.put("dtbc", 0);
2820 map.put("dtbc_m", 0); 2910 map.put("dtbc_m", 0);
2821 map.put("dtbc_a", 0); 2911 map.put("dtbc_a", 0);
2822 - Map<String, Object> m_ = culateService.culateDjg(lists, list.get(0).getXlBm());  
2823 - map.put("djg", m_.get("djgcsq"));  
2824 - map.put("djg_m", m_.get("djgcsz"));  
2825 - map.put("djg_a", m_.get("djgcsw"));  
2826 - map.put("djg_time", m_.get("djgsj")); 2912 + if(m.get("xl")==null){
  2913 + Map<String, Object> m_ = culateService.culateDjg(lists, list.get(0).getXlBm());
  2914 + map.put("djg", m_.get("djgcsq"));
  2915 + map.put("djg_m", m_.get("djgcsz"));
  2916 + map.put("djg_a", m_.get("djgcsw"));
  2917 + map.put("djg_time", m_.get("djgsj"));
  2918 + }else{
  2919 + map.put("djg", m.get("djgAll")==null?"0":m.get("djgAll"));
  2920 + map.put("djg_m", m.get("djgZgf")==null?"0":m.get("djgZgf"));
  2921 + map.put("djg_a", m.get("djgWgf")==null?"0":m.get("djgWgf"));
  2922 + map.put("djg_time", m.get("djgTime")==null?"0":m.get("djgTime"));
  2923 + }
2827 } 2924 }
2828 return map; 2925 return map;
2829 } 2926 }
@@ -2834,14 +2931,33 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2834,14 +2931,33 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2834 List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); 2931 List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>();
2835 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 2932 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
2836 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 2933 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
  2934 + List<Object[]> listInterval=new ArrayList<Object[]>();
2837 line = line.trim(); 2935 line = line.trim();
2838 if (line.equals("")) { 2936 if (line.equals("")) {
2839 //查询所有线路 2937 //查询所有线路
2840 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); 2938 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm);
  2939 + listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2);
2841 } else { 2940 } else {
2842 //查询单条线路 2941 //查询单条线路
2843 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); 2942 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2);
2844 - } 2943 + listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2);
  2944 + }
  2945 + Map<String, Map<String,Object>> mapInterval=new HashMap<String, Map<String,Object>>();
  2946 + for (int i = 0; i < listInterval.size(); i++) {
  2947 + Object[] interval=listInterval.get(i);
  2948 + String gs=interval[0].toString();
  2949 + String fgs=interval[1].toString();
  2950 + String xl=interval[2].toString();
  2951 + Map<String, Object> m=new HashMap<String,Object>();
  2952 + m.put("gs", gs);
  2953 + m.put("fgs", fgs);
  2954 + m.put("xl", xl);
  2955 + m.put("djgAll", interval[3]);
  2956 + m.put("djgZgf", interval[6]);
  2957 + m.put("djgWgf", interval[7]);
  2958 + m.put("djgTime", interval[8]);
  2959 + mapInterval.put(gs+"-"+fgs+"-"+xl, m);
  2960 + }
2845 Map<String, Boolean> lineMap=lineService.lineNature(); 2961 Map<String, Boolean> lineMap=lineService.lineNature();
2846 List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); 2962 List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2847 for (int i = 0; i < listAll.size(); i++) { 2963 for (int i = 0; i < listAll.size(); i++) {
@@ -2876,19 +2992,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2876,19 +2992,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2876 lists.add(list.get(i)); 2992 lists.add(list.get(i));
2877 } else { 2993 } else {
2878 lists.add(list.get(i)); 2994 lists.add(list.get(i));
2879 - Map<String, Object> map = staticTj(lists); 2995 + Map<String, Object> mm=new HashMap<String,Object>();
  2996 + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
  2997 + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm());
  2998 + }
  2999 + Map<String, Object> map = staticTj(lists,mm);
2880 lMap.add(map); 3000 lMap.add(map);
2881 lists = new ArrayList<ScheduleRealInfo>(); 3001 lists = new ArrayList<ScheduleRealInfo>();
2882 } 3002 }
2883 } else { 3003 } else {
2884 if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { 3004 if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) {
2885 lists.add(list.get(i)); 3005 lists.add(list.get(i));
2886 - Map<String, Object> map = staticTj(lists); 3006 + Map<String, Object> mm=new HashMap<String,Object>();
  3007 + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
  3008 + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm());
  3009 + }
  3010 + Map<String, Object> map = staticTj(lists,mm);
2887 lMap.add(map); 3011 lMap.add(map);
2888 } else { 3012 } else {
2889 lists = new ArrayList<ScheduleRealInfo>(); 3013 lists = new ArrayList<ScheduleRealInfo>();
2890 lists.add(list.get(i)); 3014 lists.add(list.get(i));
2891 - Map<String, Object> map = staticTj(lists); 3015 + Map<String, Object> mm=new HashMap<String,Object>();
  3016 + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
  3017 + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm());
  3018 + }
  3019 + Map<String, Object> map = staticTj(lists,mm);
2892 lMap.add(map); 3020 lMap.add(map);
2893 } 3021 }
2894 } 3022 }
@@ -3028,14 +3156,34 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3028,14 +3156,34 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3028 List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); 3156 List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>();
3029 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 3157 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
3030 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 3158 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
  3159 + List<Object[]> listInterval=new ArrayList<Object[]>();
  3160 +
3031 line = line.trim(); 3161 line = line.trim();
3032 if (line.equals("")) { 3162 if (line.equals("")) {
3033 //查询所有线路 3163 //查询所有线路
3034 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); 3164 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm);
  3165 + listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2);
3035 } else { 3166 } else {
3036 //查询单条线路 3167 //查询单条线路
3037 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); 3168 listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2);
3038 - } 3169 + listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2);
  3170 + }
  3171 + Map<String, Map<String,Object>> mapInterval=new HashMap<>();
  3172 + for (int i = 0; i < listInterval.size(); i++) {
  3173 + Object[] interval=listInterval.get(i);
  3174 + String gs=interval[0].toString();
  3175 + String fgs=interval[1].toString();
  3176 + String xl=interval[2].toString();
  3177 + Map<String, Object> m=new HashMap<String,Object>();
  3178 + m.put("gs", gs);
  3179 + m.put("fgs", fgs);
  3180 + m.put("xl", xl);
  3181 + m.put("djgAll", interval[3]);
  3182 + m.put("djgZgf", interval[6]);
  3183 + m.put("djgWgf", interval[7]);
  3184 + m.put("djgTime", interval[8]);
  3185 + mapInterval.put(gs+"-"+fgs+"-"+xl, m);
  3186 + }
3039 3187
3040 Map<String, Boolean> lineMap=lineService.lineNature(); 3188 Map<String, Boolean> lineMap=lineService.lineNature();
3041 List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); 3189 List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
@@ -3071,19 +3219,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3071,19 +3219,31 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3071 lists.add(list.get(i)); 3219 lists.add(list.get(i));
3072 } else { 3220 } else {
3073 lists.add(list.get(i)); 3221 lists.add(list.get(i));
3074 - Map<String, Object> map = staticTj(lists); 3222 + Map<String, Object> mm=new HashMap<String,Object>();
  3223 + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
  3224 + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm());
  3225 + }
  3226 + Map<String, Object> map = staticTj(lists,mm);
3075 lMap.add(map); 3227 lMap.add(map);
3076 lists = new ArrayList<ScheduleRealInfo>(); 3228 lists = new ArrayList<ScheduleRealInfo>();
3077 } 3229 }
3078 } else { 3230 } else {
3079 if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { 3231 if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) {
3080 lists.add(list.get(i)); 3232 lists.add(list.get(i));
3081 - Map<String, Object> map = staticTj(lists); 3233 + Map<String, Object> mm=new HashMap<String,Object>();
  3234 + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
  3235 + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm());
  3236 + }
  3237 + Map<String, Object> map = staticTj(lists,mm);
3082 lMap.add(map); 3238 lMap.add(map);
3083 } else { 3239 } else {
3084 lists = new ArrayList<ScheduleRealInfo>(); 3240 lists = new ArrayList<ScheduleRealInfo>();
3085 lists.add(list.get(i)); 3241 lists.add(list.get(i));
3086 - Map<String, Object> map = staticTj(lists); 3242 + Map<String, Object> mm=new HashMap<String,Object>();
  3243 + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){
  3244 + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm());
  3245 + }
  3246 + Map<String, Object> map = staticTj(lists,mm);
3087 lMap.add(map); 3247 lMap.add(map);
3088 } 3248 }
3089 } 3249 }
@@ -4598,7 +4758,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4598,7 +4758,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4598 public Map<String, Object> MapById(Long id) { 4758 public Map<String, Object> MapById(Long id) {
4599 // TODO Auto-generated method stub 4759 // TODO Auto-generated method stub
4600 Map<String, Object> dMap=new HashMap<>(); 4760 Map<String, Object> dMap=new HashMap<>();
4601 - dMap.put("dGroup", "oilType"); 4761 + dMap.put("dGroup_eq", "oilType");
4602 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); 4762 Iterator<Dictionary> it= dictionaryService.list(dMap).iterator();
4603 while (it.hasNext()) { 4763 while (it.hasNext()) {
4604 Dictionary d=it.next(); 4764 Dictionary d=it.next();
@@ -5210,20 +5370,22 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5210,20 +5370,22 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5210 fcsjm = String.valueOf(fcsjActural_ - fcsj_); 5370 fcsjm = String.valueOf(fcsjActural_ - fcsj_);
5211 } 5371 }
5212 } 5372 }
5213 - String[] dfsj_s =schedule.getDfsj().split(":");  
5214 - Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]);  
5215 - if ((dfsj_ - fcsjActural_) > 0) {  
5216 - if(dfsj_ - fcsjActural_>1200){  
5217 - dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_));  
5218 - }else{  
5219 - dfsjk = String.valueOf(dfsj_ - fcsjActural_);  
5220 - }  
5221 - } else {  
5222 - if(fcsjActural_ - dfsj_>1200){  
5223 - dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_));  
5224 - }else{  
5225 - dfsjm = String.valueOf(fcsjActural_ - dfsj_);  
5226 - } 5373 + if(df.equals("df")){
  5374 + String[] dfsj_s =schedule.getDfsj().split(":");
  5375 + Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]);
  5376 + if ((dfsj_ - fcsjActural_) > 0) {
  5377 + if(dfsj_ - fcsjActural_>1200){
  5378 + dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_));
  5379 + }else{
  5380 + dfsjk = String.valueOf(dfsj_ - fcsjActural_);
  5381 + }
  5382 + } else {
  5383 + if(fcsjActural_ - dfsj_>1200){
  5384 + dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_));
  5385 + }else{
  5386 + dfsjm = String.valueOf(fcsjActural_ - dfsj_);
  5387 + }
  5388 + }
5227 } 5389 }
5228 } 5390 }
5229 if(df.equals("df")){ 5391 if(df.equals("df")){
@@ -6113,14 +6275,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6113,14 +6275,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6113 6275
6114 int reportState = -1; 6276 int reportState = -1;
6115 SysUser user = SecurityUtils.getCurrentUser(); 6277 SysUser user = SecurityUtils.getCurrentUser();
6116 - String reportUser = user.getUserName(), reportName = user.getName(), incode = (String)param.get("clZbh"), repairTypes = (String)param.get("repairTypes"); 6278 + String reportUser = user.getUserName(), reportName = user.getName(), incode = (String)param.get("clZbh"), reportTypes = (String)param.get("reportTypes"), repairTypes = reportType2RepairType(reportTypes);
6117 // 分公司保存格式 分公司编码_公司编码 6279 // 分公司保存格式 分公司编码_公司编码
6118 String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode); 6280 String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode);
6119 String[] arr = val.split("_"); 6281 String[] arr = val.split("_");
6120 StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1])); 6282 StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1]));
6121 url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); 6283 url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]);
6122 6284
6123 - int count = repairReportRepository.repairReportBySch(id, 0); 6285 + int count = repairReportRepository.repairReportBySch(id, isActive ? 1 : 0);
6124 if (count > 0) return res; 6286 if (count > 0) return res;
6125 RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode); 6287 RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode);
6126 // 非主动上报并且无上报记录或上次已上报 则不用上报 6288 // 非主动上报并且无上报记录或上次已上报 则不用上报
@@ -6140,15 +6302,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6140,15 +6302,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6140 rr.setIncode(incode); 6302 rr.setIncode(incode);
6141 rr.setDepartureTime(sch.getFcsj()); 6303 rr.setDepartureTime(sch.getFcsj());
6142 rr.setRepairType(repairTypes); 6304 rr.setRepairType(repairTypes);
  6305 + rr.setReportType(reportTypes);
6143 rr.setReportDate(new Date()); 6306 rr.setReportDate(new Date());
6144 rr.setReportState(reportState); 6307 rr.setReportState(reportState);
6145 rr.setReportMode(isActive ? 1 : 0); 6308 rr.setReportMode(isActive ? 1 : 0);
6146 - repairReportRepository.save(rr); 6309 + rr = repairReportRepository.save(rr);
6147 dayOfSchedule.setLastestRepairReport(rr); 6310 dayOfSchedule.setLastestRepairReport(rr);
  6311 + // 如果上报失败,放到重传队列
  6312 + if (rr.getReportState() == -1) queue.add(rr);
6148 6313
6149 return res; 6314 return res;
6150 } 6315 }
6151 6316
  6317 + private void repairReport(RepairReport rr) {
  6318 + int reportState = -1;
  6319 + // 分公司保存格式 分公司编码_公司编码
  6320 + String val = BasicData.nbbm2FgsCompanyCodeMap.get(rr.getIncode());
  6321 + String[] arr = val.split("_");
  6322 + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url." + arr[1]));
  6323 + url.append("?nbbm=").append(rr.getIncode()).append("&bxy=").append(rr.getReportUser()).append("&bxbm=").append(rr.getRepairType()).append("&fgs=").append(arr[0]);
  6324 +
  6325 + Map<String, Object> res = request(url.toString());
  6326 + if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1;
  6327 + if (reportState == 1) {
  6328 + rr.setReportState(1);
  6329 + repairReportRepository.save(rr);
  6330 + }
  6331 + }
  6332 +
  6333 + /**
  6334 + ** 业务类型转报修类型
  6335 + */
  6336 + private String reportType2RepairType(String reportType) {
  6337 + String[] reportTypes = reportType.split(";");
  6338 + List<String> repairTypes = new ArrayList<>();
  6339 + for (String rt : reportTypes) {
  6340 + repairTypes.add(report2repair.get(rt));
  6341 + }
  6342 +
  6343 + return StringUtils.join(repairTypes, ";");
  6344 + }
  6345 +
6152 @Override 6346 @Override
6153 public List<RepairReport> repairReportList(String lineId, String date, String incode, String type) { 6347 public List<RepairReport> repairReportList(String lineId, String date, String incode, String type) {
6154 List<RepairReport> result = new ArrayList<RepairReport>(); 6348 List<RepairReport> result = new ArrayList<RepairReport>();
@@ -6168,14 +6362,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6168,14 +6362,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6168 6362
6169 result = repairReportRepository.repairReportList(lineId, start, end, incode); 6363 result = repairReportRepository.repairReportList(lineId, start, end, incode);
6170 Map<String, Object> dMap=new HashMap<>(); 6364 Map<String, Object> dMap=new HashMap<>();
6171 - dMap.put("dGroup", "repairtype"); 6365 + dMap.put("dGroup_eq", "repairtype");
6172 Map<String, String> code2name = new HashMap<String, String>(); 6366 Map<String, String> code2name = new HashMap<String, String>();
6173 for (Dictionary dic : dictionaryService.list(dMap)) { 6367 for (Dictionary dic : dictionaryService.list(dMap)) {
6174 code2name.put(dic.getdCode(), dic.getdName()); 6368 code2name.put(dic.getdCode(), dic.getdName());
6175 } 6369 }
6176 for (RepairReport rr : result) { 6370 for (RepairReport rr : result) {
6177 - String repairType = rr.getRepairType();  
6178 - String[] types = repairType.split(";"); 6371 + String reportType = rr.getReportType();
  6372 + String[] types = reportType.split(";");
6179 StringBuilder sb = new StringBuilder(); 6373 StringBuilder sb = new StringBuilder();
6180 6374
6181 for (String t : types) { 6375 for (String t : types) {
@@ -6234,6 +6428,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -6234,6 +6428,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
6234 6428
6235 return result; 6429 return result;
6236 } 6430 }
  6431 +
  6432 + @Override
  6433 + public Map<String, String> getLevelsByLines(List<String> lines) {
  6434 + Map<String, String> result = new HashMap<String, String>(), currSchDate = dayOfSchedule.getCurrSchDate();
  6435 + for (String line : lines) {
  6436 + String level = BasicData.lineDate2Level.get(line + "_" + currSchDate.get(line));
  6437 + result.put(line, level == null ? "" : level);
  6438 + }
  6439 +
  6440 + return result;
  6441 + }
  6442 +
  6443 +
  6444 + @Override
  6445 + public void destroy() throws Exception {
  6446 + // TODO Auto-generated method stub
  6447 + exec.shutdown();
  6448 + }
  6449 +
  6450 +
  6451 + @Override
  6452 + public void afterPropertiesSet() throws Exception {
  6453 + // TODO Auto-generated method stub
  6454 + // 维修上报重发调度
  6455 + exec.scheduleAtFixedRate(new Runnable() {
  6456 +
  6457 + @Override
  6458 + public void run() {
  6459 + // TODO Auto-generated method stub
  6460 + try {
  6461 + Iterator<RepairReport> it = queue.iterator();
  6462 + while (it.hasNext()) {
  6463 + RepairReport rr = it.next();
  6464 + repairReport(rr);
  6465 + if (rr.getReportState() == 1 || System.currentTimeMillis() - rr.getReportDate().getTime() > 86400000) queue.remove(rr);
  6466 + }
  6467 + } catch (Exception e) {
  6468 + logger.error("维修上报重发错误", e);
  6469 + }
  6470 + }
  6471 + }, 30, 30, TimeUnit.MINUTES);
  6472 + }
6237 } 6473 }
6238 6474
6239 class AccountMap implements Comparator<Map<String, Object>> { 6475 class AccountMap implements Comparator<Map<String, Object>> {
src/main/java/com/bsth/service/report/CalcSheetService.java
@@ -10,6 +10,7 @@ import com.bsth.service.BaseService; @@ -10,6 +10,7 @@ import com.bsth.service.BaseService;
10 public interface CalcSheetService extends BaseService<CalcSheet, Integer>{ 10 public interface CalcSheetService extends BaseService<CalcSheet, Integer>{
11 public List<CalcSheet> countListCalcSheet(Map<String, Object> map); 11 public List<CalcSheet> countListCalcSheet(Map<String, Object> map);
12 public List<CalcSheet> calcListSheet(Map<String, Object> map); 12 public List<CalcSheet> calcListSheet(Map<String, Object> map);
  13 + public List<CalcSheet> calcListSheet_d(Map<String, Object> map);
13 public List<Sheet> calcSheet(Map<String, Object> map); 14 public List<Sheet> calcSheet(Map<String, Object> map);
14 public List<Map<String, Object>> calcTurnoutrate(Map<String, Object> map); 15 public List<Map<String, Object>> calcTurnoutrate(Map<String, Object> map);
15 public List<Map<String, Object>> calcTurnoutrateZgf(Map<String, Object> map); 16 public List<Map<String, Object>> calcTurnoutrateZgf(Map<String, Object> map);
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java
@@ -179,6 +179,70 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -179,6 +179,70 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
179 String endDate=map.get("endDate").toString(); 179 String endDate=map.get("endDate").toString();
180 String sql="select * from bsth_c_calc_sheet where date >= '"+date+"' and " 180 String sql="select * from bsth_c_calc_sheet where date >= '"+date+"' and "
181 + " date <= '"+endDate+"' and xl = '"+line+"' order by date"; 181 + " date <= '"+endDate+"' and xl = '"+line+"' order by date";
  182 +
  183 + List<CalcSheet> list=jdbcTemplate.query(sql,
  184 + new RowMapper<CalcSheet>(){
  185 + @Override
  186 + public CalcSheet mapRow(ResultSet rs, int rowNum) throws SQLException {
  187 + CalcSheet s=new CalcSheet();
  188 + s.setGsdm(rs.getString("gsdm"));
  189 + s.setFgsdm(rs.getString("fgsdm"));
  190 + s.setXl(rs.getString("xl"));
  191 + s.setXlName(rs.getString("xl_name"));
  192 + s.setId(rs.getInt("id"));
  193 + s.setDate(rs.getString("date"));
  194 + s.setJhszfcs(rs.getString("jhszfcs"));
  195 + s.setSjszfczds(rs.getString("sjszfczds"));
  196 + s.setSzfczdl(rs.getString("szfczdl"));
  197 + s.setSjszddzds(rs.getString("sjszddzds"));
  198 + s.setSzddzdl(rs.getString("szddzdl"));
  199 + return s;
  200 + }
  201 + });
  202 + if(map.get("type").equals("export")){
  203 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  204 + for (int i = 0; i < list.size(); i++) {
  205 + Map<String, Object> m = new HashMap<String, Object>();
  206 + CalcSheet c = list.get(i);
  207 + m.put("gs", c.getGsname());
  208 + m.put("fgs", c.getFgsname());
  209 + m.put("date", c.getDate());
  210 + m.put("line", c.getXlName());
  211 + m.put("bcs", c.getJhszfcs());
  212 + m.put("zdbcs", c.getSjszfczds());
  213 + m.put("zdlv", c.getSzfczdl()+"%");
  214 + m.put("ddzdbcs", c.getSjszddzds());
  215 + m.put("ddzdlv", c.getSzddzdl()+"%");
  216 + tempList.add(m);
  217 + }
  218 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  219 + Map<String, Object> m = new HashMap<String, Object>();
  220 + m.put("date", date);
  221 + m.put("endDate", endDate);
  222 + ReportUtils ee = new ReportUtils();
  223 + try {
  224 + listI.add(tempList.iterator());
  225 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  226 + ee.excelReplace(listI, new Object[]{m}, path + "mould/" + "calcSheetList1.xls",
  227 + path + "export/发车到站准点率"+date.replaceAll("-", "")+"-"+endDate.replaceAll("-", "")+".xls");
  228 + } catch (Exception e) {
  229 + // TODO: handle exception
  230 + e.printStackTrace();
  231 + }
  232 + }
  233 + return list;
  234 + }
  235 +
  236 + @Override
  237 + public List<CalcSheet> calcListSheet_d(Map<String, Object> map) {
  238 + // TODO Auto-generated method stub
  239 + String line=map.get("line").toString();
  240 + String date=map.get("date").toString();
  241 + String endDate=map.get("endDate").toString();
  242 + String sql=" select b.* from (select date from bsth_c_calc_interval where date>='"+date+"' and date <='"+endDate+"'"
  243 + + " and xl_bm='"+line+"' and `level`='D' group by date ) a left join ( "
  244 + + "select * from bsth_c_calc_sheet where date >= '"+date+"' and "
  245 + + " date <= '"+endDate+"' and xl = '"+line+"' order by date ) b on a.date =b.date";
182 List<CalcSheet> list=jdbcTemplate.query(sql, 246 List<CalcSheet> list=jdbcTemplate.query(sql,
183 new RowMapper<CalcSheet>(){ 247 new RowMapper<CalcSheet>(){
184 @Override 248 @Override
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -852,12 +852,12 @@ public class ReportServiceImpl implements ReportService{ @@ -852,12 +852,12 @@ public class ReportServiceImpl implements ReportService{
852 String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM " 852 String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM "
853 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " 853 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
854 + " fcsj <='"+minfcsj+"' and bc_type!='ldks'" 854 + " fcsj <='"+minfcsj+"' and bc_type!='ldks'"
855 - + " and bc_type !='region') " 855 + + " and bc_type !='region' and bc_type !='venting' and bc_type !='major') "
856 + " union " 856 + " union "
857 + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM " 857 + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
858 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " 858 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
859 + " fcsj > '"+minfcsj+"' and bc_type!='ldks' " 859 + " fcsj > '"+minfcsj+"' and bc_type!='ldks' "
860 - + " and bc_type !='region') " 860 + + " and bc_type !='region' and bc_type !='venting' and bc_type !='major') "
861 + " order by xh, lp,fcsj"; 861 + " order by xh, lp,fcsj";
862 Map<String, Object> map=new HashMap<String,Object>(); 862 Map<String, Object> map=new HashMap<String,Object>();
863 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, 863 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
src/main/java/com/bsth/util/HttpClientUtils.java
@@ -2,6 +2,7 @@ package com.bsth.util; @@ -2,6 +2,7 @@ package com.bsth.util;
2 2
3 import org.apache.http.HttpEntity; 3 import org.apache.http.HttpEntity;
4 import org.apache.http.client.config.RequestConfig; 4 import org.apache.http.client.config.RequestConfig;
  5 +import org.apache.http.client.entity.EntityBuilder;
5 import org.apache.http.client.methods.CloseableHttpResponse; 6 import org.apache.http.client.methods.CloseableHttpResponse;
6 import org.apache.http.client.methods.HttpGet; 7 import org.apache.http.client.methods.HttpGet;
7 import org.apache.http.client.methods.HttpPost; 8 import org.apache.http.client.methods.HttpPost;
@@ -63,7 +64,7 @@ public class HttpClientUtils { @@ -63,7 +64,7 @@ public class HttpClientUtils {
63 HttpPost post = new HttpPost(url); 64 HttpPost post = new HttpPost(url);
64 65
65 post.setHeader("Accept", "application/json"); 66 post.setHeader("Accept", "application/json");
66 - post.setHeader("Content-Type", "application/json"); 67 + post.setHeader("Content-Type", "application/json;charset=UTF-8");
67 //超时时间 68 //超时时间
68 RequestConfig requestConfig = RequestConfig.custom() 69 RequestConfig requestConfig = RequestConfig.custom()
69 .setConnectTimeout(2500).setConnectionRequestTimeout(2000) 70 .setConnectTimeout(2500).setConnectionRequestTimeout(2000)
src/main/java/com/bsth/util/ReportRegisterHTTPUtil.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import org.apache.http.client.methods.CloseableHttpResponse;
  4 +import org.apache.http.client.methods.HttpGet;
  5 +import org.apache.http.client.methods.HttpPost;
  6 +import org.apache.http.impl.client.CloseableHttpClient;
  7 +import org.apache.http.impl.client.HttpClients;
  8 +import org.apache.http.util.EntityUtils;
  9 +
  10 +import javax.servlet.ServletException;
  11 +import javax.servlet.annotation.WebServlet;
  12 +import javax.servlet.http.HttpServlet;
  13 +import javax.servlet.http.HttpServletRequest;
  14 +import javax.servlet.http.HttpServletResponse;
  15 +import java.io.IOException;
  16 +
  17 +
  18 +@WebServlet("/FromAjaxservlet")
  19 +public class ReportRegisterHTTPUtil extends HttpServlet {
  20 +
  21 +
  22 + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  23 + try {
  24 + //创建默认连接
  25 + CloseableHttpClient httpClient = HttpClients.createDefault();
  26 + //创建HttpGet对象,处理get请求,转发到A站点
  27 + HttpPost httpPost = new HttpPost("http://114.80.178.13/complaint/TsReport/input.do");
  28 + //执行
  29 + CloseableHttpResponse response = httpClient.execute(httpPost);
  30 + int code = response.getStatusLine().getStatusCode();
  31 + //获取状态
  32 + System.out.println("http请求结果为:"+code);
  33 + if(code == 200){
  34 + //获取A站点返回的结果
  35 + String result = EntityUtils.toString(response.getEntity());
  36 + System.out.println(result);
  37 + //把结果返回给B站点
  38 + resp.getWriter().print(result);
  39 + }
  40 + response.close();
  41 + httpClient.close();
  42 + } catch (Exception e) {
  43 + }
  44 + }
  45 +}
0 \ No newline at end of file 46 \ No newline at end of file
src/main/java/com/bsth/util/ReportUtils.java
@@ -115,6 +115,92 @@ public class ReportUtils { @@ -115,6 +115,92 @@ public class ReportUtils {
115 } 115 }
116 } 116 }
117 117
  118 +
  119 + /**
  120 + *
  121 + * @param sheetList 多sheet模板中,需要重复显示的行所需的数据
  122 + * @param tArray
  123 + * @param sourcePath 模板路径
  124 + * @param targetPath 生成路径
  125 + */
  126 + public void excelMoreSheetReplace(List<List<Iterator<?>>> sheetList, Object[] tArray,
  127 + String sourcePath, String targetPath) {
  128 + try {
  129 + // 把源文件放入流中
  130 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(
  131 + sourcePath));
  132 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  133 + for (int s=0; s<sheetList.size(); s++){
  134 + List<Iterator<?>> list = sheetList.get(s);
  135 + if(tArray.length != 0 && tArray[0] instanceof java.util.Map){
  136 + Map<String, Object> m = (Map<String, Object>)tArray[0];
  137 + if(m.containsKey("sheetName"+s+1) && m.get("sheetName"+s+1)!=null
  138 + && m.get("sheetName"+s+1).toString().trim().length()!=0)
  139 + wb.setSheetName(0, m.get("sheetName"+s+1).toString());
  140 + }
  141 + HSSFSheet sheet = wb.getSheetAt(s);
  142 + HSSFRow row;
  143 + HSSFCell cell = null;
  144 + String key;
  145 + // 取得总行数
  146 + int rowNum = sheet.getLastRowNum();
  147 + // 取得总列数
  148 + int cellNum = sheet.getRow(0).getLastCellNum();
  149 +
  150 + // 遍历行
  151 + for (int i = 0; i <= rowNum; i++) {
  152 + row = sheet.getRow(i);
  153 + // 遍历列
  154 + for (int j = 0; j < cellNum; j++) {
  155 + if (row == null) {
  156 + continue;
  157 + }
  158 + cell = row.getCell(j);
  159 + if (cell == null) {
  160 + continue;
  161 + }
  162 + // 取得每列的内容,如果列内容是$key$格式,则替换内容
  163 + key = getCellValue(cell);
  164 + if (key != null && (key.indexOf("$") != -1 || key.indexOf("#list#") != -1)) {
  165 + // * 列中内容有#list#,则表示该行为模板行,需要以该行为模板
  166 + // * 例如:模板行格式 #list#0_0 $Car.id$
  167 + // * 第一个0表示需要在list中取iterator的索引值
  168 + // * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象
  169 + // * $Car.id$表示所取的对象为Car的对象,并且取值为id的值
  170 + if (key.indexOf("#list#") != -1) {
  171 + key = key.replace("#list#", "").trim();
  172 + String[] lists = key.split(" ");
  173 + // 取得list中的索引值
  174 + int listIndex = Integer
  175 + .valueOf(lists[0].split("_")[0]);
  176 + Iterator<?> iterator = list.get(listIndex);
  177 + // 根据模板创建行并填充数据,返回增加的行数
  178 + int rowCount = iteratorFillCellValue(wb, sheet,
  179 + cell, iterator, i, rowNum, key);
  180 + rowNum += rowCount;
  181 + i += rowCount;
  182 + break;
  183 + } else {
  184 + // 直接填充数据的列,从对象数组中取得值,这里的数组不传值
  185 + getValueAndSetCellValue(cell, key, tArray, new String[]{""});
  186 + }
  187 + }
  188 +
  189 + }
  190 + }
  191 + }
  192 +
  193 + // 创建目标文件夹
  194 + createFolder(targetPath);
  195 + // 输出文件
  196 + FileOutputStream fileOut = new FileOutputStream(targetPath);
  197 + wb.write(fileOut);
  198 + fileOut.close();
  199 + } catch (Exception e) {
  200 + e.printStackTrace();
  201 + }
  202 + }
  203 +
118 /** 204 /**
119 * 将file1中的一页sheet复制到file2中 205 * 将file1中的一页sheet复制到file2中
120 * 206 *
@@ -351,6 +437,9 @@ public class ReportUtils { @@ -351,6 +437,9 @@ public class ReportUtils {
351 * 第一个0表示需要在list中取iterator的索引值 437 * 第一个0表示需要在list中取iterator的索引值
352 * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象 438 * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象
353 */ 439 */
  440 + if(key == null || key.equals("")){
  441 + obj = iterator.next();
  442 + }
354 if (key.indexOf("#list#") != -1 && key.indexOf("_0") == -1) { 443 if (key.indexOf("#list#") != -1 && key.indexOf("_0") == -1) {
355 if (iterator.hasNext()) { 444 if (iterator.hasNext()) {
356 obj = iterator.next(); 445 obj = iterator.next();
src/main/resources/application-prodtest.properties 0 → 100644
  1 +server.port=9088
  2 +#management.port= 9001
  3 +#management.address= 127.0.0.1
  4 +management.security.enabled=false
  5 +management.context-path=/manage
  6 +dubbo.use=true
  7 +
  8 +spring.jpa.hibernate.ddl-auto= update
  9 +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
  10 +#DATABASE
  11 +spring.jpa.database= MYSQL
  12 +spring.jpa.show-sql= false
  13 +spring.datasource.driver-class-name= com.mysql.jdbc.Driver
  14 +spring.datasource.url= jdbc:mysql://10.10.150.24:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  15 +spring.datasource.username= root
  16 +spring.datasource.password= root2jsp
  17 +#DATASOURCE
  18 +spring.datasource.max-active=100
  19 +spring.datasource.max-idle=8
  20 +spring.datasource.min-idle=8
  21 +spring.datasource.initial-size=5
  22 +
  23 +spring.datasource.test-on-borrow=true
  24 +spring.datasource.test-on-connect=true
  25 +spring.datasource.test-on-return=true
  26 +spring.datasource.test-while-idle=true
  27 +spring.datasource.validation-query=select 1
  28 +
  29 +## gps client data
  30 +http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
  31 +## gateway real data
  32 +http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/
  33 +## gateway send directive
  34 +http.send.directive = http://10.10.200.79:8080/transport_server/message/
  35 +## wxsb
  36 +#http.report.url.05= http://192.168.168.154:8088/ygjwsystem_j2ee/clbx/clbx_dd.do
  37 +#http.report.url.22= http://192.168.168.154:8088/jgjwsystem_j2ee/clbx/clbx_dd.do
  38 +#http.report.url.26= http://192.168.168.154:8088/nhjwsystem_j2ee/clbx/clbx_dd.do
  39 +#http.report.url.55= http://192.168.168.154:8088/snjwsystem_j2ee/clbx/clbx_dd.do
  40 +http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do
  41 +http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do
  42 +http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do
  43 +http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do
0 \ No newline at end of file 44 \ No newline at end of file
src/main/resources/application.properties
1 -spring.profiles: dev,prod  
2 -spring.profiles.active: dev  
3 -  
4 -spring.view.suffix=.html  
5 -server.session-timeout=-1  
6 -security.basic.enabled=false  
7 -  
8 -# \u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u914D\u7F6E  
9 -# File size limit  
10 -multipart.maxFileSize = -1  
11 -# Total request size for a multipart/form-data  
12 -multipart.maxRequestSize = -1  
13 -  
14 -server.compression.enabled=true  
15 -server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript  
16 -  
17 -# batch insert  
18 -hibernate.jdbc.batch_size = 50 1 +spring.profiles: dev,prod
  2 +spring.profiles.active: dev
  3 +
  4 +spring.view.suffix=.html
  5 +server.session-timeout=-1
  6 +security.basic.enabled=false
  7 +
  8 +# \u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u9650\u5236\u914D\u7F6E
  9 +# File size limit
  10 +multipart.maxFileSize = -1
  11 +# Total request size for a multipart/form-data
  12 +multipart.maxRequestSize = -1
  13 +
  14 +server.compression.enabled=true
  15 +server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/javascript,text/css,application/javascript
  16 +
  17 +# batch insert
  18 +hibernate.jdbc.batch_size = 50
src/main/resources/datatools/config-prodtest.properties 0 → 100644
  1 +# 配置数据导入导出用到的配置信息
  2 +
  3 +# 1、kettle配置文件路径(类路径)
  4 +datatools.kettle_properties=/datatools/kettle.properties
  5 +# 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正)
  6 +
  7 +#数据库ip地址
  8 +datatools.kvars_dbip=10.10.150.24
  9 +#数据库用户名
  10 +datatools.kvars_dbuname=root
  11 +#数据库密码
  12 +datatools.kvars_dbpwd=root2jsp
  13 +#数据库库名
  14 +datatools.kvars_dbdname=control
  15 +
  16 +# 3、上传数据配置信息
  17 +# 上传文件目录配置(根据不同的环境需要修正)
  18 +datatools.fileupload_dir=/home/bsth_control_u_d_files
  19 +# ktr转换文件,中配置的错误输出目录(根据不同的环境需要修正)
  20 +datatools.trans_errordir=/home/bsth_control_u_d_files/erroroutput
  21 +# 临时输出文件目录
  22 +datatools.trans_tempdir=/home/bsth_control_u_d_files/temp
  23 +# 模版文件目录
  24 +datatools.trans_templatedir=/home/bsth_control_u_d_files/template
  25 +
  26 +##---------------------------- 导入数据ktr ----------------------------##
  27 +# 车辆信息导入ktr转换
  28 +datatools.cars_datainputktr=/datatools/ktrs/carsDataInput.ktr
  29 +# 人员信息导入
  30 +datatools.employees_datainputktr=/datatools/ktrs/employeesDataInput.ktr
  31 +# 路牌信息导入
  32 +datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr
  33 +# 时刻表基础信息导入
  34 +datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr
  35 +# 时刻表明细信息导入(元数据)
  36 +datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailDataInputMetaData.ktr
  37 +# 时刻表明细编辑用数据
  38 +datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr
  39 +# 时刻表明细信息导入
  40 +datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr
  41 +# 时刻表明细信息导入2
  42 +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr
  43 +# 时刻表明细信息导入2(版本化)
  44 +datatools.ttinfodetail_datainputktr2version=/datatools/ktrs/ttinfodetailDataInput2_version.ktr
  45 +# 时刻表明细信息导入2(版本化),使用生成时刻表格式
  46 +datatools.ttinfodetail_datainputktr2version2=/datatools/ktrs/ttinfodetailDataInput2_version_2.ktr
  47 +
  48 +# 车辆配置信息导入
  49 +datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr
  50 +# 人员配置信息导入
  51 +datatools.employeesconfig_datainputktr=/datatools/ktrs/employeesConfigDataInput.ktr
  52 +
  53 +# 排版规则信息导入
  54 +datatools.schedulerule_datainputktr=/datatools/ktrs/scheduleRuleDataInput.ktr
  55 +
  56 +# 4、数据导出配置信息
  57 +# 导出数据文件目录配置(根据不同的环境需要修正)
  58 +datatools.fileoutput_dir=/home/bsth_control_u_d_files
  59 +
  60 +##---------------------------- 导出数据ktr -----------------------------##
  61 +# 车辆信息导出ktr转换
  62 +datatools.cars_dataoutputktr=/datatools/ktrs/carsDataOutput.ktr
  63 +# 人员信息导出ktr转换
  64 +datatools.employees_dataoutputktr=/datatools/ktrs/employeesDataOutput.ktr
  65 +# 时刻表导出元数据ktr转换
  66 +datatools.ttinfodetail_metaoutput=/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr
  67 +# 时刻表导出数据ktr转换
  68 +datatools.ttinfodetail_output=/datatools/ktrs/ttinfodetailDataOutput.ktr
  69 +# 排版规则导出数据ktr转换
  70 +datatools.schedulerule_output=/datatools/ktrs/scheduleRuleDataOutput.ktr
  71 +
  72 +# 车辆配置信息导出ktr转换
  73 +datatools.carsconfig_dataoutputktr=/datatools/ktrs/carsConfigDataOutput.ktr
  74 +# 人员配置信息导出ktr转换
  75 +datatools.employeesconfig_dataoutputktr=/datatools/ktrs/employeesConfigDataOutput.ktr
  76 +
  77 +# 路牌信息导出
  78 +datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
  79 +
  80 +
  81 +# TODO:
src/main/resources/dubbo/config-prodtest.properties 0 → 100644
  1 +# application名字
  2 +spring.dubbo.application.name=bsth_control_v2
  3 +# zookeeper注册中心地址
  4 +spring.dubbo.registry=zookeeper://127.0.0.1:2181
  5 +
  6 +#----------- dubbo:consumer 性能调优选项 -------------#
  7 +# 远程服务调用超时时间,单位毫秒,这里设置30分钟
  8 +spring.dubbo.consumer.timeout=1800000
  9 +# 远程服务调用重试次数,0表示不需要重试
  10 +spring.dubbo.consumer.retries=0
  11 +#----------- dubbo:consumer 服务治理选项 -------------#
  12 +# 启动不检查提供者是否存在
  13 +spring.dubbo.consumer.check=false
src/main/resources/logback.xml
@@ -201,7 +201,7 @@ @@ -201,7 +201,7 @@
201 <!-- TODO --> 201 <!-- TODO -->
202 202
203 <!-- gps --> 203 <!-- gps -->
204 - <appender name="GPS_COUNT" 204 + <!--<appender name="GPS_COUNT"
205 class="ch.qos.logback.core.rolling.RollingFileAppender"> 205 class="ch.qos.logback.core.rolling.RollingFileAppender">
206 <file>${LOG_BASE}/gps/count.log</file> 206 <file>${LOG_BASE}/gps/count.log</file>
207 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> 207 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@@ -220,7 +220,7 @@ @@ -220,7 +220,7 @@
220 <logger name="com.bsth.data.gpsdata_v2" 220 <logger name="com.bsth.data.gpsdata_v2"
221 level="INFO" additivity="false"> 221 level="INFO" additivity="false">
222 <appender-ref ref="GPS_COUNT" /> 222 <appender-ref ref="GPS_COUNT" />
223 - </logger> 223 + </logger>-->
224 224
225 <!-- 设备状态指令 --> 225 <!-- 设备状态指令 -->
226 <appender name="GPS_STATUS_DIRECTIVE" 226 <appender name="GPS_STATUS_DIRECTIVE"
src/main/resources/static/pages/control/lineallot_v2/main.html
@@ -484,13 +484,12 @@ @@ -484,13 +484,12 @@
484 $.each(items, function () { 484 $.each(items, function () {
485 ls_line_data.push(codeMapps[$(this).data('id')]); 485 ls_line_data.push(codeMapps[$(this).data('id')]);
486 }); 486 });
487 - //将线路基础信息写入localStorage  
488 - storage.setItem('lineControlItems', JSON.stringify(ls_line_data));  
489 //监控模式还是主调模式 487 //监控模式还是主调模式
490 storage.setItem('operationMode', $('.pattern_type_label>input')[0].checked?1:0); 488 storage.setItem('operationMode', $('.pattern_type_label>input')[0].checked?1:0);
491 489
492 //进入线调 490 //进入线调
493 - var eq = EventProxy.create('cache_route', 'check_line_config', function () { 491 + var eq = EventProxy.create('cache_line_level', 'cache_mv_route', 'cache_route', 'check_line_config', function (lineLevel) {
  492 + debugger;
494 var newWinOpen = $('input','.new_window_open_label')[0].checked; 493 var newWinOpen = $('input','.new_window_open_label')[0].checked;
495 if(!newWinOpen) 494 if(!newWinOpen)
496 top.window.location.href = "/real_control/v2"; 495 top.window.location.href = "/real_control/v2";
@@ -498,6 +497,13 @@ @@ -498,6 +497,13 @@
498 window.open("/real_control/v2"); 497 window.open("/real_control/v2");
499 $('#go_to_real_system_btn').html('已经尝试打开新窗口,如看不到,可能被浏览器阻止了'); 498 $('#go_to_real_system_btn').html('已经尝试打开新窗口,如看不到,可能被浏览器阻止了');
500 } 499 }
  500 +
  501 + // 将线路级别赋值
  502 + $.each(ls_line_data, function () {
  503 + this.lineLevel = lineLevel[this.lineCode];
  504 + });
  505 + // 将线路基础信息写入localStorage
  506 + storage.setItem('lineControlItems', JSON.stringify(ls_line_data));
501 }); 507 });
502 508
503 //拼接线路编码 509 //拼接线路编码
@@ -508,15 +514,20 @@ @@ -508,15 +514,20 @@
508 //缓存路由 514 //缓存路由
509 idx=idx.substr(0, idx.length - 1); 515 idx=idx.substr(0, idx.length - 1);
510 516
511 - $.ajaxSettings.async = false; 517 + $.get('/realSchedule/lineLevel', {idx: idx}, function (rs) {
  518 + if (rs) {
  519 + eq.emit('cache_line_level', rs);
  520 + }
  521 + });
  522 +
512 $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) { 523 $.get('/realMap/findRouteAndVersionByLine', {idx: idx}, function (rs) {
513 if (rs) { 524 if (rs) {
514 for(var lineCode in rs) 525 for(var lineCode in rs)
515 storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode])); 526 storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode]));
516 - //eq.emit('cache_route'); 527 + eq.emit('cache_mv_route');
517 } 528 }
518 }); 529 });
519 - $.ajaxSettings.async = true; 530 +
520 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) { 531 $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) {
521 if (rs) { 532 if (rs) {
522 for(var lineCode in rs) 533 for(var lineCode in rs)
src/main/resources/static/pages/forms/mould/calcIntervalCount.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/calcIntervalList1.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/interval.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/repairReport.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/report_register.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/repairReport.html
@@ -53,10 +53,10 @@ @@ -53,10 +53,10 @@
53 <th>序号</th> 53 <th>序号</th>
54 <th>线路</th> 54 <th>线路</th>
55 <th>车辆编码</th> 55 <th>车辆编码</th>
56 - <th>发车时间</th> 56 + <th>计划发车时间</th>
57 <th>上报人</th> 57 <th>上报人</th>
58 <th>上报时间</th> 58 <th>上报时间</th>
59 - <th>维修类型</th> 59 + <th>上报类型</th>
60 <th>上报状态</th> 60 <th>上报状态</th>
61 </tr> 61 </tr>
62 </thead> 62 </thead>
@@ -86,7 +86,6 @@ @@ -86,7 +86,6 @@
86 $.get('/report/lineList',function(xlList){ 86 $.get('/report/lineList',function(xlList){
87 var data = []; 87 var data = [];
88 $.get('/user/companyData', function(result){ 88 $.get('/user/companyData', function(result){
89 - debugger;  
90 for(var i = 0; i < result.length; i++){ 89 for(var i = 0; i < result.length; i++){
91 var companyCode = result[i].companyCode; 90 var companyCode = result[i].companyCode;
92 var children = result[i].children; 91 var children = result[i].children;
src/main/resources/static/pages/forms/statement/scheduleDaily.html
@@ -87,7 +87,7 @@ @@ -87,7 +87,7 @@
87 <td colspan="3">放站班次</td> 87 <td colspan="3">放站班次</td>
88 <td colspan="3">调头班次</td> 88 <td colspan="3">调头班次</td>
89 <td colspan="3">发生次数</td> 89 <td colspan="3">发生次数</td>
90 - <td rowspan="2">最大间隔时间()</td> 90 + <td rowspan="2">最大间隔时间()</td>
91 <td colspan="5" rowspan="2">原因</td> 91 <td colspan="5" rowspan="2">原因</td>
92 </tr> 92 </tr>
93 <tr> 93 <tr>
src/main/resources/static/pages/permission/authorize_all/user_auth.html
@@ -55,6 +55,7 @@ @@ -55,6 +55,7 @@
55 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li> 55 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_scheduleAnaly"> 时刻表分析</label></li>
56 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li> 56 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_message"> 调度消息分析</label></li>
57 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li> 57 <li><label><input class="uk-checkbox" type="checkbox" data-event="form_changetochange"> 换人换车情况统计表</label></li>
  58 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_repairReport"> 维修上报记录</label></li>
58 </ul> 59 </ul>
59 </div> 60 </div>
60 61
@@ -78,6 +79,13 @@ @@ -78,6 +79,13 @@
78 <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li> 79 <li><label><input class="uk-checkbox" type="checkbox" data-event="signal_state"> 信号标记</label></li>
79 </ul> 80 </ul>
80 </div> 81 </div>
  82 + <div>
  83 + <h4>服务热线系统</h4>
  84 + <ul class="uk-list uk-list-large uk-list-divider">
  85 + <li><label><input class="uk-checkbox" type="checkbox" data-event="report_register"> 报备登记</label></li>
  86 + <li><label><input class="uk-checkbox" type="checkbox" data-event="form_report_register"> 报备登记报表</label></li>
  87 + </ul>
  88 + </div>
81 89
82 </div> 90 </div>
83 91
src/main/resources/static/pages/report/sheet/intervalCount.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>大间隔情况表</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 38px;" id="fgsdmDiv">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  37 + </div>
  38 + <div style="display: inline-block;margin-left: 33px;">
  39 + <span class="item-label" style="width: 80px;">线路: </span>
  40 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  41 + </div>
  42 + <div style="margin-top: 10px">
  43 + </div>
  44 + <div style="display: inline-block;margin-left: 33px;">
  45 + <span class="item-label" style="width: 80px;">等级: </span>
  46 + <select class="form-control" style="width: 180px;" id=levelType>
  47 + <option value="A,B,C">A,B,C级线路</option>
  48 + <option value="D">D级线路</option>
  49 + </select>
  50 + </div>
  51 + <div style="display: inline-block;">
  52 + <span class="item-label" style="width: 80px;margin-left: 24px;">开始时间: </span>
  53 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  54 + </div>
  55 + <div style="display: inline-block;">
  56 + <span class="item-label" style="width: 80px;margin-left: 24px;">结束时间: </span>
  57 + <input class="form-control" type="text" id="endDate" style="width: 180px;"/>
  58 + </div>
  59 +
  60 + <div class="form-group">
  61 + <input type="hidden" id="id"/>
  62 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  63 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  64 + </div>
  65 + </form>
  66 + </div>
  67 +
  68 + <div class="portlet-body">
  69 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  70 + <table class="table table-bordered table-hover table-checkable" id="forms">
  71 + <thead>
  72 + <tr>
  73 + <td>公司</td>
  74 + <td>分公司</td>
  75 + <td>线路</td>
  76 + <td>全日次数</td>
  77 + <td>高峰次数</td>
  78 + <td>早高峰次数</td>
  79 + <td>晚高峰次数</td>
  80 + <td>低谷次数</td>
  81 + <td>全日班次数</td>
  82 + <td>全日发生率</td>
  83 + <td>最大间隔时间</td>
  84 + <td>查看</td>
  85 + </tr>
  86 + </thead>
  87 + <tbody>
  88 + </tbody>
  89 + </table>
  90 +
  91 + <table class="table table-bordered table-hover table-checkable" style="display: none" id="forms_d">
  92 + <thead>
  93 + <tr>
  94 + <td>公司</td>
  95 + <td>分公司</td>
  96 + <td>线路</td>
  97 + <td>班次数</td>
  98 + <td>发车准点数</td>
  99 + <td>发车准点率</td>
  100 + <td>到站准点数</td>
  101 + <td>到站准点率</td>
  102 + <td>查看</td>
  103 + </tr>
  104 + </thead>
  105 + <tbody>
  106 + </tbody>
  107 + </table>
  108 +
  109 +
  110 + </div>
  111 +
  112 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  113 + <input class="btn btn-default" style="display: none" type="button" id="export_1" value="导出"/>
  114 + <table class="table table-bordered table-hover table-checkable" style="display: none" id="forms_1">
  115 + <thead>
  116 + <tr >
  117 + <td>公司</td>
  118 + <td>分公司</td>
  119 + <td>日期</td>
  120 + <td>线路</td>
  121 + <td>当天等级</td>
  122 + <td>全日次数</td>
  123 + <td>高峰次数</td>
  124 + <td>早高峰次数</td>
  125 + <td>晚高峰次数</td>
  126 + <td>低谷次数</td>
  127 + <td>全日班次数</td>
  128 + <td>全日发生率</td>
  129 + <td>最大间隔</td>
  130 + <td>查看</td>
  131 + </tr>
  132 + </thead>
  133 + <tbody>
  134 + </tbody>
  135 + </table>
  136 +
  137 + <table class="table table-bordered table-hover table-checkable" style="display: none" id="forms_d_1">
  138 + <thead>
  139 + <tr>
  140 + <td>公司</td>
  141 + <td>分公司</td>
  142 + <td>日期</td>
  143 + <td>线路</td>
  144 + <td>班次数</td>
  145 + <td>发车准点次数</td>
  146 + <td>发车准点率</td>
  147 + <td>查看</td>
  148 + <td>到站准点次数</td>
  149 + <td>到站准点率</td>
  150 + <td>查看</td>
  151 + </tr>
  152 + </thead>
  153 + <tbody>
  154 + </tbody>
  155 + </table>
  156 + </div>
  157 + </div>
  158 + </div>
  159 + </div>
  160 +</div>
  161 +<script src="/pages/mforms/singledatas/jquery.table2excel.min.js"></script>
  162 +<script>
  163 + $(function(){
  164 + // 关闭左侧栏
  165 + if (!$('body').hasClass('page-sidebar-closed'))
  166 + $('.menu-toggler.sidebar-toggler').click();
  167 +
  168 + var d = new Date();
  169 + d.setTime(d.getTime() - 1*1000*60*60*24);
  170 + var year = d.getFullYear();
  171 + var month = d.getMonth() + 1;
  172 + var day = d.getDate();
  173 + if(month < 10)
  174 + month = "0"+month;
  175 + if(day < 10)
  176 + day = "0"+day;
  177 + var dateTime = year + "-" + month + "-" + day;
  178 + $("#date").datetimepicker({
  179 + format : 'YYYY-MM-DD',
  180 + locale : 'zh-cn',
  181 + maxDate : dateTime
  182 + });
  183 + $("#endDate").datetimepicker({
  184 + format : 'YYYY-MM-DD',
  185 + locale : 'zh-cn',
  186 + maxDate : dateTime
  187 + });
  188 + $("#date").val(dateTime);
  189 + $("#endDate").val(dateTime);
  190 +
  191 + var fage=false;
  192 + var obj = [];
  193 + var xlList;
  194 + $.get('/report/lineList',function(result){
  195 + xlList=result;
  196 +
  197 + $.get('/user/companyData', function(result){
  198 + obj = result;
  199 + var options = '';
  200 + for(var i = 0; i < obj.length; i++){
  201 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  202 + }
  203 + if(obj.length ==0){
  204 + $("#gsdmDiv").css('display','none');
  205 + }else if(obj.length ==1){
  206 + $("#gsdmDiv").css('display','none');
  207 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  208 + $('#fgsdmDiv').css('display','none');
  209 + }
  210 + $('#gsdm').html(options);
  211 +
  212 + updateCompany();
  213 + });
  214 + });
  215 +
  216 + $("#gsdm").on("change",updateCompany);
  217 + function updateCompany(){
  218 + var company = $('#gsdm').val();
  219 + var options = '<option value="">全部分公司</option>';
  220 + for(var i = 0; i < obj.length; i++){
  221 + if(obj[i].companyCode == company){
  222 + var children = obj[i].children;
  223 + for(var j = 0; j < children.length; j++){
  224 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  225 + }
  226 + }
  227 + }
  228 + $('#fgsdm').html(options);
  229 + }
  230 +
  231 + var tempData = {};
  232 + $.get('/report/lineList',function(xlList){
  233 + var data = [];
  234 + data.push({id: " ", text: "全部线路"});
  235 + $.get('/user/companyData', function(result){
  236 + for(var i = 0; i < result.length; i++){
  237 + var companyCode = result[i].companyCode;
  238 + var children = result[i].children;
  239 + for(var j = 0; j < children.length; j++){
  240 + var code = children[j].code;
  241 + for(var k=0;k < xlList.length;k++ ){
  242 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  243 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  244 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  245 + }
  246 + }
  247 + }
  248 + }
  249 + initPinYinSelect2('#line',data,'');
  250 +
  251 + });
  252 + });
  253 +
  254 + $("#line").on("change", function(){
  255 + if($("#line").val() == " "){
  256 + $("#gsdm").attr("disabled", false);
  257 + $("#fgsdm").attr("disabled", false);
  258 + } else {
  259 + var temp = tempData[$("#line").val()].split(":");
  260 + $("#gsdm").val(temp[0]);
  261 + updateCompany();
  262 + $("#fgsdm").val(temp[1]);
  263 + $("#gsdm").attr("disabled", true);
  264 + $("#fgsdm").attr("disabled", true);
  265 + }
  266 + });
  267 +
  268 + $("#export").attr('disabled',"true");
  269 +
  270 + //查询
  271 + $("#query").on('click',function(){
  272 + var line = $("#line").val();
  273 + var date = $("#date").val();
  274 + var endDate = $("#endDate").val();
  275 + var fgs=$('#fgsdm').val();
  276 + var gs=$('#gsdm').val();
  277 + var levelType=$('#levelType').val();
  278 + var i = layer.load(2);
  279 + $get('/calcInterval/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,levelType:levelType,type:'query'},function(result){
  280 + if(levelType=="D"){
  281 + var intervalList_d = template('intervalList_d',{list:result});
  282 + $('#forms_d tbody').html(intervalList_d);
  283 + $('.btn-intervalList_d').on('click', showSheetList);
  284 + $("#forms").hide();
  285 + $("#forms_d").show();
  286 + }else{
  287 + var intervalList = template('intervalList',{list:result});
  288 + $('#forms tbody').html(intervalList);
  289 + $('.btn-intervalList').on('click', showIntervalList);
  290 + $("#forms_d").hide();
  291 + $("#forms").show();
  292 + }
  293 + $("#forms_d_1").hide();
  294 + $("#forms_1").hide();
  295 + $("#export_1").hide();
  296 +
  297 + layer.close(i);
  298 + if(result.length == 0)
  299 + $("#export").attr('disabled',"true");
  300 + else
  301 + $("#export").removeAttr("disabled");
  302 + });
  303 + });
  304 +
  305 + //查询大间隔
  306 + function showIntervalList(){
  307 + var id = $(this).data('id');
  308 + var date = $("#date").val();
  309 + var endDate = $("#endDate").val();
  310 + $("#id").val(id);
  311 + $get('/calcInterval/listInterval',{line:id,date:date,endDate:endDate,type:'query'},function(result){
  312 + var intervalList = template('intervalList_1',{list:result});
  313 + $('#forms_1 tbody').html(intervalList);
  314 + $('.btn-intervalList_1').on('click', openIntervalList);
  315 + $("#forms_1").show();
  316 + $("#export_1").show();
  317 + $("html,body").animate({scrollTop:$("#forms_1").offset().top},1000);
  318 + });
  319 + }
  320 +
  321 +
  322 + function openIntervalList(){
  323 + var id = $(this).data('id');
  324 +
  325 + id += ","+$(this).data('date')+",1";
  326 + $.get('/pages/report/sheet/intervalList.html', function (content) {
  327 + layer.open({
  328 + type: 1,
  329 + area: ['800px', '600px'],
  330 + content: content,
  331 + title: '线路准点率详细',
  332 + shift: 5,
  333 + scrollbar: false,
  334 + success: function () {
  335 + $('#calcIntervalList').trigger('init', id);
  336 + }
  337 + });
  338 + });
  339 + }
  340 + //查询首站发车
  341 + function showSheetList(){
  342 + var id = $(this).data('id');
  343 + var date = $("#date").val();
  344 + var endDate = $("#endDate").val();
  345 + $("#id").val(id);
  346 + $get('/calcSheet/calcListSheet_d',{line:id,date:date,endDate:endDate,type:'query'},function(result){
  347 + var sheetList = template('sheetList_1',{list:result});
  348 + $('#forms_d_1 tbody').html(sheetList);
  349 + $('.btn-calcSheetList_1').on('click', opencalcSheetList);
  350 + $('.btn-calcSheetList_2').on('click', opencalcSheetList2);
  351 + $("#forms_d_1").show();
  352 + $("#export_1").show();
  353 + $("html,body").animate({scrollTop:$("#forms_d_1").offset().top},1000);
  354 + });
  355 + }
  356 +
  357 +
  358 + function opencalcSheetList(){
  359 + var id = $(this).data('id');
  360 + id += ","+$(this).data('date')+",1";
  361 + $.get('/pages/report/sheet/calcList.html', function (content) {
  362 + layer.open({
  363 + type: 1,
  364 + area: ['800px', '600px'],
  365 + content: content,
  366 + title: '线路准点率详细',
  367 + shift: 5,
  368 + scrollbar: false,
  369 + success: function () {
  370 + $('#calcSheetList').trigger('init', id);
  371 + }
  372 + });
  373 + });
  374 + }
  375 + function opencalcSheetList2(){
  376 + var id = $(this).data('id');
  377 + id += ","+$(this).data('date')+",2";
  378 + $.get('/pages/report/sheet/calcList.html', function (content) {
  379 + layer.open({
  380 + type: 1,
  381 + area: ['800px', '600px'],
  382 + content: content,
  383 + title: '线路准点率详细',
  384 + shift: 5,
  385 + scrollbar: false,
  386 + success: function () {
  387 + $('#calcSheetList').trigger('init', id);
  388 + }
  389 + });
  390 + });
  391 + }
  392 + $("#export").on("click",function(){
  393 + var line = $("#line").val();
  394 + var date = $("#date").val();
  395 + var endDate = $("#endDate").val();
  396 + var fgs=$('#fgsdm').val();
  397 + var gs=$('#gsdm').val();
  398 + var levelType=$('#levelType').val();
  399 + var lineName = $('#line option:selected').text();
  400 + if(lineName == "全部线路")
  401 + lineName = $('#fgsdm option:selected').text();
  402 + if(lineName=="全部分公司")
  403 + lineName = $('#gsdm option:selected').text();
  404 +
  405 + var i = layer.load(2);
  406 + $get('/calcInterval/countList',{line:line,date:date,endDate:endDate,gs:gs,fgs:fgs,levelType:levelType,type:"export",lineName:lineName},function(result){
  407 + var dateTime = "";
  408 + if(date == endDate){
  409 + dateTime = moment(date).format("YYYYMMDD");
  410 + } else {
  411 + dateTime = moment(date).format("YYYYMMDD")+"-"+
  412 + moment(endDate).format("YYYYMMDD");
  413 + }
  414 + if(levelType=="D"){
  415 + window.open("/downloadFile/download?fileName="
  416 + +dateTime+"-"+lineName+"-发车到站准点率");
  417 + }else{
  418 + window.open("/downloadFile/download?fileName="
  419 + +dateTime+"-"+lineName+"-大间隔汇总表");
  420 + }
  421 +
  422 + layer.close(i);
  423 + });
  424 + });
  425 +
  426 + $("#export_1").on("click",function(){
  427 + var id = $("#id").val();
  428 + var date = $("#date").val();
  429 + var endDate = $("#endDate").val();
  430 + var levelType=$("#levelType").val();
  431 + if(levelType=='D'){
  432 + var i = layer.load(2);
  433 + $get('/calcSheet/calcListSheet',{line:id,date:date,endDate:endDate,type:'export'},function(result){
  434 + window.open("/downloadFile/download?fileName=发车到站准点率"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  435 + layer.close(i);
  436 + });
  437 + }else{
  438 + $get('/calcInterval/listInterval',{line:id,date:date,endDate:endDate,type:'export'},function(result){
  439 + window.open("/downloadFile/download?fileName=大间距汇总表"+moment(date).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  440 + layer.close(i);
  441 + });
  442 + }
  443 +
  444 + })
  445 +
  446 + });
  447 +</script>
  448 +<script type="text/html" id="intervalList">
  449 + {{each list as obj i}}
  450 + <tr>
  451 + <td>{{obj.gs}}</td>
  452 + <td>{{obj.fgs}}</td>
  453 + <td>{{obj.xlName}}</td>
  454 + <td>{{obj.djgAll}}</td>
  455 + <td>{{obj.djgGf}}</td>
  456 + <td>{{obj.djgZgf}}</td>
  457 + <td>{{obj.djgWgf}}</td>
  458 + <td>{{obj.djgDg}}</td>
  459 + <td>{{obj.bcs}}</td>
  460 + <td>{{obj.fsl}}</td>
  461 + <td>{{obj.djgTime}}</td>
  462 + <td>
  463 + <button type="button" class="btn btn-sm blue btn-intervalList"
  464 + data-id="{{obj.xlBm}}">查看</button>
  465 + </td>
  466 + </tr>
  467 + {{/each}}
  468 + {{if list.length == 0}}
  469 + <tr>
  470 + <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
  471 + </tr>
  472 + {{/if}}
  473 +</script>
  474 +
  475 +<script type="text/html" id="intervalList_d">
  476 + {{each list as obj i}}
  477 + <tr>
  478 + <td>{{obj.gs}}</td>
  479 + <td>{{obj.fgs}}</td>
  480 + <td>{{obj.line}}</td>
  481 + <td>{{obj.bcs}}</td>
  482 + <td>{{obj.zdbcs}}</td>
  483 + <td>{{obj.zdlv}}</td>
  484 + <td>{{obj.ddzdbcs}}</td>
  485 + <td>{{obj.ddzdlv}}</td>
  486 + <td>
  487 + <button type="button" class="btn btn-sm blue btn-intervalList_d"
  488 + data-id="{{obj.xlBm}}">查看</button>
  489 + </td>
  490 + </tr>
  491 + {{/each}}
  492 + {{if list.length == 0}}
  493 + <tr>
  494 + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td>
  495 + </tr>
  496 + {{/if}}
  497 +</script>
  498 +
  499 +
  500 +<script type="text/html" id="intervalList_1">
  501 + {{each list as obj i}}
  502 + <tr>
  503 + <td>{{obj.gs}}</td>
  504 + <td>{{obj.fgs}}</td>
  505 + <td>{{obj.date}}</td>
  506 + <td>{{obj.xl}}</td>
  507 + <td>{{obj.level}}</td>
  508 + <td>{{obj.djgAll}}</td>
  509 + <td>{{obj.djgGf}}</td>
  510 + <td>{{obj.djgZgf}}</td>
  511 + <td>{{obj.djgWgf}}</td>
  512 + <td>{{obj.djgDg}}</td>
  513 + <td>{{obj.bcs}}</td>
  514 + <td>{{obj.fsl}}</td>
  515 + <td>{{obj.djgTime}}</td>
  516 + <td>
  517 + <button type="button" class="btn btn-sm blue btn-intervalList_1"
  518 + data-id="{{obj.xlBm}}" data-date="{{obj.date}}">详细</button>
  519 + </td>
  520 + </tr>
  521 + {{/each}}
  522 + {{if list.length == 0}}
  523 + <tr>
  524 + <td colspan="11"><h6 class="muted">没有找到相关数据</h6></td>
  525 + </tr>
  526 + {{/if}}
  527 +</script>
  528 +
  529 +<script type="text/html" id="sheetList_1">
  530 + {{each list as obj i}}
  531 + <tr>
  532 + <td>{{obj.gsname}}</td>
  533 + <td>{{obj.fgsname}}</td>
  534 + <td>{{obj.xlName}}</td>
  535 + <td>{{obj.date}}</td>
  536 + <td>{{obj.jhszfcs}}</td>
  537 + <td>{{obj.sjszfczds}}</td>
  538 + <td>{{obj.szfczdl}}</td>
  539 + <td>
  540 + <button type="button" class="btn btn-sm blue btn-calcSheetList_1"
  541 + data-id="{{obj.xl}}" data-date="{{obj.date}}">详细</button>
  542 + </td>
  543 + <td>{{obj.sjszddzds}}</td>
  544 + <td>{{obj.szddzdl}}</td>
  545 + <td>
  546 + <button type="button" class="btn btn-sm blue btn-calcSheetList_2"
  547 + data-id="{{obj.xl}}" data-date="{{obj.date}}" >详细</button>
  548 + </td>
  549 + </tr>
  550 + {{/each}}
  551 + {{if list.length == 0}}
  552 + <tr>
  553 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  554 + </tr>
  555 + {{/if}}
  556 + {{if list.length == 0}}
  557 + <tr>
  558 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  559 + </tr>
  560 + {{/if}}
  561 +</script>
  562 +
src/main/resources/static/pages/report/sheet/intervalList.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title" style="margin-left: 20px">
  21 + <button id="exportList">数据导出</button>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row" id="calcIntervalList">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-body">
  29 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 600px">
  30 + <table class="table table-bordered table-hover table-checkable" id="forms_2">
  31 + <thead>
  32 + <tr>
  33 + <td></td>
  34 + <td>日期</td>
  35 + <td>线路</td>
  36 + <td>站点</td>
  37 + <td>等级</td>
  38 + <td>计发</td>
  39 + <td>实发</td>
  40 + <td>计发</td>
  41 + <td>实发</td>
  42 + <td>间隔时间</td>
  43 + </tr>
  44 + </thead>
  45 +
  46 + <tbody>
  47 +
  48 + </tbody>
  49 + </table>
  50 + </div>
  51 + </div>
  52 + </div>
  53 + </div>
  54 +</div>
  55 +<script>
  56 + $(function(){
  57 + // 关闭左侧栏
  58 + if (!$('body').hasClass('page-sidebar-closed'))
  59 + $('.menu-toggler.sidebar-toggler').click();
  60 + var no="";
  61 + var dates="";
  62 + $("#calcIntervalList").on('init', function (e, id) {
  63 + no=id.split(",")[0];
  64 + dates = id.split(",")[1];
  65 + var i = layer.load(2);
  66 + $get('/calcInterval/interval',{line:no,date:dates,type:'query'},function(result){
  67 + layer.close(i);
  68 + var calcIntervalList_2 = template('calcIntervalList_2',{list:result});
  69 + $('#forms_2 tbody').html(calcIntervalList_2);
  70 + });
  71 + })
  72 + $("#exportList").on('click',function(){
  73 + var i = layer.load(2);
  74 + $get('/calcInterval/interval',{line:no,date:dates,type:'export'},function(result){
  75 + window.open("/downloadFile/download?fileName="+dates+"大间隔详细");
  76 + layer.close(i);
  77 + });
  78 + });
  79 +
  80 +
  81 + });
  82 +</script>
  83 +<script type="text/html" id="calcIntervalList_2">
  84 + {{each list as obj i}}
  85 + <tr >
  86 + <td>{{i+1}}</td>
  87 + <td>{{obj.date}}</td>
  88 + <td>{{obj.xlName}}</td>
  89 + <td>{{obj.station}}</td>
  90 + <td>{{obj.level}}</td>
  91 + <td>{{obj.jhfc1}}</td>
  92 + <td>{{obj.sjfc1}}</td>
  93 + <td>{{obj.jhfc2}}</td>
  94 + <td>{{obj.sjfc2}}</td>
  95 + <td>{{obj.subTime}}</td>
  96 + </tr>
  97 + {{/each}}
  98 + {{if list.length == 0}}
  99 + <tr>
  100 + <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
  101 + </tr>
  102 + {{/if}}
  103 +</script>
0 \ No newline at end of file 104 \ No newline at end of file
src/main/resources/static/real_control_v2/css/line_schedule.css
@@ -370,15 +370,15 @@ span.fcsj-diff { @@ -370,15 +370,15 @@ span.fcsj-diff {
370 padding-left: 12px; 370 padding-left: 12px;
371 } 371 }
372 372
373 -.repair-type-checkbox-list {  
374 - height: 180px; 373 +.report-type-checkbox-list {
  374 + height: 150px;
375 overflow: auto; 375 overflow: auto;
376 border: 1px solid #c4c4c4; 376 border: 1px solid #c4c4c4;
377 border-radius: 4px; 377 border-radius: 4px;
378 padding: 9px 0; 378 padding: 9px 0;
379 } 379 }
380 380
381 -.repair-type-checkbox-list label { 381 +.report-type-checkbox-list label {
382 display: block; 382 display: block;
383 font-size: 14px; 383 font-size: 14px;
384 border-bottom: 1px dashed #e6e3e3; 384 border-bottom: 1px dashed #e6e3e3;
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
@@ -128,12 +128,12 @@ @@ -128,12 +128,12 @@
128 <div class="uk-grid"> 128 <div class="uk-grid">
129 <div class="uk-width-1-1"> 129 <div class="uk-width-1-1">
130 <div class="uk-form-row"> 130 <div class="uk-form-row">
131 - <label class="uk-form-label" >维修类型</label>  
132 - <div class="uk-form-controls repair-type-checkbox-list">  
133 - {{each repairTypes as repair i}} 131 + <label class="uk-form-label" >上报类型</label>
  132 + <div class="uk-form-controls report-type-checkbox-list">
  133 + {{each reportTypes as report i}}
134 <label> 134 <label>
135 - <input class="i-cbox" name="repairTypes[]" value="{{repair.code}}" type="checkbox" title="{{repair.name}}">  
136 - {{repair.name}} 135 + <input class="i-cbox" name="reportTypes[]" value="{{report.code}}" type="checkbox" title="{{report.name}}">
  136 + {{report.name}}
137 </label> 137 </label>
138 {{/each}} 138 {{/each}}
139 </div> 139 </div>
@@ -181,21 +181,20 @@ @@ -181,21 +181,20 @@
181 <script> 181 <script>
182 (function() { 182 (function() {
183 var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; 183 var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他'];
184 - var repairTypes = [{name:"轨迹不连续", code:"9101"}, {name:"无轨迹", code:"9102"}, {name:"收不到调度指令", code:"9103"}, {name:"调度指令延迟", code:"9105"}, {name:"信号漂移", code:"9104"}, {name:"其它GPS报修", code:"9109"}];  
185 - var modal = '#schedule-fcxxwt-modal'  
186 - ,sch; 184 + var reportTypes = [{name:"无到", code:"9101"}, {name:"无出", code:"9109"}, {name:"掉线", code:"9102"}, {name:"指令故障", code:"9103"}, {name:"车辆漂移", code:"9104"}];
  185 + var modal = '#schedule-fcxxwt-modal', sch, isReport = false;
187 $(modal).on('init', function(e, data) { 186 $(modal).on('init', function(e, data) {
188 e.stopPropagation(); 187 e.stopPropagation();
189 sch=data.sch; 188 sch=data.sch;
190 - var formHtml = template('schedule-fcxxwt-form-temp', {sch: sch, adjustExps:adjustExps, repairTypes:repairTypes}); 189 + var formHtml = template('schedule-fcxxwt-form-temp', {sch: sch, adjustExps:adjustExps, reportTypes:reportTypes});
191 $('form', modal).html(formHtml); 190 $('form', modal).html(formHtml);
192 $('input:checkbox').click(function(){ 191 $('input:checkbox').click(function(){
193 var remark = $('[name=remarks]').val(), title = $(this).prop("title"); 192 var remark = $('[name=remarks]').val(), title = $(this).prop("title");
194 if ($(this).prop('checked')) { 193 if ($(this).prop('checked')) {
195 - if (remark.indexOf(title) > -1) return;  
196 - $('[name=remarks]').val((remark ? remark + ";" : "") + title); 194 + if (remark.indexOf(title + ";;") > -1) return;
  195 + $('[name=remarks]').val((remark ? remark + "," : "") + title + ";;");
197 } else { 196 } else {
198 - $('[name=remarks]').val(remark.replace(";" + title, "").replace(title + ";", "").replace(title, "")); 197 + $('[name=remarks]').val(remark.replace("," + title + ";;", "").replace(title + ";;", ""));
199 } 198 }
200 }); 199 });
201 //字典转换 200 //字典转换
@@ -210,25 +209,22 @@ @@ -210,25 +209,22 @@
210 //售票员 209 //售票员
211 gb_common.personAutocomplete($('.spy-autocom', modal)); 210 gb_common.personAutocomplete($('.spy-autocom', modal));
212 // 维修类型选中 211 // 维修类型选中
213 - var initRepair = function() {  
214 - var remark = $('[name=remarks]').val(), items = remark.split(';');  
215 - for (var i = 0;i < items.length;i++) {  
216 - if (items[i].length > 2) {  
217 - for (var j = 0;j < repairTypes.length;j++) {  
218 - if (items[i] == repairTypes[j].name) {  
219 - $('input:checkbox[value=' + repairTypes[j].code + ']').prop('checked', true);  
220 - }  
221 - }  
222 - }  
223 - } 212 + var initReport = function() {
  213 + var remark = $('[name=remarks]').val();
  214 + for (var i = 0;i < reportTypes.length;i++) {
  215 + if (remark.indexOf(reportTypes[i] + ";;") > -1) {
  216 + $('input:checkbox[value=' + reportTypes[i].code + ']').prop('checked', true);
  217 + isReport = true;
  218 + }
  219 + }
224 } 220 }
225 - initRepair(); 221 + initReport();
226 222
227 //submit 223 //submit
228 var f = $('form', modal).formValidation(gb_form_validation_opts); 224 var f = $('form', modal).formValidation(gb_form_validation_opts);
229 f.on('success.form.fv', function(e) { 225 f.on('success.form.fv', function(e) {
230 e.preventDefault(); 226 e.preventDefault();
231 - var data = $(this).serializeJSON(); 227 + var data = $(this).serializeJSON(), reportText = new Array();
232 228
233 //校验实发实达时间 229 //校验实发实达时间
234 if(!validation_s_e_Time(data)){ 230 if(!validation_s_e_Time(data)){
@@ -241,11 +237,40 @@ @@ -241,11 +237,40 @@
241 //修改里程 237 //修改里程
242 var editJhlc = data.jhlc != sch.jhlc && data.jhlc != 0; 238 var editJhlc = data.jhlc != sch.jhlc && data.jhlc != 0;
243 // 修改报修类型为字符串 239 // 修改报修类型为字符串
244 - if (data.repairTypes) data.repairTypes = data.repairTypes.join(";");  
245 if(!data.adjustExps && (data.status==-1 || normalDestory || editJhlc)){ 240 if(!data.adjustExps && (data.status==-1 || normalDestory || editJhlc)){
246 notify_err("当前操作需要选择调整原因!"); 241 notify_err("当前操作需要选择调整原因!");
247 return; 242 return;
248 } 243 }
  244 + if (data.reportTypes) {
  245 + for (var i = 0;i < data.reportTypes.length;i++) {
  246 + for (var j = 0;j < reportTypes.length;j++) {
  247 + if (data.reportTypes[i] == reportTypes[j].code) {
  248 + reportText.push(reportTypes[j].name);
  249 + break;
  250 + }
  251 + }
  252 + }
  253 + if (!isReport) {
  254 + layer.confirm('确定上报类型[' + reportText.join(';') + ']?', {
  255 + btn : [ '确定', '取消' ],
  256 + icon : 3,
  257 + skin : 'layui-layer-cfm-add'
  258 + }, function() {
  259 + layer.closeAll();
  260 + // 修改报修类型为字符串
  261 + data.reportTypes = data.reportTypes.join(";");
  262 + postData(data);
  263 + }, function() {
  264 + $('.uk-button-primary').attr('disabled', false);
  265 + });
  266 + return;
  267 + }
  268 +
  269 + data.reportTypes = data.reportTypes.join(";");
  270 + postData(data);
  271 + return;
  272 + }
  273 +
249 postData(data); 274 postData(data);
250 }); 275 });
251 276
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sftz.html
@@ -8,13 +8,13 @@ @@ -8,13 +8,13 @@
8 </div> 8 </div>
9 9
10 <script id="schedule-sftz-form-temp" type="text/html"> 10 <script id="schedule-sftz-form-temp" type="text/html">
11 - <input type="hidden" name="id" value="{{id}}" /> 11 + <input type="hidden" name="id" value="{{sch.id}}" />
12 <div class="uk-grid"> 12 <div class="uk-grid">
13 <div class="uk-width-1-1"> 13 <div class="uk-width-1-1">
14 <div class="uk-form-row"> 14 <div class="uk-form-row">
15 <label class="uk-form-label" >车辆</label> 15 <label class="uk-form-label" >车辆</label>
16 <div class="uk-form-controls"> 16 <div class="uk-form-controls">
17 - <input type="text" value="{{clZbh}}" disabled> 17 + <input type="text" name="clZbh" value="{{sch.clZbh}}" readonly>
18 </div> 18 </div>
19 </div> 19 </div>
20 </div> 20 </div>
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <div class="uk-form-row"> 24 <div class="uk-form-row">
25 <label class="uk-form-label" >路牌</label> 25 <label class="uk-form-label" >路牌</label>
26 <div class="uk-form-controls"> 26 <div class="uk-form-controls">
27 - <input type="text" value="{{lpName}}" disabled> 27 + <input type="text" value="{{sch.lpName}}" disabled>
28 </div> 28 </div>
29 </div> 29 </div>
30 </div> 30 </div>
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 <div class="uk-form-row"> 34 <div class="uk-form-row">
35 <label class="uk-form-label" >计发时刻</label> 35 <label class="uk-form-label" >计发时刻</label>
36 <div class="uk-form-controls"> 36 <div class="uk-form-controls">
37 - <input type="text" value="{{fcsj}}" disabled> 37 + <input type="text" value="{{sch.fcsj}}" disabled>
38 </div> 38 </div>
39 </div> 39 </div>
40 </div> 40 </div>
@@ -44,7 +44,22 @@ @@ -44,7 +44,22 @@
44 <div class="uk-form-row"> 44 <div class="uk-form-row">
45 <label class="uk-form-label" >实发时刻</label> 45 <label class="uk-form-label" >实发时刻</label>
46 <div class="uk-form-controls"> 46 <div class="uk-form-controls">
47 - <input type="time" name="fcsjActual" value="{{fcsjActual}}" required autofocus> 47 + <input type="time" name="fcsjActual" value="{{sch.fcsjActual}}" required autofocus>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + </div>
  52 + <div class="uk-grid">
  53 + <div class="uk-width-1-1">
  54 + <div class="uk-form-row">
  55 + <label class="uk-form-label" >上报类型</label>
  56 + <div class="uk-form-controls report-type-checkbox-list">
  57 + {{each reportTypes as report i}}
  58 + <label>
  59 + <input class="i-cbox" name="reportTypes[]" value="{{report.code}}" type="checkbox" title="{{report.name}}">
  60 + {{report.name}}
  61 + </label>
  62 + {{/each}}
48 </div> 63 </div>
49 </div> 64 </div>
50 </div> 65 </div>
@@ -54,7 +69,7 @@ @@ -54,7 +69,7 @@
54 <div class="uk-form-row ct-stacked"> 69 <div class="uk-form-row ct-stacked">
55 <label class="uk-form-label" for="form-s-t">调整说明<small class="font-danger">(不超过20个字符)</small></label> 70 <label class="uk-form-label" for="form-s-t">调整说明<small class="font-danger">(不超过20个字符)</small></label>
56 <div class="uk-form-controls"> 71 <div class="uk-form-controls">
57 - <textarea id="form-s-t" cols="30" rows="5" name="remarks" required data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="不超过20个字符。必填">{{remarks}}</textarea> 72 + <textarea id="form-s-t" cols="30" rows="5" name="remarks" required data-fv-stringlength="true" data-fv-stringlength-max="20" placeholder="不超过20个字符。必填">{{sch.remarks}}</textarea>
58 </div> 73 </div>
59 </div> 74 </div>
60 </div> 75 </div>
@@ -68,21 +83,65 @@ @@ -68,21 +83,65 @@
68 83
69 <script> 84 <script>
70 (function() { 85 (function() {
71 - var modal = '#schedule-sftz-modal',  
72 - sch; 86 + var modal = '#schedule-sftz-modal', sch, isReport = false;
  87 + var reportTypes = [{name:"无到", code:"9101"}, {name:"无出", code:"9109"}, {name:"掉线", code:"9102"}, {name:"指令故障", code:"9103"}, {name:"车辆漂移", code:"9104"}];
73 $(modal).on('init', function(e, data) { 88 $(modal).on('init', function(e, data) {
74 e.stopPropagation(); 89 e.stopPropagation();
75 sch = data.sch; 90 sch = data.sch;
76 - var formHtml = template('schedule-sftz-form-temp', sch); 91 + debugger;
  92 + var formHtml = template('schedule-sftz-form-temp', {sch: sch, reportTypes:reportTypes});
77 $('form', modal).html(formHtml); 93 $('form', modal).html(formHtml);
  94 + $('input:checkbox').click(function(){
  95 + var remark = $('[name=remarks]').val(), title = $(this).prop("title");
  96 + if ($(this).prop('checked')) {
  97 + if (remark.indexOf(title + ";;") > -1) return;
  98 + $('[name=remarks]').val((remark ? remark + "," : "") + title + ";;");
  99 + } else {
  100 + $('[name=remarks]').val(remark.replace("," + title + ";;", "").replace(title + ";;", ""));
  101 + }
  102 + });
78 103
79 //submit 104 //submit
80 var f = $('form', modal).formValidation(gb_form_validation_opts); 105 var f = $('form', modal).formValidation(gb_form_validation_opts);
81 f.on('success.form.fv', function(e) { 106 f.on('success.form.fv', function(e) {
82 e.preventDefault(); 107 e.preventDefault();
83 - var data = $(this).serializeJSON(); 108 + var data = $(this).serializeJSON(), reportText = new Array();
84 109
85 - gb_common.$post('/realSchedule/realOutAdjust', data, function(rs) { 110 + if (data.reportTypes) {
  111 + for (var i = 0;i < data.reportTypes.length;i++) {
  112 + for (var j = 0;j < reportTypes.length;j++) {
  113 + if (data.reportTypes[i] == reportTypes[j].code) {
  114 + reportText.push(reportTypes[j].name);
  115 + break;
  116 + }
  117 + }
  118 + }
  119 + if (!isReport) {
  120 + layer.confirm('确定上报类型[' + reportText.join(';') + ']?', {
  121 + btn : [ '确定', '取消' ],
  122 + icon : 3,
  123 + skin : 'layui-layer-cfm-add'
  124 + }, function() {
  125 + layer.closeAll();
  126 + // 修改报修类型为字符串
  127 + data.reportTypes = data.reportTypes.join(";");
  128 + postData(data);
  129 + }, function() {
  130 + $('.uk-button-primary').attr('disabled', false);
  131 + });
  132 + return;
  133 + }
  134 +
  135 + data.reportTypes = data.reportTypes.join(";");
  136 + postData(data);
  137 + return;
  138 + }
  139 +
  140 + postData(data);
  141 + });
  142 +
  143 + var postData = function (data) {
  144 + gb_common.$post('/realSchedule/realOutAdjust', data, function(rs) {
86 if (rs.ts) { 145 if (rs.ts) {
87 //更新前端数据 146 //更新前端数据
88 gb_schedule_table.updateSchedule(rs.ts); 147 gb_schedule_table.updateSchedule(rs.ts);
@@ -93,7 +152,19 @@ @@ -93,7 +152,19 @@
93 gb_schedule_table.calc_yfwf_num(sch.xlBm); 152 gb_schedule_table.calc_yfwf_num(sch.xlBm);
94 } 153 }
95 }); 154 });
96 - }); 155 + }
  156 +
  157 + // 维修类型选中
  158 + var initReport = function() {
  159 + var remark = $('[name=remarks]').val();
  160 + for (var i = 0;i < reportTypes.length;i++) {
  161 + if (remark.indexOf(reportTypes[i] + ";;") > -1) {
  162 + $('input:checkbox[value=' + reportTypes[i].code + ']').prop('checked', true);
  163 + isReport = true;
  164 + }
  165 + }
  166 + }
  167 + initReport();
97 }); 168 });
98 })(); 169 })();
99 </script> 170 </script>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/wxsb.html
@@ -20,9 +20,9 @@ @@ -20,9 +20,9 @@
20 </div> 20 </div>
21 <div class="uk-width-1-2"> 21 <div class="uk-width-1-2">
22 <div class="uk-form-row"> 22 <div class="uk-form-row">
23 - <label class="uk-form-label" >报修类型</label> 23 + <label class="uk-form-label" >故障类型</label>
24 <div class="uk-form-controls"> 24 <div class="uk-form-controls">
25 - <select name="repairTypes"></select> 25 + <select name="reportTypes"></select>
26 </div> 26 </div>
27 </div> 27 </div>
28 </div> 28 </div>
@@ -35,8 +35,7 @@ @@ -35,8 +35,7 @@
35 35
36 <script> 36 <script>
37 (function() { 37 (function() {
38 - var modal = '#schedule-wxsb-modal'  
39 - ,sch; 38 + var modal = '#schedule-wxsb-modal', sch;
40 39
41 $(modal).on('init', function(e, data) { 40 $(modal).on('init', function(e, data) {
42 e.stopPropagation(); 41 e.stopPropagation();
@@ -46,23 +45,40 @@ @@ -46,23 +45,40 @@
46 45
47 //报修类型字典 46 //报修类型字典
48 var opts = new Array(); 47 var opts = new Array();
49 - var repairTypes=[{name:"录像不连续", code:"9201"}, {name:"无录像", code:"9202"}, {name:"录像缺通告", code:"9203"}, {name:"无法调取录像", code:"9204"}, {name:"其它录像报修", code:"9209"}, {name:"黑屏", code:"9301"}, {name:"间歇性黑屏", code:"9302"}, {name:"中门视屏无", code:"9303"}, {name:"卡在启动界面", code:"9304"}, {name:"倒车视频无", code:"9305"}, {name:"启动后显示倒车", code:"9306"}, {name:"其它屏幕报修", code:"9309"}];  
50 - for(var i = 0;i < repairTypes.length;i++){  
51 - opts.push('<option value="'+repairTypes[i].code+'">'+repairTypes[i].name+'</option>'); 48 + var reportTypes = [{name:"录像不连续", code:"9201"}, {name:"无录像", code:"9202"}, {name:"录像缺通告", code:"9203"}, {name:"无法调取录像", code:"9204"}, {name:"其它录像报修", code:"9209"}, {name:"黑屏", code:"9301"}, {name:"间歇性黑屏", code:"9302"}, {name:"中门视屏无", code:"9303"}, {name:"卡在启动界面", code:"9304"}, {name:"倒车视频无", code:"9305"}, {name:"启动后显示倒车", code:"9306"}, {name:"其它屏幕报修", code:"9309"}];
  49 + for(var i = 0;i < reportTypes.length;i++){
  50 + opts.push('<option value="'+reportTypes[i].code+'">'+reportTypes[i].name+'</option>');
52 } 51 }
53 - $('[name=repairTypes]', modal).html(opts.join("")); 52 + $('[name=reportTypes]', modal).html(opts.join(""));
54 53
55 //submit 54 //submit
56 var f = $('form', modal).formValidation(gb_form_validation_opts); 55 var f = $('form', modal).formValidation(gb_form_validation_opts);
57 f.on('success.form.fv', function(e) { 56 f.on('success.form.fv', function(e) {
58 e.preventDefault(); 57 e.preventDefault();
59 $('[type=submit]', f).attr('disabled', 'disabled'); 58 $('[type=submit]', f).attr('disabled', 'disabled');
60 - var data = $(this).serializeJSON();  
61 - gb_common.$post('/realSchedule/wxsb', data, function(rs){  
62 - //更新班次信息  
63 - notify_succ('操作成功!');  
64 - UIkit.modal(modal).hide();  
65 - }); 59 + var data = $(this).serializeJSON(), reportText = new Array();
  60 +
  61 + for (var j = 0;j < reportTypes.length;j++) {
  62 + if (data.reportTypes == reportTypes[j].code) {
  63 + reportText.push(reportTypes[j].name);
  64 + break;
  65 + }
  66 + }
  67 +
  68 + layer.confirm('确定上报类型[' + reportText.join(';') + ']?', {
  69 + btn : [ '确定', '取消' ],
  70 + icon : 3,
  71 + skin : 'layui-layer-cfm-add'
  72 + }, function() {
  73 + layer.closeAll();
  74 + gb_common.$post('/realSchedule/wxsb', data, function(rs){
  75 + //更新班次信息
  76 + notify_succ('操作成功!');
  77 + UIkit.modal(modal).hide();
  78 + });
  79 + }, function() {
  80 + $('.uk-button-primary').attr('disabled', false);
  81 + });
66 }); 82 });
67 }); 83 });
68 })(); 84 })();