Commit 1ab75657617d9d6a3f3c2e4c73f3258aa2743ce5

Authored by 廖磊
2 parents a1875c52 3f0d21a1

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

minhang

# Conflicts:
#	src/main/java/com/bsth/data/gpsdata/GpsRealData.java
#	src/main/resources/ms-jdbc.properties
Showing 57 changed files with 2800 additions and 870 deletions

Too many changes to show.

To preserve performance only 57 of 652 files are displayed.

... ... @@ -225,6 +225,12 @@
225 225 <artifactId>spring-boot-devtools</artifactId>
226 226 <optional>true</optional>
227 227 </dependency>-->
  228 + <dependency>
  229 + <groupId>com.vividsolutions</groupId>
  230 + <artifactId>jts</artifactId>
  231 + <version>1.13</version>
  232 + </dependency>
  233 +
228 234 </dependencies>
229 235  
230 236 <dependencyManagement>
... ...
src/main/java/com/bsth/controller/BaseController2.java
... ... @@ -187,9 +187,11 @@ public class BaseController2&lt;T, ID extends Serializable&gt; {
187 187 }
188 188  
189 189 System.out.println(outputfile.getName());
  190 + System.out.println(outputfile.getAbsolutePath());
  191 +
190 192 String filePath = outputfile.getAbsolutePath();
191   - String fp[] = filePath.split(File.separator);
192   - String fileName = fp[fp.length - 1];
  193 +// String fp[] = filePath.split(File.separator);
  194 +// String fileName = fp[fp.length - 1];
193 195  
194 196 // TODO:使用ktr获取导出数据
195 197  
... ...
src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -65,10 +65,12 @@ public class ExportController {
65 65 i++;
66 66 }
67 67  
  68 +
  69 +
68 70 try {
69 71 listI.add(resList.iterator());
70 72 String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
71   - ee.excelReplace(listI, new Object[] { map }, path + "mould\\linepassengerflow.xls",
  73 + ee.excelReplace(listI, new Object[] { map }, path + "mould\\linepasswengerflow.xls",
72 74 path + "export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
73 75 } catch (Exception e) {
74 76 e.printStackTrace();
... ... @@ -189,7 +191,7 @@ public class ExportController {
189 191 listI.add(resList.iterator());
190 192 String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
191 193 ee.excelReplace(listI, new Object[] { map }, path + "mould\\singledata.xls",
192   - path + "export\\路单报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  194 + path + "export\\路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
193 195 } catch (Exception e) {
194 196 e.printStackTrace();
195 197 }
... ... @@ -203,8 +205,8 @@ public class ExportController {
203 205 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
204 206 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
205 207 ReportUtils ee = new ReportUtils();
206   - List<Vehicleloading> vehicleloading = formsService.vehicleloading(/*map.get("gsdmVehic").toString(),map.get("fgsdmVehic").toString(),*/map.get("line").toString(),
207   - map.get("date").toString());
  208 + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("gsdmVehic").toString(),map.get("fgsdmVehic").toString(),map.get("line").toString(),
  209 + map.get("data").toString());
208 210 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
209 211 int i = 1;
210 212 for (Vehicleloading l : vehicleloading) {
... ... @@ -214,8 +216,8 @@ public class ExportController {
214 216 m.put("gS", l.getgS());
215 217 m.put("xL", l.getxL());
216 218 m.put("clzbh", l.getClzbh());
217   - m.put("hyl", l.getHyl());
218 219 m.put("jzl", l.getJzl());
  220 + m.put("hyl", l.getHyl());
219 221 m.put("ls", l.getLs());
220 222 m.put("jhlc", l.getJhlc());
221 223 m.put("unyyyl", l.getUnyyyl());
... ... @@ -229,7 +231,7 @@ public class ExportController {
229 231 listI.add(resList.iterator());
230 232 String path = this.getClass().getResource("/").getPath() + "static\\pages\\forms\\";
231 233 ee.excelReplace(listI, new Object[] { map }, path + "mould\\vehicleloading.xls",
232   - path + "export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls");
  234 + path + "export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("dat").toString())) + ".xls");
233 235 } catch (Exception e) {
234 236 e.printStackTrace();
235 237 }
... ... @@ -417,5 +419,9 @@ public class ExportController {
417 419 }
418 420 return resList;
419 421 }
  422 +
  423 +
  424 +
  425 +
420 426  
421 427 }
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
... ... @@ -80,9 +80,9 @@ public class MCY_FormsController {
80 80  
81 81 // 车辆加注
82 82 @RequestMapping(value = "/vehicleloading", method = RequestMethod.POST)
83   - public List<Vehicleloading> vehicleloading(/*@RequestParam String gsdmVehic, @RequestParam String fgsdmVehic,*/
  83 + public List<Vehicleloading> vehicleloading(@RequestParam String gsdmVehic, @RequestParam String fgsdmVehic,
84 84 @RequestParam String line, @RequestParam String data) {
85   - return formsService.vehicleloading(/*gsdmVehic, fgsdmVehic, */line, data);
  85 + return formsService.vehicleloading(gsdmVehic, fgsdmVehic, line, data);
86 86 }
87 87  
88 88 // 运营服务阶段报表
... ...
src/main/java/com/bsth/controller/gps/GpsController.java
1 1 package com.bsth.controller.gps;
2 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.*;
8   -
9 3 import com.bsth.data.BasicData;
10 4 import com.bsth.data.gpsdata.GpsEntity;
11 5 import com.bsth.data.gpsdata.GpsRealData;
12 6 import com.bsth.service.gps.GpsService;
13 7 import com.google.common.base.Splitter;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.*;
  10 +
  11 +import java.util.List;
  12 +import java.util.Map;
14 13  
15 14 @RestController
16 15 @RequestMapping("gps")
... ... @@ -70,7 +69,7 @@ public class GpsController {
70 69 return gpsService.history(nbbmArray, st, et);
71 70 }
72 71  
73   - /*@RequestMapping(value = "/arrival/ram")
  72 + /*@RequestMapping(value = "/analyse/ram")
74 73 public List<ArrivalInfo> ramData(@RequestParam String nbbm) {
75 74 return ArrivalDataBuffer.allMap.get(nbbm);
76 75 }*/
... ... @@ -84,4 +83,9 @@ public class GpsController {
84 83 public Map<String, Object> findBuffAeraByCode(@RequestParam String code,@RequestParam String type){
85 84 return gpsService.findBuffAeraByCode(code, type);
86 85 }
  86 +
  87 + @RequestMapping(value = "/findRoadSpeed")
  88 + public Map<String, Object> findRoadSpeed(@RequestParam String lineCode){
  89 + return gpsService.findRoadSpeed(lineCode);
  90 + }
87 91 }
... ...
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
3   -import java.util.HashMap;
4   -import java.util.List;
5   -import java.util.Map;
6   -
7   -import org.springframework.web.bind.annotation.RequestMapping;
8   -import org.springframework.web.bind.annotation.RestController;
9   -
10 3 import com.alibaba.fastjson.JSON;
11 4 import com.alibaba.fastjson.serializer.PropertyFilter;
12 5 import com.bsth.data.BasicData;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import java.util.HashMap;
  10 +import java.util.List;
  11 +import java.util.Map;
13 12  
14 13 @RestController
15 14 @RequestMapping("/basic")
... ...
src/main/java/com/bsth/controller/schedule/RerunController.java deleted 100644 → 0
1   -package com.bsth.controller.schedule;
2   -
3   -import com.bsth.controller.BaseController;
4   -import com.bsth.entity.schedule.rule.RerunRule;
5   -import com.bsth.repository.schedule.RerunRuleRepository;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.*;
8   -
9   -import java.util.Map;
10   -
11   -/**
12   - * Created by xu on 16/10/20.
13   - */
14   -@RestController
15   -@RequestMapping("rms")
16   -public class RerunController extends BaseController<RerunRule, Long> {
17   -
18   - @Autowired
19   - private RerunRuleRepository rerunRuleRepository;
20   -
21   - @Override
22   - public RerunRule findById(@PathVariable("id") Long aLong) {
23   - return rerunRuleRepository.findOneExtend(aLong);
24   - }
25   -
26   - /**
27   - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
28   - * @Title: save
29   - * @Description: TODO(持久化对象)
30   - * @param @param t
31   - * @param @return 设定文件
32   - * @return Map<String,Object> {status: 1(成功),-1(失败)}
33   - * @throws
34   - */
35   - @RequestMapping(method = RequestMethod.POST)
36   - public Map<String, Object> save(@RequestBody RerunRule t){
37   - return baseService.save(t);
38   - }
39   -
40   -
41   -}
src/main/java/com/bsth/controller/schedule/TTInfoController.java deleted 100644 → 0
1   -package com.bsth.controller.schedule;
2   -
3   -import com.bsth.controller.BaseController2;
4   -import com.bsth.entity.schedule.TTInfo;
5   -import com.bsth.repository.schedule.TTInfoDetailRepository;
6   -import com.bsth.repository.schedule.TTInfoRepository;
7   -import com.bsth.service.schedule.utils.DataToolsProperties;
8   -import org.springframework.beans.factory.annotation.Autowired;
9   -import org.springframework.boot.context.properties.EnableConfigurationProperties;
10   -import org.springframework.data.domain.Page;
11   -import org.springframework.web.bind.annotation.*;
12   -
13   -import java.util.Map;
14   -
15   -/**
16   - * Created by xu on 16/5/12.
17   - */
18   -@RestController
19   -@RequestMapping("tic")
20   -@EnableConfigurationProperties(DataToolsProperties.class)
21   -public class TTInfoController extends BaseController2<TTInfo, Long> {
22   - @Autowired
23   - private DataToolsProperties dataToolsProperties;
24   - @Autowired
25   - private TTInfoRepository ttInfoRepository;
26   - @Autowired
27   - private TTInfoDetailRepository ttInfoDetailRepository;
28   -
29   - @Override
30   - protected String getDataImportKtrClasspath() {
31   - return dataToolsProperties.getTtinfoDatainputktr();
32   - }
33   -
34   - @Override
35   - public TTInfo findById(@PathVariable("id") Long aLong) {
36   - return ttInfoRepository.findOneExtend(aLong);
37   - }
38   -
39   - /**
40   - * 验证。
41   - * @param map
42   - * @return
43   - */
44   - @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)
45   - public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {
46   - // 一般比较自编号是否重复
47   - return baseService.validateEquale(map);
48   - }
49   -
50   - @Override
51   - public Page<TTInfo> list(@RequestParam Map<String, Object> map, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "10") int size, @RequestParam(defaultValue = "id") String order, @RequestParam(defaultValue = "DESC") String direction) {
52   - // 如果有isCancel键值,将其值变成boolean
53   - if (map.get("isCancel_eq") != null)
54   - map.put("isCancel_eq", new Boolean(map.get("isCancel_eq").toString()));
55   -
56   - return super.list(map, page, size, order, direction);
57   - }
58   -}
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
... ... @@ -113,6 +113,9 @@ public class TTInfoDetailController extends BaseController2&lt;TTInfoDetail, Long&gt;
113 113 p1.put("stationName_eq", cell_con.trim());
114 114 p1.put("stationMark_eq", "B");
115 115  
  116 +
  117 + // TODO:这里要修改(起点站有启用撤销的标志的)
  118 +
116 119 List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1);
117 120 if (CollectionUtils.isEmpty(stationRouteList)) {
118 121 rtn.put("status", ResponseCode.ERROR);
... ...
src/main/java/com/bsth/controller/schedule/core/RerunController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.bsth.controller.schedule.BController;
  4 +import com.bsth.entity.schedule.rule.RerunRule;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by xu on 16/10/20.
  10 + */
  11 +@RestController
  12 +@RequestMapping("rms")
  13 +public class RerunController extends BController<RerunRule, Long> {
  14 +
  15 +
  16 +}
... ...
src/main/java/com/bsth/controller/schedule/core/TTInfoController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.schedule.TTInfo;
  6 +import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.TTInfoService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/12/20.
  19 + */
  20 +@RestController(value = "tTInfoController_ec")
  21 +@RequestMapping(value = "tic_ec")
  22 +public class TTInfoController extends BController<TTInfo, Long> {
  23 + @Autowired
  24 + private TTInfoService ttInfoService;
  25 +
  26 + @RequestMapping(value = "/validate_name", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_name(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 名字重复验证
  31 + TTInfo ttInfo = new TTInfo(
  32 + param.get("id_eq"),
  33 + param.get("xl.id_eq"),
  34 + param.get("name_eq"),
  35 + param.get("rule_days_eq"),
  36 + param.get("special_days_eq")
  37 + );
  38 + ttInfoService.validate_name(ttInfo);
  39 + rtn.put("status", ResponseCode.SUCCESS);
  40 + } catch (ScheduleException exp) {
  41 + rtn.put("status", ResponseCode.ERROR);
  42 + rtn.put("msg", exp.getMessage());
  43 + }
  44 +
  45 + return rtn;
  46 + }
  47 +
  48 + @RequestMapping(value = "/validate_n_d", method = RequestMethod.GET)
  49 + public Map<String, Object> validate_n_d(@RequestParam Map<String, Object> param) {
  50 + Map<String, Object> rtn = new HashMap<>();
  51 + try {
  52 + // 常规有效日重复验证
  53 + TTInfo ttInfo = new TTInfo(
  54 + param.get("id_eq"),
  55 + param.get("xl.id_eq"),
  56 + param.get("name_eq"),
  57 + param.get("rule_days_eq"),
  58 + param.get("special_days_eq")
  59 + );
  60 + ttInfoService.validate_n_d(ttInfo);
  61 + rtn.put("status", ResponseCode.SUCCESS);
  62 + } catch (ScheduleException exp) {
  63 + rtn.put("status", ResponseCode.ERROR);
  64 + rtn.put("msg", exp.getMessage());
  65 + }
  66 + return rtn;
  67 + }
  68 +
  69 + @RequestMapping(value = "/validate_s_d", method = RequestMethod.GET)
  70 + public Map<String, Object> validate_s_d(@RequestParam Map<String, Object> param) {
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + try {
  73 + // 特殊有效日重复判定
  74 + TTInfo ttInfo = new TTInfo(
  75 + param.get("id_eq"),
  76 + param.get("xl.id_eq"),
  77 + param.get("name_eq"),
  78 + param.get("rule_days_eq"),
  79 + param.get("special_days_eq")
  80 + );
  81 + ttInfoService.validate_s_d(ttInfo);
  82 + rtn.put("status", ResponseCode.SUCCESS);
  83 + } catch (ScheduleException exp) {
  84 + rtn.put("status", ResponseCode.ERROR);
  85 + rtn.put("msg", exp.getMessage());
  86 + }
  87 + return rtn;
  88 + }
  89 +
  90 +}
  91 +
  92 +//
  93 +//@Autowired
  94 +//private DataToolsProperties dataToolsProperties;
  95 +//@Autowired
  96 +//private TTInfoRepository ttInfoRepository;
  97 +//@Autowired
  98 +//private TTInfoDetailRepository ttInfoDetailRepository;
  99 +//
  100 +// @Override
  101 +// protected String getDataImportKtrClasspath() {
  102 +// return dataToolsProperties.getTtinfoDatainputktr();
  103 +// }
  104 +//
  105 +// @Override
  106 +// public TTInfo findById(@PathVariable("id") Long aLong) {
  107 +// return ttInfoRepository.findOneExtend(aLong);
  108 +// }
  109 +//
  110 +// /**
  111 +// * 验证。
  112 +// * @param map
  113 +// * @return
  114 +// */
  115 +// @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)
  116 +// public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {
  117 +// // 一般比较自编号是否重复
  118 +// return baseService.validateEquale(map);
  119 +// }
  120 +//
  121 +// @Override
  122 +// public Page<TTInfo> list(@RequestParam Map<String, Object> map, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "10") int size, @RequestParam(defaultValue = "id") String order, @RequestParam(defaultValue = "DESC") String direction) {
  123 +// // 如果有isCancel键值,将其值变成boolean
  124 +// if (map.get("isCancel_eq") != null)
  125 +// map.put("isCancel_eq", new Boolean(map.get("isCancel_eq").toString()));
  126 +//
  127 +// return super.list(map, page, size, order, direction);
  128 +// }
0 129 \ No newline at end of file
... ...
src/main/java/com/bsth/data/BasicData.java
1 1 package com.bsth.data;
2 2  
3 3 import com.bsth.Application;
  4 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
4 5 import com.bsth.entity.*;
5 6 import com.bsth.entity.schedule.CarConfigInfo;
6 7 import com.bsth.repository.*;
... ... @@ -57,7 +58,7 @@ public class BasicData implements CommandLineRunner {
57 58 public static Map<String, String> lineCode2NameMap;
58 59  
59 60 //线路编码_站点编码 == 0|1 上下行
60   - public static Map<String, Integer> lineStationUpDownMap;
  61 + //public static Map<String, Integer> lineStationUpDownMap;
61 62  
62 63 //停车场
63 64 public static List<String> parkCodeList;
... ... @@ -86,7 +87,7 @@ public class BasicData implements CommandLineRunner {
86 87  
87 88 @Override
88 89 public void run(String... arg0) throws Exception {
89   - Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 1, TimeUnit.HOURS);
  90 + Application.mainServices.scheduleWithFixedDelay(dataLoader, 2, 2, TimeUnit.HOURS);
90 91 }
91 92  
92 93  
... ... @@ -117,6 +118,9 @@ public class BasicData implements CommandLineRunner {
117 118 @Autowired
118 119 BusinessRepository businessRepository;
119 120  
  121 + @Autowired
  122 + GeoCacheData geoCacheData;
  123 +
120 124  
121 125 @Override
122 126 public void run() {
... ... @@ -138,11 +142,13 @@ public class BasicData implements CommandLineRunner {
138 142 //车辆和线路映射信息
139 143 loadNbbm2LineInfo();
140 144 //站点路由信息
141   - loadStationRouteInfo();
  145 + //loadStationRouteInfo();
142 146 //人员信息
143 147 loadPersonnelInfo();
144 148 //公司信息
145 149 loadBusinessInfo();
  150 +
  151 + geoCacheData.loadData();
146 152 logger.info("加载基础数据成功!,");
147 153 } catch (Exception e) {
148 154 logger.error("加载基础数据时出现异常,", e);
... ... @@ -151,7 +157,7 @@ public class BasicData implements CommandLineRunner {
151 157 }
152 158  
153 159  
154   - private void loadStationRouteInfo() {
  160 +/* private void loadStationRouteInfo() {
155 161 Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator();
156 162  
157 163 Map<String, String> sePointMap = new HashMap<>();
... ... @@ -172,7 +178,7 @@ public class BasicData implements CommandLineRunner {
172 178 }
173 179 lineStationUpDownMap = map;
174 180 lineSEPointMap = sePointMap;
175   - }
  181 + }*/
176 182  
177 183 /**
178 184 * loadBusinessInfo
... ... @@ -280,7 +286,7 @@ public class BasicData implements CommandLineRunner {
280 286 /**
281 287 * 加载运管处的站点及序号
282 288 * 上行从1开始,下行顺序续编
283   - */
  289 +
284 290 List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
285 291 if(ygcLines != null && ygcLines.size() > 0){
286 292 int size = ygcLines.size();
... ... @@ -299,7 +305,7 @@ public class BasicData implements CommandLineRunner {
299 305 key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
300 306 tempStationName2YgcNumber.put(key,num++);
301 307 }
302   - }
  308 + }*/
303 309 }
304 310  
305 311 lineId2CodeMap = biMap;
... ...
src/main/java/com/bsth/data/arrival/AnalyseData.java
1 1 package com.bsth.data.arrival;
2 2  
3   -import java.util.ArrayList;
4   -import java.util.Collections;
5   -import java.util.List;
6   -import java.util.Set;
7   -
8 3 import org.slf4j.Logger;
9 4 import org.slf4j.LoggerFactory;
10 5 import org.springframework.stereotype.Component;
11 6  
12   -import com.bsth.data.BasicData;
  7 +import java.util.ArrayList;
  8 +import java.util.Collections;
  9 +import java.util.List;
  10 +import java.util.Set;
13 11  
14 12 /**
15 13 *
... ... @@ -98,14 +96,15 @@ public class AnalyseData {
98 96 }
99 97  
100 98 private boolean effective(ArrivalEntity arr){
101   - //停车场
  99 + /*//停车场
102 100 if(BasicData.parkCodeList.contains(arr.getStopNo())){
103 101 arr.setTcc(true);
104 102 return true;
105 103 }
106   -
  104 +
107 105 Integer upDown = BasicData.lineStationUpDownMap.get(arr.getLineCode() + "_" + arr.getStopNo());
108   -
109   - return arr.getUpDown() == upDown || BasicData.parkCodeList.contains(arr.getStopNo());
  106 +
  107 + return arr.getUpDown() == upDown || BasicData.parkCodeList.contains(arr.getStopNo());*/
  108 + return false;
110 109 }
111 110 }
... ...
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
... ... @@ -70,7 +70,7 @@ public class ForecastRealServer implements CommandLineRunner {
70 70 /* public void forecast(String nbbm){
71 71 logger.info("预测," + nbbm);
72 72 //当前执行班次
73   - ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm);
  73 + ScheduleRealInfo sch = dayOfSchedule.execPlanMap().get(nbbm);
74 74 if(null == sch)
75 75 return;
76 76  
... ... @@ -86,7 +86,7 @@ public class ForecastRealServer implements CommandLineRunner {
86 86 //终点站
87 87 String eStation = null;
88 88 //当前执行班次
89   - ScheduleRealInfo sch = dayOfSchedule.execPlamMap().get(nbbm);
  89 + ScheduleRealInfo sch = dayOfSchedule.execPlanMap().get(nbbm);
90 90 if(null != sch)
91 91 eStation = sch.getZdzCode();
92 92  
... ...
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
1 1 package com.bsth.data.gpsdata;
2 2  
  3 +import com.bsth.data.gpsdata.analyse.StationRoute;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +
3 6 /**
4 7 *
5 8 * @ClassName: GpsRealData
... ... @@ -58,21 +61,32 @@ public class GpsEntity {
58 61 /** 预计到达终点时间 */
59 62 private Float expectStopTime;
60 63  
61   - /** 设备是否在线 */
  64 + /** 设备是否在线
62 65 private boolean online;
63   -
  66 + */
64 67 /** 当前执行班次ID */
65 68 private Long schId;
66 69  
67 70 /** 是否异常数据 */
68 71 private boolean abnormal;
69   -
70   - private int valid;
  72 +/*
  73 + private int valid;*/
71 74  
72 75 private int version;
73 76  
74   - /** 是否起终点站 */
  77 + /** 是否起终点站
75 78 private boolean sEPoint;
  79 + */
  80 +
  81 + /** 站内 */
  82 + private boolean instation;
  83 +
  84 + /** 站点信息,站内时有值 */
  85 + @JsonIgnore
  86 + private StationRoute station;
  87 +
  88 + /** 状态 */
  89 + private String state2;
76 90  
77 91 public Integer getCompanyCode() {
78 92 return companyCode;
... ... @@ -178,14 +192,6 @@ public class GpsEntity {
178 192 this.stationName = stationName;
179 193 }
180 194  
181   - public boolean isOnline() {
182   - return online;
183   - }
184   -
185   - public void setOnline(boolean online) {
186   - this.online = online;
187   - }
188   -
189 195 public long getArrTime() {
190 196 return arrTime;
191 197 }
... ... @@ -218,35 +224,44 @@ public class GpsEntity {
218 224 this.schId = schId;
219 225 }
220 226  
221   - public boolean isAbnormal() {
222   - return abnormal;
  227 +
  228 + public int getVersion() {
  229 + return version;
223 230 }
224 231  
225   - public void setAbnormal(boolean abnormal) {
226   - this.abnormal = abnormal;
  232 + public void setVersion(int version) {
  233 + this.version = version;
227 234 }
228 235  
229   - public int getValid() {
230   - return valid;
  236 + public boolean isInstation() {
  237 + return instation;
231 238 }
232 239  
233   - public void setValid(int valid) {
234   - this.valid = valid;
  240 + public void setInstation(boolean instation) {
  241 + this.instation = instation;
235 242 }
236 243  
237   - public int getVersion() {
238   - return version;
  244 + public StationRoute getStation() {
  245 + return station;
239 246 }
240 247  
241   - public void setVersion(int version) {
242   - this.version = version;
  248 + public void setStation(StationRoute station) {
  249 + this.station = station;
  250 + }
  251 +
  252 + public boolean isAbnormal() {
  253 + return abnormal;
  254 + }
  255 +
  256 + public void setAbnormal(boolean abnormal) {
  257 + this.abnormal = abnormal;
243 258 }
244 259  
245   - public boolean issEPoint() {
246   - return sEPoint;
  260 + public String getState2() {
  261 + return state2;
247 262 }
248 263  
249   - public void setsEPoint(boolean sEPoint) {
250   - this.sEPoint = sEPoint;
  264 + public void setState2(String state2) {
  265 + this.state2 = state2;
251 266 }
252 267 }
... ...
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
... ... @@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
5 5 import com.bsth.Application;
6 6 import com.bsth.data.BasicData;
7 7 import com.bsth.data.forecast.ForecastRealServer;
  8 +import com.bsth.data.gpsdata.analyse.GpsAnalyse;
  9 +import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
8 10 import com.bsth.data.schedule.DayOfSchedule;
9 11 import com.bsth.entity.realcontrol.ScheduleRealInfo;
10 12 import com.bsth.util.ConfigUtil;
... ... @@ -55,6 +57,9 @@ public class GpsRealData implements CommandLineRunner{
55 57  
56 58 @Autowired
57 59 ForecastRealServer forecastRealServer;
  60 +
  61 +
  62 +
58 63 /**
59 64 * 构造函数
60 65 */
... ... @@ -67,13 +72,17 @@ public class GpsRealData implements CommandLineRunner{
67 72 @Override
68 73 public void run(String... arg0) throws Exception {
69 74 logger.info("gpsDataLoader,20,6");
70   - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS);
  75 + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 40, 20, TimeUnit.SECONDS);
71 76 }
72 77  
73 78 public GpsEntity add(GpsEntity gps) {
74 79 String device = gps.getDeviceId();
75 80 GpsEntity old = gpsMap.get(device);
76 81  
  82 + //分析gps
  83 + if(isAvailable(gps) && (old == null || old.getTimestamp() != gps.getTimestamp()))
  84 + GpsAnalyse.start(gps);
  85 +
77 86 if(!StringUtils.isEmpty(gps.getStopNo())){
78 87 //定时定距数据附带站点编码改变
79 88 if(null == old || !gps.getStopNo().equals(old.getStopNo())){
... ... @@ -94,6 +103,11 @@ public class GpsRealData implements CommandLineRunner{
94 103 return gps;
95 104 }
96 105  
  106 + public boolean isAvailable(GpsEntity gps){
  107 + return StringUtils.isNotEmpty(gps.getLineId()) &&
  108 + dayOfSchedule.getCurrSchDate().containsKey(gps.getLineId());
  109 + }
  110 +
97 111 /**
98 112 *
99 113 * @Title: get @Description: TODO(设备号获取GPS)
... ... @@ -118,7 +132,7 @@ public class GpsRealData implements CommandLineRunner{
118 132 if(gps.isAbnormal())
119 133 continue;
120 134  
121   - sch = dayOfSchedule.execPlamMap().get(gps.getNbbm());
  135 + sch = dayOfSchedule.execPlanMap().get(gps.getNbbm());
122 136 if(null != sch)
123 137 gps.setSchId(sch.getId());
124 138 rs.add(gps);
... ... @@ -161,6 +175,11 @@ public class GpsRealData implements CommandLineRunner{
161 175 @Override
162 176 public void run() {
163 177 try{
  178 + //如果正在恢复数据
  179 + if(GpsDataRecovery.run){
  180 + return;
  181 + }
  182 +
164 183 load();
165 184 }catch(Exception e){
166 185 logger.error("", e);
... ... @@ -207,21 +226,7 @@ public class GpsRealData implements CommandLineRunner{
207 226 gpsRealData.add(gps);
208 227  
209 228 //纠正走向
210   - correctUpdown(gps);
211   - /*if(issEPoint(gps))
212   - continue;
213   -
214   - //如果走向未知,尝试根据站点纠正走向
215   - if(gps.getUpDown() == -1){
216   - updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
217   - if(updown != null)
218   - gps.setUpDown(updown);
219   - }
220   - //如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向
221   - updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
222   - if(updown != null && !gps.getUpDown().equals(updown)){
223   - gps.setUpDown(updown);
224   - }*/
  229 + //correctUpdown(gps);
225 230 }
226 231 } else
227 232 logger.error("result is null");
... ... @@ -240,7 +245,7 @@ public class GpsRealData implements CommandLineRunner{
240 245 * 是否是起终点
241 246 * @param gps
242 247 * @return
243   - */
  248 +
244 249 public boolean isSEPoint(GpsEntity gps){
245 250 String key = gps.getLineId()+"_"+gps.getUpDown()+"_"
246 251 ,stationCode;
... ... @@ -261,29 +266,19 @@ public class GpsRealData implements CommandLineRunner{
261 266 }
262 267 }
263 268 return false;
264   - }
  269 + }*/
265 270  
266 271 /**
267 272 * 纠正上下行
268 273 * @param gps
269   - */
  274 +
270 275 public void correctUpdown(GpsEntity gps){
271 276 Integer updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
272 277 if(updown != null && !updown.equals(gps.getUpDown()))
273 278 gps.setUpDown(updown);
274   - /*//如果走向未知,尝试根据站点纠正走向
275   - if(gps.getUpDown() == -1){
276   -
277   - }*/
278 279  
279 280 if(isSEPoint(gps))
280 281 return;
281   -
282   - /*//如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向
283   - updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo());
284   - if(updown != null && !gps.getUpDown().equals(updown)){
285   - gps.setUpDown(updown);
286   - }*/
287   - }
  282 + }*/
288 283 }
289   -}
  284 +}
290 285 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/CircleQueue.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import java.util.Arrays;
  4 +
  5 +/**
  6 + * 循环队列
  7 + * Created by panzhao on 2016/12/23.
  8 + */
  9 +public class CircleQueue<T> {
  10 +
  11 + /**
  12 + * (循环队列)数组的容量
  13 + */
  14 + public int capacity;
  15 +
  16 + /**
  17 + * 数组:保存循环队列的元素
  18 + */
  19 + public Object[] elementData;
  20 +
  21 + /**
  22 + * 队头(先进先出)
  23 + */
  24 + public int head = 0;
  25 +
  26 + /**
  27 + * 队尾
  28 + */
  29 + public int tail = 0;
  30 +
  31 + /**
  32 + * 以指定长度的数组来创建循环队列
  33 + *
  34 + * @param initSize
  35 + */
  36 + public CircleQueue(final int initSize) {
  37 + capacity = initSize;
  38 + elementData = new Object[capacity];
  39 + }
  40 +
  41 + /**
  42 + * 获取循环队列的大小(包含元素的个数)
  43 + */
  44 + public int size() {
  45 + if (isEmpty()) {
  46 + return 0;
  47 + } else if (isFull()) {
  48 + return capacity;
  49 + } else {
  50 + return tail + 1;
  51 + }
  52 + }
  53 +
  54 + /**
  55 + * 插入队尾一个元素
  56 + */
  57 + public void add(final T element) {
  58 + if (isEmpty()) {
  59 + elementData[0] = element;
  60 + } else if (isFull()) {
  61 + elementData[head] = element;
  62 + head++;
  63 + tail++;
  64 + head = head == capacity ? 0 : head;
  65 + tail = tail == capacity ? 0 : tail;
  66 + } else {
  67 + elementData[tail + 1] = element;
  68 + tail++;
  69 + }
  70 + }
  71 +
  72 + public boolean isEmpty() {
  73 + return tail == head && tail == 0 && elementData[tail] == null;
  74 + }
  75 +
  76 + public boolean isFull() {
  77 + return head != 0 && head - tail == 1 || head == 0 && tail == capacity - 1;
  78 + }
  79 +
  80 + public void clear() {
  81 + Arrays.fill(elementData, null);
  82 + head = 0;
  83 + tail = 0;
  84 + }
  85 +
  86 + /**
  87 + * @return 取 循环队列里的值(先进的index=0)
  88 + */
  89 + public Object[] getQueue() {
  90 + final Object[] elementDataSort = new Object[capacity];
  91 + final Object[] elementDataCopy = elementData.clone();
  92 + if (isEmpty()) {
  93 + } else if (isFull()) {
  94 + int indexMax = capacity;
  95 + int indexSort = 0;
  96 + for (int i = head; i < indexMax;) {
  97 + elementDataSort[indexSort] = elementDataCopy[i];
  98 + indexSort++;
  99 + i++;
  100 + if (i == capacity) {
  101 + i = 0;
  102 + indexMax = head;
  103 + }
  104 + }
  105 + } else {
  106 + for (int i = 0; i < tail; i++) {
  107 + elementDataSort[i] = elementDataCopy[i];
  108 + }
  109 + }
  110 + return elementDataSort;
  111 + }
  112 +
  113 + public T getTail(){
  114 + return elementData[tail] == null?null:(T)elementData[tail];
  115 + }
  116 +}
0 117 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/GeoCacheData.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.google.common.collect.ArrayListMultimap;
  5 +import com.vividsolutions.jts.geom.Coordinate;
  6 +import com.vividsolutions.jts.geom.GeometryFactory;
  7 +import com.vividsolutions.jts.geom.LineString;
  8 +import com.vividsolutions.jts.geom.Polygon;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.jdbc.core.RowMapper;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.sql.ResultSet;
  18 +import java.sql.SQLException;
  19 +import java.util.*;
  20 +
  21 +/**
  22 + * Created by panzhao on 2016/12/23.
  23 + */
  24 +@Component
  25 +public class GeoCacheData {
  26 +
  27 + static Logger logger = LoggerFactory.getLogger(GeoCacheData.class);
  28 +
  29 + //每辆车缓存最后200条gps
  30 + private static final int CACHE_SIZE = 200;
  31 + private static Map<String, CircleQueue<GpsEntity>> gpsCacheMap = new HashMap<>();
  32 +
  33 + //线路路段走向
  34 + private static ArrayListMultimap<String, LineString> sectionCacheMap;
  35 +
  36 + //线路站点路由
  37 + private static ArrayListMultimap<String, StationRoute> stationCacheMap;
  38 +
  39 + //停车场
  40 + public static Map<String, Polygon> tccMap;
  41 +
  42 + @Autowired
  43 + JdbcTemplate jdbcTemplate;
  44 +
  45 + public static CircleQueue<GpsEntity> getGps(String nbbm) {
  46 + return gpsCacheMap.get(nbbm);
  47 + }
  48 +
  49 + public static void putGps(GpsEntity gps) {
  50 + CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getNbbm());
  51 + if (queue == null) {
  52 + //第一个点从站内开始
  53 + if(!gps.isInstation())
  54 + return;
  55 +
  56 + queue = new CircleQueue<>(CACHE_SIZE);
  57 + gpsCacheMap.put(gps.getNbbm(), queue);
  58 + }
  59 + queue.add(gps);
  60 + }
  61 +
  62 + public static List<StationRoute> getStationRoute(String lineCode, int directions) {
  63 + return stationCacheMap.get(lineCode + "_" + directions);
  64 + }
  65 +
  66 + public static StationRoute getStation(String lineCode, int directions, String code) {
  67 + List<StationRoute> list = getStationRoute(lineCode, directions);
  68 +
  69 + for (StationRoute sr : list) {
  70 + if (sr.getCode().equals(code)) {
  71 + return sr;
  72 + }
  73 + }
  74 + return null;
  75 + }
  76 +
  77 + public static Polygon getTccPolygon(String code){
  78 + return tccMap.get(code);
  79 + }
  80 +
  81 + public void loadData() {
  82 + final GeometryFactory geometryFactory = new GeometryFactory();
  83 + //加载站点路由
  84 + String sql = "select r.LINE_CODE,r.DIRECTIONS,r.STATION_CODE,r.STATION_MARK,s.SHAPES_TYPE,s.G_LONX,s.G_LATY,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID,s.RADIUS, r.STATION_ROUTE_CODE from bsth_c_stationroute r left join bsth_c_station s on r.station=s.id where r.destroy=0 order by r.station_route_code";
  85 + List<StationRoute> routeList = jdbcTemplate.query(sql, new RowMapper<StationRoute>() {
  86 + @Override
  87 + public StationRoute mapRow(ResultSet rs, int rowNum) throws SQLException {
  88 + StationRoute sRoute = new StationRoute();
  89 + sRoute.setCode(rs.getString("STATION_CODE"));
  90 + sRoute.setLineCode(rs.getString("LINE_CODE"));
  91 + sRoute.setDirections(rs.getInt("DIRECTIONS"));
  92 + sRoute.setPoint(geometryFactory.createPoint(new Coordinate(rs.getFloat("G_LATY"), rs.getFloat("G_LONX"))));
  93 + sRoute.setRadius(rs.getFloat("RADIUS"));
  94 + sRoute.setRouteSort(rs.getInt("STATION_ROUTE_CODE"));
  95 + sRoute.setMark(rs.getString("STATION_MARK"));
  96 +
  97 + String shapesType = rs.getString("SHAPES_TYPE");
  98 + //多边形电子围栏
  99 + if (StringUtils.isNotEmpty(shapesType) && shapesType.equals("d")) {
  100 + geometryFactory.createPolygon(parsePolygon(rs.getString("G_POLYGON_GRID")));
  101 + }
  102 + return sRoute;
  103 + }
  104 + });
  105 + //按线路和走向分组
  106 + if (routeList.size() > 0) {
  107 + ArrayListMultimap<String, StationRoute> tempMap = ArrayListMultimap.create();
  108 + for (StationRoute sr : routeList) {
  109 + tempMap.put(sr.getLineCode() + "_" + sr.getDirections(), sr);
  110 + }
  111 +
  112 + StationRouteComp srCom = new StationRouteComp();
  113 + //连接路由
  114 + Set<String> set = tempMap.keySet();
  115 + for (String key : set) {
  116 + Collections.sort(tempMap.get(key), srCom);
  117 + connectStationRoute(tempMap.get(key));
  118 + }
  119 +
  120 + stationCacheMap = tempMap;
  121 + }
  122 +
  123 + //加载停车场数据
  124 + sql = "select PARK_CODE, ST_AsText(G_PARK_POINT) as G_PARK_POINT from bsth_c_car_park where park_code is not null and b_park_point is not null";
  125 + List<Map<String, Object>> tccList = jdbcTemplate.queryForList(sql);
  126 + Map<String, Polygon> tccTempMap = new HashMap<>();
  127 +
  128 + Polygon polygon;
  129 + for (Map<String, Object> tMap : tccList) {
  130 +
  131 + try {
  132 + polygon = geometryFactory.createPolygon(parsePolygon(tMap.get("G_PARK_POINT").toString()));
  133 + tccTempMap.put(tMap.get("PARK_CODE").toString()
  134 + , polygon);
  135 + } catch (Exception e) {
  136 + logger.error("停车场:" + tMap.get("PARK_CODE") , e);
  137 + }
  138 + }
  139 +
  140 + if(tccTempMap.size() > 0)
  141 + tccMap = tccTempMap;
  142 + }
  143 +
  144 + private void connectStationRoute(List<StationRoute> list) {
  145 + int size = list.size();
  146 + StationRoute sr = null;
  147 + for (int i = 0; i < size; i++) {
  148 + sr = list.get(i);
  149 + //上一个
  150 + if (i > 0)
  151 + sr.setPrve(list.get(i - 1));
  152 + //下一个
  153 + if (i < size - 1)
  154 + sr.setNext(list.get(i + 1));
  155 + }
  156 + }
  157 +
  158 + public Coordinate[] parsePolygon(String polygonStr) {
  159 + String[] coords = polygonStr.substring(9, polygonStr.length() - 2).split(","), temps;
  160 +
  161 + Coordinate[] cds = new Coordinate[coords.length];
  162 + int len = coords.length;
  163 + for (int i = 0; i < len; i++) {
  164 + temps = coords[i].split(" ");
  165 + cds[i] = new Coordinate(Float.parseFloat(temps[1]), Float.parseFloat(temps[0]));
  166 + }
  167 + return cds;
  168 + }
  169 +
  170 +}
0 171 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/GpsAnalyse.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.analyse.components.GpsArrival;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +
  8 +import java.util.concurrent.ExecutorService;
  9 +import java.util.concurrent.Executors;
  10 +
  11 +/**
  12 + * 分析gps状态信息
  13 + * Created by panzhao on 2016/12/23.
  14 + */
  15 +public class GpsAnalyse {
  16 +
  17 + static Logger logger = LoggerFactory.getLogger(GpsAnalyse.class);
  18 +
  19 + //线程池
  20 + static ExecutorService threadPool = Executors.newFixedThreadPool(50);
  21 +
  22 + public static void start(GpsEntity gps) {
  23 + threadPool.execute(new ArrivalMatchThread(gps));
  24 + }
  25 +
  26 + public static class ArrivalMatchThread implements Runnable {
  27 +
  28 + private GpsEntity gps;
  29 +
  30 + public ArrivalMatchThread(GpsEntity gps) {
  31 + this.gps = gps;
  32 + }
  33 +
  34 + @Override
  35 + public void run() {
  36 + GpsArrival.arrival(gps);
  37 + }
  38 + }
  39 +}
0 40 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata/analyse/StationRoute.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import com.vividsolutions.jts.geom.Point;
  4 +import com.vividsolutions.jts.geom.Polygon;
  5 +
  6 +/**
  7 + * Created by panzhao on 2016/12/23.
  8 + */
  9 +public class StationRoute {
  10 +
  11 + /**
  12 + * 线路编码
  13 + */
  14 + private String lineCode;
  15 +
  16 + /**
  17 + * 上下行
  18 + */
  19 + private int directions;
  20 +
  21 + /**
  22 + * 站点编码
  23 + */
  24 + private String code;
  25 +
  26 + /**
  27 + * 路由顺序
  28 + */
  29 + private int routeSort;
  30 +
  31 + /**
  32 + * 站点位置
  33 + */
  34 + private Point point;
  35 +
  36 + /**
  37 + * 圆形半径
  38 + */
  39 + private Float radius;
  40 +
  41 + /**
  42 + * 多边形电子围栏
  43 + */
  44 + private Polygon polygon;
  45 +
  46 + /**
  47 + * 站点标记
  48 + */
  49 + private String mark;
  50 +
  51 + /**
  52 + * 下一站
  53 + */
  54 + private StationRoute next;
  55 +
  56 + /**
  57 + * 上一站
  58 + */
  59 + private StationRoute prve;
  60 +
  61 + public String getCode() {
  62 + return code;
  63 + }
  64 +
  65 + public void setCode(String code) {
  66 + this.code = code;
  67 + }
  68 +
  69 + public int getRouteSort() {
  70 + return routeSort;
  71 + }
  72 +
  73 + public void setRouteSort(int routeSort) {
  74 + this.routeSort = routeSort;
  75 + }
  76 +
  77 + public Point getPoint() {
  78 + return point;
  79 + }
  80 +
  81 + public void setPoint(Point point) {
  82 + this.point = point;
  83 + }
  84 +
  85 + public Float getRadius() {
  86 + return radius;
  87 + }
  88 +
  89 + public void setRadius(Float radius) {
  90 + this.radius = radius;
  91 + }
  92 +
  93 + public Polygon getPolygon() {
  94 + return polygon;
  95 + }
  96 +
  97 + public void setPolygon(Polygon polygon) {
  98 + this.polygon = polygon;
  99 + }
  100 +
  101 + public String getLineCode() {
  102 + return lineCode;
  103 + }
  104 +
  105 + public void setLineCode(String lineCode) {
  106 + this.lineCode = lineCode;
  107 + }
  108 +
  109 + public int getDirections() {
  110 + return directions;
  111 + }
  112 +
  113 + public void setDirections(int directions) {
  114 + this.directions = directions;
  115 + }
  116 +
  117 + public StationRoute getNext() {
  118 + return next;
  119 + }
  120 +
  121 + public void setNext(StationRoute next) {
  122 + this.next = next;
  123 + }
  124 +
  125 + public StationRoute getPrve() {
  126 + return prve;
  127 + }
  128 +
  129 + public void setPrve(StationRoute prve) {
  130 + this.prve = prve;
  131 + }
  132 +
  133 + public String getMark() {
  134 + return mark;
  135 + }
  136 +
  137 + public void setMark(String mark) {
  138 + this.mark = mark;
  139 + }
  140 +}
  141 +
... ...
src/main/java/com/bsth/data/gpsdata/analyse/StationRouteComp.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse;
  2 +
  3 +import java.util.Comparator;
  4 +
  5 +/**
  6 + * Created by panzhao on 2016/12/24.
  7 + */
  8 +public class StationRouteComp implements Comparator<StationRoute>{
  9 + @Override
  10 + public int compare(StationRoute s1, StationRoute s2) {
  11 + return s1.getRouteSort() - s2.getRouteSort();
  12 + }
  13 +}
... ...
src/main/java/com/bsth/data/gpsdata/analyse/components/GpsArrival.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse.components;
  2 +
  3 +import com.bsth.data.LineConfigData;
  4 +import com.bsth.data.gpsdata.GpsEntity;
  5 +import com.bsth.data.gpsdata.analyse.CircleQueue;
  6 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
  7 +import com.bsth.data.gpsdata.analyse.StationRoute;
  8 +import com.bsth.data.gpsdata.analyse.util.GeoUtils;
  9 +import com.bsth.data.schedule.DayOfSchedule;
  10 +import com.bsth.entity.realcontrol.LineConfig;
  11 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.BeansException;
  15 +import org.springframework.context.ApplicationContext;
  16 +import org.springframework.context.ApplicationContextAware;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * gps 到离站判断
  23 + * Created by panzhao on 2016/12/24.
  24 + */
  25 +@Component
  26 +public class GpsArrival implements ApplicationContextAware {
  27 +
  28 + static Logger logger = LoggerFactory.getLogger(GpsArrival.class);
  29 +
  30 + static DayOfSchedule dayOfSchedule;
  31 +
  32 + static LineConfigData lineConfigData;
  33 +
  34 + public static void arrival(GpsEntity gps) {
  35 +
  36 + if (gps.getLat() == 0 || gps.getLon() == 0) {
  37 + //logger.error("无效的gps");
  38 + return;
  39 + }
  40 +
  41 + Object task = DayOfSchedule.executeCurr(gps.getNbbm());
  42 + if (task == null)
  43 + return;
  44 + if (task.getClass().isAssignableFrom(ScheduleRealInfo.class)) {
  45 + ScheduleRealInfo sch = (ScheduleRealInfo) task;
  46 + //和班次同步走向
  47 + gps.setUpDown(Integer.parseInt(sch.getXlDir()));
  48 +
  49 + //出场
  50 + if (sch.getBcType().equals("out")) {
  51 + outCarpark(gps, sch);
  52 + }
  53 + else if (sch.getBcType().equals("normal"))
  54 + normalInOut(gps, sch);
  55 + else if(sch.getBcType().equals("in")){
  56 + inCarpark(gps, sch);
  57 + }
  58 + }
  59 +
  60 + GeoCacheData.putGps(gps);
  61 + }
  62 +
  63 + /**
  64 + * 正常班次
  65 + *
  66 + * @param gps
  67 + * @param sch
  68 + */
  69 + private static void normalInOut(GpsEntity gps, ScheduleRealInfo sch) {
  70 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  71 + GpsEntity prev = null;
  72 + if (queue != null)
  73 + prev = queue.getTail();
  74 +
  75 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), gps.getUpDown());
  76 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  77 +
  78 + if (station != null) {
  79 + //站内
  80 + gps.setStopNo(station.getCode());
  81 + gps.setInstation(true);
  82 + stationInside(gps, prev, sch);
  83 + } else {
  84 + //站外
  85 + stationOutside(gps, prev, sch);
  86 + }
  87 + }
  88 +
  89 + /**
  90 + * GPS在站点内
  91 + *
  92 + * @param gps
  93 + * @param prev
  94 + * @param sch
  95 + */
  96 + private static void stationInside(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch) {
  97 + if(prev == null)
  98 + return;
  99 +
  100 + if (gps.getStopNo().equals(sch.getZdzCode()) && sch.getZdsjActual() == null) {
  101 + //到终点站
  102 + arriveEnd(sch, gps);
  103 + return;
  104 + }
  105 +
  106 + //上一个点在站外
  107 + if(!prev.isInstation())
  108 + return;
  109 + //超过 (待发时间 + 90%的单程运送时间),还在起点站。默认烂一圈
  110 + if (prev.getStopNo().equals(gps.getStopNo())){
  111 + if(gps.getStopNo().equals(sch.getQdzCode())
  112 + && gps.getTimestamp() > sch.getDfsjT() + (sch.getBcsj() * 60 * 1000 * 0.9)){
  113 +
  114 + ScheduleRealInfo next = dayOfSchedule.next(dayOfSchedule.next(sch));
  115 + dayOfSchedule.addExecPlan(next);
  116 + }
  117 + return;
  118 + }
  119 +
  120 + //发车
  121 + if (prev.getStopNo().equals(sch.getQdzCode())) {
  122 + busWillDepart(sch, gps);
  123 + return;
  124 + }
  125 +
  126 + //中途站
  127 + StationRoute prevStation = GeoCacheData.getStation(prev.getLineId(), prev.getUpDown(), prev.getStopNo());
  128 + StationRoute currStation = GeoCacheData.getStation(gps.getLineId(), gps.getUpDown(), gps.getStopNo());
  129 + if (currStation.getRouteSort() < prevStation.getRouteSort()) {
  130 + //开始下一个班次
  131 + finishPlan(sch);
  132 +
  133 + logger.info("路由反向。。。。。。:" + gps.getTimestamp());
  134 + //为班次补上实际时间
  135 +
  136 + }
  137 + }
  138 +
  139 + /**
  140 + * GPS在站点外
  141 + *
  142 + * @param gps
  143 + * @param prev
  144 + * @param sch
  145 + */
  146 + private static void stationOutside(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch) {
  147 + if(prev == null)
  148 + return;
  149 +
  150 + gps.setStopNo(prev.getStopNo());
  151 + if (prev.isInstation() && prev.getStopNo().equals(sch.getQdzCode())) {
  152 + //发车
  153 + busWillDepart(sch, gps);
  154 + return;
  155 + }
  156 + }
  157 +
  158 + /**
  159 + * 公交车起点发出
  160 + */
  161 + final static long DRIFT_VAL_TIME = 1000 * 60 * 10;
  162 + //班次最大差值1小时
  163 + final static long MAX_DIFF = 1000 * 60 * 60;
  164 + private static void busWillDepart(ScheduleRealInfo sch, GpsEntity gps) {
  165 + //实发时间不覆盖
  166 + if (sch.getFcsjActual() == null && Math.abs(gps.getTimestamp() - sch.getDfsjT()) < MAX_DIFF) {
  167 +
  168 + //提前10分钟以上发出,判断一下是否是漂移
  169 + if(sch.getDfsjT() - gps.getTimestamp() > DRIFT_VAL_TIME){
  170 + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
  171 + if(schPrev != null && schPrev.getZdsjActual() != null){
  172 + //计划停站时间
  173 + long stopTimeJH = sch.getDfsjT() - schPrev.getZdsjT();
  174 + //实际停站时间
  175 + long actualStopTime = gps.getTimestamp() - schPrev.getZdsjActualTime();
  176 + /*
  177 + 没停够计划百分之60的,算漂移
  178 + (这里出现的误判,由程序在车辆到中途站的时候进行补偿)
  179 + */
  180 + if(stopTimeJH * 0.6 < actualStopTime){
  181 + logger.info("漂移.... 车辆:" + gps.getNbbm() + " ts: " + gps.getTimestamp());
  182 + return;
  183 + }
  184 + }
  185 + }
  186 +
  187 + LineConfig config = lineConfigData.get(sch.getXlBm());
  188 + if(config != null && config.getOutConfig() == 2){
  189 + //出站既出场
  190 + ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
  191 + if(schPrev.getBcType().equals("out")){
  192 + schPrev.setFcsjActualAll(schPrev.getDfsjT());
  193 + schPrev.setZdsjActualAll(schPrev.getZdsjT());
  194 + }
  195 + }
  196 +
  197 + sch.setFcsjActualAll(gps.getTimestamp());
  198 + logger.info("(站外)班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
  199 + }
  200 + }
  201 +
  202 + /**
  203 + * 公交车到达终点
  204 + *
  205 + * @param sch
  206 + * @param gps
  207 + */
  208 + private static void arriveEnd(ScheduleRealInfo sch, GpsEntity gps) {
  209 + sch.setZdsjActualAll(gps.getTimestamp());
  210 + ScheduleRealInfo next = finishPlan(sch);
  211 + logger.info("班次:" + sch.getDfsj() + "到达终点, 时间:" + sch.getZdsjActual());
  212 +
  213 + if (next == null)
  214 + return;
  215 +
  216 + //将gps转换为下一个班次走向的站内信号
  217 + int updown = Integer.parseInt(next.getXlDir());
  218 + List<StationRoute> srs = GeoCacheData.getStationRoute(next.getXlBm(), updown);
  219 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  220 + if (station != null) {
  221 + gps.setUpDown(updown);
  222 + gps.setStopNo(station.getCode());
  223 + }
  224 + }
  225 +
  226 + /**
  227 + * 出场班次
  228 + *
  229 + * @param gps
  230 + * @param sch
  231 + */
  232 + private static void outCarpark(GpsEntity gps, ScheduleRealInfo sch) {
  233 + String carpark = GeoUtils.gpsInCarpark(gps);
  234 + if (carpark != null) {
  235 + gps.setInstation(true);
  236 + gps.setStopNo(carpark);
  237 + return; // 还在场内
  238 + }
  239 +
  240 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  241 + if (queue == null)
  242 + return;
  243 + //上一个gps
  244 + GpsEntity prev = queue.getTail();
  245 +
  246 + if (carpark == null && prev.isInstation() && prev.getStopNo().equals(sch.getQdzCode())) {
  247 + gps.setStopNo(prev.getStopNo());
  248 + //停车场发出
  249 + busWillDepart(sch, gps);
  250 + return;
  251 + }
  252 +
  253 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), gps.getUpDown());
  254 + StationRoute station = GeoUtils.gpsInStation(gps, srs);
  255 +
  256 + if (station != null && station.getCode().equals(sch.getZdzCode())) {
  257 + gps.setStopNo(station.getCode());
  258 + //到达终点
  259 + arriveEnd(sch, gps);
  260 + }
  261 + }
  262 +
  263 +
  264 + /**
  265 + * 进场班次
  266 + * @param gps
  267 + * @param sch
  268 + */
  269 + private static void inCarpark(GpsEntity gps, ScheduleRealInfo sch) {
  270 + String carpark = GeoUtils.gpsInCarpark(gps);
  271 + if (carpark != null && carpark.equals(sch.getZdzCode())) {
  272 + //进场班次取第一个实际进场时间
  273 + if(sch.getZdsjActual() != null)
  274 + return;
  275 +
  276 + //进场
  277 + arriveEnd(sch, gps);
  278 + return;
  279 + }
  280 +
  281 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  282 + if (queue == null)
  283 + return;
  284 + //上一个gps
  285 + GpsEntity prev = queue.getTail();
  286 +
  287 + if (carpark == null && prev.isInstation() && prev.getStopNo().equals(sch.getQdzCode())) {
  288 + gps.setStopNo(prev.getStopNo());
  289 + //进场班次发出
  290 + busWillDepart(sch, gps);
  291 + return;
  292 + }
  293 + }
  294 +
  295 + /**
  296 + * 完成班次 -返回下一个班次
  297 + *
  298 + * @param sch
  299 + */
  300 + private static ScheduleRealInfo finishPlan(ScheduleRealInfo sch) {
  301 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  302 + if (next != null) {
  303 + next.setQdzArrDatesj(sch.getZdsjActual());
  304 + dayOfSchedule.addExecPlan(next);
  305 + }
  306 + return next;
  307 + }
  308 +
  309 + @Override
  310 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  311 + dayOfSchedule = applicationContext.getBean(DayOfSchedule.class);
  312 + lineConfigData = applicationContext.getBean(LineConfigData.class);
  313 + }
  314 +}
... ...
src/main/java/com/bsth/data/gpsdata/analyse/components/GpsStateCorrective.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse.components;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.vividsolutions.jts.geom.GeometryFactory;
  7 +import org.joda.time.format.DateTimeFormat;
  8 +import org.joda.time.format.DateTimeFormatter;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.BeansException;
  12 +import org.springframework.context.ApplicationContext;
  13 +import org.springframework.context.ApplicationContextAware;
  14 +import org.springframework.stereotype.Component;
  15 +
  16 +/**
  17 + * GPS状态纠正
  18 + * Created by panzhao on 2016/12/23.
  19 + */
  20 +@Component
  21 +public class GpsStateCorrective implements ApplicationContextAware {
  22 +
  23 + static Logger logger = LoggerFactory.getLogger(GpsStateCorrective.class);
  24 +
  25 + static DayOfSchedule dayOfSchedule;
  26 +
  27 + private static GeometryFactory geometryFactory = new GeometryFactory();
  28 +
  29 + public static void correct(GpsEntity gps, ScheduleRealInfo sch){
  30 +/* int upDown = Integer.parseInt(sch.getXlDir());
  31 + gps.setUpDown(upDown);
  32 + List<StationRoute> srs = GeoCacheData.getStationRoute(sch.getXlBm(), upDown);
  33 +
  34 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  35 +
  36 + //之前的点位
  37 + CircleQueue<GpsEntity> queue = GeoCacheData.getGps(gps.getNbbm());
  38 + GpsEntity prev = null;
  39 + if(queue != null)
  40 + prev = queue.getTail();
  41 +
  42 + //线路上,站点间
  43 + StationRoute station = GeoUtils.pointInStation(point, srs);
  44 + //在站内
  45 + if(station != null){
  46 + gps.setStopNo(station.getCode());
  47 + gps.setInstation(true);
  48 + gps.setStation(station);
  49 +
  50 + if(prev != null && prev.getUpDown() == upDown){
  51 + StationRoute prevStation = GeoCacheData.getStation(prev.getLineId(), upDown, prev.getStopNo());
  52 +
  53 + //倒着开??
  54 + if(prevStation.getRouteSort() > station.getRouteSort()){
  55 + reversalHandle(gps, prev, sch);
  56 + }
  57 + }
  58 + }
  59 + else{
  60 + if(prev != null)
  61 + gps.setStopNo(prev.getStopNo());
  62 + }
  63 +
  64 + //是否在停车场内
  65 + Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
  66 + Set<String> codes = carparkMap.keySet();
  67 + Polygon p;
  68 + for(String code : codes){
  69 + p = carparkMap.get(code);
  70 + //场内
  71 + if(p.contains(point)){
  72 + gps.setCarparkNo(code);
  73 + if(sch.getBcType().equals("out")){
  74 + gps.setInstation(true);
  75 + gps.setStopNo(code);
  76 + }
  77 + }
  78 + }*/
  79 + }
  80 +
  81 + private static DateTimeFormatter fmt = DateTimeFormat.forPattern("HH:mm");
  82 +
  83 + private static void reversalHandle(GpsEntity gps, GpsEntity prev, ScheduleRealInfo sch){
  84 + /*if(sch.getBcType().equals("out") && gps.getTimestamp() < sch.getZdsjT())
  85 + return;
  86 +
  87 + //先假设没到终点,直接开始了下一个班次
  88 + ScheduleRealInfo next = dayOfSchedule.next(sch);
  89 + String log = "倒着开??? nbbm: " + gps.getNbbm() + " 当前:" + gps.getStopNo() + " 上一站:" + prev.getStopNo() + " 当前班次:" + sch.getDfsj();
  90 + if(next != null){
  91 + dayOfSchedule.addExecPlan(next);
  92 +
  93 + log += (" 下一个班次:" + next.getDfsj());
  94 + }
  95 +
  96 + log += (" GPS时间:" + fmt.print(gps.getTimestamp()));
  97 +
  98 + logger.info(log);*/
  99 + }
  100 +
  101 + @Override
  102 + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
  103 + dayOfSchedule = applicationContext.getBean(DayOfSchedule.class);
  104 + }
  105 +}
... ...
src/main/java/com/bsth/data/gpsdata/analyse/util/GeoUtils.java 0 → 100644
  1 +package com.bsth.data.gpsdata.analyse.util;
  2 +
  3 +import com.bsth.data.gpsdata.GpsEntity;
  4 +import com.bsth.data.gpsdata.analyse.GeoCacheData;
  5 +import com.bsth.data.gpsdata.analyse.StationRoute;
  6 +import com.vividsolutions.jts.geom.Coordinate;
  7 +import com.vividsolutions.jts.geom.GeometryFactory;
  8 +import com.vividsolutions.jts.geom.Point;
  9 +import com.vividsolutions.jts.geom.Polygon;
  10 +
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +import java.util.Set;
  14 +
  15 +/**
  16 + * Created by panzhao on 2016/12/23.
  17 + */
  18 +public class GeoUtils {
  19 +
  20 + private final static double EARTHRADIUS = 6378137;
  21 +
  22 + private static GeometryFactory geometryFactory = new GeometryFactory();
  23 + /**
  24 + * gps是否在路由上的某个站内
  25 + *
  26 + * @param gps
  27 + * @param srs
  28 + * @return
  29 + */
  30 + public static StationRoute gpsInStation(GpsEntity gps, List<StationRoute> srs) {
  31 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  32 + double min = -1, distance, distance2;
  33 + StationRoute stationRoute = null;
  34 +
  35 + for (StationRoute sr : srs) {
  36 + if (sr.getPolygon() == null) {
  37 + //圆形
  38 + distance = getDistance(sr.getPoint(), point);//sr.getPoint().distance(point);
  39 +
  40 + if (distance > sr.getRadius())
  41 + continue;
  42 +
  43 + if (min > distance || min == -1) {
  44 + min = distance;
  45 + stationRoute = sr;
  46 + }
  47 + } else {
  48 + //多边形
  49 + if (sr.getPolygon().contains(point)) {
  50 + stationRoute = sr;
  51 + break;
  52 + }
  53 + }
  54 + }
  55 + return stationRoute;
  56 + }
  57 +
  58 + public static double getDistance(Point p1, Point p2) {
  59 + double lng1 = getLoop(p1.getY(), -180, 180), lat1 = getRange(
  60 + p1.getX(), -74, 74);
  61 + double lng2 = getLoop(p2.getY(), -180, 180), lat2 = getRange(
  62 + p2.getX(), -74, 74);
  63 +
  64 + double x1, x2, y1, y2;
  65 + x1 = degreeToRad(lng1);
  66 + y1 = degreeToRad(lat1);
  67 + x2 = degreeToRad(lng2);
  68 + y2 = degreeToRad(lat2);
  69 + return EARTHRADIUS
  70 + * Math.acos((Math.sin(y1) * Math.sin(y2) + Math.cos(y1)
  71 + * Math.cos(y2) * Math.cos(x2 - x1)));
  72 + }
  73 +
  74 + private static double getLoop(double v, double a, double b) {
  75 + while (v > b) {
  76 + v -= b - a;
  77 + }
  78 + while (v < a) {
  79 + v += b - a;
  80 + }
  81 + return v;
  82 + }
  83 +
  84 + private static double getRange(double v, double a, double b) {
  85 + v = Math.min(Math.max(v, a), b);
  86 + return v;
  87 + }
  88 +
  89 + private static double degreeToRad(double degree) {
  90 + return Math.PI * degree / 180;
  91 + }
  92 +
  93 +
  94 + /**
  95 + * gps 是否在某个停车场内
  96 + * @param gps
  97 + * @return
  98 + */
  99 + public static String gpsInCarpark(GpsEntity gps){
  100 + Point point = geometryFactory.createPoint(new Coordinate(gps.getLat(), gps.getLon()));
  101 +
  102 + Map<String, Polygon> carparkMap = GeoCacheData.tccMap;
  103 + Set<String> codes = carparkMap.keySet();
  104 + Polygon polygon;
  105 + for(String code : codes){
  106 + polygon = carparkMap.get(code);
  107 + if(point.within(polygon)){
  108 + return code;
  109 + }
  110 + }
  111 + return null;
  112 + }
  113 +
  114 + /**
  115 + * 是否是有效的连续点
  116 + * @param prevGps
  117 + * @param gps
  118 + * @return
  119 + */
  120 + public static boolean overdue(GpsEntity prevGps, GpsEntity gps) {
  121 + return gps.getTimestamp() - prevGps.getTimestamp() < 120000;
  122 + }
  123 +}
... ...
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java 0 → 100644
  1 +package com.bsth.data.gpsdata.recovery;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.gpsdata.GpsEntity;
  5 +import com.bsth.data.gpsdata.analyse.components.GpsArrival;
  6 +import com.bsth.util.db.DBUtils_MS;
  7 +import com.google.common.collect.ArrayListMultimap;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.jdbc.core.JdbcTemplate;
  11 +import org.springframework.jdbc.core.RowMapper;
  12 +
  13 +import java.sql.ResultSet;
  14 +import java.sql.SQLException;
  15 +import java.util.*;
  16 +import java.util.concurrent.CountDownLatch;
  17 +import java.util.concurrent.ExecutorService;
  18 +import java.util.concurrent.Executors;
  19 +
  20 +/**
  21 + * 数据恢复
  22 + * Created by panzhao on 2016/12/24.
  23 + */
  24 +public class GpsDataRecovery {
  25 +
  26 + static Logger logger = LoggerFactory.getLogger(GpsDataRecovery.class);
  27 +
  28 + public static boolean run;
  29 +
  30 + static ExecutorService threadPool = Executors.newFixedThreadPool(50);
  31 +
  32 + private static CountDownLatch count;
  33 +
  34 + public static void recovery() {
  35 + List<GpsEntity> list = loadData();
  36 +
  37 + //按车辆分组数据
  38 + ArrayListMultimap<String, GpsEntity> listMap = ArrayListMultimap.create();
  39 + for (GpsEntity gps : list) {
  40 + if(gps.getNbbm() != null)
  41 + listMap.put(gps.getNbbm(), gps);
  42 + }
  43 +
  44 + count = new CountDownLatch(listMap.keySet().size());
  45 +
  46 + Set<String> keys = listMap.keySet();
  47 + for (String nbbm : keys) {
  48 + threadPool.execute(new RecoveryDataThread(listMap.get(nbbm), count));
  49 + /*if(nbbm.equals("W9A-250"))
  50 + new RecoveryDataThread(listMap.get(nbbm), count).run();*/
  51 + }
  52 + try {
  53 + //等待子线程结束
  54 + count.await();
  55 + logger.info("GPS 数据恢复完成....");
  56 + } catch (InterruptedException e) {
  57 + logger.error("", e);
  58 + }
  59 + }
  60 +
  61 + /**
  62 + * 加载当天的gps数据
  63 + *
  64 + * @return
  65 + */
  66 + public static List<GpsEntity> loadData() {
  67 + Calendar calendar = Calendar.getInstance();
  68 + int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
  69 +
  70 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from BSTH_C_GPS_INFO where days_year=" + dayOfYear;
  71 + JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
  72 +
  73 + List<GpsEntity> list =
  74 + jdbcTemplate.query(sql, new RowMapper<GpsEntity>() {
  75 + @Override
  76 + public GpsEntity mapRow(ResultSet rs, int rowNum) throws SQLException {
  77 + GpsEntity gps = new GpsEntity();
  78 +
  79 + gps.setDeviceId(rs.getString("DEVICE_ID"));
  80 + gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
  81 + gps.setSpeed(rs.getFloat("SPEED_GPS"));
  82 + gps.setLat(rs.getFloat("LAT"));
  83 + gps.setLon(rs.getFloat("LON"));
  84 + gps.setLineId(rs.getString("LINE_ID"));
  85 + gps.setTimestamp(rs.getLong("TS"));
  86 + gps.setUpDown(getUpOrDown(rs.getLong("SERVICE_STATE")));
  87 + return gps;
  88 + }
  89 + });
  90 + return list;
  91 + }
  92 +
  93 + /**
  94 + * 王通 2016/6/29 9:23:24 获取车辆线路上下行
  95 + *
  96 + * @return -1无效 0上行 1下行
  97 + */
  98 + public static int getUpOrDown(long serviceState) {
  99 + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000
  100 + || (serviceState & 0x01000000) == 0x01000000 || (serviceState & 0x08000000) == 0x08000000)
  101 + return -1;
  102 + return (((serviceState & 0x10000000) == 0x10000000) ? 1 : 0);
  103 + }
  104 +
  105 + public static class RecoveryDataThread implements Runnable {
  106 +
  107 + List<GpsEntity> list;
  108 + CountDownLatch count;
  109 +
  110 + public RecoveryDataThread(List<GpsEntity> list, CountDownLatch count) {
  111 + this.list = list;
  112 + this.count = count;
  113 + }
  114 +
  115 + @Override
  116 + public void run() {
  117 + try {
  118 + //排序
  119 + Collections.sort(list, new GpsComp());
  120 + //依次跑完gps
  121 + //int i = 0;
  122 + for(GpsEntity gps : list){
  123 + /* i++;
  124 + if(i == 383){
  125 + System.out.println("aaa");
  126 + }*/
  127 + GpsArrival.arrival(gps);
  128 + }
  129 + } catch (Exception e) {
  130 + logger.error("", e);
  131 + } finally {
  132 + count.countDown();
  133 + }
  134 + }
  135 + }
  136 +
  137 + public static class GpsComp implements Comparator<GpsEntity>{
  138 +
  139 + @Override
  140 + public int compare(GpsEntity g1, GpsEntity g2) {
  141 + return (int) (g1.getTimestamp() - g2.getTimestamp());
  142 + }
  143 + }
  144 +}
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -3,9 +3,11 @@ package com.bsth.data.schedule;
3 3 import com.alibaba.fastjson.JSON;
4 4 import com.alibaba.fastjson.JSONArray;
5 5 import com.bsth.Application;
  6 +import com.bsth.data.BasicData;
6 7 import com.bsth.data.LineConfigData;
7 8 import com.bsth.data.directive.FirstScheduleCheckThread;
8 9 import com.bsth.data.gpsdata.GpsRealData;
  10 +import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
9 11 import com.bsth.data.schedule.thread.ScheduleLateThread;
10 12 import com.bsth.data.schedule.thread.SchedulePstThread;
11 13 import com.bsth.data.schedule.thread.ScheduleRefreshThread;
... ... @@ -111,19 +113,30 @@ public class DayOfSchedule implements CommandLineRunner {
111 113 @Autowired
112 114 SubmitToTrafficManage submitToTrafficManage;
113 115  
  116 + @Autowired
  117 + LineConfigData lineConfigs;
  118 +
  119 + @Autowired
  120 + BasicData.BasicDataLoader dataLoader;
  121 +
114 122 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd")
115 123 ,fmtHHmm = DateTimeFormat.forPattern("HH:mm");
116 124  
117 125 @Override
118 126 public void run(String... arg0) throws Exception {
  127 + //加载基础数据
  128 + dataLoader.loadAllData();
  129 + //从数据库恢复排班
  130 + //dataRecovery();
  131 +
119 132 //翻班线程
120 133 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
121 134 //入库
122   -// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
  135 + Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
123 136 //首班出场指令补发器
124 137 // Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS);
125 138 //班次误点扫描
126   -// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
  139 + Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
127 140  
128 141 //每天凌晨2点20提交数据到运管处
129 142 long diff = (DateUtils.getTimestamp() + 1000*60*140) - System.currentTimeMillis();
... ... @@ -134,6 +147,23 @@ public class DayOfSchedule implements CommandLineRunner {
134 147 //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
135 148 }
136 149  
  150 + //数据恢复
  151 + private void dataRecovery() {
  152 + GpsDataRecovery.run = true;
  153 +
  154 + Collection<LineConfig> confs = lineConfigs.getAll();
  155 + String lineCode, currSchDate;
  156 + for(LineConfig conf : confs){
  157 + lineCode = conf.getLine().getLineCode();
  158 + currSchDate = calcSchDate(lineCode);
  159 + //加载班次数据
  160 + reloadSch(lineCode, currSchDate, false);
  161 + }
  162 +
  163 + //恢复gps数据
  164 + GpsDataRecovery.recovery();
  165 + }
  166 +
137 167 public Map<String, String> getCurrSchDate() {
138 168 return currSchDateMap;
139 169 }
... ... @@ -189,17 +219,20 @@ public class DayOfSchedule implements CommandLineRunner {
189 219 putAll(list);
190 220  
191 221 Set<String> cars = searchAllCars(list);
192   - //计算“起点站应到”时间
193   - for(String nbbm : cars)
  222 + for(String nbbm : cars){
  223 + //计算“起点站应到”时间
194 224 schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm));
195   -
  225 + //车辆 ——> 要执行的班次对照
  226 + carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(nbbmScheduleMap.get(nbbm)));
  227 + }
  228 +
196 229 //是否是出站即出场
197 230 LineConfig conf = lineConfigData.get(lineCode);
198 231 if(conf.getOutConfig() == 2){
199 232 for(String nbbm : cars)
200 233 schAttrCalculator.connectOutSchedule(nbbmScheduleMap.get(nbbm));
201 234 }
202   -
  235 +
203 236 // 页面 翻班通知
204 237 sendUtils.shiftSchedule(lineCode);
205 238 } catch (Exception e) {
... ... @@ -451,6 +484,10 @@ public class DayOfSchedule implements CommandLineRunner {
451 484 public ScheduleRealInfo next(ScheduleRealInfo sch) {
452 485  
453 486 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  487 + int outConfig = -1;
  488 + LineConfig config = lineConfigData.get(sch.getXlBm());
  489 + if(config != null)
  490 + outConfig = config.getOutConfig();
454 491  
455 492 boolean flag = false;
456 493 ScheduleRealInfo next = null;
... ... @@ -462,6 +499,10 @@ public class DayOfSchedule implements CommandLineRunner {
462 499 //忽略烂班
463 500 if(temp.isDestroy())
464 501 continue;
  502 +
  503 + //出站既出场,忽略出场班次
  504 + if(outConfig == 2 && temp.getBcType().equals("out"))
  505 + continue;
465 506  
466 507 if(flag){
467 508 next = temp;
... ... @@ -471,6 +512,30 @@ public class DayOfSchedule implements CommandLineRunner {
471 512 return next;
472 513 }
473 514  
  515 + /**
  516 + * 上一个班次
  517 + * @param sch
  518 + * @return
  519 + */
  520 + public ScheduleRealInfo prev(ScheduleRealInfo sch){
  521 + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  522 +
  523 + //boolean flag = false;
  524 + ScheduleRealInfo prev = null;
  525 + int size = list.size();
  526 +
  527 + for(int i = 0; i < size; i ++){
  528 + if(list.get(i).isDestroy())
  529 + continue;
  530 +
  531 + if(list.get(i).getId().equals(sch.getId())){
  532 + return prev;
  533 + }
  534 + prev = list.get(i);
  535 + }
  536 + return prev;
  537 + }
  538 +
474 539 public void put(ScheduleRealInfo sch) {
475 540 schAttrCalculator
476 541 .calcRealDate(sch)
... ... @@ -666,9 +731,18 @@ public class DayOfSchedule implements CommandLineRunner {
666 731 carExecutePlanMap.remove(clzbh);
667 732 }
668 733  
669   - public Map<String, ScheduleRealInfo> execPlamMap(){
  734 + public Map<String, ScheduleRealInfo> execPlanMap(){
670 735 return carExecutePlanMap;
671 736 }
  737 +
  738 + /**
  739 + * 车辆当前执行的班次
  740 + * @param nbbm
  741 + * @return
  742 + */
  743 + public static ScheduleRealInfo executeCurr(String nbbm){
  744 + return carExecutePlanMap.get(nbbm);
  745 + }
672 746  
673 747 /**
674 748 * @Title: changeCar
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -215,4 +215,30 @@ public class SchAttrCalculator {
215 215 if(sch.getZdsjActualTime() == null && sch.getZdsjActual() != null)
216 216 sch.setZdsjActualAll(sch.getZdsjActual());
217 217 }
  218 +
  219 + /**
  220 + * 计算当前要执行的班次
  221 + * @param list
  222 + * @return
  223 + */
  224 + public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list){
  225 + String lineCode = list.get(0).getXlBm();
  226 + LineConfig conf = lineConfigData.get(lineCode);
  227 + int outConfig = -1;
  228 + if(conf != null)
  229 + outConfig = conf.getOutConfig();
  230 +
  231 + for(ScheduleRealInfo sch : list){
  232 + //如果是出站既出场,忽略出场班次
  233 + if(outConfig == 2 && sch.getBcType().equals("out"))
  234 + continue;
  235 +
  236 + //已执行
  237 + if(StringUtils.isNotEmpty(sch.getZdsjActual()))
  238 + continue;
  239 +
  240 + return sch;
  241 + }
  242 + return null;
  243 + }
218 244 }
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
3   -import java.util.Collection;
4   -import java.util.Set;
5   -
6   -import org.slf4j.Logger;
7   -import org.slf4j.LoggerFactory;
8   -import org.springframework.beans.factory.annotation.Autowired;
9   -import org.springframework.stereotype.Component;
10   -
11 3 import com.bsth.data.BasicData;
12 4 import com.bsth.data.LineConfigData;
13 5 import com.bsth.data.arrival.ArrivalData_GPS;
... ... @@ -15,6 +7,13 @@ import com.bsth.data.directive.DayOfDirectives;
15 7 import com.bsth.data.pilot80.PilotReport;
16 8 import com.bsth.data.schedule.DayOfSchedule;
17 9 import com.bsth.entity.realcontrol.LineConfig;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Component;
  14 +
  15 +import java.util.Collection;
  16 +import java.util.Set;
18 17  
19 18 /**
20 19 *
... ... @@ -57,6 +56,7 @@ public class ScheduleRefreshThread extends Thread{
57 56 currSchDate = dayOfSchedule.calcSchDate(lineCode);
58 57  
59 58 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
  59 +
60 60 logger.info(lineCode + "开始翻班, " + currSchDate);
61 61 //清除进出站数据
62 62 arrivalData.clearRAMData(lineCode);
... ...
src/main/java/com/bsth/entity/mcy_forms/Changetochange.java
1 1 package com.bsth.entity.mcy_forms;
2 2  
3   -import java.util.Date;
4   -
5 3 import javax.persistence.Entity;
6 4 import javax.persistence.GeneratedValue;
7 5 import javax.persistence.Id;
... ...
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
1 1 package com.bsth.entity.realcontrol;
2 2  
3   -import javax.persistence.Entity;
4   -import javax.persistence.FetchType;
5   -import javax.persistence.GeneratedValue;
6   -import javax.persistence.Id;
7   -import javax.persistence.ManyToOne;
8   -import javax.persistence.NamedAttributeNode;
9   -import javax.persistence.NamedEntityGraph;
10   -import javax.persistence.NamedEntityGraphs;
11   -import javax.persistence.Table;
12   -
13 3 import com.fasterxml.jackson.annotation.JsonIgnore;
14 4  
  5 +import javax.persistence.*;
  6 +import java.util.Date;
  7 +
15 8  
16 9 /**
17 10 *
... ... @@ -95,6 +88,10 @@ public class ChildTaskPlan {
95 88 */
96 89 private String destroyReason;
97 90  
  91 + /** 创建日期 */
  92 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  93 + private Date createDate;
  94 +
98 95 /**
99 96 * 主排班计划
100 97 */
... ... @@ -233,4 +230,12 @@ public class ChildTaskPlan {
233 230 public boolean equals(Object obj) {
234 231 return this.id.equals(((ChildTaskPlan)obj).getId());
235 232 }
  233 +
  234 + public Date getCreateDate() {
  235 + return createDate;
  236 + }
  237 +
  238 + public void setCreateDate(Date createDate) {
  239 + this.createDate = createDate;
  240 + }
236 241 }
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleType.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +/**
  4 + * 班次类型
  5 + * Created by panzhao on 2016/12/23.
  6 + */
  7 +public enum ScheduleType {
  8 +
  9 + normal, //正常班次
  10 + out, //出场
  11 + in, //进场
  12 + region, //区间
  13 + venting,//直放
  14 + major //放站
  15 +}
... ...
src/main/java/com/bsth/entity/schedule/TTInfo.java
1 1 package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.entity.sys.SysUser;
5 4  
6 5 import javax.persistence.*;
7 6 import java.util.Date;
... ... @@ -18,7 +17,7 @@ import java.util.Date;
18 17 @NamedAttributeNode("updateBy")
19 18 })
20 19 })
21   -public class TTInfo {
  20 +public class TTInfo extends BEntity {
22 21  
23 22 /** 主键Id */
24 23 @Id
... ... @@ -50,9 +49,9 @@ public class TTInfo {
50 49  
51 50 // TODO:还有很多判定条件,这里先不放
52 51  
53   - /** 路牌数 */
  52 + /** 路牌数(这两个字段暂时不用) */
54 53 private int lpCount;
55   - /** 圈数 */
  54 + /** 圈数(这两个字段暂时不倒) */
56 55 private int loopCount;
57 56  
58 57 // TODO:原系统里的分别在,圈后圈进场,意思不知道,再议
... ... @@ -62,19 +61,25 @@ public class TTInfo {
62 61 /** 特殊有效日期(格式:2001-01-01,多个用逗号隔开) */
63 62 private String special_days;
64 63  
65   - /** 操作人员关联 */
66   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
67   - private SysUser createBy;
68   - /** 更新人员关联 */
69   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
70   - private SysUser updateBy;
71   - // 创建日期
72   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
73   - private Date createDate;
74   - // 修改日期
75   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
76   - private Date updateDate;
77   -
  64 + public TTInfo() {}
  65 + public TTInfo(Object id, Object xlid, Object name, Object nds, Object sds) {
  66 + if (id != null) {
  67 + this.id = Long.parseLong(id.toString());
  68 + }
  69 + if (xlid != null) {
  70 + this.xl = new Line();
  71 + this.xl.setId(Integer.valueOf(xlid.toString()));
  72 + }
  73 + if (name != null) {
  74 + this.name = String.valueOf(name);
  75 + }
  76 + if (nds != null) {
  77 + this.rule_days = String.valueOf(nds);
  78 + }
  79 + if (sds != null) {
  80 + this.special_days = String.valueOf(sds);
  81 + }
  82 + }
78 83  
79 84 public Long getId() {
80 85 return id;
... ... @@ -164,38 +169,6 @@ public class TTInfo {
164 169 this.special_days = special_days;
165 170 }
166 171  
167   - public SysUser getCreateBy() {
168   - return createBy;
169   - }
170   -
171   - public void setCreateBy(SysUser createBy) {
172   - this.createBy = createBy;
173   - }
174   -
175   - public SysUser getUpdateBy() {
176   - return updateBy;
177   - }
178   -
179   - public void setUpdateBy(SysUser updateBy) {
180   - this.updateBy = updateBy;
181   - }
182   -
183   - public Date getCreateDate() {
184   - return createDate;
185   - }
186   -
187   - public void setCreateDate(Date createDate) {
188   - this.createDate = createDate;
189   - }
190   -
191   - public Date getUpdateDate() {
192   - return updateDate;
193   - }
194   -
195   - public void setUpdateDate(Date updateDate) {
196   - this.updateDate = updateDate;
197   - }
198   -
199 172 public Boolean getIsCancel() {
200 173 return isCancel;
201 174 }
... ...
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
... ... @@ -3,10 +3,8 @@ package com.bsth.entity.schedule;
3 3 import com.bsth.entity.CarPark;
4 4 import com.bsth.entity.Line;
5 5 import com.bsth.entity.Station;
6   -import com.bsth.entity.sys.SysUser;
7 6  
8 7 import javax.persistence.*;
9   -import java.util.Date;
10 8  
11 9 /**
12 10 * 时刻表明细
... ... @@ -23,7 +21,7 @@ import java.util.Date;
23 21 @NamedAttributeNode("tcc")
24 22 })
25 23 })
26   -public class TTInfoDetail {
  24 +public class TTInfoDetail extends BEntity {
27 25  
28 26 /** 主健Id */
29 27 @Id
... ... @@ -85,20 +83,6 @@ public class TTInfoDetail {
85 83 /** 备注 */
86 84 private String remark;
87 85  
88   - /** 创建人 */
89   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
90   - private SysUser createBy;
91   - /** 修改人 */
92   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
93   - private SysUser updateBy;
94   -
95   - /** 创建日期 */
96   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
97   - private Date createDate;
98   - /** 修改日期 */
99   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
100   - private Date updateDate;
101   -
102 86 public Long getId() {
103 87 return id;
104 88 }
... ... @@ -235,38 +219,6 @@ public class TTInfoDetail {
235 219 this.remark = remark;
236 220 }
237 221  
238   - public SysUser getCreateBy() {
239   - return createBy;
240   - }
241   -
242   - public void setCreateBy(SysUser createBy) {
243   - this.createBy = createBy;
244   - }
245   -
246   - public SysUser getUpdateBy() {
247   - return updateBy;
248   - }
249   -
250   - public void setUpdateBy(SysUser updateBy) {
251   - this.updateBy = updateBy;
252   - }
253   -
254   - public Date getCreateDate() {
255   - return createDate;
256   - }
257   -
258   - public void setCreateDate(Date createDate) {
259   - this.createDate = createDate;
260   - }
261   -
262   - public Date getUpdateDate() {
263   - return updateDate;
264   - }
265   -
266   - public void setUpdateDate(Date updateDate) {
267   - this.updateDate = updateDate;
268   - }
269   -
270 222 public CarPark getTcc() {
271 223 return tcc;
272 224 }
... ...
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
1 1 package com.bsth.entity.schedule.rule;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.entity.schedule.CarConfigInfo;
5   -import com.bsth.entity.schedule.EmployeeConfigInfo;
6   -import com.bsth.entity.schedule.GuideboardInfo;
7   -import com.bsth.entity.schedule.TTInfo;
8   -import com.bsth.entity.sys.SysUser;
  4 +import com.bsth.entity.schedule.*;
9 5  
10 6 import javax.persistence.*;
11   -import java.util.Date;
12 7  
13 8 /**
14 9 * 套跑规则。
... ... @@ -41,7 +36,7 @@ import java.util.Date;
41 36 })
42 37  
43 38  
44   -public class RerunRule {
  39 +public class RerunRule extends BEntity {
45 40 /** 主键Id */
46 41 @Id
47 42 @GeneratedValue
... ... @@ -84,19 +79,6 @@ public class RerunRule {
84 79 @Column(nullable = false)
85 80 private Boolean isCancel = false;
86 81  
87   - /** 创建人 */
88   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
89   - private SysUser createBy;
90   - /** 修改人 */
91   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
92   - private SysUser updateBy;
93   - /** 创建日期 */
94   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
95   - private Date createDate;
96   - /** 修改日期 */
97   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
98   - private Date updateDate;
99   -
100 82 public Long getId() {
101 83 return id;
102 84 }
... ... @@ -177,34 +159,6 @@ public class RerunRule {
177 159 this.useEmployeeConfig = useEmployeeConfig;
178 160 }
179 161  
180   - public SysUser getCreateBy() {
181   - return createBy;
182   - }
183   -
184   - public void setCreateBy(SysUser createBy) {
185   - this.createBy = createBy;
186   - }
187   -
188   - public SysUser getUpdateBy() {
189   - return updateBy;
190   - }
191   -
192   - public void setUpdateBy(SysUser updateBy) {
193   - this.updateBy = updateBy;
194   - }
195   -
196   - public Date getCreateDate() {
197   - return createDate;
198   - }
199   -
200   - public void setCreateDate(Date createDate) {
201   - this.createDate = createDate;
202   - }
203   -
204   - public Date getUpdateDate() {
205   - return updateDate;
206   - }
207   -
208 162 public Boolean getIsCancel() {
209 163 return isCancel;
210 164 }
... ... @@ -213,7 +167,4 @@ public class RerunRule {
213 167 this.isCancel = isCancel;
214 168 }
215 169  
216   - public void setUpdateDate(Date updateDate) {
217   - this.updateDate = updateDate;
218   - }
219 170 }
... ...
src/main/java/com/bsth/service/forms/FormsService.java
... ... @@ -30,7 +30,7 @@ public interface FormsService {
30 30  
31 31 public List<Singledata> singledata(Map<String, Object> map);
32 32  
33   - public List<Vehicleloading> vehicleloading(/*String gsdmVehic,String fgsdmVehic,*/String line,String data);
  33 + public List<Vehicleloading> vehicleloading(String gsdmVehic,String fgsdmVehic,String line,String data);
34 34  
35 35 public List<Operationservice> operationservice(Map<String, Object> map);
36 36  
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -26,6 +26,7 @@ import com.bsth.entity.mcy_forms.Waybillday;
26 26 import com.bsth.entity.mcy_forms.Allline;
27 27 import com.bsth.entity.mcy_forms.Changetochange;
28 28 import com.bsth.entity.mcy_forms.Executionrate;
  29 +import com.bsth.service.forms.CommonService;
29 30 import com.bsth.service.forms.FormsService;
30 31 import com.bsth.service.realcontrol.ScheduleRealInfoService;
31 32  
... ... @@ -38,20 +39,32 @@ public class FormsServiceImpl implements FormsService {
38 39 @Autowired
39 40 ScheduleRealInfoService scheduleRealInfoService;
40 41  
  42 + @Autowired
  43 + CommonService commonService;
  44 +
41 45 // 行车路单日报表
42 46 @Override
43 47 public List<Waybillday> waybillday(Map<String, Object> map) {
  48 +
44 49 String sql ="select x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name "
45 50 + " from bsth_c_s_sp_info_real x INNER join "
46 51 + " ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH,c.personnel_name from"
47 52 + " bsth_c_ylb y LEFT JOIN bsth_c_personnel c ON c.job_code=y.JSY "
48   - + " where to_days(y.RQ)=to_days('"+map.get("date").toString() + "') and y.XLBM= '"+ map.get("line").toString()+"' GROUP BY y.NBBM) "
49   - + " z on x.cl_zbh=z.nbbm where to_days( x.schedule_date)=to_days('"+map.get("date").toString()+"') "
50   - + " and x.xl_bm='"+map.get("line").toString()+"'"
51   - /*+ " and x.gs_bm='"+map.get("gsdmWaybillday").toString()+"'"
52   - + " and x.fgs_bm='"+map.get("fgsdmWaybillday").toString()+"'"*/
53   - + " GROUP BY x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name";
54   - //x.cl_zbh,j_gh
  53 + + " where 1=1 ";
  54 + if(map.get("date").toString()!=""){
  55 + sql+=" and to_days(y.RQ)=to_days('"+map.get("date").toString() + "') ";
  56 + }
  57 + if( map.get("line").toString()!=""){
  58 + sql+=" and y.XLBM= '"+ map.get("line").toString()+"' GROUP BY y.NBBM) ";
  59 + }
  60 + sql+= " z on x.cl_zbh=z.nbbm where to_days( x.schedule_date)=to_days('"+map.get("date").toString()+"') ";
  61 + if(map.get("gsdmWaybillday").toString()!=""){
  62 + sql+=" and x.gs_bm='"+map.get("gsdmWaybillday").toString()+"'";
  63 + }
  64 + if(map.get("fgsdmWaybillday").toString()!=""){
  65 + sql+=" and x.fgs_bm='"+map.get("fgsdmWaybillday").toString()+"'";
  66 + }
  67 + sql += " GROUP BY x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name ";
55 68 List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() {
56 69 @Override
57 70 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException {
... ... @@ -60,21 +73,16 @@ public class FormsServiceImpl implements FormsService {
60 73 wbd.setJzl(arg0.getString("JZL"));
61 74 wbd.setYh(arg0.getString("YH"));
62 75 wbd.setjName(arg0.getString("personnel_name"));
63   - // wbd.setZlc(arg0.getInt("zlc"));
64   - // System.out.println(arg0.getObject("yl"));
65   - // wbd.setYl(arg0.getString("yl"));
66   - // wbd.setNbbm(arg0.getString("nbbm"));
67 76 wbd.setRq(arg0.getString("schedule_date"));
68 77 wbd.setJgh(arg0.getString("j_gh"));
69 78 return wbd;
70   -
71 79 }
72 80 });
73 81  
74 82 for(int i=0;i<list.size();i++){
75 83 Waybillday w=list.get(i);
76 84 Map<String, Object> maps = new HashMap<>();
77   - maps = scheduleRealInfoService.findKMBC2(w.getJgh(), w.getCarPlate(),
  85 + maps = commonService.findKMBC2(w.getJgh(), w.getCarPlate(),
78 86 w.getRq());
79 87 w.setJzl1(maps.get("ksgl").toString());
80 88 w.setZlc(maps.get("realMileage").toString());
... ... @@ -86,18 +94,25 @@ public class FormsServiceImpl implements FormsService {
86 94 // 线路客流量报表
87 95 @Override
88 96 public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) {
89   - String sql = " SELECT s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name"
  97 + String sql = " SELECT r.schedule_date,s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name"
90 98 + " from bsth_c_stationroute s "
91 99 + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code "
92 100 + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code"
93   - + " where to_days(l.create_date)=to_days('"+map.get("date").toString() + "') "
94   - + " and l.line_code=" + map.get("line").toString()
95   - + " AND r.gs_bm is not null"
96   - /*+ " and r.gs_bm='"+map.get("gsdmLine").toString()+"'"
97   - + " and r.fgs_bm='"+map.get("fgsdmLine").toString()+"'"*/
98   - + " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
99   -
100   - //s.station_name
  101 + + " where 1=1 ";
  102 + if(map.get("date").toString()!=""){
  103 + sql+="and to_days(r.schedule_date)=to_days('"+map.get("date").toString() + "') ";
  104 + }
  105 + if( map.get("line").toString()!=""){
  106 + sql+=" and l.line_code=" + map.get("line").toString();
  107 + }
  108 + sql+= " AND r.gs_bm is not null";
  109 + if(map.get("gsdmLine").toString()!=""){
  110 + sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' ";
  111 + }
  112 + if(map.get("fgsdmLine").toString()!=""){
  113 + sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"'";
  114 + }
  115 + sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
101 116 List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() {
102 117  
103 118 @Override
... ... @@ -109,8 +124,6 @@ public class FormsServiceImpl implements FormsService {
109 124 }
110 125 });
111 126  
112   -
113   -
114 127 return list;
115 128 }
116 129  
... ... @@ -122,16 +135,26 @@ public class FormsServiceImpl implements FormsService {
122 135 public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map) {
123 136 String sql = "select r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
124 137 + " from bsth_c_s_sp_info_real r "
125   - + " where to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') "
126   - + " and to_days('" + map.get("endDate").toString() + "') "
127   - + " and r.xl_bm='"+ map.get("line").toString() + "'"
128   - + " AND r.gs_bm is not null"
129   - + " and r.bc_type not in('in','out')"
130   - /* + " and r.gs_bm='"+map.get("gsdmManth").toString()+"'"
131   - + " and r.fgs_bm='"+map.get("fgsdmManth").toString()+"'"*/
132   - + " GROUP BY r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name"
133   - + " ORDER BY r.j_name";
134   - //r.j_name
  138 + + " where 1=1 ";
  139 + if(map.get("startDate").toString()!=""){
  140 + sql+=" and to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') ";
  141 + }
  142 +
  143 + if(map.get("endDate").toString()!=""){
  144 + sql+=" and to_days('" + map.get("endDate").toString() + "') ";
  145 + }
  146 + if( map.get("line").toString()!=""){
  147 + sql+=" and r.xl_bm='"+ map.get("line").toString() + "' ";
  148 + }
  149 + sql+= " AND r.gs_bm is not null and r.bc_type not in('in','out')";
  150 + if(map.get("gsdmManth").toString()!=""){
  151 + sql+=" and r.gs_bm='"+map.get("gsdmManth").toString()+"' ";
  152 + }
  153 + if(map.get("fgsdmManth").toString()!=""){
  154 + sql+=" and r.fgs_bm='"+map.get("fgsdmManth").toString()+"' ";
  155 + }
  156 + sql += " GROUP BY r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type ";
  157 +
135 158 startDate = map.get("startDate").toString();
136 159 endDate = map.get("endDate").toString();
137 160 List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() {
... ... @@ -150,7 +173,7 @@ public class FormsServiceImpl implements FormsService {
150 173 Shiftuehiclemanth s=list.get(i);
151 174 Map<String, Object> maps = new HashMap<>();
152 175  
153   - maps = scheduleRealInfoService.findKMBC1(s.getjName(),s.getZbh(), startDate,
  176 + maps = commonService.findKMBC1(s.getjName(),s.getZbh(), startDate,
154 177 endDate);
155 178  
156 179 s.setJhlc(maps.get("jhlc").toString());
... ... @@ -172,13 +195,22 @@ public class FormsServiceImpl implements FormsService {
172 195 String sql = " select r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,"
173 196 + " r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
174 197 + " FROM bsth_c_s_sp_info_real r "
175   - + " where to_days(r.schedule_date)=to_days('"
176   - + map.get("date").toString() + "') and r.xl_bm=" + map.get("line").toString()
177   - + " and r.bc_type not in('in','out')"
178   - /*+ " and r.gs_bm='"+map.get("gsdmShif").toString()+"'"
179   - + " and r.fgs_bm='"+map.get("fgsdmShif").toString()+"'"*/
180   - + " GROUP BY r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
181   - + " ORDER BY r.lp_name asc";
  198 + + " where 1=1 ";
  199 + if(map.get("date").toString()!=""){
  200 + sql+=" and to_days(r.schedule_date)=to_days('"+ map.get("date").toString() + "') ";
  201 + }
  202 + if( map.get("line").toString()!=""){
  203 + sql+=" and r.xl_bm=" + map.get("line").toString();
  204 + }
  205 + sql+= " and r.bc_type not in('in','out')";
  206 + if(map.get("gsdmShif").toString()!=""){
  207 + sql+=" and r.gs_bm='"+map.get("gsdmShif").toString()+"'";
  208 + }
  209 + if(map.get("fgsdmShif").toString()!=""){
  210 + sql+=" and r.fgs_bm='"+map.get("fgsdmShif").toString()+"'";
  211 + }
  212 + sql += " GROUP BY r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  213 + + " ORDER BY r.lp_name asc";
182 214  
183 215 List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() {
184 216  
... ... @@ -200,7 +232,7 @@ public class FormsServiceImpl implements FormsService {
200 232 for(int i=0;i<list.size();i++){
201 233 Shifday shi=list.get(i);
202 234 Map<String, Object> maps = new HashMap<>();
203   - maps = scheduleRealInfoService.findKMBC2(shi.getJgh(), shi.getCarPlate(),
  235 + maps = commonService.findKMBC2(shi.getJgh(), shi.getCarPlate(),
204 236 shi.getRq());
205 237 shi.setJhlc(maps.get("jhlc").toString());// 计划里程
206 238 //shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程
... ... @@ -261,7 +293,6 @@ public class FormsServiceImpl implements FormsService {
261 293 @Override
262 294 public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException {
263 295 Changetochange chan = new Changetochange();
264   -
265 296 chan.setRq(rq);
266 297 chan.setGs(arg0.getString("gs"));
267 298 chan.setFgs(arg0.getString("fgs"));
... ... @@ -302,18 +333,22 @@ public class FormsServiceImpl implements FormsService {
302 333  
303 334 rq = rq2 + "-" + rq3;
304 335  
305   - String sql = " SELECT r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  336 + String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
306 337 + " FROM bsth_c_s_sp_info_real r "
307   - + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y "
308   - + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "' and '"+ map.get("endDate").toString() + "'"
309   - + " and y.XLBM= '" + map.get("line").toString() + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y on r.cl_zbh=y.nbbm "
  338 + + " left join bsth_c_ylb y"
  339 + + " ON r.cl_zbh = y.nbbm "
310 340 + " where r.schedule_date_str BETWEEN '" + map.get("startDate").toString() + "'"
311 341 + " and '"+ map.get("endDate").toString() + "'"
312 342 + " and r.xl_bm='" + map.get("line").toString() + "'"
313   - + " AND r.gs_bm is not null"
314   - /* + " and r.gs_bm='"+map.get("gsdmSing").toString()+"'"
315   - + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"'"*/
316   - + " GROUP BY r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
  343 + + " AND r.gs_bm is not null";
  344 +
  345 + if(map.get("gsdmSing").toString()!=""){
  346 + sql+=" and r.gs_bm='"+map.get("gsdmSing").toString()+"'";
  347 + }
  348 + if(map.get("fgsdmSing").toString()!=""){
  349 + sql+=" and r.fgs_bm='"+map.get("fgsdmSing").toString()+"'";
  350 + }
  351 + sql += " GROUP BY r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
317 352  
318 353 startDate = map.get("startDate").toString();
319 354 endDate = map.get("endDate").toString();
... ... @@ -324,7 +359,7 @@ public class FormsServiceImpl implements FormsService {
324 359 Singledata sin = new Singledata();
325 360 sin.setrQ(rq);
326 361 sin.setgS(arg0.getString("gs_name"));
327   - sin.setxL(arg0.getString("xl_bm"));
  362 + sin.setxL(arg0.getString("xl_name"));
328 363 sin.setClzbh(arg0.getString("cl_zbh"));
329 364 sin.setJsy(arg0.getString("j_gh"));
330 365 sin.setjName(arg0.getString("j_name"));
... ... @@ -339,7 +374,7 @@ public class FormsServiceImpl implements FormsService {
339 374 for(int i=0;i<list.size();i++){
340 375 Singledata si=list.get(i);
341 376 Map<String, Object> maps = new HashMap<>();
342   - maps = scheduleRealInfoService.findKMBC1(si.getjName(),si.getClzbh(), startDate,
  377 + maps = commonService.findKMBC1(si.getjName(),si.getClzbh(), startDate,
343 378 endDate);
344 379 //sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString());
345 380 si.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString());
... ... @@ -356,24 +391,30 @@ public class FormsServiceImpl implements FormsService {
356 391 @Override
357 392 public List<Operationservice> operationservice(Map<String, Object> map) {
358 393  
359   - String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
  394 + String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
360 395 + " FROM bsth_c_s_sp_info_real r "
361 396 // + "LEFT JOIN bsth_c_s_sp_info_real r on r.cl_zbh=y.NBBM"
362   - + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y "
363   - + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "' and '"+ map.get("endDate").toString() + "'"
364   - + " and y.XLBM= '" + map.get("line").toString() + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y on r.cl_zbh=y.nbbm "
365   - + " where r.schedule_date_str BETWEEN '"+ map.get("startDate").toString()
366   - + "'" + " and '" + map.get("endDate").toString() + "'"
367   - + " and r.xl_bm='" + map.get("line").toString() + "'"
368   - + " and r.bc_type not in('in','out')"
369   - /* + " and r.gs_bm='"+map.get("gsdmOperat").toString()+"'"
370   - + " and r.fgs_bm='"+map.get("fgsdmOperat").toString()+"'"*/
371   - + " AND r.gs_bm is not null"
372   - + " GROUP BY r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name";
  397 + + " left join bsth_c_ylb y ON r.cl_zbh = y.nbbm "
  398 + + " where 1=1 ";
  399 + if(map.get("startDate").toString()!=""){
  400 + sql+=" and to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') ";
  401 + }
373 402  
374   - //r.j_name
375   - startDate = map.get("startDate").toString();
376   - endDate = map.get("endDate").toString();
  403 + if(map.get("endDate").toString()!=""){
  404 + sql+=" and to_days('" + map.get("endDate").toString() + "') ";
  405 + }
  406 + sql+=" and r.xl_bm='" + map.get("line").toString() + "'" ;
  407 + sql+=" and r.bc_type not in('in','out')";
  408 + if(map.get("gsdmOperat").toString()!=""){
  409 + sql+=" and r.gs_bm='"+map.get("gsdmOperat").toString()+"'";
  410 + }
  411 + if(map.get("fgsdmOperat").toString()!=""){
  412 + sql+=" and r.fgs_bm='"+map.get("fgsdmOperat").toString()+"'";
  413 + }
  414 + sql += " AND r.gs_bm is not null";
  415 + sql += " GROUP BY r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name";
  416 + startDate = map.get("startDate").toString();
  417 + endDate = map.get("endDate").toString();
377 418 List<Operationservice> list = jdbcTemplate.query(sql, new RowMapper<Operationservice>() {
378 419  
379 420 @Override
... ... @@ -392,9 +433,9 @@ public class FormsServiceImpl implements FormsService {
392 433 for(int i=0;i<list.size();i++){
393 434 Operationservice o=list.get(i);
394 435 Map<String, Object> maps = new HashMap<>();
395   - maps = scheduleRealInfoService.findKMBC1(o.getJname(), o.getClzbh(), startDate,
  436 + maps = commonService.findKMBC1(o.getJname(), o.getClzbh(), startDate,
396 437 endDate);
397   - o.setXsgl(maps.get("yygl").toString() == null ? "" : maps.get("yygl").toString());
  438 + o.setXsgl(maps.get("jhlc").toString() == null ? "" : maps.get("jhlc").toString());
398 439 o.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString());
399 440 o.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());
400 441 }
... ... @@ -404,7 +445,7 @@ public class FormsServiceImpl implements FormsService {
404 445  
405 446 // 车辆加注
406 447 @Override
407   - public List<Vehicleloading> vehicleloading(/*String gsdmVehic,String fgsdmVehic,*/String line, String date) {
  448 + public List<Vehicleloading> vehicleloading(String gsdmVehic,String fgsdmVehic,String line, String date) {
408 449  
409 450 String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
410 451 + " FROM bsth_c_s_sp_info_real r "
... ... @@ -414,13 +455,14 @@ public class FormsServiceImpl implements FormsService {
414 455 + " where to_days(r.schedule_date_str)=to_days('" + date + "')"
415 456 + " and r.xl_bm='" + line + "' "
416 457 + " AND r.gs_bm is not null"
417   - + " and r.bc_type not in('in','out')"
418   - /* + " and r.gs_bm='"+gsdmVehic +"'"
419   - + " and r.fgs_bm='"+fgsdmVehic +"'"*/
420   - + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
421   -
422   -
423   - //r.cl_zbh
  458 + + " and r.bc_type not in('in','out')";
  459 + if(gsdmVehic.toString()!=""){
  460 + sql+=" and r.gs_bm='"+gsdmVehic+"'";
  461 + }
  462 + if(fgsdmVehic.toString()!=""){
  463 + sql+=" and r.fgs_bm='"+fgsdmVehic +"'";
  464 + }
  465 + sql += " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
424 466 List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() {
425 467 @Override
426 468 public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException {
... ... @@ -429,8 +471,8 @@ public class FormsServiceImpl implements FormsService {
429 471 ve.setgS(arg0.getString("gs_name"));
430 472 ve.setxL(arg0.getString("xl_name"));
431 473 ve.setClzbh(arg0.getString("cl_zbh"));
432   - ve.setHyl(arg0.getString("YH"));
433 474 ve.setJzl(arg0.getString("JZL"));
  475 + ve.setHyl(arg0.getString("YH"));
434 476 // ve.setLs(arg0.getString("").toString());//尿素
435 477 ve.setJgh(arg0.getString("j_gh").toString());
436 478 return ve;
... ... @@ -440,9 +482,9 @@ public class FormsServiceImpl implements FormsService {
440 482 for(int i=0;i<list.size();i++){
441 483 Vehicleloading v=list.get(i);
442 484 Map<String, Object> maps = new HashMap<>();
443   - maps = scheduleRealInfoService.findKMBC2(v.getJgh(), line,
444   - date);
445   - v.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
  485 + maps = commonService.findKMBC2(v.getJgh(), v.getClzbh(),
  486 + v.getrQ());
  487 + v.setJhlc(maps.get("jhlc") == null ? "" : maps.get("jhlc").toString());
446 488 v.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次
447 489 v.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次
448 490 }
... ... @@ -476,8 +518,8 @@ public class FormsServiceImpl implements FormsService {
476 518 + " and '" + map.get("endDate").toString() + "' and xl_bm='"+ map.get("line").toString() + "' "
477 519 + " AND gs_bm is not null "
478 520 + " AND bc_type NOT IN ('in', 'out')"
479   - /*+ " and gs_bm='"+ map.get("gsdmTurn").toString() + "'"
480   - + " and fgs_bm='"+ map.get("fgsdmTurn").toString() + "'"*/
  521 + + " and gs_bm='"+ map.get("gsdmTurn").toString() + "'"
  522 + + " and fgs_bm='"+ map.get("fgsdmTurn").toString() + "'"
481 523 + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type ) a left JOIN ("
482 524 + " SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl,t.warrant_car "
483 525 + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
... ... @@ -510,7 +552,7 @@ public class FormsServiceImpl implements FormsService {
510 552 tu.setBcjh(arg0.getString("jbc").toString());
511 553 tu.setBcsj(arg0.getString("sbc").toString());
512 554 tu.setBbzxl(result2 + "%");// 班次执行率
513   - // tu.setSm(arg0.getString("gs_name").toString());
  555 + tu.setSm(arg0.getString("gs_name").toString());
514 556 tu.setGsgs(arg0.getString("gslsbm").toString());
515 557 tu.setFgsgs(arg0.getString("fgsbm").toString());
516 558 return tu;
... ... @@ -547,8 +589,8 @@ public class FormsServiceImpl implements FormsService {
547 589 + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
548 590 + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
549 591 + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')"
550   - /*+ " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'"
551   - + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'"*/
  592 + + " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'"
  593 + + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'"
552 594 + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type ) a left JOIN ("
553 595 + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
554 596 + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
... ... @@ -618,8 +660,8 @@ public class FormsServiceImpl implements FormsService {
618 660 + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
619 661 + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
620 662 + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "
621   - /*+ " and gs_bm='"+ map.get("gsdmAllline").toString() + "'"
622   - + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'"*/
  663 + + " and gs_bm='"+ map.get("gsdmAllline").toString() + "'"
  664 + + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'"
623 665 + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type ) a left JOIN ("
624 666 + "SELECT COUNT(*"
625 667 + ") as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b."
... ... @@ -655,18 +697,13 @@ public class FormsServiceImpl implements FormsService {
655 697 tu.setBcsj(arg0.getString("sbc").toString());
656 698 tu.setBbzxl(result2 + "%");// 班次执行率
657 699  
658   - // tu.setSm(arg0.getString("xl_name").toString());
  700 + tu.setSm(arg0.getString("xl_name").toString());
659 701 tu.setGsgs(arg0.getString("gslsbm").toString());
660 702 tu.setFgsgs(arg0.getString("fgsbm").toString());
661 703 return tu;
662   - }
663   -
664   -
  704 + }
665 705 });
666 706  
667   -
668   -
669   -
670 707 return list;
671 708 }
672 709 }
... ...
src/main/java/com/bsth/service/gps/GpsService.java
... ... @@ -14,4 +14,6 @@ public interface GpsService {
14 14 Map<String, Object> search(Map<String, Object> map, int page, int size, String order, String direction);
15 15  
16 16 Map<String,Object> removeRealGps(String device);
  17 +
  18 + Map<String,Object> findRoadSpeed(String lineCode);
17 19 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
1 1 package com.bsth.service.gps;
2 2  
3   -import java.lang.reflect.Field;
4   -import java.sql.Connection;
5   -import java.sql.PreparedStatement;
6   -import java.sql.ResultSet;
7   -import java.util.ArrayList;
8   -import java.util.Calendar;
9   -import java.util.Collection;
10   -import java.util.Collections;
11   -import java.util.Comparator;
12   -import java.util.Date;
13   -import java.util.HashMap;
14   -import java.util.List;
15   -import java.util.Map;
16   -
17   -import org.apache.commons.lang3.StringUtils;
18   -import org.slf4j.Logger;
19   -import org.slf4j.LoggerFactory;
20   -import org.springframework.beans.factory.annotation.Autowired;
21   -import org.springframework.stereotype.Service;
22   -
23 3 import com.bsth.common.ResponseCode;
24 4 import com.bsth.data.BasicData;
25 5 import com.bsth.data.arrival.ArrivalEntity;
... ... @@ -31,6 +11,19 @@ import com.bsth.util.DateUtils;
31 11 import com.bsth.util.TransGPS;
32 12 import com.bsth.util.TransGPS.Location;
33 13 import com.bsth.util.db.DBUtils_MS;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.dao.DataAccessException;
  19 +import org.springframework.jdbc.core.JdbcTemplate;
  20 +import org.springframework.stereotype.Service;
  21 +
  22 +import java.lang.reflect.Field;
  23 +import java.sql.Connection;
  24 +import java.sql.PreparedStatement;
  25 +import java.sql.ResultSet;
  26 +import java.util.*;
34 27  
35 28 @Service
36 29 public class GpsServiceImpl implements GpsService {
... ... @@ -51,6 +44,9 @@ public class GpsServiceImpl implements GpsService {
51 44 @Autowired
52 45 GpsRealData gpsRealData;
53 46  
  47 + @Autowired
  48 + JdbcTemplate jdbcTemplate;
  49 +
54 50 // 历史gps查询
55 51 @Override
56 52 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) {
... ... @@ -199,9 +195,9 @@ public class GpsServiceImpl implements GpsService {
199 195 inv = inv.substring(0, inv.length() - 1);
200 196  
201 197 // 查询到离站数据
202   - Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv);
  198 + //Map<String, ArrivalEntity> arrivalMap = findArrivalByTs(weekOfYear/* 30 */, st, et, inv);
203 199  
204   - String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO from bsth_c_gps_info where days_year=? and device_id in ("
  200 + String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS from bsth_c_gps_info where days_year=? and device_id in ("
205 201 + inv + ") and ts > ? and ts < ?";
206 202 try {
207 203 conn = DBUtils_MS.getConnection();
... ... @@ -235,15 +231,19 @@ public class GpsServiceImpl implements GpsService {
235 231 map.put("ts", rs.getLong("TS"));
236 232 map.put("timestamp", rs.getLong("TS"));
237 233 map.put("stopNo", rs.getString("STOP_NO"));
  234 + map.put("direction", rs.getFloat("DIRECTION"));
  235 +
  236 + map.put("lineId", rs.getString("LINE_ID"));
  237 + map.put("speed", rs.getFloat("SPEED_GPS"));
238 238  
239 239 inOutStop = rs.getInt("INOUT_STOP");
240 240 map.put("inout_stop", inOutStop);
241 241  
242   - arrival = arrivalMap.get(rs.getString("DEVICE_ID") + "_" + rs.getLong("TS"));
243   - if (arrival != null) {
244   - map.put("inout_stop_info", arrival);
245   - map.put("inout_stop", arrival.getInOut());
246   - }
  242 + /*analyse = arrivalMap.get(rs.getString("DEVICE_ID") + "_" + rs.getLong("TS"));
  243 + if (analyse != null) {
  244 + map.put("inout_stop_info", analyse);
  245 + map.put("inout_stop", analyse.getInOut());
  246 + }*/
247 247 map.put("nbbm", BasicData.deviceId2NbbmMap.get(rs.getString("DEVICE_ID")));
248 248 map.put("state", 0);
249 249 // 上下行
... ... @@ -388,6 +388,22 @@ public class GpsServiceImpl implements GpsService {
388 388 return rs;
389 389 }
390 390  
  391 + @Override
  392 + public Map<String, Object> findRoadSpeed(String lineCode) {
  393 + Map<String, Object> rs = new HashMap<>();
  394 +
  395 + try {
  396 + String sql = "select ID, ST_AsText(GROAD_VECTOR) as GROAD_VECTOR,ROAD_CODE,ROAD_NAME,SPEED from bsth_c_road where road_code in(select section_code from bsth_c_sectionroute where line_code=? and destroy=0)";
  397 + List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, lineCode);
  398 + rs.put("status", ResponseCode.SUCCESS);
  399 + rs.put("roads", list);
  400 + } catch (DataAccessException e) {
  401 + logger.error("", e);
  402 + rs.put("status", ResponseCode.ERROR);
  403 + }
  404 + return rs;
  405 + }
  406 +
391 407 private void sortGpsList(final Field f, List<GpsEntity> rs) {
392 408 Collections.sort(rs, new Comparator<GpsEntity>() {
393 409  
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -573,6 +573,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
573 573 String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1));
574 574 // 查询所有班次
575 575 List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow);
  576 + int j = 0; // 初始化标识
576 577 if(schedulePlanList != null ){
577 578 int size = schedulePlanList.size();
578 579 for (int i = 0; i < size; i++) {
... ... @@ -583,7 +584,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
583 584 if(line.getInUse() == null || line.getInUse() == 0){
584 585 continue;
585 586 }
586   - if(i == 0){// 第一次,则初始化值
  587 + if(++j == 1){// 第一次,则初始化值
587 588 zbh = schedulePlanInfo.getClZbh();
588 589 lp = schedulePlanInfo.getLp();
589 590 // 拼装XML
... ...
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
... ... @@ -6,6 +6,6 @@ import com.bsth.entity.schedule.CarConfigInfo;
6 6 * Created by xu on 16/5/9.
7 7 */
8 8 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
9   - public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
10   - public void toggleCancel(Long id) throws ScheduleException;
  9 + void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  10 + void toggleCancel(Long id) throws ScheduleException;
11 11 }
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
... ... @@ -912,7 +912,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
912 912 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
913 913 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
914 914 Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>();
915   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
  915 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
916 916  
917 917 String company = map.get("company").toString();
918 918 String subCompany = map.get("subCompany").toString();
... ...
src/main/java/com/bsth/service/schedule/RerunService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.rule.RerunRule;
4   -import com.bsth.service.BaseService;
5 4  
6 5 /**
7 6 * Created by xu on 16/10/20.
8 7 */
9   -public interface RerunService extends BaseService<RerunRule, Long> {
  8 +public interface RerunService extends BService<RerunRule, Long> {
10 9 }
... ...
src/main/java/com/bsth/service/schedule/RerunServiceImpl.java deleted 100644 → 0
1   -package com.bsth.service.schedule;
2   -
3   -import com.bsth.common.ResponseCode;
4   -import com.bsth.entity.schedule.rule.RerunRule;
5   -import com.bsth.repository.schedule.RerunRuleRepository;
6   -import com.bsth.service.impl.BaseServiceImpl;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.stereotype.Service;
9   -
10   -import javax.transaction.Transactional;
11   -import java.util.HashMap;
12   -import java.util.Map;
13   -
14   -/**
15   - * Created by xu on 16/10/20.
16   - */
17   -@Service
18   -public class RerunServiceImpl extends BaseServiceImpl<RerunRule, Long> implements RerunService {
19   -
20   - @Autowired
21   - private RerunRuleRepository rerunRuleRepository;
22   -
23   - @Override
24   - @Transactional
25   - public Map<String, Object> delete(Long aLong) {
26   - // 获取带作废的数据
27   - RerunRule rerunRule = rerunRuleRepository.findOne(aLong);
28   -
29   - toogleIsCancel(rerunRule);
30   -
31   - Map<String, Object> map = new HashMap<>();
32   - map.put("status", ResponseCode.SUCCESS);
33   -
34   - return map;
35   -
36   - }
37   -
38   - /**
39   - * 撤销/作废切换。
40   - * @param rerunRule
41   - */
42   - private void toogleIsCancel(RerunRule rerunRule) {
43   - boolean isCancel = rerunRule.getIsCancel();
44   - if (isCancel) {
45   - rerunRule.setIsCancel(false);
46   - } else {
47   - rerunRule.setIsCancel(true);
48   - }
49   - }
50   -}
src/main/java/com/bsth/service/schedule/TTInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.TTInfo;
4   -import com.bsth.service.BaseService;
5 4  
6 5 /**
7 6 * Created by xu on 16/5/12.
8 7 */
9   -public interface TTInfoService extends BaseService<TTInfo, Long> {
  8 +public interface TTInfoService extends BService<TTInfo, Long> {
  9 + void validate_name(TTInfo ttInfo) throws ScheduleException;
  10 + void validate_n_d(TTInfo ttInfo) throws ScheduleException;
  11 + void validate_s_d(TTInfo ttInfo) throws ScheduleException;
  12 + void toggleCancel(Long id) throws ScheduleException;
  13 +
10 14 }
... ...
src/main/java/com/bsth/service/schedule/TTInfoServiceImpl.java deleted 100644 → 0
1   -package com.bsth.service.schedule;
2   -
3   -import com.bsth.common.ResponseCode;
4   -import com.bsth.entity.schedule.TTInfo;
5   -import com.bsth.repository.schedule.TTInfoRepository;
6   -import com.bsth.service.impl.BaseServiceImpl;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.stereotype.Service;
9   -
10   -import javax.transaction.Transactional;
11   -import java.util.HashMap;
12   -import java.util.Map;
13   -
14   -/**
15   - * Created by xu on 16/5/12.
16   - */
17   -@Service
18   -@Transactional
19   -public class TTInfoServiceImpl extends BaseServiceImpl<TTInfo, Long> implements TTInfoService {
20   - @Autowired
21   - private TTInfoRepository ttInfoRepository;
22   -
23   - @Transactional
24   - @Override
25   - public Map<String, Object> delete(Long aLong) {
26   - // 获取待作废的数据
27   - TTInfo ttInfo = ttInfoRepository.findOne(aLong);
28   -
29   - toogleIsCancel(ttInfo);
30   -
31   - Map<String, Object> map = new HashMap<>();
32   - map.put("status", ResponseCode.SUCCESS);
33   -
34   - return map;
35   - }
36   -
37   -
38   -
39   - private void toogleIsCancel(TTInfo ttInfo) {
40   - boolean isCancel = ttInfo.getIsCancel();
41   - if (isCancel) {
42   - ttInfo.setIsCancel(false);
43   - } else {
44   - ttInfo.setIsCancel(true);
45   - }
46   - }
47   -}
src/main/java/com/bsth/service/schedule/impl/RerunServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.schedule.rule.RerunRule;
  4 +import com.bsth.service.schedule.RerunService;
  5 +import com.bsth.service.schedule.ScheduleException;
  6 +import org.springframework.stereotype.Service;
  7 +import org.springframework.transaction.annotation.Transactional;
  8 +
  9 +/**
  10 + * Created by xu on 16/10/20.
  11 + */
  12 +@Service
  13 +public class RerunServiceImpl extends BServiceImpl<RerunRule, Long> implements RerunService {
  14 +
  15 + @Transactional
  16 + @Override
  17 + public void delete(Long aLong) throws ScheduleException {
  18 + toggleCancel(aLong);
  19 + }
  20 +
  21 + private void toggleCancel(Long id) throws ScheduleException {
  22 + RerunRule rerunRule = findById(id);
  23 + if (rerunRule.getIsCancel()) {
  24 + rerunRule.setIsCancel(false);
  25 + } else {
  26 + rerunRule.setIsCancel(true);
  27 + }
  28 + }
  29 +}
... ...
src/main/java/com/bsth/service/schedule/impl/TTInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.schedule.TTInfo;
  4 +import com.bsth.service.schedule.ScheduleException;
  5 +import com.bsth.service.schedule.TTInfoService;
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.springframework.stereotype.Service;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +import org.springframework.util.CollectionUtils;
  10 +
  11 +import java.util.HashMap;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * Created by xu on 16/12/20.
  17 + */
  18 +@Service
  19 +public class TTInfoServiceImpl extends BServiceImpl<TTInfo, Long> implements TTInfoService {
  20 +
  21 + @Override
  22 + public void validate_name(TTInfo ttInfo) throws ScheduleException {
  23 + // 名字重复验证
  24 + Map<String, Object> param = new HashMap<>();
  25 + if (ttInfo.getId() != null) {
  26 + param.put("id_ne", ttInfo.getId());
  27 + }
  28 + param.put("xl.id_eq", ttInfo.getXl().getId());
  29 + param.put("name_eq", ttInfo.getName());
  30 +
  31 + if (!CollectionUtils.isEmpty(list(param))) {
  32 + throw new ScheduleException("名字重复");
  33 + }
  34 + }
  35 +
  36 + @Override
  37 + public void validate_n_d(TTInfo ttInfo) throws ScheduleException {
  38 + // 常规有效日重复验证
  39 + // 找出所有未作废,已启用的时刻表,验证
  40 + Map<String, Object> param = new HashMap<>();
  41 + if (ttInfo.getId() != null) {
  42 + param.put("id_ne", ttInfo.getId());
  43 + }
  44 + param.put("xl.id_eq", ttInfo.getXl().getId());
  45 + param.put("isCancel_eq", false);
  46 + param.put("isEnableDisTemplate_eq", true);
  47 + List<TTInfo> ttInfos = list(param);
  48 + if (StringUtils.isEmpty(ttInfo.getRule_days())) {
  49 + throw new ScheduleException("常规有效日为空");
  50 + } else {
  51 + String[] nds = ttInfo.getRule_days().split(",");
  52 + for (TTInfo t : ttInfos) {
  53 + String[] nds_e = t.getRule_days().split(",");
  54 + for (int i = 0; i < 7; i++) {
  55 + if ("0".equals(nds[i])) {
  56 + //
  57 + } else {
  58 + if (nds[i].equals(nds_e[i])) {
  59 + throw new ScheduleException("当前常规有效日期已经使用");
  60 + }
  61 + }
  62 + }
  63 + }
  64 + }
  65 + }
  66 +
  67 + @Override
  68 + public void validate_s_d(TTInfo ttInfo) throws ScheduleException {
  69 + // 特殊有效日重复验证
  70 + // 找出所有未作废,已启用的时刻表,验证
  71 + Map<String, Object> param = new HashMap<>();
  72 + if (ttInfo.getId() != null) {
  73 + param.put("id_ne", ttInfo.getId());
  74 + }
  75 +
  76 + param.put("xl.id_eq", ttInfo.getXl().getId());
  77 + param.put("isCancel_eq", false);
  78 + param.put("isEnableDisTemplate_eq", true);
  79 + List<TTInfo> ttInfos = list(param);
  80 + if (StringUtils.isEmpty(ttInfo.getSpecial_days())) {
  81 + //
  82 + } else {
  83 + String[] sds = ttInfo.getSpecial_days().split(",");
  84 + for (TTInfo t : ttInfos) {
  85 + if (StringUtils.isEmpty(t.getSpecial_days())) {
  86 + //
  87 + } else {
  88 + for (String sd : sds) {
  89 + if (t.getSpecial_days().indexOf(sd) != -1) {
  90 + throw new ScheduleException("当前特殊日期已经使用");
  91 + }
  92 + }
  93 + }
  94 + }
  95 + }
  96 + }
  97 +
  98 +
  99 + @Transactional
  100 + @Override
  101 + public void delete(Long aLong) throws ScheduleException {
  102 + toggleCancel(aLong);
  103 + }
  104 +
  105 + @Transactional
  106 + @Override
  107 + public void toggleCancel(Long id) throws ScheduleException {
  108 + TTInfo ttInfo = findById(id);
  109 + if (ttInfo.getIsCancel()) {
  110 + ttInfo.setIsCancel(false);
  111 + } else {
  112 + ttInfo.setIsCancel(true);
  113 + }
  114 + }
  115 +}
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
... ... @@ -116,6 +116,27 @@
116 116 <bordercolorblue>100</bordercolorblue>
117 117 <drawshadow>Y</drawshadow>
118 118 </notepad>
  119 + <notepad>
  120 + <note>&#x8fd9;&#x91cc;&#x6709;&#x4e9b;&#x95ee;&#x9898;&#xa;&#x5728;window2012&#x7684;&#x73af;&#x5883;&#x4e0b;&#xff0c;&#xa;MySql&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x4e2d;&#x5982;&#x679c;&#x8fd4;&#x56de;&#x4e2d;&#x6587;&#x5185;&#x5bb9;&#x7684;&#x5b57;&#x6bb5;&#xff0c;&#x8fd9;&#x4e2a;&#x5185;&#x5bb9;&#x4e71;&#x7801;&#xa;&#x89e3;&#x51b3;&#x529e;&#x6cd5;&#xff0c;&#x5c31;&#x662f;&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x5168;&#x90e8;&#x7f13;&#x5b58;&#xff0c;&#x5c31;&#x4e0d;&#x4e71;&#x7801;&#xa;linux&#x73af;&#x5883;&#x4e0b;&#x6ca1;&#x95ee;&#x9898;</note>
  121 + <xloc>721</xloc>
  122 + <yloc>762</yloc>
  123 + <width>333</width>
  124 + <heigth>90</heigth>
  125 + <fontname>YaHei Consolas Hybrid</fontname>
  126 + <fontsize>12</fontsize>
  127 + <fontbold>N</fontbold>
  128 + <fontitalic>N</fontitalic>
  129 + <fontcolorred>0</fontcolorred>
  130 + <fontcolorgreen>0</fontcolorgreen>
  131 + <fontcolorblue>0</fontcolorblue>
  132 + <backgroundcolorred>255</backgroundcolorred>
  133 + <backgroundcolorgreen>205</backgroundcolorgreen>
  134 + <backgroundcolorblue>112</backgroundcolorblue>
  135 + <bordercolorred>100</bordercolorred>
  136 + <bordercolorgreen>100</bordercolorgreen>
  137 + <bordercolorblue>100</bordercolorblue>
  138 + <drawshadow>Y</drawshadow>
  139 + </notepad>
119 140 </notepads>
120 141 <connection>
121 142 <name>bus_control_variable</name>
... ... @@ -130,6 +151,7 @@
130 151 <data_tablespace/>
131 152 <index_tablespace/>
132 153 <attributes>
  154 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
133 155 <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
134 156 <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
135 157 <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
... ... @@ -437,7 +459,7 @@
437 459 <optimizationLevel>9</optimizationLevel>
438 460 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
439 461 <jsScript_name>Script 1</jsScript_name>
440   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x6dfb;&#x52a0;&#x7ad9;&#x70b9;&#x6807;&#x8bc6;&#xa;var cc_groups &#x3d; qdzgroups.split&#x28;&#x22;,&#x22;&#x29;&#x3b; &#x2f;&#x2f; &#x6240;&#x6709;&#x73ed;&#x6b21;&#x8d77;&#x70b9;&#x7ad9;&#x6570;&#x7ec4;&#xa;var zdzname &#x3d; cc_groups&#x5b;gno&#x5d;&#x3b; &#x2f;&#x2f; &#x51fa;&#x573a;&#x73ed;&#x6b21;&#x7684;&#x7ec8;&#x70b9;&#x7ad9;&#x662f;&#x4e0b;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x59cb;&#x7ad9;&#xa;var endZdtype &#x3d; &#x27;E&#x27;&#x3b;</jsScript_script>
  462 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x6dfb;&#x52a0;&#x7ad9;&#x70b9;&#x6807;&#x8bc6;&#xa;var cc_groups &#x3d; qdzgroups.split&#x28;&#x22;,&#x22;&#x29;&#x3b; &#x2f;&#x2f; &#x6240;&#x6709;&#x73ed;&#x6b21;&#x8d77;&#x70b9;&#x7ad9;&#x6570;&#x7ec4;&#xa;var zdzname &#x3d; cc_groups&#x5b;gno&#x5d;&#x3b; &#x2f;&#x2f; &#x51fa;&#x573a;&#x73ed;&#x6b21;&#x7684;&#x7ec8;&#x70b9;&#x7ad9;&#x662f;&#x4e0b;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x59cb;&#x7ad9;&#xa;var endZdtype &#x3d; &#x27;E&#x27;&#x3b;&#xa;&#xa;var destory &#x3d; 0&#x3b; &#x2f;&#x2f; &#x672a;&#x64a4;&#x9500;flag</jsScript_script>
441 463 </jsScript> </jsScripts> <fields> <field> <name>zdzname</name>
442 464 <rename>zdzname</rename>
443 465 <type>String</type>
... ... @@ -450,6 +472,12 @@
450 472 <length>-1</length>
451 473 <precision>-1</precision>
452 474 <replace>N</replace>
  475 + </field> <field> <name>destory</name>
  476 + <rename>destory</rename>
  477 + <type>Integer</type>
  478 + <length>-1</length>
  479 + <precision>-1</precision>
  480 + <replace>N</replace>
453 481 </field> </fields> <cluster_schema/>
454 482 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
455 483 <xloc>575</xloc>
... ... @@ -1341,6 +1369,12 @@
1341 1369 <condition>&#x3d;</condition>
1342 1370 <name2/>
1343 1371 </key>
  1372 + <key>
  1373 + <name>destory</name>
  1374 + <field>destroy</field>
  1375 + <condition>&#x3d;</condition>
  1376 + <name2/>
  1377 + </key>
1344 1378 <value>
1345 1379 <name>station</name>
1346 1380 <rename>zdzid</rename>
... ... @@ -1677,6 +1711,12 @@
1677 1711 <condition>&#x3d;</condition>
1678 1712 <name2/>
1679 1713 </key>
  1714 + <key>
  1715 + <name>destory</name>
  1716 + <field>destroy</field>
  1717 + <condition>&#x3d;</condition>
  1718 + <name2/>
  1719 + </key>
1680 1720 <value>
1681 1721 <name>station_name</name>
1682 1722 <rename>zdzname</rename>
... ... @@ -1737,6 +1777,12 @@
1737 1777 <condition>&#x3d;</condition>
1738 1778 <name2/>
1739 1779 </key>
  1780 + <key>
  1781 + <name>destory</name>
  1782 + <field>destroy</field>
  1783 + <condition>&#x3d;</condition>
  1784 + <name2/>
  1785 + </key>
1740 1786 <value>
1741 1787 <name>station</name>
1742 1788 <rename>qdzid</rename>
... ... @@ -1845,6 +1891,12 @@
1845 1891 <condition>&#x3d;</condition>
1846 1892 <name2/>
1847 1893 </key>
  1894 + <key>
  1895 + <name>destory</name>
  1896 + <field>destroy</field>
  1897 + <condition>&#x3d;</condition>
  1898 + <name2/>
  1899 + </key>
1848 1900 <value>
1849 1901 <name>directions</name>
1850 1902 <rename>sxx</rename>
... ... @@ -1872,8 +1924,8 @@
1872 1924 <schema_name/>
1873 1925 </partitioning>
1874 1926 <connection>bus_control_variable</connection>
1875   - <cache>N</cache>
1876   - <cache_load_all>N</cache_load_all>
  1927 + <cache>Y</cache>
  1928 + <cache_load_all>Y</cache_load_all>
1877 1929 <cache_size>0</cache_size>
1878 1930 <lookup>
1879 1931 <schema/>
... ... @@ -1899,6 +1951,12 @@
1899 1951 <condition>&#x3d;</condition>
1900 1952 <name2/>
1901 1953 </key>
  1954 + <key>
  1955 + <name>destory</name>
  1956 + <field>destroy</field>
  1957 + <condition>&#x3d;</condition>
  1958 + <name2/>
  1959 + </key>
1902 1960 <value>
1903 1961 <name>station_name</name>
1904 1962 <rename>zdzname_calcu</rename>
... ... @@ -1953,6 +2011,12 @@
1953 2011 <condition>&#x3d;</condition>
1954 2012 <name2/>
1955 2013 </key>
  2014 + <key>
  2015 + <name>destory</name>
  2016 + <field>destroy</field>
  2017 + <condition>&#x3d;</condition>
  2018 + <name2/>
  2019 + </key>
1956 2020 <value>
1957 2021 <name>directions</name>
1958 2022 <rename>sxx2</rename>
... ... @@ -1989,7 +2053,7 @@
1989 2053 <optimizationLevel>9</optimizationLevel>
1990 2054 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
1991 2055 <jsScript_name>Script 1</jsScript_name>
1992   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x6dfb;&#x52a0;&#x7ad9;&#x70b9;&#x6807;&#x8bc6;&#xa;var sendZdtype &#x3d; &#x27;B&#x27;&#x3b;&#xa;var endZdtype &#x3d; &#x27;E&#x27;&#x3b;&#xa;</jsScript_script>
  2056 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x6dfb;&#x52a0;&#x7ad9;&#x70b9;&#x6807;&#x8bc6;&#xa;var sendZdtype &#x3d; &#x27;B&#x27;&#x3b;&#xa;var endZdtype &#x3d; &#x27;E&#x27;&#x3b;&#xa;&#xa;var destory &#x3d; 0&#x3b; &#x2f;&#x2f; &#x672a;&#x64a4;&#x9500;flag</jsScript_script>
1993 2057 </jsScript> </jsScripts> <fields> <field> <name>sendZdtype</name>
1994 2058 <rename>sendZdtype</rename>
1995 2059 <type>String</type>
... ... @@ -2002,6 +2066,12 @@
2002 2066 <length>-1</length>
2003 2067 <precision>-1</precision>
2004 2068 <replace>N</replace>
  2069 + </field> <field> <name>destory</name>
  2070 + <rename>destory</rename>
  2071 + <type>Integer</type>
  2072 + <length>-1</length>
  2073 + <precision>-1</precision>
  2074 + <replace>N</replace>
2005 2075 </field> </fields> <cluster_schema/>
2006 2076 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
2007 2077 <xloc>588</xloc>
... ... @@ -2539,7 +2609,7 @@
2539 2609 <optimizationLevel>9</optimizationLevel>
2540 2610 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
2541 2611 <jsScript_name>Script 1</jsScript_name>
2542   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x6dfb;&#x52a0;&#x7ad9;&#x70b9;&#x6807;&#x8bc6;&#xa;var cc_groups &#x3d; qdzgroups.split&#x28;&#x22;,&#x22;&#x29;&#x3b; &#x2f;&#x2f; &#x6240;&#x6709;&#x73ed;&#x6b21;&#x8d77;&#x70b9;&#x7ad9;&#x6570;&#x7ec4;&#xa;var qdzname_calcu &#x3d; cc_groups&#x5b;gno - 2&#x5d;&#x3b; &#x2f;&#x2f; &#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x70b9;&#x7ad9;&#x662f;&#x4e0a;&#x4e00;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x7ec8;&#x70b9;&#x7ad9;&#xff0c;&#x8fd9;&#x91cc;&#x53ea;&#x6709;&#x4e0a;&#x4e00;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x70b9;&#x7ad9;&#xff0c;&#x8fd8;&#x9700;&#x8981;&#x8ba1;&#x7b97;&#xa;var startZdtype_calcu &#x3d; &#x27;B&#x27;&#x3b;&#xa;var endZdtype_calcu &#x3d; &#x27;E&#x27;&#x3b;</jsScript_script>
  2612 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x6dfb;&#x52a0;&#x7ad9;&#x70b9;&#x6807;&#x8bc6;&#xa;var cc_groups &#x3d; qdzgroups.split&#x28;&#x22;,&#x22;&#x29;&#x3b; &#x2f;&#x2f; &#x6240;&#x6709;&#x73ed;&#x6b21;&#x8d77;&#x70b9;&#x7ad9;&#x6570;&#x7ec4;&#xa;var qdzname_calcu &#x3d; cc_groups&#x5b;gno - 2&#x5d;&#x3b; &#x2f;&#x2f; &#x8fdb;&#x573a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x70b9;&#x7ad9;&#x662f;&#x4e0a;&#x4e00;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x7ec8;&#x70b9;&#x7ad9;&#xff0c;&#x8fd9;&#x91cc;&#x53ea;&#x6709;&#x4e0a;&#x4e00;&#x4e2a;&#x73ed;&#x6b21;&#x7684;&#x8d77;&#x70b9;&#x7ad9;&#xff0c;&#x8fd8;&#x9700;&#x8981;&#x8ba1;&#x7b97;&#xa;var startZdtype_calcu &#x3d; &#x27;B&#x27;&#x3b;&#xa;var endZdtype_calcu &#x3d; &#x27;E&#x27;&#x3b;&#xa;&#xa;var destory &#x3d; 0&#x3b; &#x2f;&#x2f; &#x672a;&#x64a4;&#x9500;flag</jsScript_script>
2543 2613 </jsScript> </jsScripts> <fields> <field> <name>qdzname_calcu</name>
2544 2614 <rename>qdzname_calcu</rename>
2545 2615 <type>String</type>
... ... @@ -2558,6 +2628,12 @@
2558 2628 <length>-1</length>
2559 2629 <precision>-1</precision>
2560 2630 <replace>N</replace>
  2631 + </field> <field> <name>destory</name>
  2632 + <rename>destory</rename>
  2633 + <type>Integer</type>
  2634 + <length>-1</length>
  2635 + <precision>-1</precision>
  2636 + <replace>N</replace>
2561 2637 </field> </fields> <cluster_schema/>
2562 2638 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
2563 2639 <xloc>754</xloc>
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataOutput.ktr
... ... @@ -74,6 +74,27 @@
74 74 <is_key_private>N</is_key_private>
75 75 </info>
76 76 <notepads>
  77 + <notepad>
  78 + <note>&#x8fd9;&#x91cc;&#x6709;&#x4e9b;&#x95ee;&#x9898;&#xa;&#x5728;window2012&#x7684;&#x73af;&#x5883;&#x4e0b;&#xff0c;&#xa;MySql&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x4e2d;&#x5982;&#x679c;&#x8fd4;&#x56de;&#x4e2d;&#x6587;&#x5185;&#x5bb9;&#x7684;&#x5b57;&#x6bb5;&#xff0c;&#x8fd9;&#x4e2a;&#x5185;&#x5bb9;&#x4e71;&#x7801;&#xa;&#x89e3;&#x51b3;&#x529e;&#x6cd5;&#xff0c;&#x5c31;&#x662f;&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x5168;&#x90e8;&#x7f13;&#x5b58;&#xff0c;&#x5c31;&#x4e0d;&#x4e71;&#x7801;&#xa;linux&#x73af;&#x5883;&#x4e0b;&#x6ca1;&#x95ee;&#x9898;</note>
  79 + <xloc>114</xloc>
  80 + <yloc>227</yloc>
  81 + <width>333</width>
  82 + <heigth>90</heigth>
  83 + <fontname>YaHei Consolas Hybrid</fontname>
  84 + <fontsize>12</fontsize>
  85 + <fontbold>N</fontbold>
  86 + <fontitalic>N</fontitalic>
  87 + <fontcolorred>0</fontcolorred>
  88 + <fontcolorgreen>0</fontcolorgreen>
  89 + <fontcolorblue>0</fontcolorblue>
  90 + <backgroundcolorred>255</backgroundcolorred>
  91 + <backgroundcolorgreen>205</backgroundcolorgreen>
  92 + <backgroundcolorblue>112</backgroundcolorblue>
  93 + <bordercolorred>100</bordercolorred>
  94 + <bordercolorgreen>100</bordercolorgreen>
  95 + <bordercolorblue>100</bordercolorblue>
  96 + <drawshadow>Y</drawshadow>
  97 + </notepad>
77 98 </notepads>
78 99 <connection>
79 100 <name>bus_control_variable</name>
... ... @@ -88,6 +109,7 @@
88 109 <data_tablespace/>
89 110 <index_tablespace/>
90 111 <attributes>
  112 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
91 113 <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
92 114 <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
93 115 <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
... ... @@ -243,6 +265,73 @@
243 265 <hop> <from>&#x8def;&#x724c;&#x540d;&#x5b57;&#x67e5;&#x627e;</from><to>&#x6392;&#x5e8f;&#x8bb0;&#x5f55;</to><enabled>Y</enabled> </hop>
244 266 </order>
245 267 <step>
  268 + <name>Excel&#x8f93;&#x51fa;</name>
  269 + <type>ExcelOutput</type>
  270 + <description/>
  271 + <distribute>Y</distribute>
  272 + <custom_distribution/>
  273 + <copies>1</copies>
  274 + <partitioning>
  275 + <method>none</method>
  276 + <schema_name/>
  277 + </partitioning>
  278 + <header>Y</header>
  279 + <footer>N</footer>
  280 + <encoding/>
  281 + <append>N</append>
  282 + <add_to_result_filenames>Y</add_to_result_filenames>
  283 + <file>
  284 + <name>&#x24;&#x7b;filepath&#x7d;</name>
  285 + <extention/>
  286 + <do_not_open_newfile_init>N</do_not_open_newfile_init>
  287 + <create_parent_folder>N</create_parent_folder>
  288 + <split>N</split>
  289 + <add_date>N</add_date>
  290 + <add_time>N</add_time>
  291 + <SpecifyFormat>N</SpecifyFormat>
  292 + <date_time_format/>
  293 + <sheetname>Sheet1</sheetname>
  294 + <autosizecolums>N</autosizecolums>
  295 + <nullisblank>N</nullisblank>
  296 + <protect_sheet>N</protect_sheet>
  297 + <password>Encrypted </password>
  298 + <splitevery>0</splitevery>
  299 + <usetempfiles>N</usetempfiles>
  300 + <tempdirectory/>
  301 + </file>
  302 + <template>
  303 + <enabled>N</enabled>
  304 + <append>N</append>
  305 + <filename>template.xls</filename>
  306 + </template>
  307 + <fields>
  308 + </fields>
  309 + <custom>
  310 + <header_font_name>arial</header_font_name>
  311 + <header_font_size>10</header_font_size>
  312 + <header_font_bold>N</header_font_bold>
  313 + <header_font_italic>N</header_font_italic>
  314 + <header_font_underline>no</header_font_underline>
  315 + <header_font_orientation>horizontal</header_font_orientation>
  316 + <header_font_color>black</header_font_color>
  317 + <header_background_color>none</header_background_color>
  318 + <header_row_height>255</header_row_height>
  319 + <header_alignment>left</header_alignment>
  320 + <header_image/>
  321 + <row_font_name>arial</row_font_name>
  322 + <row_font_size>10</row_font_size>
  323 + <row_font_color>black</row_font_color>
  324 + <row_background_color>none</row_background_color>
  325 + </custom>
  326 + <cluster_schema/>
  327 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  328 + <xloc>731</xloc>
  329 + <yloc>65</yloc>
  330 + <draw>Y</draw>
  331 + </GUI>
  332 + </step>
  333 +
  334 + <step>
246 335 <name>&#x5217;&#x8f6c;&#x884c;</name>
247 336 <type>Denormaliser</type>
248 337 <description/>
... ... @@ -368,6 +457,30 @@
368 457 </step>
369 458  
370 459 <step>
  460 + <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
  461 + <type>SelectValues</type>
  462 + <description/>
  463 + <distribute>Y</distribute>
  464 + <custom_distribution/>
  465 + <copies>1</copies>
  466 + <partitioning>
  467 + <method>none</method>
  468 + <schema_name/>
  469 + </partitioning>
  470 + <fields> <field> <name>lp_name</name>
  471 + <rename>&#x8def;&#x724c;</rename>
  472 + <length>-2</length>
  473 + <precision>-2</precision>
  474 + </field> <select_unspecified>Y</select_unspecified>
  475 + </fields> <cluster_schema/>
  476 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  477 + <xloc>534</xloc>
  478 + <yloc>243</yloc>
  479 + <draw>Y</draw>
  480 + </GUI>
  481 + </step>
  482 +
  483 + <step>
371 484 <name>&#x6392;&#x5e8f;&#x8bb0;&#x5f55;</name>
372 485 <type>SortRows</type>
373 486 <description/>
... ... @@ -434,97 +547,6 @@
434 547 </step>
435 548  
436 549 <step>
437   - <name>Excel&#x8f93;&#x51fa;</name>
438   - <type>ExcelOutput</type>
439   - <description/>
440   - <distribute>Y</distribute>
441   - <custom_distribution/>
442   - <copies>1</copies>
443   - <partitioning>
444   - <method>none</method>
445   - <schema_name/>
446   - </partitioning>
447   - <header>Y</header>
448   - <footer>N</footer>
449   - <encoding/>
450   - <append>N</append>
451   - <add_to_result_filenames>Y</add_to_result_filenames>
452   - <file>
453   - <name>&#x24;&#x7b;filepath&#x7d;</name>
454   - <extention/>
455   - <do_not_open_newfile_init>N</do_not_open_newfile_init>
456   - <create_parent_folder>N</create_parent_folder>
457   - <split>N</split>
458   - <add_date>N</add_date>
459   - <add_time>N</add_time>
460   - <SpecifyFormat>N</SpecifyFormat>
461   - <date_time_format/>
462   - <sheetname>Sheet1</sheetname>
463   - <autosizecolums>N</autosizecolums>
464   - <nullisblank>N</nullisblank>
465   - <protect_sheet>N</protect_sheet>
466   - <password>Encrypted </password>
467   - <splitevery>0</splitevery>
468   - <usetempfiles>N</usetempfiles>
469   - <tempdirectory/>
470   - </file>
471   - <template>
472   - <enabled>N</enabled>
473   - <append>N</append>
474   - <filename>template.xls</filename>
475   - </template>
476   - <fields>
477   - </fields>
478   - <custom>
479   - <header_font_name>arial</header_font_name>
480   - <header_font_size>10</header_font_size>
481   - <header_font_bold>N</header_font_bold>
482   - <header_font_italic>N</header_font_italic>
483   - <header_font_underline>no</header_font_underline>
484   - <header_font_orientation>horizontal</header_font_orientation>
485   - <header_font_color>black</header_font_color>
486   - <header_background_color>none</header_background_color>
487   - <header_row_height>255</header_row_height>
488   - <header_alignment>left</header_alignment>
489   - <header_image/>
490   - <row_font_name>arial</row_font_name>
491   - <row_font_size>10</row_font_size>
492   - <row_font_color>black</row_font_color>
493   - <row_background_color>none</row_background_color>
494   - </custom>
495   - <cluster_schema/>
496   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
497   - <xloc>731</xloc>
498   - <yloc>65</yloc>
499   - <draw>Y</draw>
500   - </GUI>
501   - </step>
502   -
503   - <step>
504   - <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
505   - <type>SelectValues</type>
506   - <description/>
507   - <distribute>Y</distribute>
508   - <custom_distribution/>
509   - <copies>1</copies>
510   - <partitioning>
511   - <method>none</method>
512   - <schema_name/>
513   - </partitioning>
514   - <fields> <field> <name>lp_name</name>
515   - <rename>&#x8def;&#x724c;</rename>
516   - <length>-2</length>
517   - <precision>-2</precision>
518   - </field> <select_unspecified>Y</select_unspecified>
519   - </fields> <cluster_schema/>
520   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
521   - <xloc>534</xloc>
522   - <yloc>243</yloc>
523   - <draw>Y</draw>
524   - </GUI>
525   - </step>
526   -
527   - <step>
528 550 <name>&#x8def;&#x724c;&#x540d;&#x5b57;&#x67e5;&#x627e;</name>
529 551 <type>DBLookup</type>
530 552 <description/>
... ... @@ -536,8 +558,8 @@
536 558 <schema_name/>
537 559 </partitioning>
538 560 <connection>bus_control_variable</connection>
539   - <cache>N</cache>
540   - <cache_load_all>N</cache_load_all>
  561 + <cache>Y</cache>
  562 + <cache_load_all>Y</cache_load_all>
541 563 <cache_size>0</cache_size>
542 564 <lookup>
543 565 <schema/>
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr
... ... @@ -89,6 +89,27 @@
89 89 <is_key_private>N</is_key_private>
90 90 </info>
91 91 <notepads>
  92 + <notepad>
  93 + <note>&#x8fd9;&#x91cc;&#x6709;&#x4e9b;&#x95ee;&#x9898;&#xa;&#x5728;window2012&#x7684;&#x73af;&#x5883;&#x4e0b;&#xff0c;&#xa;MySql&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x4e2d;&#x5982;&#x679c;&#x8fd4;&#x56de;&#x4e2d;&#x6587;&#x5185;&#x5bb9;&#x7684;&#x5b57;&#x6bb5;&#xff0c;&#x8fd9;&#x4e2a;&#x5185;&#x5bb9;&#x4e71;&#x7801;&#xa;&#x89e3;&#x51b3;&#x529e;&#x6cd5;&#xff0c;&#x5c31;&#x662f;&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x5168;&#x90e8;&#x7f13;&#x5b58;&#xff0c;&#x5c31;&#x4e0d;&#x4e71;&#x7801;&#xa;linux&#x73af;&#x5883;&#x4e0b;&#x6ca1;&#x95ee;&#x9898;</note>
  94 + <xloc>165</xloc>
  95 + <yloc>402</yloc>
  96 + <width>333</width>
  97 + <heigth>90</heigth>
  98 + <fontname>YaHei Consolas Hybrid</fontname>
  99 + <fontsize>12</fontsize>
  100 + <fontbold>N</fontbold>
  101 + <fontitalic>N</fontitalic>
  102 + <fontcolorred>0</fontcolorred>
  103 + <fontcolorgreen>0</fontcolorgreen>
  104 + <fontcolorblue>0</fontcolorblue>
  105 + <backgroundcolorred>255</backgroundcolorred>
  106 + <backgroundcolorgreen>205</backgroundcolorgreen>
  107 + <backgroundcolorblue>112</backgroundcolorblue>
  108 + <bordercolorred>100</bordercolorred>
  109 + <bordercolorgreen>100</bordercolorgreen>
  110 + <bordercolorblue>100</bordercolorblue>
  111 + <drawshadow>Y</drawshadow>
  112 + </notepad>
92 113 </notepads>
93 114 <connection>
94 115 <name>bus_control_variable</name>
... ... @@ -103,6 +124,7 @@
103 124 <data_tablespace/>
104 125 <index_tablespace/>
105 126 <attributes>
  127 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
106 128 <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
107 129 <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
108 130 <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
... ... @@ -322,8 +344,8 @@
322 344 </step>
323 345  
324 346 <step>
325   - <name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x5206;&#x7ec4;&#x6570;&#x636e;</name>
326   - <type>TableInput</type>
  347 + <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
  348 + <type>SelectValues</type>
327 349 <description/>
328 350 <distribute>Y</distribute>
329 351 <custom_distribution/>
... ... @@ -332,24 +354,30 @@
332 354 <method>none</method>
333 355 <schema_name/>
334 356 </partitioning>
335   - <connection>bus_control_variable</connection>
336   - <sql>select &#xa;fcno&#xa;, min&#x28;xl_dir&#x29; xl_dir&#xa;,min&#x28;qdz&#x29; qdz&#xa;,min&#x28;zdz&#x29; zdz&#xa;,bc_type &#xa;from bsth_c_s_ttinfo_detail&#xa;where ttinfo &#x3d; &#x24;&#x7b;ttinfoid&#x7d;&#xa;group by fcno,bc_type</sql>
337   - <limit>0</limit>
338   - <lookup/>
339   - <execute_each_row>N</execute_each_row>
340   - <variables_active>Y</variables_active>
341   - <lazy_conversion_active>N</lazy_conversion_active>
342   - <cluster_schema/>
  357 + <fields> <field> <name>fieldname</name>
  358 + <rename/>
  359 + <length>-2</length>
  360 + <precision>-2</precision>
  361 + </field> <field> <name>fieldtype</name>
  362 + <rename/>
  363 + <length>-2</length>
  364 + <precision>-2</precision>
  365 + </field> <field> <name>fcno</name>
  366 + <rename/>
  367 + <length>-2</length>
  368 + <precision>-2</precision>
  369 + </field> <select_unspecified>N</select_unspecified>
  370 + </fields> <cluster_schema/>
343 371 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
344   - <xloc>56</xloc>
345   - <yloc>185</yloc>
  372 + <xloc>533</xloc>
  373 + <yloc>325</yloc>
346 374 <draw>Y</draw>
347 375 </GUI>
348 376 </step>
349 377  
350 378 <step>
351   - <name>&#x8fc7;&#x6ee4;&#x8bb0;&#x5f55;</name>
352   - <type>FilterRows</type>
  379 + <name>&#x6392;&#x5e8f;&#x8bb0;&#x5f55;</name>
  380 + <type>SortRows</type>
353 381 <description/>
354 382 <distribute>Y</distribute>
355 383 <custom_distribution/>
... ... @@ -358,27 +386,32 @@
358 386 <method>none</method>
359 387 <schema_name/>
360 388 </partitioning>
361   -<send_true_to/>
362   -<send_false_to/>
363   - <compare>
364   -<condition>
365   - <negated>N</negated>
366   - <leftvalue>bc_type</leftvalue>
367   - <function>IS NOT NULL</function>
368   - <rightvalue/>
369   - </condition>
370   - </compare>
  389 + <directory>&#x25;&#x25;java.io.tmpdir&#x25;&#x25;</directory>
  390 + <prefix>out</prefix>
  391 + <sort_size>1000000</sort_size>
  392 + <free_memory/>
  393 + <compress>N</compress>
  394 + <compress_variable/>
  395 + <unique_rows>N</unique_rows>
  396 + <fields>
  397 + <field>
  398 + <name>fcno</name>
  399 + <ascending>Y</ascending>
  400 + <case_sensitive>N</case_sensitive>
  401 + <presorted>N</presorted>
  402 + </field>
  403 + </fields>
371 404 <cluster_schema/>
372 405 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
373   - <xloc>182</xloc>
374   - <yloc>189</yloc>
  406 + <xloc>642</xloc>
  407 + <yloc>325</yloc>
375 408 <draw>Y</draw>
376 409 </GUI>
377 410 </step>
378 411  
379 412 <step>
380   - <name>&#x8ba1;&#x7b97;&#x7ad9;&#x70b9;</name>
381   - <type>ScriptValueMod</type>
  413 + <name>&#x65f6;&#x523b;&#x8868;&#x660e;&#x7ec6;&#x5206;&#x7ec4;&#x6570;&#x636e;</name>
  414 + <type>TableInput</type>
382 415 <description/>
383 416 <distribute>Y</distribute>
384 417 <custom_distribution/>
... ... @@ -387,21 +420,17 @@
387 420 <method>none</method>
388 421 <schema_name/>
389 422 </partitioning>
390   - <compatible>N</compatible>
391   - <optimizationLevel>9</optimizationLevel>
392   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
393   - <jsScript_name>Script 1</jsScript_name>
394   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var zd&#x3b;&#xa;&#xa;if &#x28;bc_type &#x3d;&#x3d; &#x27;in&#x27;&#x29; &#x7b;&#xa; zd &#x3d; qdz&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;out&#x27;&#x29; &#x7b;&#xa; zd &#x3d; zdz&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;normal&#x27;&#x29; &#x7b;&#xa; zd &#x3d; qdz&#x3b;&#xa;&#x7d; else &#x7b;&#xa; zd &#x3d; qdz&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
395   - </jsScript> </jsScripts> <fields> <field> <name>zd</name>
396   - <rename>zd</rename>
397   - <type>String</type>
398   - <length>-1</length>
399   - <precision>-1</precision>
400   - <replace>N</replace>
401   - </field> </fields> <cluster_schema/>
  423 + <connection>bus_control_variable</connection>
  424 + <sql>select &#xa;fcno&#xa;, min&#x28;xl_dir&#x29; xl_dir&#xa;,min&#x28;qdz&#x29; qdz&#xa;,min&#x28;zdz&#x29; zdz&#xa;,bc_type &#xa;from bsth_c_s_ttinfo_detail&#xa;where ttinfo &#x3d; &#x24;&#x7b;ttinfoid&#x7d;&#xa;group by fcno,bc_type</sql>
  425 + <limit>0</limit>
  426 + <lookup/>
  427 + <execute_each_row>N</execute_each_row>
  428 + <variables_active>Y</variables_active>
  429 + <lazy_conversion_active>N</lazy_conversion_active>
  430 + <cluster_schema/>
402 431 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
403   - <xloc>300</xloc>
404   - <yloc>190</yloc>
  432 + <xloc>56</xloc>
  433 + <yloc>185</yloc>
405 434 <draw>Y</draw>
406 435 </GUI>
407 436 </step>
... ... @@ -418,8 +447,8 @@
418 447 <schema_name/>
419 448 </partitioning>
420 449 <connection>bus_control_variable</connection>
421   - <cache>N</cache>
422   - <cache_load_all>N</cache_load_all>
  450 + <cache>Y</cache>
  451 + <cache_load_all>Y</cache_load_all>
423 452 <cache_size>0</cache_size>
424 453 <lookup>
425 454 <schema/>
... ... @@ -455,8 +484,8 @@
455 484 </step>
456 485  
457 486 <step>
458   - <name>&#x8ba1;&#x7b97;&#x53cd;&#x8303;&#x5f0f;&#x5143;&#x6570;&#x636e;</name>
459   - <type>ScriptValueMod</type>
  487 + <name>&#x751f;&#x6210;&#x8def;&#x724c;&#x5b57;&#x6bb5;</name>
  488 + <type>RowGenerator</type>
460 489 <description/>
461 490 <distribute>Y</distribute>
462 491 <custom_distribution/>
... ... @@ -465,39 +494,53 @@
465 494 <method>none</method>
466 495 <schema_name/>
467 496 </partitioning>
468   - <compatible>N</compatible>
469   - <optimizationLevel>9</optimizationLevel>
470   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
471   - <jsScript_name>Script 1</jsScript_name>
472   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var targetfieldname&#x3b; &#x2f;&#x2f; &#x76ee;&#x6807;&#x5b57;&#x6bb5;&#x540d;&#xa;var targettype&#x3b; &#x2f;&#x2f; &#x76ee;&#x6807;&#x7c7b;&#x578b;&#xa;var valuefieldname&#x3b; &#x2f;&#x2f; &#x503c;&#x5b57;&#x6bb5;&#x540d;&#xa;var keyvalue&#x3b; &#x2f;&#x2f; &#x5173;&#x952e;&#x5b57;&#x503c;&#xa;&#xa;if &#x28;bc_type &#x3d;&#x3d; &#x27;in&#x27;&#x29; &#x7b;&#xa; targetfieldname &#x3d; &#x27;&#x8fdb;&#x573a;&#x27; &#x2b; fcno&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;out&#x27;&#x29; &#x7b;&#xa; targetfieldname &#x3d; &#x27;&#x51fa;&#x573a;&#x27; &#x2b; fcno&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;normal&#x27;&#x29; &#x7b;&#xa; targetfieldname &#x3d; zdname &#x2b; fcno&#x3b;&#xa;&#x7d; else &#x7b;&#xa; targetfieldname &#x3d; zdname &#x2b; fcno&#x3b;&#xa;&#x7d; &#xa;&#xa;targettype &#x3d; &#x27;String&#x27;&#x3b;&#xa;valuefieldname &#x3d; &#x27;fcsj&#x27;&#x3b;&#xa;keyvalue &#x3d; fcno&#x3b;&#xa;</jsScript_script>
473   - </jsScript> </jsScripts> <fields> <field> <name>targetfieldname</name>
474   - <rename>targetfieldname</rename>
475   - <type>String</type>
476   - <length>-1</length>
477   - <precision>-1</precision>
478   - <replace>N</replace>
479   - </field> <field> <name>targettype</name>
480   - <rename>targettype</rename>
  497 + <fields>
  498 + <field>
  499 + <name>fieldname</name>
481 500 <type>String</type>
  501 + <format/>
  502 + <currency/>
  503 + <decimal/>
  504 + <group/>
  505 + <nullif>&#x8def;&#x724c;</nullif>
482 506 <length>-1</length>
483 507 <precision>-1</precision>
484   - <replace>N</replace>
485   - </field> <field> <name>valuefieldname</name>
486   - <rename>valuefieldname</rename>
  508 + <set_empty_string>N</set_empty_string>
  509 + </field>
  510 + <field>
  511 + <name>fieldtype</name>
487 512 <type>String</type>
  513 + <format/>
  514 + <currency/>
  515 + <decimal/>
  516 + <group/>
  517 + <nullif>String</nullif>
488 518 <length>-1</length>
489 519 <precision>-1</precision>
490   - <replace>N</replace>
491   - </field> <field> <name>keyvalue</name>
492   - <rename>keyvalue</rename>
493   - <type>String</type>
  520 + <set_empty_string>N</set_empty_string>
  521 + </field>
  522 + <field>
  523 + <name>fcno</name>
  524 + <type>Integer</type>
  525 + <format/>
  526 + <currency/>
  527 + <decimal/>
  528 + <group/>
  529 + <nullif>0</nullif>
494 530 <length>-1</length>
495 531 <precision>-1</precision>
496   - <replace>N</replace>
497   - </field> </fields> <cluster_schema/>
  532 + <set_empty_string>N</set_empty_string>
  533 + </field>
  534 + </fields>
  535 + <limit>1</limit>
  536 + <never_ending>N</never_ending>
  537 + <interval_in_ms>5000</interval_in_ms>
  538 + <row_time_field>now</row_time_field>
  539 + <last_time_field>FiveSecondsAgo</last_time_field>
  540 + <cluster_schema/>
498 541 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
499   - <xloc>410</xloc>
500   - <yloc>64</yloc>
  542 + <xloc>530</xloc>
  543 + <yloc>194</yloc>
501 544 <draw>Y</draw>
502 545 </GUI>
503 546 </step>
... ... @@ -539,8 +582,8 @@
539 582 </step>
540 583  
541 584 <step>
542   - <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
543   - <type>SelectValues</type>
  585 + <name>&#x8ba1;&#x7b97;&#x53cd;&#x8303;&#x5f0f;&#x5143;&#x6570;&#x636e;</name>
  586 + <type>ScriptValueMod</type>
544 587 <description/>
545 588 <distribute>Y</distribute>
546 589 <custom_distribution/>
... ... @@ -549,30 +592,46 @@
549 592 <method>none</method>
550 593 <schema_name/>
551 594 </partitioning>
552   - <fields> <field> <name>fieldname</name>
553   - <rename/>
554   - <length>-2</length>
555   - <precision>-2</precision>
556   - </field> <field> <name>fieldtype</name>
557   - <rename/>
558   - <length>-2</length>
559   - <precision>-2</precision>
560   - </field> <field> <name>fcno</name>
561   - <rename/>
562   - <length>-2</length>
563   - <precision>-2</precision>
564   - </field> <select_unspecified>N</select_unspecified>
565   - </fields> <cluster_schema/>
  595 + <compatible>N</compatible>
  596 + <optimizationLevel>9</optimizationLevel>
  597 + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
  598 + <jsScript_name>Script 1</jsScript_name>
  599 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var targetfieldname&#x3b; &#x2f;&#x2f; &#x76ee;&#x6807;&#x5b57;&#x6bb5;&#x540d;&#xa;var targettype&#x3b; &#x2f;&#x2f; &#x76ee;&#x6807;&#x7c7b;&#x578b;&#xa;var valuefieldname&#x3b; &#x2f;&#x2f; &#x503c;&#x5b57;&#x6bb5;&#x540d;&#xa;var keyvalue&#x3b; &#x2f;&#x2f; &#x5173;&#x952e;&#x5b57;&#x503c;&#xa;&#xa;if &#x28;bc_type &#x3d;&#x3d; &#x27;in&#x27;&#x29; &#x7b;&#xa; targetfieldname &#x3d; &#x27;&#x8fdb;&#x573a;&#x27; &#x2b; fcno&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;out&#x27;&#x29; &#x7b;&#xa; targetfieldname &#x3d; &#x27;&#x51fa;&#x573a;&#x27; &#x2b; fcno&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;normal&#x27;&#x29; &#x7b;&#xa; targetfieldname &#x3d; zdname &#x2b; fcno&#x3b;&#xa;&#x7d; else &#x7b;&#xa; targetfieldname &#x3d; zdname &#x2b; fcno&#x3b;&#xa;&#x7d; &#xa;&#xa;targettype &#x3d; &#x27;String&#x27;&#x3b;&#xa;valuefieldname &#x3d; &#x27;fcsj&#x27;&#x3b;&#xa;keyvalue &#x3d; fcno&#x3b;&#xa;</jsScript_script>
  600 + </jsScript> </jsScripts> <fields> <field> <name>targetfieldname</name>
  601 + <rename>targetfieldname</rename>
  602 + <type>String</type>
  603 + <length>-1</length>
  604 + <precision>-1</precision>
  605 + <replace>N</replace>
  606 + </field> <field> <name>targettype</name>
  607 + <rename>targettype</rename>
  608 + <type>String</type>
  609 + <length>-1</length>
  610 + <precision>-1</precision>
  611 + <replace>N</replace>
  612 + </field> <field> <name>valuefieldname</name>
  613 + <rename>valuefieldname</rename>
  614 + <type>String</type>
  615 + <length>-1</length>
  616 + <precision>-1</precision>
  617 + <replace>N</replace>
  618 + </field> <field> <name>keyvalue</name>
  619 + <rename>keyvalue</rename>
  620 + <type>String</type>
  621 + <length>-1</length>
  622 + <precision>-1</precision>
  623 + <replace>N</replace>
  624 + </field> </fields> <cluster_schema/>
566 625 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
567   - <xloc>533</xloc>
568   - <yloc>325</yloc>
  626 + <xloc>410</xloc>
  627 + <yloc>64</yloc>
569 628 <draw>Y</draw>
570 629 </GUI>
571 630 </step>
572 631  
573 632 <step>
574   - <name>&#x751f;&#x6210;&#x8def;&#x724c;&#x5b57;&#x6bb5;</name>
575   - <type>RowGenerator</type>
  633 + <name>&#x8ba1;&#x7b97;&#x7ad9;&#x70b9;</name>
  634 + <type>ScriptValueMod</type>
576 635 <description/>
577 636 <distribute>Y</distribute>
578 637 <custom_distribution/>
... ... @@ -581,60 +640,28 @@
581 640 <method>none</method>
582 641 <schema_name/>
583 642 </partitioning>
584   - <fields>
585   - <field>
586   - <name>fieldname</name>
587   - <type>String</type>
588   - <format/>
589   - <currency/>
590   - <decimal/>
591   - <group/>
592   - <nullif>&#x8def;&#x724c;</nullif>
593   - <length>-1</length>
594   - <precision>-1</precision>
595   - <set_empty_string>N</set_empty_string>
596   - </field>
597   - <field>
598   - <name>fieldtype</name>
  643 + <compatible>N</compatible>
  644 + <optimizationLevel>9</optimizationLevel>
  645 + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
  646 + <jsScript_name>Script 1</jsScript_name>
  647 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var zd&#x3b;&#xa;&#xa;if &#x28;bc_type &#x3d;&#x3d; &#x27;in&#x27;&#x29; &#x7b;&#xa; zd &#x3d; qdz&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;out&#x27;&#x29; &#x7b;&#xa; zd &#x3d; zdz&#x3b;&#xa;&#x7d; else if &#x28;bc_type &#x3d;&#x3d; &#x27;normal&#x27;&#x29; &#x7b;&#xa; zd &#x3d; qdz&#x3b;&#xa;&#x7d; else &#x7b;&#xa; zd &#x3d; qdz&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
  648 + </jsScript> </jsScripts> <fields> <field> <name>zd</name>
  649 + <rename>zd</rename>
599 650 <type>String</type>
600   - <format/>
601   - <currency/>
602   - <decimal/>
603   - <group/>
604   - <nullif>String</nullif>
605   - <length>-1</length>
606   - <precision>-1</precision>
607   - <set_empty_string>N</set_empty_string>
608   - </field>
609   - <field>
610   - <name>fcno</name>
611   - <type>Integer</type>
612   - <format/>
613   - <currency/>
614   - <decimal/>
615   - <group/>
616   - <nullif>0</nullif>
617 651 <length>-1</length>
618 652 <precision>-1</precision>
619   - <set_empty_string>N</set_empty_string>
620   - </field>
621   - </fields>
622   - <limit>1</limit>
623   - <never_ending>N</never_ending>
624   - <interval_in_ms>5000</interval_in_ms>
625   - <row_time_field>now</row_time_field>
626   - <last_time_field>FiveSecondsAgo</last_time_field>
627   - <cluster_schema/>
  653 + <replace>N</replace>
  654 + </field> </fields> <cluster_schema/>
628 655 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
629   - <xloc>530</xloc>
630   - <yloc>194</yloc>
  656 + <xloc>300</xloc>
  657 + <yloc>190</yloc>
631 658 <draw>Y</draw>
632 659 </GUI>
633 660 </step>
634 661  
635 662 <step>
636   - <name>&#x6392;&#x5e8f;&#x8bb0;&#x5f55;</name>
637   - <type>SortRows</type>
  663 + <name>&#x8fc7;&#x6ee4;&#x8bb0;&#x5f55;</name>
  664 + <type>FilterRows</type>
638 665 <description/>
639 666 <distribute>Y</distribute>
640 667 <custom_distribution/>
... ... @@ -643,25 +670,20 @@
643 670 <method>none</method>
644 671 <schema_name/>
645 672 </partitioning>
646   - <directory>&#x25;&#x25;java.io.tmpdir&#x25;&#x25;</directory>
647   - <prefix>out</prefix>
648   - <sort_size>1000000</sort_size>
649   - <free_memory/>
650   - <compress>N</compress>
651   - <compress_variable/>
652   - <unique_rows>N</unique_rows>
653   - <fields>
654   - <field>
655   - <name>fcno</name>
656   - <ascending>Y</ascending>
657   - <case_sensitive>N</case_sensitive>
658   - <presorted>N</presorted>
659   - </field>
660   - </fields>
  673 +<send_true_to/>
  674 +<send_false_to/>
  675 + <compare>
  676 +<condition>
  677 + <negated>N</negated>
  678 + <leftvalue>bc_type</leftvalue>
  679 + <function>IS NOT NULL</function>
  680 + <rightvalue/>
  681 + </condition>
  682 + </compare>
661 683 <cluster_schema/>
662 684 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
663   - <xloc>642</xloc>
664   - <yloc>325</yloc>
  685 + <xloc>182</xloc>
  686 + <yloc>189</yloc>
665 687 <draw>Y</draw>
666 688 </GUI>
667 689 </step>
... ...
src/main/resources/datatools/ktrs/ttinfodetailoutputforedit.ktr
... ... @@ -89,6 +89,27 @@
89 89 <is_key_private>N</is_key_private>
90 90 </info>
91 91 <notepads>
  92 + <notepad>
  93 + <note>&#x8fd9;&#x91cc;&#x6709;&#x4e9b;&#x95ee;&#x9898;&#xa;&#x5728;window2012&#x7684;&#x73af;&#x5883;&#x4e0b;&#xff0c;&#xa;MySql&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x4e2d;&#x5982;&#x679c;&#x8fd4;&#x56de;&#x4e2d;&#x6587;&#x5185;&#x5bb9;&#x7684;&#x5b57;&#x6bb5;&#xff0c;&#x8fd9;&#x4e2a;&#x5185;&#x5bb9;&#x4e71;&#x7801;&#xa;&#x89e3;&#x51b3;&#x529e;&#x6cd5;&#xff0c;&#x5c31;&#x662f;&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x5168;&#x90e8;&#x7f13;&#x5b58;&#xff0c;&#x5c31;&#x4e0d;&#x4e71;&#x7801;&#xa;linux&#x73af;&#x5883;&#x4e0b;&#x6ca1;&#x95ee;&#x9898;</note>
  94 + <xloc>135</xloc>
  95 + <yloc>299</yloc>
  96 + <width>333</width>
  97 + <heigth>90</heigth>
  98 + <fontname>YaHei Consolas Hybrid</fontname>
  99 + <fontsize>12</fontsize>
  100 + <fontbold>N</fontbold>
  101 + <fontitalic>N</fontitalic>
  102 + <fontcolorred>0</fontcolorred>
  103 + <fontcolorgreen>0</fontcolorgreen>
  104 + <fontcolorblue>0</fontcolorblue>
  105 + <backgroundcolorred>255</backgroundcolorred>
  106 + <backgroundcolorgreen>205</backgroundcolorgreen>
  107 + <backgroundcolorblue>112</backgroundcolorblue>
  108 + <bordercolorred>100</bordercolorred>
  109 + <bordercolorgreen>100</bordercolorgreen>
  110 + <bordercolorblue>100</bordercolorblue>
  111 + <drawshadow>Y</drawshadow>
  112 + </notepad>
92 113 </notepads>
93 114 <connection>
94 115 <name>bus_control_variable</name>
... ... @@ -103,6 +124,7 @@
103 124 <data_tablespace/>
104 125 <index_tablespace/>
105 126 <attributes>
  127 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
106 128 <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
107 129 <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
108 130 <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
... ... @@ -4544,8 +4566,8 @@
4544 4566 <schema_name/>
4545 4567 </partitioning>
4546 4568 <connection>bus_control_variable</connection>
4547   - <cache>N</cache>
4548   - <cache_load_all>N</cache_load_all>
  4569 + <cache>Y</cache>
  4570 + <cache_load_all>Y</cache_load_all>
4549 4571 <cache_size>0</cache_size>
4550 4572 <lookup>
4551 4573 <schema/>
... ... @@ -4598,8 +4620,8 @@
4598 4620 <schema_name/>
4599 4621 </partitioning>
4600 4622 <connection>bus_control_variable</connection>
4601   - <cache>N</cache>
4602   - <cache_load_all>N</cache_load_all>
  4623 + <cache>Y</cache>
  4624 + <cache_load_all>Y</cache_load_all>
4603 4625 <cache_size>0</cache_size>
4604 4626 <lookup>
4605 4627 <schema/>
... ...
src/main/resources/ms-jdbc.properties
... ... @@ -3,12 +3,7 @@
3 3 #ms.mysql.username= root
4 4 #ms.mysql.password= 123456
5 5  
6   -#ms.mysql.driver= com.mysql.jdbc.Driver
7   -#ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8
8   -#ms.mysql.username= root
9   -#ms.mysql.password= root2jsp
10   -
11 6 ms.mysql.driver= com.mysql.jdbc.Driver
12   -ms.mysql.url= jdbc:mysql://192.168.168.117:3306/ms?useUnicode=true&characterEncoding=utf-8
  7 +ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8
13 8 ms.mysql.username= root
14   -ms.mysql.password= root
15 9 \ No newline at end of file
  10 +ms.mysql.password= root2jsp
16 11 \ No newline at end of file
... ...
src/main/resources/static/assets/bower_components/handsontable/.bower.json 0 → 100644
  1 +{
  2 + "name": "handsontable",
  3 + "description": "Spreadsheet-like data grid editor that provides copy/paste functionality compatible with Excel/Google Docs",
  4 + "version": "0.24.3",
  5 + "main": [
  6 + "./dist/handsontable.js",
  7 + "./dist/handsontable.css"
  8 + ],
  9 + "homepage": "http://handsontable.com/",
  10 + "repository": {
  11 + "type": "git",
  12 + "url": "https://github.com/handsontable/handsontable.git"
  13 + },
  14 + "authors": [
  15 + "Handsoncode",
  16 + "Handsoncode <hello@handsontable.com>"
  17 + ],
  18 + "keywords": [
  19 + "data",
  20 + "grid",
  21 + "table",
  22 + "editor",
  23 + "grid-editor",
  24 + "data-grid",
  25 + "data-table",
  26 + "spreadsheet",
  27 + "excel",
  28 + "tabular-data",
  29 + "edit-cell",
  30 + "editable-table",
  31 + "data-spreadsheet"
  32 + ],
  33 + "ignore": [
  34 + "**/.*",
  35 + "components",
  36 + "demo",
  37 + "node_modules",
  38 + "src",
  39 + "test"
  40 + ],
  41 + "dependencies": {
  42 + "zeroclipboard": "^2.2.0",
  43 + "moment": "^2.9.0",
  44 + "pikaday": "^1.3.2"
  45 + },
  46 + "devDependencies": {
  47 + "chroma-js": "~0.5.6"
  48 + },
  49 + "_release": "0.24.3",
  50 + "_resolution": {
  51 + "type": "version",
  52 + "tag": "0.24.3",
  53 + "commit": "eb19e2e0a364f0f535380238ddb10a2dd4fc150a"
  54 + },
  55 + "_source": "https://github.com/handsontable/handsontable.git",
  56 + "_target": "~0.24.0",
  57 + "_originalSource": "handsontable"
  58 +}
0 59 \ No newline at end of file
... ...
src/main/resources/static/assets/bower_components/handsontable/CHANGELOG.md 0 → 100644
  1 +All releases are described at https://github.com/handsontable/handsontable/releases
... ...
src/main/resources/static/assets/bower_components/handsontable/CNAME 0 → 100644
  1 +handsontable.com
... ...
src/main/resources/static/assets/bower_components/handsontable/CONTRIBUTING.md 0 → 100644
  1 +# Contributing to Handsontable
  2 +
  3 +Your contributions to the project are very welcome. If you would like to fix a bug or propose a new feature, you can submit a Pull Request.
  4 +
  5 +To help us merge your Pull Request, please make sure you follow these points:
  6 +
  7 +1. Please make your fix on a separate branch. This makes merging much easier.
  8 +2. Do not edit files in `dist/` directory (e.g: `handsontable.js`, `handsontable.css`, `handsontable.full.js`, `handsontable.full.css`). Instead, try to edit files inside the `src/` directory and then use `grunt` to make a build. More information about this on wiki page [Building](https://github.com/handsontable/handsontable/wiki/Building).
  9 +3. **Very important:** For any change that you make, **please try to also add a test case(s)** in `tests/jasmine/spec/` or `src/3rdparty/walkontable/test/jasmine/spec/`. This helps us understand the issue and make sure that it will stay fixed forever. See [Testing](https://github.com/handsontable/handsontable/wiki/Testing)
  10 +4. **Very important:** Please review our [coding style](https://github.com/handsontable/handsontable/wiki/Coding-style) for instructions on how to maintain a fork and submit patches.
  11 +5. Describe the problem in the Pull Request description (of course you would do it, why do I mention that?)
  12 +
  13 +Thank you for your commitment!
  14 +
  15 +## Team rules
  16 +
  17 +The Handsontable team utilizes Git-Flow. See [How we use Git-Flow](https://github.com/handsontable/handsontable/wiki/How-we-use-Git-Flow)
... ...
src/main/resources/static/assets/bower_components/handsontable/Gruntfile.js 0 → 100644
  1 +/**
  2 + * This file is used to build Handsontable from `src/*`
  3 + *
  4 + * Installation:
  5 + * 1. Install Grunt CLI (`npm install -g grunt-cli`)
  6 + * 1. Install Grunt 0.4.0 and other dependencies (`npm install`)
  7 + *
  8 + * Build:
  9 + * Execute `grunt` from root directory of this directory (where Gruntfile.js is)
  10 + * To execute automatically after each change, execute `grunt --force default watch`
  11 + * To execute build followed by the test run, execute `grunt test`
  12 + *
  13 + * Result:
  14 + * building Handsontable will create files:
  15 + * - dist/handsontable.js
  16 + * - dist/handsontable.css
  17 + * - dist/handsontable.full.js
  18 + * - dist/handsontable.full.css
  19 + * - dist/handsontable.full.min.js
  20 + * - dist/handsontable.full.min.css
  21 + *
  22 + * See http://gruntjs.com/getting-started for more information about Grunt
  23 + */
  24 +var browsers = [
  25 + {
  26 + browserName: 'firefox',
  27 + platform: 'Windows 7'
  28 + },
  29 + {
  30 + browserName: 'chrome',
  31 + platform: 'Windows 7'
  32 + },
  33 + {
  34 + browserName: 'opera',
  35 + platform: 'Windows 7'
  36 + },
  37 + //{
  38 + // browserName: 'internet explorer',
  39 + // version: '8',
  40 + // platform: 'Windows 7'
  41 + //},
  42 + //{
  43 + // browserName: 'internet explorer',
  44 + // version: '9',
  45 + // platform: 'Windows 7'
  46 + //},
  47 + {
  48 + browserName: 'internet explorer',
  49 + version: '10',
  50 + platform: 'Windows 8'
  51 + }
  52 +];
  53 +
  54 +module.exports = function(grunt) {
  55 +
  56 + require('time-grunt')(grunt);
  57 + require('load-grunt-tasks')(grunt);
  58 +
  59 + grunt.initConfig({
  60 + pkg: grunt.file.readJSON('package.json'),
  61 + gitinfo: {},
  62 +
  63 + meta: {
  64 + src: [
  65 + 'src/*.js',
  66 + 'src/editors/*.js',
  67 + 'src/plugins/**/!(*.spec).js',
  68 + 'src/renderers/*.js',
  69 + 'src/validators/*.js',
  70 + 'src/shims/*.js',
  71 + 'src/3rdparty/*.js'
  72 + ],
  73 + walkontable: [
  74 + 'src/3rdparty/walkontable/src/**/*.js'
  75 + ],
  76 + vendor: [
  77 + 'lib/numeral/numeral.js'
  78 + ]
  79 + },
  80 +
  81 + watch: {
  82 + options: {
  83 + livereload: true // works with Chrome LiveReload extension. See: https://github.com/gruntjs/grunt-contrib-watch
  84 + },
  85 + files: [
  86 + 'src/**/*(*.js|*.css|*.html)',
  87 + '!src/3rdparty/walkontable/test/**/*',
  88 + 'lib/**/*(*.js|*.css)'
  89 + ],
  90 + tasks: ['build-dev']
  91 + },
  92 +
  93 + jasmine: {
  94 + options: {
  95 + page: {
  96 + viewportSize: {
  97 + width: 1200,
  98 + height: 1000
  99 + }
  100 + },
  101 + },
  102 + handsontableStandalone: {
  103 + src: [
  104 + 'dist/handsontable.js',
  105 + 'demo/js/numeral.de-de.js',
  106 + 'demo/js/backbone/lodash.underscore.js',
  107 + 'demo/js/backbone/backbone.js',
  108 + 'demo/js/backbone/backbone-relational/backbone-relational.js',
  109 + 'demo/js/jquery-ui/js/jquery-ui.custom.js',
  110 + 'plugins/removeRow/handsontable.removeRow.js'
  111 + ],
  112 + options: {
  113 + specs: [
  114 + 'test/jasmine/spec/*Spec.js',
  115 + 'test/jasmine/spec/!(mobile)*/*Spec.js',
  116 + 'src/plugins/*/test/*.spec.js',
  117 + 'plugins/*/test/*.spec.js',
  118 + 'test/jasmine/spec/MemoryLeakTest.js'
  119 + ],
  120 + styles: [
  121 + 'test/jasmine/css/SpecRunner.css',
  122 + 'dist/handsontable.min.css',
  123 + 'plugins/removeRow/handsontable.removeRow.css',
  124 + 'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
  125 + 'demo/js/pikaday/css/pikaday.css'
  126 + ],
  127 + vendor: [
  128 + 'demo/js/jquery.min.js',
  129 + 'lib/numeral/numeral.js',
  130 + 'demo/js/moment/moment.js',
  131 + 'demo/js/pikaday/pikaday.js',
  132 + 'demo/js/ZeroClipboard.js',
  133 + 'test/jasmine/lib/jasmine-extensions.js'
  134 + ],
  135 + helpers: [
  136 + 'test/jasmine/spec/SpecHelper.js',
  137 + 'test/jasmine/lib/nodeShim.js',
  138 + 'test/jasmine/spec/test-init.js'
  139 + ],
  140 + outfile: 'test/jasmine/SpecRunner.html',
  141 + template: 'test/jasmine/templates/SpecRunner.tmpl',
  142 + keepRunner: true
  143 + }
  144 + },
  145 + handsontableFull: {
  146 + src: [
  147 + 'dist/handsontable.full.min.js',
  148 + 'demo/js/numeral.de-de.js',
  149 + 'demo/js/backbone/lodash.underscore.js',
  150 + 'demo/js/backbone/backbone.js',
  151 + 'demo/js/backbone/backbone-relational/backbone-relational.js',
  152 + 'demo/js/jquery-ui/js/jquery-ui.custom.js',
  153 + 'plugins/removeRow/handsontable.removeRow.js'
  154 + ],
  155 + options: {
  156 + specs: [
  157 + 'test/jasmine/spec/*Spec.js',
  158 + 'test/jasmine/spec/!(mobile)*/*Spec.js',
  159 + 'src/plugins/*/test/*.spec.js',
  160 + 'plugins/*/test/*.spec.js',
  161 + 'test/jasmine/spec/MemoryLeakTest.js'
  162 + ],
  163 + styles: [
  164 + 'test/jasmine/css/SpecRunner.css',
  165 + 'dist/handsontable.min.css',
  166 + 'plugins/removeRow/handsontable.removeRow.css',
  167 + 'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
  168 + 'demo/js/pikaday/css/pikaday.css'
  169 + ],
  170 + vendor: [
  171 + 'demo/js/jquery.min.js',
  172 + 'demo/js/moment/moment.js',
  173 + 'test/jasmine/lib/jasmine-extensions.js'
  174 + ],
  175 + helpers: [
  176 + 'test/jasmine/spec/SpecHelper.js',
  177 + 'test/jasmine/lib/nodeShim.js',
  178 + 'test/jasmine/spec/test-init.js'
  179 + ],
  180 + outfile: 'test/jasmine/SpecRunner.html',
  181 + template: 'test/jasmine/templates/SpecRunner.tmpl',
  182 + keepRunner: true
  183 + }
  184 + },
  185 + walkontable: {
  186 + src: [
  187 + 'dist/handsontable.min.js'
  188 + ],
  189 + options: {
  190 + specs: [
  191 + 'src/3rdparty/walkontable/test/jasmine/spec/**/*.spec.js'
  192 + ],
  193 + styles: [
  194 + 'src/3rdparty/walkontable/css/walkontable.css'
  195 + ],
  196 + vendor: [
  197 + 'demo/js/jquery.min.js',
  198 + 'lib/numeral/numeral.js',
  199 + 'demo/js/moment/moment.js',
  200 + 'demo/js/pikaday/pikaday.js',
  201 + 'demo/js/ZeroClipboard.js',
  202 + 'demo/js/numeral.de-de.js'
  203 + ],
  204 + helpers: [
  205 + 'src/3rdparty/walkontable/test/jasmine/SpecHelper.js',
  206 + 'test/jasmine/lib/nodeShim.js',
  207 + 'src/3rdparty/walkontable/test/jasmine/test-init.js'
  208 +
  209 + ],
  210 + outfile: 'src/3rdparty/walkontable/test/jasmine/SpecRunner.html',
  211 + template: 'test/jasmine/templates/SpecRunner.tmpl',
  212 + keepRunner: true
  213 + }
  214 + },
  215 + mobile: {
  216 + src: [
  217 + 'dist/handsontable.min.js',
  218 + 'demo/js/numeral.de-de.js',
  219 + 'demo/js/backbone/lodash.underscore.js',
  220 + 'demo/js/backbone/backbone.js',
  221 + 'demo/js/backbone/backbone-relational/backbone-relational.js',
  222 + 'demo/js/jquery-ui/js/jquery-ui.custom.js',
  223 + 'plugins/removeRow/handsontable.removeRow.js'
  224 + ],
  225 + options: {
  226 + specs: [
  227 + 'test/jasmine/spec/mobile/*Spec.js',
  228 + 'src/plugins/*/test/mobile/*.spec.js'
  229 + ],
  230 + styles: [
  231 + 'test/jasmine/css/SpecRunner.css',
  232 + 'dist/handsontable.min.css',
  233 + 'plugins/removeRow/handsontable.removeRow.css',
  234 + 'demo/js/jquery-ui/css/ui-bootstrap/jquery-ui.custom.css',
  235 + 'demo/js/pikaday/css/pikaday.css'
  236 + ],
  237 + vendor: [
  238 + 'demo/js/jquery.min.js',
  239 + 'lib/numeral/numeral.js',
  240 + 'demo/js/ZeroClipboard.js',
  241 + 'demo/js/moment/moment.js',
  242 + 'demo/js/pikaday/pikaday.js',
  243 + 'test/jasmine/lib/jasmine-extensions.js'
  244 + ],
  245 + helpers: [
  246 + 'test/jasmine/spec/SpecHelper.js',
  247 + 'test/jasmine/spec/MobileSpecHelper.js',
  248 + 'test/jasmine/lib/nodeShim.js',
  249 + 'test/jasmine/spec/test-init.js'
  250 + ],
  251 + outfile: 'test/jasmine/MobileSpecRunner.html',
  252 + template: 'test/jasmine/templates/SpecRunner.tmpl',
  253 + keepRunner: true
  254 + }
  255 + }
  256 + },
  257 +
  258 + connect: {
  259 + server: {
  260 + options: {
  261 + port: 8080,
  262 + base: '.',
  263 + keepalive: true
  264 + }
  265 + },
  266 + sauce: {
  267 + options: {
  268 + port: 9999,
  269 + base: '.',
  270 + keepalive: false
  271 + }
  272 + }
  273 + },
  274 + 'saucelabs-jasmine': {
  275 + handsontable: {
  276 + options: {
  277 + urls: ['http://localhost:9999/test/jasmine/SpecRunner.html'],
  278 + build: '<%= pkg.version %>-<%= gitinfo.local.branch.current.name %>',
  279 + concurrency: 3,
  280 + browsers: browsers,
  281 + testname: 'Development test (Handsontable)'
  282 + }
  283 + },
  284 + walkontable: {
  285 + options: {
  286 + urls: ['http://localhost:9999/src/3rdparty/walkontable/test/jasmine/SpecRunner.html'],
  287 + build: '<%= pkg.version %>-<%= gitinfo.local.branch.current.name %>',
  288 + concurrency: 3,
  289 + browsers: browsers,
  290 + testname: 'Development test (Walkontable)'
  291 + }
  292 + }
  293 + },
  294 +
  295 + jshint: {
  296 + options: {
  297 + jshintrc: true
  298 + },
  299 + handsontable: '<%= meta.src %>',
  300 + walkontable: '<%= meta.walkontable %>'
  301 + },
  302 +
  303 + jscs: {
  304 + handsontable: {
  305 + files: {
  306 + src: ['<%= meta.src %>', '!src/shims/classes.js']
  307 + }
  308 + },
  309 + walkontable: {
  310 + files: {
  311 + src: ['<%= meta.walkontable %>', '!src/shims/classes.js']
  312 + }
  313 + },
  314 + options: {
  315 + config: '.jscsrc',
  316 + esnext: true,
  317 + verbose: true
  318 + }
  319 + },
  320 +
  321 + hotBuilder: {
  322 + handsontable: {
  323 + files: {
  324 + dist: 'package.json'
  325 + }
  326 + },
  327 + handsontableDev: {
  328 + files: {
  329 + dist: 'package.json'
  330 + },
  331 + options: {
  332 + devMode: true
  333 + }
  334 + },
  335 + handsontableCustom: {
  336 + files: {
  337 + dist: 'package.json'
  338 + },
  339 + options: {
  340 + disableUI: false
  341 + }
  342 + },
  343 + options: {
  344 + minify: true
  345 + }
  346 + }
  347 + });
  348 +
  349 + // Default task.
  350 + grunt.registerTask('default', ['jscs', 'jshint', 'gitinfo', 'build']);
  351 + grunt.registerTask('build', ['hotBuilder:handsontable']);
  352 + grunt.registerTask('build-dev', ['hotBuilder:handsontableDev']);
  353 + grunt.registerTask('build-custom', ['hotBuilder:handsontableCustom']);
  354 + grunt.registerTask('test', ['default', 'jasmine:handsontableStandalone', 'jasmine:handsontableFull', 'jasmine:walkontable', 'jasmine:mobile:build']);
  355 + grunt.registerTask('test:handsontable', ['default', 'jasmine:handsontableStandalone']);
  356 + grunt.registerTask('test:handsontableStandalone', ['test:handsontable']);
  357 + grunt.registerTask('test:handsontableFull', ['default', 'jasmine:handsontableFull']);
  358 + grunt.registerTask('test:walkontable', ['default', 'jasmine:walkontable']);
  359 + grunt.registerTask('test:mobile', ['default', 'jasmine:mobile:build']);
  360 + grunt.registerTask('sauce', ['default', 'connect:sauce', 'saucelabs-jasmine:walkontable', 'saucelabs-jasmine:handsontable']);
  361 + grunt.registerTask('sauce:handsontable', ['default', 'connect:sauce', 'saucelabs-jasmine:handsontable']);
  362 + grunt.registerTask('sauce:walkontable', ['default', 'connect:sauce', 'saucelabs-jasmine:walkontable']);
  363 +
  364 + grunt.registerTask('test-handsontable-standalone', ['default', 'jasmine:handsontableStandalone']);
  365 + grunt.registerTask('test-handsontable-full', ['default', 'jasmine:handsontableFull']);
  366 + grunt.registerTask('test-handsontable', ['test-handsontable-standalone']);
  367 +
  368 + grunt.loadTasks('tasks');
  369 + grunt.loadNpmTasks('hot-builder');
  370 + grunt.loadNpmTasks('grunt-jscs');
  371 +};
... ...