Commit 27cda0bcdb0753ca53560d8e44fb59d8def69781

Authored by 潘钊
2 parents b853be73 966e73ff

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

update...

Too many changes to show.

To preserve performance only 16 of 40 files are displayed.

src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -48,5 +48,25 @@ public class ReportController {
48 48 @RequestParam String code) {
49 49 return service.historyMessageCount(line, date, code);
50 50 }
  51 +
  52 + @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET)
  53 + public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String date) {
  54 + return service.tbodyTime1(line, date);
  55 + }
  56 +
  57 + @RequestMapping(value = "/tbodyTime2", method = RequestMethod.GET)
  58 + public Map<String, Object> tbodyTime2(@RequestParam String line,@RequestParam String date) {
  59 + return service.tbodyTime2(line, date);
  60 + }
  61 +
  62 + @RequestMapping(value = "/tbodyTime3", method = RequestMethod.GET)
  63 + public List<Map<String, Object>> tbodyTime3(@RequestParam String line,@RequestParam String date) {
  64 + return service.tbodyTime3(line, date);
  65 + }
  66 +
  67 + @RequestMapping(value = "/tbodyTime5", method = RequestMethod.GET)
  68 + public List<Map<String, Object>> tbodyTime5(@RequestParam String line,@RequestParam String date) {
  69 + return service.tbodyTime5(line, date);
  70 + }
51 71  
52 72 }
... ...
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
... ... @@ -3,25 +3,24 @@ package com.bsth.controller.schedule;
3 3 import com.bsth.service.TrafficManageService;
4 4  
5 5 import org.springframework.beans.factory.annotation.Autowired;
6   -import org.springframework.web.bind.annotation.PathVariable;
7 6 import org.springframework.web.bind.annotation.RequestMapping;
8 7 import org.springframework.web.bind.annotation.RequestMethod;
9 8 import org.springframework.web.bind.annotation.RequestParam;
10 9 import org.springframework.web.bind.annotation.RestController;
11 10  
12 11 /**
13   - *
  12 + *
14 13 * @author BSTH
15 14 *
16 15 */
17 16 @RestController
18 17 @RequestMapping("trmg")
19 18 public class TrafficManageController {
20   -
  19 +
21 20 @Autowired
22   - private TrafficManageService trManageService;
23   -
24   -
  21 + private TrafficManageService trManageService;
  22 +
  23 +
25 24 @RequestMapping(value = "/setXL", method = RequestMethod.GET)
26 25 public String setXL() throws Exception {
27 26 try {
... ... @@ -30,7 +29,7 @@ public class TrafficManageController {
30 29 throw new Exception(exp.getCause());
31 30 }
32 31 }
33   -
  32 +
34 33 @RequestMapping(value = "/setCL", method = RequestMethod.GET)
35 34 public String setCL() throws Exception {
36 35 try {
... ... @@ -39,7 +38,7 @@ public class TrafficManageController {
39 38 throw new Exception(exp.getCause());
40 39 }
41 40 }
42   -
  41 +
43 42 @RequestMapping(value = "/setSJ", method = RequestMethod.GET)
44 43 public String setSJ() throws Exception {
45 44 try {
... ... @@ -48,16 +47,43 @@ public class TrafficManageController {
48 47 throw new Exception(exp.getCause());
49 48 }
50 49 }
51   -
52   - @RequestMapping(value = "/setCS", method = RequestMethod.GET)
53   - public String setCS() throws Exception {
  50 +
  51 + @RequestMapping(value = "/setLD", method = RequestMethod.GET)
  52 + public String setLD() throws Exception {
54 53 try {
55   - return trManageService.setCS();
  54 + return trManageService.setLD();
  55 + } catch (Exception exp) {
  56 + throw new Exception(exp.getCause());
  57 + }
  58 + }
  59 +
  60 + @RequestMapping(value = "/setLCYH", method = RequestMethod.GET)
  61 + public String setLCYH() throws Exception {
  62 + try {
  63 + return trManageService.setLCYH();
  64 + } catch (Exception exp) {
  65 + throw new Exception(exp.getCause());
  66 + }
  67 + }
  68 +
  69 + @RequestMapping(value = "/setDDRB", method = RequestMethod.GET)
  70 + public String setDDRB() throws Exception {
  71 + try {
  72 + return trManageService.setDDRB();
56 73 } catch (Exception exp) {
57 74 throw new Exception(exp.getCause());
58 75 }
59 76 }
60   -
  77 +
  78 + @RequestMapping(value = "/setJHBC", method = RequestMethod.GET)
  79 + public String setJHBC() throws Exception {
  80 + try {
  81 + return trManageService.setJHBC();
  82 + } catch (Exception exp) {
  83 + throw new Exception(exp.getCause());
  84 + }
  85 + }
  86 +
61 87 @RequestMapping(value = "/setSKB", method = RequestMethod.GET)
62 88 public String setSKB(@RequestParam("ids") String ids) throws Exception {
63 89 try {
... ... @@ -66,7 +92,7 @@ public class TrafficManageController {
66 92 throw new Exception(exp.getCause());
67 93 }
68 94 }
69   -
  95 +
70 96 @RequestMapping(value = "/setXLPC", method = RequestMethod.GET)
71 97 public String setXLPC() throws Exception {
72 98 try {
... ... @@ -75,13 +101,23 @@ public class TrafficManageController {
75 101 throw new Exception(exp.getCause());
76 102 }
77 103 }
78   -
79   - @RequestMapping(value = "/setJHBC", method = RequestMethod.GET)
80   - public String setJHBC() throws Exception {
  104 +
  105 + @RequestMapping(value = "/setCS", method = RequestMethod.GET)
  106 + public String setCS() throws Exception {
81 107 try {
82   - return trManageService.setDDRB();
  108 + return trManageService.setCS();
83 109 } catch (Exception exp) {
84 110 throw new Exception(exp.getCause());
85 111 }
86 112 }
  113 +
  114 + @RequestMapping(value = "/getDownLoadAllDataFile", method = RequestMethod.GET)
  115 + public String getDownLoadAllDataFile() throws Exception {
  116 + try {
  117 + return trManageService.getDownLoadAllDataFile();
  118 + } catch (Exception exp) {
  119 + throw new Exception(exp.getCause());
  120 + }
  121 + }
  122 +
87 123 }
... ...
src/main/java/com/bsth/data/BasicData.java
... ... @@ -70,7 +70,7 @@ public class BasicData implements CommandLineRunner {
70 70 public static Map<String, String> allPerson;
71 71  
72 72 //站点名和运管处编号 对照
73   - public static Map<String, Map<String, Map>> stationName2YgcNumber;
  73 + public static Map<String,Integer> stationName2YgcNumber;
74 74  
75 75  
76 76 static Logger logger = LoggerFactory.getLogger(BasicData.class);
... ... @@ -233,13 +233,6 @@ public class BasicData implements CommandLineRunner {
233 233 * @Description: TODO(加载线路相关信息)
234 234 */
235 235 public void loadLineInfo(){
236   - List<StationRoute> stationsList = null;// 站点路由集
237   - StationRoute stationRoute = null;
238   - int size = 0;
239   - Map<String, Integer> station2Number ;
240   - Map<String, Map> dirs2Statioin ;
241   - int[] dirs = {0,1};// 运行方向 上下行
242   - int num = 1;
243 236 Iterator<Line> iterator = lineRepository.findAll().iterator();
244 237  
245 238 Line line;
... ... @@ -247,7 +240,7 @@ public class BasicData implements CommandLineRunner {
247 240 Map<String, String> code2name = new HashMap<>();
248 241 Map<Integer, String> id2SHcode = new HashMap<Integer, String>();
249 242 Map<String, String> code2SHcode = new HashMap<String, String>();
250   - Map<String, Map<String, Map>> tempStationName2YgcNumber = new HashMap<String, Map<String, Map>>();
  243 + Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>();
251 244  
252 245 while(iterator.hasNext()){
253 246 line = iterator.next();
... ... @@ -259,27 +252,26 @@ public class BasicData implements CommandLineRunner {
259 252 /**
260 253 * 加载运管处的站点及序号
261 254 * 上行从1开始,下行顺序续编
262   -
263   - num = 1;
264   - dirs2Statioin = new HashMap<String, Map>();
265   - for (int i = 0; i < dirs.length; i++) {
266   - // 分别取得上下行的站点
267   - stationsList = stationRouteRepository.findByLine(line.getLineCode(), dirs[i]);
268   - size = stationsList == null ? 0 :stationsList.size();
269   - if(size > 0 ){
270   - station2Number = new HashMap<String, Integer>();
271   - for (int j = 0; j < size; j++) {
272   - stationRoute = stationsList.get(j);
273   - // map保存为(站点名称 -->序号)
274   - station2Number.put(stationRoute.getStationName(), num++);
  255 + */
  256 + List<Object[]> ygcLines = stationRouteRepository.findAllLineWithYgc();
  257 + if(ygcLines != null && ygcLines.size() > 0){
  258 + int size = ygcLines.size();
  259 + Object[] tempArray ;
  260 + int num = 1;
  261 + String key;
  262 + String lineCode = "";
  263 + for (int i = 0; i < size; i ++){
  264 + tempArray = ygcLines.get(i);
  265 + if(lineCode.equals("")){
  266 + lineCode = tempArray[0]+"";
  267 + }else if(!lineCode.equals(tempArray[0]+"")){
  268 + num = 1;
  269 + lineCode = tempArray[0]+"";
275 270 }
276   - // 保存两个数据,(0 --> station2Number)(1 --> station2Number) 0上行 1 下行
277   - dirs2Statioin.put(dirs[i]+"", station2Number);
  271 + key = tempArray[0] + "_"+tempArray[1] + "_"+tempArray[2];
  272 + tempStationName2YgcNumber.put(key,num++);
278 273 }
279 274 }
280   - // 保存(站点编码 --> dirs2Statioin)
281   - tempStationName2YgcNumber.put(line.getLineCode(), dirs2Statioin);
282   - */
283 275 }
284 276  
285 277 lineId2CodeMap = biMap;
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -257,4 +257,15 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
257 257 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
258 258 @Query("select s from StationRoute s where s.destroy=0 and s.lineCode=?1")
259 259 List<StationRoute> findByLineCode(String lineCode);
  260 +
  261 + @Query("SELECT " +
  262 + "lineCode,directions,stationName,stationRouteCode " +
  263 + "FROM " +
  264 + "StationRoute s " +
  265 + "WHERE " +
  266 + "s.destroy = 0 " +
  267 + "and s.lineCode in(select lineCode from Line where inUse = 1) " +
  268 + "ORDER BY " +
  269 + "lineCode,directions,stationRouteCode")
  270 + List<Object[]> findAllLineWithYgc();
260 271 }
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3   -import java.io.BufferedOutputStream;
4   -import java.io.File;
5   -import java.io.FileOutputStream;
6   -import java.io.IOException;
7   -import java.sql.Connection;
8   -import java.sql.PreparedStatement;
9   -import java.sql.ResultSet;
10   -import java.text.DecimalFormat;
11   -import java.text.SimpleDateFormat;
12   -import java.util.Date;
13   -import java.util.HashMap;
14   -import java.util.Iterator;
15   -import java.util.List;
16   -import java.util.Map;
17   -import java.util.Set;
18   -
19   -import org.apache.commons.lang.time.DateUtils;
20   -import org.slf4j.Logger;
21   -import org.slf4j.LoggerFactory;
22   -import org.springframework.beans.factory.annotation.Autowired;
23   -import org.springframework.data.domain.Sort;
24   -import org.springframework.data.domain.Sort.Direction;
25   -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
26   -import org.springframework.stereotype.Service;
27   -
28 3 import com.bsth.data.BasicData;
29   -import com.bsth.entity.Cars;
30   -import com.bsth.entity.Line;
31   -import com.bsth.entity.LineInformation;
32   -import com.bsth.entity.Personnel;
33   -import com.bsth.entity.StationRoute;
  4 +import com.bsth.entity.*;
34 5 import com.bsth.entity.realcontrol.ChildTaskPlan;
35 6 import com.bsth.entity.realcontrol.ScheduleRealInfo;
36 7 import com.bsth.entity.schedule.SchedulePlanInfo;
37 8 import com.bsth.entity.schedule.TTInfo;
38 9 import com.bsth.entity.schedule.TTInfoDetail;
39 10 import com.bsth.entity.search.CustomerSpecs;
40   -import com.bsth.repository.CarsRepository;
41   -import com.bsth.repository.LineInformationRepository;
42   -import com.bsth.repository.LineRepository;
43   -import com.bsth.repository.PersonnelRepository;
44   -import com.bsth.repository.StationRouteRepository;
45   -import com.bsth.repository.schedule.CarConfigInfoRepository;
46   -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
47   -import com.bsth.repository.schedule.SchedulePlanInfoRepository;
48   -import com.bsth.repository.schedule.TTInfoDetailRepository;
49   -import com.bsth.repository.schedule.TTInfoRepository;
  11 +import com.bsth.repository.*;
  12 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  13 +import com.bsth.repository.schedule.*;
50 14 import com.bsth.service.TrafficManageService;
51 15 import com.bsth.util.TimeUtils;
52 16 import com.bsth.util.db.DBUtils_MS;
... ... @@ -54,7 +18,25 @@ import com.bsth.webService.trafficManage.geotool.services.Internal;
54 18 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
55 19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
56 20 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
57   -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  21 +import org.apache.commons.lang.time.DateUtils;
  22 +import org.slf4j.Logger;
  23 +import org.slf4j.LoggerFactory;
  24 +import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.data.domain.Sort;
  26 +import org.springframework.data.domain.Sort.Direction;
  27 +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
  28 +import org.springframework.stereotype.Service;
  29 +
  30 +import java.io.BufferedOutputStream;
  31 +import java.io.File;
  32 +import java.io.FileOutputStream;
  33 +import java.io.IOException;
  34 +import java.sql.Connection;
  35 +import java.sql.PreparedStatement;
  36 +import java.sql.ResultSet;
  37 +import java.text.DecimalFormat;
  38 +import java.text.SimpleDateFormat;
  39 +import java.util.*;
58 40 /**
59 41 *
60 42 * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类)
... ... @@ -63,7 +45,7 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
63 45 *
64 46 * @Description: TODO(运管处接口service业务层)
65 47 *
66   - * @Author bsth@z
  48 + * @Author bsth@zq
67 49 *
68 50 * @Date 2016年10月28日 上午9:21:17
69 51 *
... ... @@ -158,8 +140,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
158 140 @Override
159 141 public String setXL() {
160 142 String result = "failure";
  143 + StringBuffer sBuffer = new StringBuffer();
161 144 try {
162   - StringBuffer sBuffer = new StringBuffer(); ;
163 145 Iterator<Line> lineIterator = lineRepository.findAll().iterator();
164 146 Line line = null;
165 147 List<StationRoute> stationsList = null;// 站点路由集
... ... @@ -168,7 +150,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
168 150 sBuffer.append("<XLs>");
169 151 while(lineIterator.hasNext()){
170 152 line = lineIterator.next();
171   - if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){
  153 + if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null
  154 + || line.getInUse() == 0){
172 155 continue;
173 156 }
174 157 sBuffer.append("<XL>");
... ... @@ -208,7 +191,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
208 191 sBuffer.append("</XLs>");
209 192 System.out.println(sBuffer.toString());
210 193 if(sBuffer.indexOf("<XL>") != -1){
211   - logger.info("setXL:"+sBuffer.toString());
212 194 String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString());
213 195 String portArray[] = portResult.split("\n");
214 196 if(portArray.length >= 4){
... ... @@ -224,8 +206,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
224 206 }
225 207 }
226 208 } catch (Exception e) {
  209 + logger.error("setXL:",e);
227 210 e.printStackTrace();
228 211 }finally{
  212 + logger.info("setXL:"+sBuffer.toString());
229 213 logger.info("setXL:"+result);
230 214 }
231 215 return result;
... ... @@ -237,8 +221,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
237 221 @Override
238 222 public String setCL() {
239 223 String result = "failure";
  224 + StringBuffer sBuffer =new StringBuffer();
240 225 try {
241   - StringBuffer sBuffer =new StringBuffer();
242 226 sBuffer.append("<CLs>");
243 227 Cars cars = null;
244 228 String company;
... ... @@ -258,13 +242,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
258 242 sBuffer.append("</CL>");
259 243 }
260 244 sBuffer.append("</CLs>");
261   - logger.info("setCL:"+sBuffer.toString());
262 245 if(ssop.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
263 246 result = "success";
264 247 }
265 248 } catch (Exception e) {
  249 + logger.error("setCL:",e);
266 250 e.printStackTrace();
267 251 }finally{
  252 + logger.info("setCL:"+sBuffer.toString());
268 253 logger.info("setCL:"+result);
269 254 }
270 255 return result;
... ... @@ -276,8 +261,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
276 261 @Override
277 262 public String setSJ() {
278 263 String result = "failure";
  264 + StringBuffer sBuffer =new StringBuffer();
279 265 try {
280   - StringBuffer sBuffer =new StringBuffer();
281 266 sBuffer.append("<SJs>");
282 267 Personnel personnel = null;
283 268 String company;
... ... @@ -295,13 +280,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
295 280 sBuffer.append("</SJ>");
296 281 }
297 282 sBuffer.append("</SJs>");
298   - logger.info("setSJ:"+sBuffer.toString());
299 283 if(ssop.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
300 284 result = "success";
301 285 };
302 286 } catch (Exception e) {
  287 + logger.error("setSJ:",e);
303 288 e.printStackTrace();
304 289 }finally{
  290 + logger.info("setSJ:"+sBuffer.toString());
305 291 logger.info("setSJ:"+result);
306 292 }
307 293 return result;
... ... @@ -309,15 +295,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
309 295  
310 296 /**
311 297 * 上传路单
312   - * @param date
313   - * @return xml格式的字符串
  298 + * @return 上传成功标识
314 299 */
315 300 public String setLD(){
316 301 String result = "failure";
317 302 // 取昨天 的日期
318 303 String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
  304 + StringBuffer sf = new StringBuffer();
319 305 try {
320   - StringBuffer sf = new StringBuffer();
321 306 sf.append("<DLDS>");
322 307 List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date);
323 308 List<ScheduleRealInfo> listGroup = scheduleRealInfoRepository.setLDGroup(date);
... ... @@ -368,20 +353,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{
368 353 sf.append("</LD>");
369 354 }
370 355 }
371   -
372 356 sf.append("</LDList>");
373 357 sf.append("</DLD>");
374 358 }
375 359 }
376   -
377 360 sf.append("</DLDS>");
378   - logger.info("setLD:"+sf.toString());
379 361 if(ssop.setLD(userNameOther, passwordOther, sf.toString()).isSuccess()){
380 362 result = "success";
381 363 }
382 364 } catch (Exception e) {
  365 + logger.error("setLD:",e);
383 366 e.printStackTrace();
384 367 }finally{
  368 + logger.info("setLD:"+sf.toString());
385 369 logger.info("setLD:"+result);
386 370 }
387 371 return result;
... ... @@ -389,15 +373,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
389 373  
390 374 /**
391 375 * 上传里程油耗
392   - * @param date
393   - * @return
  376 + * @return 上传成功标识
394 377 */
395 378 public String setLCYH(){
396 379 String result = "failure";
397 380 // 取昨天 的日期
398 381 String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
  382 + StringBuffer sf = new StringBuffer();
399 383 try {
400   - StringBuffer sf = new StringBuffer();
401 384 sf.append("<LCYHS>");
402 385 List<ScheduleRealInfo> listGroup = scheduleRealInfoRepository.setLCYHGroup(date);
403 386 List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date);
... ... @@ -451,13 +434,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
451 434 }
452 435 }
453 436 sf.append("</LCYHS>");
454   - logger.info("setLCYH:"+sf.toString());
455 437 if(ssop.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()){
456 438 result = "success";
457 439 }
458 440 } catch (Exception e) {
  441 + logger.error("setLCYH:",e);
459 442 e.printStackTrace();
460 443 }finally{
  444 + logger.info("setLCYH:"+sf.toString());
461 445 logger.info("setLCYH:"+result);
462 446 }
463 447 return result;
... ... @@ -471,8 +455,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
471 455 String result = "failure";
472 456 // 取昨天 的日期
473 457 String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
  458 + StringBuffer sf = new StringBuffer();
474 459 try {
475   - StringBuffer sf = new StringBuffer();
476 460 sf.append("<DDRBS>");
477 461 List<ScheduleRealInfo> listGroup = scheduleRealInfoRepository.setDDRBGroup(date);
478 462 List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date);
... ... @@ -554,13 +538,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
554 538 }
555 539 }
556 540 sf.append("</DDRBS>");
557   - logger.info("setDDRB:"+sf.toString());
558 541 if(ssop.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()){
559 542 result = "success";
560 543 }
561 544 } catch (Exception e) {
  545 + logger.error("setDDRB:",e);
562 546 e.printStackTrace();
563 547 }finally{
  548 + logger.info("setDDRB:"+sf.toString());
564 549 logger.info("setDDRB:"+result);
565 550 }
566 551 return result;
... ... @@ -572,8 +557,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
572 557 @Override
573 558 public String setJHBC() {
574 559 String result = "failure";
  560 + StringBuffer sBuffer =new StringBuffer();
575 561 try {
576   - StringBuffer sBuffer =new StringBuffer();
577 562 sBuffer.append("<JHBCs>");
578 563 // 声明变量
579 564 SchedulePlanInfo schedulePlanInfo = null;
... ... @@ -633,13 +618,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
633 618 }
634 619 }
635 620 sBuffer.append("</JHBCs>");
636   - logger.info("setJHBC:"+sBuffer.toString());
637 621 if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
638 622 result = "success";
639 623 }
640 624 } catch (Exception e) {
  625 + logger.error("setJHBC:",e);
641 626 e.printStackTrace();
642 627 }finally{
  628 + logger.info("setJHBC:"+sBuffer.toString());
643 629 logger.info("setJHBC:"+result);
644 630 }
645 631 return result;
... ... @@ -651,14 +637,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
651 637 @Override
652 638 public String setSKB(String ids) {
653 639 String result = "failure";
  640 + StringBuffer sBuffer = new StringBuffer();
654 641 try {
655 642 String[] idArray = ids.split(",");
656   - StringBuffer sBuffer = new StringBuffer();
  643 + StringBuffer sBufferA;
  644 + StringBuffer sBufferB;
657 645 TTInfo ttInfo;
658   - TTInfoDetail ttInfoDetail;
  646 + TTInfoDetail ttInfoDetail = null;
659 647 Iterator<TTInfoDetail> ttInfoDetailIterator;
660 648 HashMap<String,Object> param = new HashMap<String, Object>();
661   - String ttinfoJhlc = null;//计划总里程
662 649 String lineCode ;
663 650 sBuffer.append("<SKBs>");
664 651 for (int i = 0; i < idArray.length; i++) {
... ... @@ -668,57 +655,61 @@ public class TrafficManageServiceImpl implements TrafficManageService{
668 655 param.put("ttinfo.id_eq", ttInfo.getId());
669 656 ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param),
670 657 new Sort(Direction.ASC, "xlDir")).iterator();
671   - sBuffer.append("<SKB>");
672   - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId()))
673   - .append("</XLBM>");
674   - ttinfoJhlc = new String();
675   - sBuffer.append("<JHZLC>").append(ttinfoJhlc).append("</JHZLC>");
676   - sBuffer.append("<JHYYLC>").append(ttinfoJhlc).append("</JHYYLC>");
677   - sBuffer.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>");
678   - sBuffer.append("<JSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</JSRQ>");/////////
679   - sBuffer.append("<ZJZX>").append(changeRuleDay(ttInfo.getRule_days())).append("</ZJZX>");
680   - sBuffer.append("<TBYY>").append("").append("</TBYY>");
681   - sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
682   - int num = 1;
683   - // 加上<BCList>
684 658 if(ttInfoDetailIterator.hasNext()){
685   - sBuffer.append("<BCList>");
686   - }
687   - while (ttInfoDetailIterator.hasNext()) {
688   - ttInfoDetail = ttInfoDetailIterator.next();
689   - if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){
690   - continue;
  659 + sBuffer.append("<SKB>");
  660 + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId()))
  661 + .append("</XLBM>");
  662 + sBufferB = new StringBuffer();
  663 + sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>");
  664 + // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表
  665 + sBufferB.append("<JSRQ>").append("").append("</JSRQ>");
  666 + sBufferB.append("<ZJZX>").append(changeRuleDay(ttInfo.getRule_days())).append("</ZJZX>");
  667 + sBufferB.append("<TBYY>").append("").append("</TBYY>");
  668 + sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
  669 + sBufferB.append("<BCList>");
  670 + int num = 1;
  671 + while (ttInfoDetailIterator.hasNext()) {
  672 + ttInfoDetail = ttInfoDetailIterator.next();
  673 + if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){
  674 + continue;
  675 + }
  676 + if(num++ == 1){
  677 + sBufferA = new StringBuffer();
  678 + sBufferA.append("<JHZLC>").append(ttInfoDetail.getJhlc()).append("</JHZLC>");
  679 + sBufferA.append("<JHYYLC>").append(ttInfoDetail.getJhlc()).append("</JHYYLC>");
  680 + sBuffer.append(sBufferA).append(sBufferB);
  681 + }
  682 + lineCode = ttInfoDetail.getXl().getLineCode();
  683 + // 如果发车时间格式错误,忽略此条
  684 + if(changeTimeFormat(ttInfoDetail) == null){
  685 + continue;
  686 + }
  687 + sBuffer.append("<BC>");
  688 + sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
  689 + sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>");
  690 + sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>");
  691 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
  692 + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>");
  693 + sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
  694 + sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>");
  695 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
  696 + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</DDXH>");
  697 + sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
  698 + sBuffer.append("</BC>");
691 699 }
692   - ttinfoJhlc = ttInfoDetail.getJhlc()+"";// 设置计划总里程
693   - lineCode = ttInfoDetail.getXl().getLineCode();
694   - sBuffer.append("<BC>");
695   - sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
696   - sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>");
697   - sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>");
698   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
699   - lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>");
700   - sBuffer.append("<JHFCSJ>").append(ttInfoDetail.getFcsj()).append("</JHFCSJ>");
701   - sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>");
702   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(
703   - lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</ZDXH>");
704   - sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
705   - sBuffer.append("</BC>");
706   -
707   - num++;
708   - }
709   - if(sBuffer.indexOf("<BCList>") != -1){
710 700 sBuffer.append("</BCList>");
  701 + sBuffer.append("</SKB>");
711 702 }
712   - sBuffer.append("</SKB>");
713 703 }
714 704 sBuffer.append("</SKBs>");
715   - logger.info("setSKB:"+sBuffer.toString());
716 705 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
717 706 result = "success";
718 707 }
719 708 } catch (Exception e) {
  709 + logger.error("setSKB:", e);
720 710 e.printStackTrace();
721 711 }finally{
  712 + logger.info("setSKB:"+sBuffer.toString());
722 713 logger.info("setSKB:"+result);
723 714 }
724 715 return result;
... ... @@ -730,8 +721,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
730 721 @Override
731 722 public String setXLPC() {
732 723 String result = "failure";
  724 + StringBuffer sBuffer =new StringBuffer();
733 725 try {
734   - StringBuffer sBuffer =new StringBuffer();
735 726 sBuffer.append("<XLPCs>");
736 727 // 声明变量
737 728 Line line = null;
... ... @@ -773,13 +764,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
773 764 sBuffer.append("</XLPC>");
774 765 }
775 766 sBuffer.append("</XLPCs>");
776   - logger.info("setXLPC:"+sBuffer.toString());
777 767 if(ssop.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
778 768 result = "success";
779 769 }
780 770 } catch (Exception e) {
  771 + logger.error("setXLPC:",e);
781 772 e.printStackTrace();
782 773 }finally{
  774 + logger.info("setXLPC:"+sBuffer.toString());
783 775 logger.info("setXLPC:"+result);
784 776 }
785 777 return result;
... ... @@ -832,13 +824,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
832 824 sBuffer.append("</CS>");
833 825 }
834 826 sBuffer.append("</CSs>");
835   - logger.info("setCS:"+sBuffer.toString());
836 827 if(ssop.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
837 828 result = "success";
838 829 }
839 830 } catch (Exception e) {
  831 + logger.error("setCS:",e);
840 832 e.printStackTrace();
841 833 } finally {
  834 + logger.info("setCS:"+sBuffer.toString());
842 835 logger.info("setCS:"+result);
843 836 DBUtils_MS.close(rs, ps, conn);
844 837 }
... ... @@ -949,11 +942,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
949 942 min = fullTime % 60;
950 943 sumHour = Integer.valueOf(fcsjArray[0])+hour;
951 944 if(sumHour >= 24){
952   - result = sumHour - 24+":";
  945 + result = String.format("%02d",sumHour - 24);
953 946 }else{
954   - result = sumHour +":";
  947 + result = String.format("%02d",sumHour);;
955 948 }
956   - result +=String.format("%02d", min);
  949 + result +=":"+String.format("%02d", min);
957 950 }else{
958 951 result = fcsj;
959 952 }
... ... @@ -961,6 +954,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{
961 954 }
962 955  
963 956 /**
  957 + * 改变时间格式
  958 + * @param ttInfoDetail 时刻表详细
  959 + * @return xx:yy
  960 + */
  961 + private String changeTimeFormat(TTInfoDetail ttInfoDetail){
  962 + String result = "00:00";
  963 + String fcsj = ttInfoDetail.getFcsj();
  964 + if(fcsj.indexOf(":") != -1){
  965 + // 时和分隔开
  966 + String[] fcsjArray = fcsj.split(":");
  967 + result = String.format("%02d", Integer.valueOf(fcsjArray[0]))+":";
  968 + result +=String.format("%02d", Integer.valueOf(fcsjArray[1]));
  969 + }else{
  970 + result = null;
  971 + logger.info("setSKB:发车时间错误:ttInfoDetail.id="+ttInfoDetail.getId());
  972 + }
  973 + return result;
  974 + }
  975 +
  976 + /**
964 977 * 拼装线路计划班次表的XML
965 978 * @param sBuffer
966 979 * @param schedulePlanInfo
... ... @@ -993,7 +1006,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
993 1006 flag = 0;
994 1007 }
995 1008 result += flag;
996   - if(i !=ruleDayArray.length ){
  1009 + if(i !=ruleDayArray.length -1){
997 1010 result +=",";
998 1011 }
999 1012 }
... ... @@ -1017,15 +1030,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1017 1030 }
1018 1031 }
1019 1032 /**
1020   - * @param stations 站点路由集
  1033 + * @param stationsList 站点路由集
1021 1034 * @param sBuffer sBuffer
1022   - * @param StartId 站点序号起始ID
  1035 + * @param startId 站点序号起始ID
1023 1036 *
1024 1037 * @return 站点序号累加后的ID
1025 1038 */
1026 1039 private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){
1027 1040 int size = stationsList.size();
1028   - StationRoute srRoute = null;
  1041 + StationRoute srRoute;
1029 1042 String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站
1030 1043 for (int i = 0; i < size; i++) {
1031 1044 srRoute = stationsList.get(i);
... ... @@ -1062,9 +1075,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1062 1075 */
1063 1076 private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationName){
1064 1077 Integer number = 0;
1065   - Map<String, Map> dirs2Statioin = BasicData.stationName2YgcNumber.get(lineCode);
1066   - Map<String, Integer> station2Number = dirs2Statioin.get(direction);
1067   - number = station2Number.get(stationName);
  1078 + number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationName);
1068 1079 return number;
1069 1080 }
1070 1081 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -1145,7 +1145,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1145 1145 || scheduleRealInfo.getBcType().equals("venting")){
1146 1146 ksgl += tempJhlc;
1147 1147 }else{
1148   - yygl += tempJhlc;
  1148 + if(scheduleRealInfo.getStatus() != -1){
  1149 + yygl += tempJhlc;
  1150 + }
1149 1151 }
1150 1152 }else{
1151 1153 Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
... ... @@ -1154,7 +1156,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1154 1156 if(childTaskPlan.getMileageType().equals("empty")){
1155 1157 ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
1156 1158 }else{
1157   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1159 + if(childTaskPlan.isDestroy()){
  1160 + remMileage += tempJhlc;
  1161 + cjbc++;
  1162 + }else{
  1163 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1164 + }
1158 1165 }
1159 1166 }
1160 1167 }
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -18,4 +18,12 @@ public interface ReportService {
18 18 List<Map<String, String>> sreachZd(String line,int zdlx,String zd);
19 19  
20 20 List<Object[]> historyMessageCount(String line, String date, String code);
  21 +
  22 + Map<String, Object> tbodyTime1(String line ,String date);
  23 +
  24 + Map<String, Object> tbodyTime2(String line ,String date);
  25 +
  26 + List<Map<String, Object>> tbodyTime3(String line ,String date);
  27 + List<Map<String, Object>> tbodyTime5(String line ,String date);
  28 +
21 29 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -3,6 +3,7 @@ import java.sql.Connection;
3 3 import java.sql.PreparedStatement;
4 4 import java.sql.ResultSet;
5 5 import java.sql.SQLException;
  6 +import java.text.DecimalFormat;
6 7 import java.text.ParseException;
7 8 import java.text.SimpleDateFormat;
8 9 import java.util.ArrayList;
... ... @@ -16,12 +17,15 @@ import org.slf4j.Logger;
16 17 import org.slf4j.LoggerFactory;
17 18 import org.springframework.beans.factory.annotation.Autowired;
18 19 import org.springframework.jdbc.core.JdbcTemplate;
  20 +import org.springframework.jdbc.core.RowMapper;
19 21 import org.springframework.stereotype.Service;
20 22  
21 23 import com.bsth.data.BasicData;
22 24 import com.bsth.entity.StationRoute;
23 25 import com.bsth.entity.excep.ArrivalInfo;
  26 +import com.bsth.entity.oil.Ylb;
24 27 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  28 +import com.bsth.entity.schedule.SchedulePlanInfo;
25 29 import com.bsth.repository.StationRouteRepository;
26 30 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
27 31 import com.bsth.service.report.ReportService;
... ... @@ -252,5 +256,515 @@ public class ReportServiceImpl implements ReportService{
252 256 List<Object[]> list = scheduleRealInfoRepository.historyMessageCount(line, date, code);
253 257 return list;
254 258 }
  259 + @Override
  260 + public Map<String, Object> tbodyTime1(String line, String date) {
  261 + DecimalFormat df = new DecimalFormat("#0.00");
  262 + // TODO Auto-generated method stub
  263 + //查询配车
  264 + String sqlPc=" SELECT cl_zbh FROM bsth_c_s_sp_info "
  265 + +" where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' "
  266 + + " and xl_bm='"+line+"' and bc_type='normal' "
  267 + + " group by cl_zbh ";
  268 + Map<String, Object> map=new HashMap<String,Object>();
  269 + List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,
  270 + new RowMapper<Map<String, Object>>(){
  271 + @Override
  272 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  273 + Map<String, Object> m=new HashMap<String,Object>();
  274 + m.put("zbh", rs.getString("cl_zbh"));
  275 + return m;
  276 + }
  277 + });
  278 + //配车
  279 + int pcs=listPc.size();
  280 +
  281 +
  282 + String sqlPlan="select jhlc, bc_type ,fcsj from bsth_c_s_sp_info "
  283 + + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"'";
  284 +
  285 + //班次
  286 + int zgf_0 = 6*60+31,zgf_1 = 8*60+30,wgf_0 = 16*60+1,wgf_1 = 18*60;
  287 + int qcBc=0,qjBc=0,zqcBc=0,zqjBc=0,wqcBc=0,wqjBc=0;
  288 + double zlc = 0 , yylc = 0,kslc=0;
  289 + //查询班次
  290 + List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan,
  291 + new RowMapper<Map<String, Object>>(){
  292 + @Override
  293 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  294 + Map<String, Object> m2=new HashMap<String,Object>();
  295 + m2.put("jhlc", rs.getDouble("jhlc"));
  296 + m2.put("bcType", rs.getString("bc_type"));
  297 + m2.put("fcsj", rs.getString("fcsj"));
  298 + return m2;
  299 + }
  300 + });
  301 +
  302 + for (int i = 0; i < listPlan.size(); i++) {
  303 + Map<String, Object> m=listPlan.get(i);
  304 + double jhlc=Double.parseDouble(m.get("jhlc").toString());
  305 + String bcType=m.get("bcType").toString();
  306 + String fcsjs[]=m.get("fcsj").toString().split(":");
  307 +
  308 + zlc +=jhlc;
  309 + if(bcType.equals("normal")){
  310 + qcBc ++;
  311 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  312 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
  313 + zqcBc++;
  314 + }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
  315 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
  316 + wqcBc++;
  317 + }
  318 + yylc +=jhlc;
  319 + }else if(bcType.equals("region")){
  320 + qjBc++;
  321 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  322 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
  323 + zqjBc++;
  324 + }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
  325 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
  326 + wqjBc++;
  327 + }
  328 +
  329 + yylc+=jhlc;
  330 + }else{
  331 + kslc+=jhlc;
  332 + }
  333 + }
  334 +
  335 + map.put("pcs", pcs);
  336 + map.put("qcbc", qcBc);
  337 + map.put("qjbc", qjBc);
  338 + map.put("zqcbc", zqcBc);
  339 + map.put("zqjbc", zqjBc);
  340 + map.put("wqcbc", wqcBc);
  341 + map.put("wqjbc", wqjBc);
  342 + map.put("zlc", df.format( zlc));
  343 + map.put("yylc", df.format(yylc));
  344 + map.put("kslc",df.format( kslc));
  345 + //查询里程
  346 + return map;
  347 + }
  348 + @Override
  349 + public Map<String, Object> tbodyTime2(String line, String date) {
  350 + DecimalFormat df = new DecimalFormat("#0.00");
  351 + // TODO Auto-generated method stub
  352 + //查询配车
  353 + String sqlPc=" SELECT sum(bcsj) as yysj ,sum(jhlc) as yygl FROM bsth_c_s_sp_info "
  354 + +" where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' "
  355 + + " and xl_bm='"+line+"' and bc_type in ('normal' ,'region' )";
  356 + Map<String, Object> map=new HashMap<String,Object>();
  357 + List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
  358 + new RowMapper<Map<String, Object>>(){
  359 + @Override
  360 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  361 + Map<String, Object> m=new HashMap<String,Object>();
  362 + m.put("yysj", rs.getInt("yysj"));
  363 + m.put("yygl", rs.getString("yygl")==null?"0":rs.getString("yygl"));
  364 + return m;
  365 + }
  366 + });
  367 + int yysj=0 ;
  368 + double yycs=0 ,yygl=0;
  369 + if(list.size()>0){
  370 + Map<String, Object> m=list.get(0);
  371 + yysj=Integer.parseInt((m.get("yysj").toString()));
  372 + yygl=Double.parseDouble(m.get("yygl").toString());
  373 + }
  374 + if(yysj>0){
  375 + yycs =yygl/(yysj*1.0/60);
  376 + }
  377 + int hh=yysj/60;
  378 + int mm=yysj%60;
  379 +
  380 + map.put("yysj", hh+":"+mm);
  381 + map.put("yycs", df.format(yycs)+"公里/小时");
  382 +// map.put(key, value)
  383 + return map;
  384 + }
255 385  
  386 + public static void main(String[] args) {
  387 + System.out.println(609360/60);
  388 + System.out.println(609360%60);
  389 + }
  390 + @Override
  391 + public List<Map<String, Object>> tbodyTime3(String line, String date) {
  392 + // TODO Auto-generated method stub
  393 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  394 + String sqlZd=" select qdz_name, count(cl_zbh) as cls , 'zqc' as lx from bsth_c_s_sp_info where "
  395 + + " DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"' and bc_type='normal' "
  396 + + " and fcsj>'06:31' and fcsj<'08:00' group by qdz_name union "
  397 + + " select qdz_name, count(cl_zbh) as cls , 'wqc' as lx from bsth_c_s_sp_info "
  398 + + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"' "
  399 + + " and bc_type='normal' and fcsj>'16:01' and fcsj<'18:00' group by qdz_name union "
  400 + + " select qdz_name, count(cl_zbh) as cls , 'zqj' as lx from bsth_c_s_sp_info "
  401 + + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"' "
  402 + + " and bc_type='region' and fcsj>'06:31' and fcsj<'08:00' group by qdz_name union "
  403 + + " select qdz_name, count(cl_zbh) as cls , 'wqj' as lx from bsth_c_s_sp_info "
  404 + + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"' "
  405 + + " and bc_type='region' and fcsj>'16:01' and fcsj<'18:00'group by qdz_name";
  406 +
  407 + List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd,
  408 + new RowMapper<Map<String, Object>>(){
  409 + @Override
  410 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  411 + Map<String, Object> m=new HashMap<String,Object>();
  412 + m.put("zdm", rs.getString("qdz_name"));
  413 + m.put("cls", rs.getString("cls"));
  414 + m.put("lx", rs.getString("lx"));
  415 + return m;
  416 + }
  417 + });
  418 + int a=0;
  419 + int b=0;
  420 + int c=0;
  421 + int d=0;
  422 + for(int i=0;i<lists.size();i++){
  423 + boolean fage=true;
  424 + Map<String, Object> newMap= new HashMap<String, Object>();
  425 + list.add(newMap);
  426 + Map<String, Object> maps=lists.get(i);
  427 + if(maps.get("lx").equals("zqc")){
  428 + list.get(a).put("zqcZm", maps.get("zdm"));
  429 + list.get(a).put("zqcCls", maps.get("cls"));
  430 + a++;
  431 + fage=false;
  432 + }else if(maps.get("lx").equals("wqc")){
  433 + list.get(b).put("wqcZm", maps.get("zdm"));
  434 + list.get(b).put("wqcCls", maps.get("cls"));
  435 + b++;
  436 + fage=false;
  437 + }else if(maps.get("lx").equals("zqj")){
  438 + list.get(c).put("zqjZm", maps.get("zdm"));
  439 + list.get(c).put("zqjCls", maps.get("cls"));
  440 + c++;
  441 + fage=false;
  442 + }else if(maps.get("lx").equals("wqj")){
  443 + list.get(d).put("wqjZm", maps.get("zdm"));
  444 + list.get(d).put("wqjCls", maps.get("cls"));
  445 + d++;
  446 + fage=false;
  447 + }
  448 + if(fage){
  449 + break;
  450 + }
  451 + }
  452 + boolean status=true;
  453 + while (status) {
  454 + for (int i = 0; i < list.size(); i++) {
  455 + if(list.get(i).isEmpty()){
  456 + list.remove(i);
  457 + status=true;
  458 + }else{
  459 + status=false;
  460 + }
  461 + }
  462 +
  463 + }
  464 + return list;
  465 + }
  466 + @Override
  467 + public List<Map<String, Object>> tbodyTime5(String line, String date) {
  468 + // TODO Auto-generated method stub
  469 + String sql="select min(fcsj) as fcsj,'lx0' as lx from bsth_c_s_sp_info where "
  470 + + " DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"'"
  471 + + " and bc_type='out' and xl_dir=0 union "
  472 + + " select min(fcsj) as fcsj,'lx1' as lx from bsth_c_s_sp_info where "
  473 + + " DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"'"
  474 + + " and bc_type='out' and xl_dir=1";
  475 + List<Map<String, Object>> lists= jdbcTemplate.query(sql,
  476 + new RowMapper<Map<String, Object>>(){
  477 + @Override
  478 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  479 + Map<String, Object> m=new HashMap<String,Object>();
  480 + m.put("lx", rs.getString("lx"));
  481 + m.put("fcsj", rs.getString("fcsj"));
  482 + return m;
  483 + }
  484 + });
  485 +
  486 + String sqlList="select * from bsth_c_s_sp_info where "
  487 + + "DATE_FORMAT(schedule_date,'%Y-%m-%d') ='"+date+"' and xl_bm='"+line+"'"
  488 + + " and bc_type='normal' order by fcsj";
  489 + List<SchedulePlanInfo> list= jdbcTemplate.query(sqlList,
  490 + new RowMapper<SchedulePlanInfo>(){
  491 + @Override
  492 + public SchedulePlanInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  493 + SchedulePlanInfo m=new SchedulePlanInfo();
  494 + m.setBcsj(rs.getInt("bcsj"));
  495 + m.setXlDir(rs.getString("xl_dir"));
  496 + m.setFcsj(rs.getString("fcsj"));
  497 + return m;
  498 + }
  499 + });
  500 + //上下行最早发车时间 (用于与夜班线 跨零点的班次进行比较)
  501 + String lx0="";
  502 + String lx1="";
  503 + for (int x = 0; x < lists.size(); x++) {
  504 + if(lists.get(x).get("lx").equals("lx0")){
  505 + lx0=lists.get(x).get("fcsj").toString();
  506 + }else{
  507 + lx1=lists.get(x).get("fcsj").toString();
  508 + }
  509 + }
  510 +
  511 + String[] lx0sj = lx0.split(":");
  512 + int sxFc=Integer.parseInt(lx0sj[0])*60+Integer.parseInt(lx0sj[1]);
  513 + String[] lx1sj = lx1.split(":");
  514 + int xxFc=Integer.parseInt(lx1sj[0])*60+Integer.parseInt(lx1sj[1]);
  515 + //班次
  516 + int sj_0 = 6*60+31,sj_1 = 8*60+30,sj_2 = 16*60+1,sj_3 = 18*60;
  517 +
  518 + //顺序 出场--早高峰---中午---晚高峰---进场
  519 + //实驶时间时间(分),0为上行,1为下行
  520 + int ccsj0=0,ccsj1=0,zgf0=0,zgf1=0,zw0=0,zw1=0,wgf0=0,wgf1=0,jcsj0=0,jcsj1=0;
  521 +
  522 + //记录上一个发车时间(方便记录间距)
  523 + int cfc0=0,cfc1=0,zfc0=0,zfc1=0,zwfc0=0,zwfc1=0,wfc0=0,wfc1=0,jcfc0Z=0,jcfc1Z=0,jcfc0W=0,jcfc1W=0;
  524 + //车距 (发车时间的间距) i--MIN a--MAX
  525 + int iC=999,aC=-1,iZg=999,aZg=-1,iZw=999,aZw=-1,iWg=999,aWg=-1,iJcZ=999,aJcZ=-1,iJcW=999,aJcW=-1;
  526 + int iC1=999,aC1=-1,iZg1=999,aZg1=-1,iZw1=999,aZw1=-1,iWg1=999,aWg1=-1,iJc1Z=999,aJc1Z=-1,iJc1W=999,aJc1W=-1;
  527 +// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  528 + for(int i=0;i<list.size();i++){
  529 + SchedulePlanInfo t=list.get(i);
  530 + String xlDir=t.getXlDir();
  531 + int bcsj=t.getBcsj();
  532 + String fcsj=t.getFcsj();
  533 + String[] fcsjs=fcsj.split(":");
  534 + int fcsjNum=Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1]);
  535 +
  536 + if(xlDir.equals("0")){
  537 + if(fcsjNum>=sxFc && fcsjNum<sj_0){
  538 + ccsj0 +=bcsj;
  539 + if(aC<0){
  540 + cfc0 =fcsjNum;
  541 + aC=0;
  542 + }else{
  543 + if(fcsjNum-cfc0<iC){
  544 + iC=fcsjNum-cfc0;
  545 + }
  546 + if(fcsjNum-cfc0>aC){
  547 + aC=fcsjNum-cfc0;
  548 + }
  549 +
  550 + cfc0=fcsjNum;
  551 + }
  552 +
  553 + }else if(fcsjNum>=sj_0 && fcsjNum<=sj_1){
  554 + zgf0 +=bcsj;
  555 + if(aZg<0){
  556 + zfc0 =fcsjNum;
  557 + aZg=0;
  558 + }else{
  559 + if(fcsjNum-zfc0<iZg){
  560 + iZg=fcsjNum-zfc0;
  561 + }
  562 +
  563 + if(fcsjNum-zfc0>aZg){
  564 + aZg=fcsjNum-zfc0;
  565 + }
  566 +
  567 + zfc0=fcsjNum;
  568 + }
  569 + }else if(fcsjNum>sj_1 && fcsjNum<sj_2){
  570 + zw0 +=bcsj;
  571 + if(aZw<0){
  572 + zwfc0 =fcsjNum;
  573 + aZw=0;
  574 + }else{
  575 + if(fcsjNum-zwfc0<iZw){
  576 + iZw=fcsjNum-zwfc0;
  577 + }
  578 + if(fcsjNum-zwfc0>aZw){
  579 + aZw=fcsjNum-zwfc0;
  580 + }
  581 + zwfc0=fcsjNum;
  582 + }
  583 +
  584 + }else if(fcsjNum>=sj_2 && fcsjNum<=sj_3){
  585 + wgf0 +=bcsj;
  586 + if(aWg<0){
  587 + wfc0=fcsjNum;
  588 + aWg=0;
  589 + }else{
  590 + if(fcsjNum-wfc0<iWg){
  591 + iWg=fcsjNum-wfc0;
  592 + }
  593 + if(fcsjNum-wfc0>aWg){
  594 + aWg=fcsjNum-wfc0;
  595 + }
  596 + wfc0=fcsjNum;
  597 + }
  598 + }else if(fcsjNum>sj_3){
  599 + jcsj0 +=bcsj;
  600 + if(aJcW<0){
  601 + jcfc0W=fcsjNum;
  602 + aJcW=0;
  603 + }else{
  604 + if(fcsjNum-jcfc0W<iJcW){
  605 + iJcW=fcsjNum-jcfc0W;
  606 + }
  607 + if(fcsjNum-jcfc0W>aJcW){
  608 + aJcW=fcsjNum-jcfc0W;
  609 + }
  610 + jcfc0W=fcsjNum;
  611 + }
  612 + }else if(fcsjNum<sxFc){
  613 + jcsj0 +=bcsj;
  614 + if(aJcZ<0){
  615 + jcfc0Z=fcsjNum;
  616 + aJcZ=0;
  617 + }else{
  618 + if(fcsjNum-jcfc0Z<iJcZ){
  619 + iJcZ=fcsjNum-jcfc0Z;
  620 + }
  621 + if(fcsjNum-jcfc0Z>aJcZ){
  622 + aJcZ=fcsjNum-jcfc0Z;
  623 + }
  624 + jcfc0Z=fcsjNum;
  625 + }
  626 + }
  627 +
  628 +
  629 + }else{
  630 + if(fcsjNum>=xxFc && fcsjNum<sj_0){
  631 + ccsj1 +=bcsj;
  632 + if(aC1<0){
  633 + cfc1=fcsjNum;
  634 + aC1=0;
  635 + }else{
  636 + if(fcsjNum-cfc1<iC1){
  637 + iC1=fcsjNum-cfc1;
  638 + }
  639 + if(fcsjNum-cfc1>aC1){
  640 + aC1=fcsjNum-cfc1;
  641 + }
  642 + cfc1=fcsjNum;
  643 + }
  644 + }else if(fcsjNum>=sj_0 && fcsjNum<=sj_1){
  645 + zgf1 +=bcsj;
  646 + if(aZg1<0){
  647 + zfc1=fcsjNum;
  648 + aZg1=0;
  649 + }else{
  650 + if(fcsjNum-zfc1<iZg1){
  651 + iZg1=fcsjNum-zfc1;
  652 + }
  653 + if(fcsjNum-zfc1>aZg1){
  654 + aZg1=fcsjNum-zfc1;
  655 + }
  656 +
  657 + zfc1=fcsjNum;
  658 + }
  659 + }else if(fcsjNum>sj_1 && fcsjNum<sj_2){
  660 + zw1 +=bcsj;
  661 + if(aZw1<0){
  662 + zwfc1=fcsjNum;
  663 + aZw1=0;
  664 + }else{
  665 + if(fcsjNum-zwfc1<iZw1){
  666 + iZw1=fcsjNum-zwfc1;
  667 + }
  668 + if(fcsjNum-zwfc1>aZw1){
  669 + aZw1=fcsjNum-zwfc1;
  670 + }
  671 + zwfc1=fcsjNum;
  672 + }
  673 + }else if(fcsjNum>=sj_2 && fcsjNum<=sj_3){
  674 + wgf1 +=bcsj;
  675 + if(aWg1<0){
  676 + wfc1=fcsjNum;
  677 + aWg1=0;
  678 + }else{
  679 + if(fcsjNum-wfc1<iWg1){
  680 + iWg1=fcsjNum-wfc1;
  681 + }
  682 + if(fcsjNum-wfc1<aWg1){
  683 + aWg1=fcsjNum-wfc1;
  684 + }
  685 + wfc1=fcsjNum;
  686 + }
  687 + }else if(fcsjNum>sj_3){
  688 + jcsj1 +=bcsj;
  689 + if(aJc1W<0){
  690 + jcfc1W=fcsjNum;
  691 + aJc1W=0;
  692 + }else{
  693 + if(fcsjNum-jcfc1W<iJc1W){
  694 + aJc1W=fcsjNum-jcfc1W;
  695 + }
  696 + if(fcsjNum-jcfc1W>aJc1W){
  697 + aJc1W=fcsjNum-jcfc1W;
  698 + }
  699 +
  700 + jcfc1W=fcsjNum;
  701 + }
  702 + }else if(fcsjNum<xxFc){
  703 + jcsj1 +=bcsj;
  704 + if(aJc1Z<0){
  705 + jcfc1Z=fcsjNum;
  706 + aJc1Z=0;
  707 + }else{
  708 + if(fcsjNum-jcfc1Z<iJc1Z){
  709 + aJc1Z=fcsjNum-jcfc1Z;
  710 + }
  711 + if(fcsjNum-jcfc1Z>aJc1Z){
  712 + aJc1Z=fcsjNum-jcfc1Z;
  713 + }
  714 +
  715 + jcfc1Z=fcsjNum;
  716 + }
  717 + }
  718 + }
  719 +
  720 + }
  721 +
  722 +
  723 + List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
  724 + Map<String, Object> newmap1=new HashMap<String,Object>();
  725 + Map<String, Object> newmap2=new HashMap<String,Object>();
  726 + Map<String, Object> newmap3=new HashMap<String,Object>();
  727 + Map<String, Object> newmap4=new HashMap<String,Object>();
  728 + Map<String, Object> newmap5=new HashMap<String,Object>();
  729 + newmap1.put("sjd", "(首)——6:30");
  730 + newmap1.put("sxsj", ccsj0);
  731 + newmap1.put("xxsj", ccsj1);
  732 + newmap1.put("fqsj", ccsj0+ccsj1);
  733 + newmap1.put("cj", (iC-iC1>0?iC1:iC)+"——"+(aC-aC1>0?aC:aC1));
  734 +
  735 + newmap2.put("sjd", "6:31——8:30");
  736 + newmap2.put("sxsj", zgf0);
  737 + newmap2.put("xxsj", zgf1);
  738 + newmap2.put("fqsj", zgf1+zgf0);
  739 + newmap2.put("cj", (iZg-iZg1>0?iZg1:iZg)+"——"+(aZg-aZg1>0?aZg:aZg1));
  740 +
  741 + newmap3.put("sjd", "8:30——16:00");
  742 + newmap3.put("sxsj", zw0);
  743 + newmap3.put("xxsj", zw1);
  744 + newmap3.put("fqsj", zw0+zw1);
  745 + newmap3.put("cj", (iZw-iZw1>0?iZw1:iZw)+"——"+(aZw-aZw1>0?aZw:aZw1));
  746 +
  747 + newmap4.put("sjd", "16:01——18:00");
  748 + newmap4.put("sxsj", wgf0);
  749 + newmap4.put("xxsj", wgf1);
  750 + newmap4.put("fqsj", wgf0+wgf1);
  751 + newmap4.put("cj", (iWg-iWg1>0?iWg1:iWg)+"——"+(aWg-aWg1>0?aWg:aWg1));
  752 +
  753 + newmap5.put("sjd", "18:00——(末)");
  754 + newmap5.put("sxsj", jcsj0);
  755 + newmap5.put("xxsj", jcsj1);
  756 + newmap5.put("fqsj", jcsj0+jcsj1);
  757 + int min0=iJcZ-iJcW>0?iJcW:iJcZ;
  758 + int max0=aJcZ-aJcW>0?aJcZ:aJcW;
  759 + int min1=iJc1Z-iJc1W>0?iJc1W:iJc1Z;
  760 + int max1=aJc1Z-aJc1W>0?aJc1Z:aJc1W;
  761 + newmap5.put("cj", (min0-min1>0?min1:min0)+"——"+(max0-max1>0?max0:max1));
  762 +
  763 + newList.add(newmap1);
  764 + newList.add(newmap2);
  765 + newList.add(newmap3);
  766 + newList.add(newmap4);
  767 + newList.add(newmap5);
  768 + return newList;
  769 + }
256 770 }
... ...
src/main/resources/static/pages/forms/statement/changetochange.html
... ... @@ -28,7 +28,7 @@
28 28  
29 29 <div class="page-head">
30 30 <div class="page-title">
31   - <h1>换人换车情况统计表</h1>
  31 + <h1>鎹汉鎹㈣溅鎯呭喌缁熻琛</h1>
32 32 </div>
33 33 </div>
34 34  
... ... @@ -38,28 +38,28 @@
38 38 <div class="portlet-title">
39 39 <form class="form-inline" action="" method="post">
40 40 <div style="display: inline-block;">
41   - <span class="item-label" style="width: 80px;">线路: </span>
  41 + <span class="item-label" style="width: 80px;">绾胯矾: </span>
42 42 <select class="form-control" name="line" id="line" style="width: 120px;"></select>
43 43 </div>
44 44 <div style="display: inline-block;margin-left: 15px;">
45   - <span class="item-label" style="width: 80px;">开始时间: </span>
  45 + <span class="item-label" style="width: 80px;">寮濮嬫椂闂: </span>
46 46 <input class="form-control" type="text" id="startDate" style="width: 120px;"/>
47 47 </div>
48 48 <div style="display: inline-block;margin-left: 15px;">
49   - <span class="item-label" style="width: 80px;">结束时间: </span>
  49 + <span class="item-label" style="width: 80px;">缁撴潫鏃堕棿: </span>
50 50 <input class="form-control" type="text" id="endDate" style="width: 120px;"/>
51 51 </div>
52 52 <div style="display: inline-block;">
53   - <span class="item-label" style="width: 120px;">类型: </span>
  53 + <span class="item-label" style="width: 120px;">绫诲瀷: </span>
54 54 <select class="form-control" id="sel">
55   - <option value="">请选择</option>
56   - <option value="1">换人</option>
57   - <option value="2">换车</option>
  55 + <option value="">璇烽夋嫨</option>
  56 + <option value="1">鎹汉</option>
  57 + <option value="2">鎹㈣溅</option>
58 58 </select>
59 59 </div>
60 60 <div class="form-group">
61   - <input class="btn btn-default" type="button" id="query" value="筛选"/>
62   - <input class="btn btn-default" type="button" id="export" value="导出"/>
  61 + <input class="btn btn-default" type="button" id="query" value="绛涢"/>
  62 + <input class="btn btn-default" type="button" id="export" value="瀵煎嚭"/>
63 63 </div>
64 64 </form>
65 65 </div>
... ... @@ -68,35 +68,35 @@
68 68 <table class="table table-bordered table-hover table-checkable" id="forms">
69 69 <thead>
70 70 <tr>
71   - <th colspan="15">换人换车情况统计表</th>
  71 + <th colspan="15">鎹汉鎹㈣溅鎯呭喌缁熻琛</th>
72 72 </tr>
73 73 <tr>
74   - <td rowspan="3" style=" padding-top: 50px;">日期</td>
75   - <td rowspan="3" style=" padding-top: 50px;">公司</td>
76   - <td rowspan="3" style=" padding-top: 50px;">分公司</td>
77   - <td rowspan="3" style=" padding-top: 50px;">线路</td>
78   - <td rowspan="3" style=" padding-top: 50px;">路牌</td>
79   - <td rowspan="3" style=" padding-top: 50px;">发生时间</td>
80   - <td rowspan="3" style=" padding-top: 50px;">修改时间</td>
81   - <td colspan="2">配车</td>
82   - <td colspan="4">人员</td>
83   - <td rowspan="3" style=" padding-top: 50px;">原因</td>
84   - <td rowspan="3" style=" padding-top: 50px;">修改人</td>
  74 + <td rowspan="3" style=" padding-top: 50px;">鏃ユ湡</td>
  75 + <td rowspan="3" style=" padding-top: 50px;">鍏徃</td>
  76 + <td rowspan="3" style=" padding-top: 50px;">鍒嗗叕鍙</td>
  77 + <td rowspan="3" style=" padding-top: 50px;">绾胯矾</td>
  78 + <td rowspan="3" style=" padding-top: 50px;">璺墝</td>
  79 + <td rowspan="3" style=" padding-top: 50px;">鍙戠敓鏃堕棿</td>
  80 + <td rowspan="3" style=" padding-top: 50px;">淇敼鏃堕棿</td>
  81 + <td colspan="2">閰嶈溅</td>
  82 + <td colspan="4">浜哄憳</td>
  83 + <td rowspan="3" style=" padding-top: 50px;">鍘熷洜</td>
  84 + <td rowspan="3" style=" padding-top: 50px;">淇敼浜</td>
85 85 </tr>
86 86 <tr>
87   - <td>计划</td>
88   - <td>实际</td>
89   - <td colspan="2">计划</td>
90   - <td colspan="2">实际</td>
  87 + <td>璁″垝</td>
  88 + <td>瀹為檯</td>
  89 + <td colspan="2">璁″垝</td>
  90 + <td colspan="2">瀹為檯</td>
91 91  
92 92 </tr>
93 93 <tr>
94   - <td>车号</td>
95   - <td>车号</td>
96   - <td>工号</td>
97   - <td>人员</td>
98   - <td>工号</td>
99   - <td>人员</td>
  94 + <td>杞﹀彿</td>
  95 + <td>杞﹀彿</td>
  96 + <td>宸ュ彿</td>
  97 + <td>浜哄憳</td>
  98 + <td>宸ュ彿</td>
  99 + <td>浜哄憳</td>
100 100 </tr>
101 101 </thead>
102 102 <tbody>
... ... @@ -111,7 +111,7 @@
111 111  
112 112 <script>
113 113 $(function(){
114   - // 关闭左侧栏
  114 + // 鍏抽棴宸︿晶鏍
115 115 if (!$('body').hasClass('page-sidebar-closed'))
116 116 $('.menu-toggler.sidebar-toggler').click();
117 117  
... ... @@ -148,13 +148,13 @@
148 148 },
149 149 language: {
150 150 noResults: function(){
151   - return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>';
  151 + return '<span style="color:red;font-size: 12px;">娌℃湁鎼滅储鍒扮嚎璺紒</span>';
152 152 },
153 153 inputTooShort : function(e) {
154   - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>';
  154 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 杈撳叆绾胯矾鎼滅储绾胯矾</span>';
155 155 },
156 156 searching : function() {
157   - return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>';
  157 + return '<span style="color:gray;font-size: 12px;"> 姝e湪鎼滅储绾胯矾...</span>';
158 158 }
159 159 }
160 160 });
... ... @@ -182,20 +182,20 @@
182 182 }
183 183 obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
184 184 });
185   - // 把数据填充到模版中
  185 + // 鎶婃暟鎹~鍏呭埌妯$増涓
186 186 var tbodyHtml = template('changetochange',{list:result});
187   - // 把渲染好的模版html文本追加到表格中
  187 + // 鎶婃覆鏌撳ソ鐨勬ā鐗坔tml鏂囨湰杩藉姞鍒拌〃鏍间腑
188 188 $('#forms tbody').html(tbodyHtml);
189 189 })
190 190  
191 191 }else{
192   - alert("请选择时间范围!");
  192 + alert("璇烽夋嫨鏃堕棿鑼冨洿!");
193 193 }
194 194 });
195 195  
196 196 $("#export").on("click",function(){
197 197 $post('/mcy_export/changetochangeExport',{startDate:startDate,endDate:endDate,type:'export'},function(result){
198   - window.open("/downloadFile/download?fileName=换人换车情况日统计"+moment(startDate).format("YYYYMMDD"));
  198 + window.open("/downloadFile/download?fileName=鎹汉鎹㈣溅鎯呭喌鏃ョ粺璁"+moment(startDate).format("YYYYMMDD"));
199 199 });
200 200 });
201 201 });
... ... @@ -222,7 +222,7 @@
222 222 {{/each}}
223 223 {{if list.length == 0}}
224 224 <tr>
225   - <td colspan="15"><h6 class="muted">没有找到相关数据</h6></td>
  225 + <td colspan="15"><h6 class="muted">娌℃湁鎵惧埌鐩稿叧鏁版嵁</h6></td>
226 226 </tr>
227 227 {{/if}}
228 228 </script>
... ...
src/main/resources/static/pages/report/timetable/timetable.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>行车时刻表统计表</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block;">
  31 + <span class="item-label" style="width: 80px;">线路: </span>
  32 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block;margin-left: 15px;">
  35 + <span class="item-label" style="width: 80px;">时间: </span>
  36 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  37 + </div>
  38 + <div class="form-group">
  39 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  40 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  41 + </div>
  42 + </form>
  43 + </div>
  44 + <div class="portlet-body">
  45 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  46 + <label id="xlxq"></label>
  47 + <table class="table table-bordered table-hover table-checkable" style="margin-bottom:5p" id="formsTime1">
  48 + <thead>
  49 + <tr>
  50 + <th colspan="10">行车时刻表统计表</th>
  51 + </tr>
  52 + <tr>
  53 + <td align="center">配车</td>
  54 + <td colspan="6" align="center">全日班次</td>
  55 + <td colspan="3" align="center">计划里程</td>
  56 + </tr>
  57 + <tr>
  58 + <td rowspan="2" style="text-align:center;vertical-align:middle;">合计</td>
  59 + <td rowspan="2" style="text-align:center;vertical-align:middle;">全程 班次</td>
  60 + <td rowspan="2" style="text-align:center;vertical-align:middle;">区间 班次</td>
  61 + <td colspan="2" align="center">6:31-8:30</td>
  62 + <td colspan="2" align="center">16:01-18:00</td>
  63 + <td rowspan="2" style="text-align:center;vertical-align:middle;">总里程</td>
  64 + <td rowspan="2" style="text-align:center;vertical-align:middle;">营业里程</td>
  65 + <td rowspan="2" style="text-align:center;vertical-align:middle;">空驶里程</td>
  66 + </tr>
  67 + <tr>
  68 + <td >全程</td>
  69 + <td >区间</td>
  70 + <td >全程</td>
  71 + <td >区间</td>
  72 + </tr>
  73 + </thead>
  74 +
  75 + <tbody class="tbody_time_1">
  76 +
  77 + </tbody>
  78 + </table>
  79 +
  80 + <div class="portlet-body">
  81 + <div class="row">
  82 + <div class="col-md-4" id="divTime2">
  83 + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="formsTime2">
  84 + <tr>
  85 + <td colspan="2"> 营运车时 (计划班次的营运时间/公里)</td>
  86 + </tr>
  87 + <tr>
  88 + <td colspan="2">营业里程/营运时间(小时)</td>
  89 +
  90 + </tr>
  91 + <tr>
  92 + <td align="center" width="50%">
  93 + 营运时间(时:分)
  94 + </td>
  95 + <td align="center">
  96 + 营运车速
  97 + </td>
  98 + </tr>
  99 + <tbody class="tbody_time_2">
  100 +
  101 + </tbody>
  102 + </table>
  103 +
  104 + </div>
  105 +
  106 + <div class="col-md-8" id="divTime3" >
  107 + <table class="table table-bordered table-checkable" id="formsTime3">
  108 + <tr>
  109 + <td colspan="8">站点配车</td>
  110 + </tr>
  111 + <tr>
  112 + <td colspan="4" align="center">6:31—8:30</td>
  113 + <td colspan="4" align="center">16:01—18:00</td>
  114 + </tr>
  115 + <tr>
  116 + <td width="18%">全程站名</td>
  117 + <td>配车</td>
  118 + <td width="18%">区间站名</td>
  119 + <td>配车</td>
  120 + <td width="18%">全程站名</td>
  121 + <td>配车</td>
  122 + <td width="18%">区间站名</td>
  123 + <td>配车</td>
  124 + </tr>
  125 + <tbody class="tbody_time_3">
  126 +
  127 + </tbody>
  128 + </table>
  129 + </div>
  130 +
  131 + </div>
  132 + </div>
  133 + <div class="portlet-body">
  134 + <div class="row">
  135 + <div class="col-md-6" >
  136 + <table class="table table-bordered table-checkable">
  137 + <tr>
  138 + <td colspan="6">调度形式</td>
  139 + </tr>
  140 + <tr>
  141 + <td colspan="3" align="center">上行向()站</td>
  142 + <td colspan="3" align="center">下行向()站</td>
  143 + </tr>
  144 + <tr>
  145 + <td>起讫站</td>
  146 + <td>起讫时间</td>
  147 + <td>班次</td>
  148 + <td>起讫站</td>
  149 + <td>起讫时间</td>
  150 + <td>班次</td>
  151 + </tr>
  152 + <tbody class="tbody_time_4">
  153 +
  154 + </tbody>
  155 + </table>
  156 + </div>
  157 + <div class="col-md-6" >
  158 + <table class="table table-bordered table-checkable" id="formsTime5">
  159 + <tr>
  160 + <td colspan="5">全日分组行驶时间(区间除外)</td>
  161 + </tr>
  162 + <tr>
  163 + <td width="25%" rowspan="2" style="text-align:center;vertical-align:middle;w">分组 时间</td>
  164 + <td width="30%" colspan="2" style="text-align:center;vertical-align:middle;">实驶(分)</td>
  165 + <td width="20%" rowspan="2" style="text-align:center;vertical-align:middle;">分圈 时间</td>
  166 + <td width="25%" rowspan="2" style="text-align:center;vertical-align:middle;">车距</td>
  167 + </tr>
  168 + <tr>
  169 + <td>上行</td>
  170 + <td>下行</td>
  171 + </tr>
  172 + <tbody class="tbody_time_5">
  173 +
  174 + </tbody>
  175 + </table>
  176 + </div>
  177 + </div>
  178 + </div>
  179 + </div>
  180 + </div>
  181 + </div>
  182 + </div>
  183 +</div>
  184 +
  185 +<script>
  186 + $(function(){
  187 + // 关闭左侧栏
  188 + if (!$('body').hasClass('page-sidebar-closed'))
  189 + $('.menu-toggler.sidebar-toggler').click();
  190 +
  191 + $("#date").datetimepicker({
  192 + format : 'YYYY-MM-DD',
  193 + locale : 'zh-cn'
  194 + });
  195 +
  196 +
  197 +
  198 + $.get('/basic/lineCode2Name',function(result){
  199 + var data=[];
  200 +
  201 + for(var code in result){
  202 + data.push({id: code, text: result[code]});
  203 + }
  204 + initPinYinSelect2('#line',data,'');
  205 +
  206 + })
  207 + //查询
  208 + $("#query").on('click',function(){
  209 + var line = $("#line").val();
  210 + var xlName = $("#select2-line-container").html();
  211 + var date = $("#date").val();
  212 + if(date==null|| date==""){
  213 + layer.msg('请选择日期.');
  214 + }else if(line==null || line ==""){
  215 + layer.msg('请选择线路.');
  216 + }else{
  217 + $get('/report/tbodyTime1',{line:line,date:date},function(result){
  218 + var tbodyTime1 = template('tbodyTime1',{result});
  219 + $('#formsTime1 .tbody_time_1').html(tbodyTime1);
  220 + });
  221 + $.get('/report/tbodyTime2',{line:line,date:date},function(result){
  222 + var tbodyTime2 = template('tbodyTime2',{result});
  223 + $('#formsTime2 .tbody_time_2').html(tbodyTime2);
  224 + });
  225 + $.get('/report/tbodyTime3',{line:line,date:date},function(result){
  226 +
  227 + var tbodyTime3 = template('tbodyTime3',{list:result});
  228 + $('#formsTime3 .tbody_time_3').html(tbodyTime3);
  229 + var divTime3 = window.document.getElementById('formsTime3');
  230 + var divTime2 = window.document.getElementById('formsTime2');
  231 + console.log(divTime3.offsetHeight);
  232 + divTime2.style.height=divTime3.offsetHeight+"px";
  233 + });/*
  234 + $.get('/report/tbodyTime4',{line:line,date:date},function(result){
  235 + var scheduleDaily_3 = template('scheduleDaily_3',{list:result});
  236 + $('#forms .scheduleDaily_3').html(scheduleDaily_3);
  237 + });*/
  238 + $.get('/report/tbodyTime5',{line:line,date:date},function(result){
  239 + var tbodyTime5 = template('tbodyTime5',{list:result});
  240 + $('#formsTime5 .tbody_time_5').html(tbodyTime5);
  241 + });
  242 + }
  243 +
  244 +
  245 + });
  246 + });
  247 +</script>
  248 +<script type="text/html" id="tbodyTime1">
  249 + <tr>
  250 + <td>{{result.pcs}}</td>
  251 + <td>{{result.qcbc}}</td>
  252 + <td>{{result.qjbc}}</td>
  253 + <td>{{result.zqcbc}}</td>
  254 + <td>{{result.zqjbc}}</td>
  255 + <td>{{result.wqcbc}}</td>
  256 + <td>{{result.wqjbc}}</td>
  257 + <td>{{result.zlc}}</td>
  258 + <td>{{result.yylc}}</td>
  259 + <td>{{result.kslc}}</td>
  260 + </tr>
  261 +</script>
  262 +
  263 +<script type="text/html" id="tbodyTime2">
  264 + <tr>
  265 + <td align="center">{{result.yysj}}</td>
  266 + <td align="center">{{result.yycs}}</td>
  267 + </tr>
  268 +</script>
  269 +
  270 +<script type="text/html" id="tbodyTime3">
  271 +{{each list as result i}}
  272 + <tr>
  273 + <td align="center">{{result.zqcZm}}</td>
  274 + <td align="center">{{result.zqcCls}}</td>
  275 + <td align="center">{{result.zqjZm}}</td>
  276 + <td align="center">{{result.zqjCls}}</td>
  277 + <td align="center">{{result.wqcZm}}</td>
  278 + <td align="center">{{result.wqcCls}}</td>
  279 + <td align="center">{{result.wqjZm}}</td>
  280 + <td align="center">{{result.wqjCls}}</td>
  281 + </tr>
  282 +{{/each}}
  283 +{{if list.length == 0}}
  284 + <tr>
  285 + <td colspan="8"><h6 class="muted">没有找到相关数据</h6></td>
  286 + </tr>
  287 + {{/if}}
  288 +</script>
  289 +
  290 +
  291 +<script type="text/html" id="tbodyTime5">
  292 +{{each list as result i}}
  293 + <tr>
  294 + <td align="center">{{result.sjd}}</td>
  295 + <td align="center">{{result.sxsj}}</td>
  296 + <td align="center">{{result.xxsj}}</td>
  297 + <td align="center">{{result.fqsj}}</td>
  298 + <td align="center">{{result.cj}}</td>
  299 + </tr>
  300 +{{/each}}
  301 +{{if list.length == 0}}
  302 + <tr>
  303 + <td colspan="5"><h6 class="muted">没有找到相关数据</h6></td>
  304 + </tr>
  305 + {{/if}}
  306 +</script>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
1   -// 车辆基础信息维护 service controller等写在一起
2   -
3   -angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageService_g', function(service) {
4   -
5   - /** 当前的查询条件信息 */
6   - var currentSearchCondition = {
7   - "carCode_like" : "",
8   - "insideCode_like" : "",
9   - "equipmentCode_like" : "",
10   - "carPlate_like" : ""
11   - };
12   -
13   - /** 当前第几页 */
14   - var currentPageNo = 1;
15   - return {
16   - /**
17   - * 获取查询条件信息,
18   - * 用于给controller用来和页面数据绑定。
19   - */
20   - getSearchCondition: function() {
21   - return currentSearchCondition;
22   - },
23   - /**
24   - * 重置查询条件信息。
25   - */
26   - resetSearchCondition: function() {
27   - var key;
28   - for (key in currentSearchCondition) {
29   - currentSearchCondition[key] = undefined;
30   - }
31   - currentPageNo = 1;
32   - },
33   - /**
34   - * 设置当前页码。
35   - * @param cpn 从1开始,后台是从0开始的
36   - */
37   - setCurrentPageNo: function(cpn) {
38   - currentPageNo = cpn;
39   - },
40   - /**
41   - * 组装查询参数,返回一个promise查询结果。
42   - * @param params 查询参数
43   - * @return 返回一个 promise
44   - */
45   - getPage: function() {
46   - var params = currentSearchCondition; // 查询条件
47   - params.page = currentPageNo - 1; // 服务端页码从0开始
48   - return service.rest.list(params).$promise;
49   - },
50   - /**
51   - * 获取明细信息。
52   - * @param id 车辆id
53   - * @return 返回一个 promise
54   - */
55   - getDetail: function(id) {
56   - var params = {id: id};
57   - return service.rest.get(params).$promise;
58   - },
59   - /**
60   - * 保存信息。
61   - * @param obj 车辆详细信息
62   - * @return 返回一个 promise
63   - */
64   - saveDetail: function(obj) {
65   - return service.rest.save(obj).$promise;
66   - },
67   - /**
68   - * 数据导出。
69   - * @returns {*|Function|promise|n}
70   - */
71   - dataExport: function() {
72   - return service.dataTools.dataExport().$promise;
73   - }
74   - };
75   -}]);
76   -
77   -angular.module('ScheduleApp').controller('BusInfoManageCtrl', [
78   - 'BusInfoManageService','$state', '$uibModal', 'FileDownload_g',
79   - function(busInfoManageService, $state, $uibModal, fileDownload) {
80   - var self = this;
81   -
82   - // 切换到form状态
83   - self.goForm = function() {
84   - //alert("切换");
85   - $state.go("busInfoManage_form");
86   - };
87   -
88   - // 导入excel
89   - self.importData = function() {
90   - // large方式弹出模态对话框
91   - var modalInstance = $uibModal.open({
92   - templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/dataImport.html',
93   - size: "lg",
94   - animation: true,
95   - backdrop: 'static',
96   - resolve: {
97   - // 可以传值给controller
98   - },
99   - windowClass: 'center-modal',
100   - controller: "BusInfoManageToolsCtrl",
101   - controllerAs: "ctrl",
102   - bindToController: true
103   - });
104   - modalInstance.result.then(
105   - function() {
106   - console.log("dataImport.html打开");
107   - },
108   - function() {
109   - console.log("dataImport.html消失");
110   - }
111   - );
112   - };
113   -
114   - // 导出excel
115   - self.exportData = function() {
116   - busInfoManageService.dataExport().then(
117   - function(result) {
118   - fileDownload.downloadFile(result.data, "application/octet-stream", "车辆基础信息.xls");
119   - },
120   - function(result) {
121   - console.log("exportData failed:" + result);
122   - }
123   - );
124   - };
125   - }]);
126   -
127   -angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
128   - var self = this;
129   - self.data = "TODO";
130   -
131   - // 关闭窗口
132   - self.close = function() {
133   - $modalInstance.dismiss("cancel");
134   - };
135   -
136   - self.clearInputFile = function() {
137   - angular.element("input[type='file']").val(null);
138   - };
139   -
140   - // 上传文件组件
141   - self.uploader = new FileUploader({
142   - url: "/cars/dataImport",
143   - filters: [] // 用于过滤文件,比如只允许导入excel
144   - });
145   - self.uploader.onAfterAddingFile = function(fileItem)
146   - {
147   - console.info('onAfterAddingFile', fileItem);
148   - console.log(self.uploader.queue.length);
149   - if (self.uploader.queue.length > 1)
150   - self.uploader.removeFromQueue(0);
151   - };
152   - self.uploader.onSuccessItem = function(fileItem, response, status, headers)
153   - {
154   - console.info('onSuccessItem', fileItem, response, status, headers);
155   - };
156   - self.uploader.onErrorItem = function(fileItem, response, status, headers)
157   - {
158   - console.info('onErrorItem', fileItem, response, status, headers);
159   - };
160   -
161   -}]);
162   -
163   -
164   -angular.module('ScheduleApp').controller('BusInfoManageListCtrl', ['BusInfoManageService','$scope', function(busInfoManageService, $scope) {
165   - var self = this;
166   - self.pageInfo = {
167   - totalItems : 0,
168   - currentPage : 1,
169   - infos: []
170   - };
171   -
172   - // 初始创建的时候,获取一次列表数据
173   - busInfoManageService.getPage().then(
174   - function(result) {
175   - self.pageInfo.totalItems = result.totalElements;
176   - self.pageInfo.currentPage = result.number + 1;
177   - self.pageInfo.infos = result.content;
178   - busInfoManageService.setCurrentPageNo(result.number + 1);
179   - },
180   - function(result) {
181   - alert("出错啦!");
182   - }
183   - );
184   -
185   - //$scope.$watch("ctrl.pageInfo.currentPage", function() {
186   - // alert("dfdfdf");
187   - //});
188   -
189   - // 翻页的时候调用
190   - self.pageChanaged = function() {
191   - busInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
192   - busInfoManageService.getPage().then(
193   - function(result) {
194   - self.pageInfo.totalItems = result.totalElements;
195   - self.pageInfo.currentPage = result.number + 1;
196   - self.pageInfo.infos = result.content;
197   - busInfoManageService.setCurrentPageNo(result.number + 1);
198   - },
199   - function(result) {
200   - alert("出错啦!");
201   - }
202   - );
203   - };
204   - // 获取查询条件数据
205   - self.searchCondition = function() {
206   - return busInfoManageService.getSearchCondition();
207   - };
208   - // 重置查询条件
209   - self.resetSearchCondition = function() {
210   - busInfoManageService.resetSearchCondition();
211   - self.pageInfo.currentPage = 1;
212   - self.pageChanaged();
213   - };
214   -}]);
215   -
216   -angular.module('ScheduleApp').controller('BusInfoManageFormCtrl', ['BusInfoManageService', '$stateParams', '$state', function(busInfoManageService, $stateParams, $state) {
217   - var self = this;
218   -
219   - // 报废日期 日期控件开关
220   - self.scrapDateOpen = false;
221   - self.scrapDate_open = function() {
222   - self.scrapDateOpen = true;
223   - };
224   -
225   - // 启用日期 日期控件开关
226   - self.openDateOpen = false;
227   - self.openDate_open = function() {
228   - self.openDateOpen = true;
229   - };
230   - // 取消日期 日期控件开关
231   - self.closeDateOpen = false;
232   - self.closeDate_open = function() {
233   - self.closeDateOpen = true;
234   - };
235   -
236   - // 欲保存的busInfo信息,绑定
237   - self.busInfoForSave = {};
238   -
239   - // 获取传过来的id,有的话就是修改,获取一遍数据
240   - var id = $stateParams.id;
241   - if (id) {
242   - self.busInfoForSave.id = id;
243   - busInfoManageService.getDetail(id).then(
244   - function(result) {
245   - var key;
246   - for (key in result) {
247   - self.busInfoForSave[key] = result[key];
248   - }
249   - },
250   - function(result) {
251   - alert("出错啦!");
252   - }
253   - );
254   - }
255   -
256   - // 提交方法
257   - self.submit = function() {
258   - console.log(self.busInfoForSave);
259   - //if (self.busInfoForSave) {
260   - // delete $stateParams.id;
261   - //}
262   - busInfoManageService.saveDetail(self.busInfoForSave).then(
263   - function(result) {
264   - // TODO:弹出框方式以后改
265   - if (result.status == 'SUCCESS') {
266   - alert("保存成功!");
267   - $state.go("busInfoManage");
268   - } else {
269   - alert("保存异常!");
270   - }
271   - },
272   - function(result) {
273   - // TODO:弹出框方式以后改
274   - alert("出错啦!");
275   - }
276   - );
277   - };
278   -
279   -}]);
280   -
281   -angular.module('ScheduleApp').controller('BusInfoManageDetailCtrl', ['BusInfoManageService', '$stateParams', function(busInfoManageService, $stateParams) {
282   - var self = this;
283   - self.title = "";
284   - self.busInfoForDetail = {};
285   - self.busInfoForDetail.id = $stateParams.id;
286   -
287   - // 当转向到此页面时,就获取明细信息并绑定
288   - busInfoManageService.getDetail($stateParams.id).then(
289   - function(result) {
290   - var key;
291   - for (key in result) {
292   - self.busInfoForDetail[key] = result[key];
293   - }
294   -
295   - self.title = "车辆 " + self.busInfoForDetail.insideCode + " 详细信息";
296   - },
297   - function(result) {
298   - // TODO:弹出框方式以后改
299   - alert("出错啦!");
300   - }
301   - );
  1 +// 车辆基础信息维护 service controller等写在一起
  2 +
  3 +angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageService_g', function(service) {
  4 +
  5 + /** 当前的查询条件信息 */
  6 + var currentSearchCondition = {
  7 + "carCode_like" : "",
  8 + "insideCode_like" : "",
  9 + "equipmentCode_like" : "",
  10 + "carPlate_like" : ""
  11 + };
  12 +
  13 + /** 当前第几页 */
  14 + var currentPageNo = 1;
  15 + return {
  16 + /**
  17 + * 获取查询条件信息,
  18 + * 用于给controller用来和页面数据绑定。
  19 + */
  20 + getSearchCondition: function() {
  21 + return currentSearchCondition;
  22 + },
  23 + /**
  24 + * 重置查询条件信息。
  25 + */
  26 + resetSearchCondition: function() {
  27 + var key;
  28 + for (key in currentSearchCondition) {
  29 + currentSearchCondition[key] = undefined;
  30 + }
  31 + currentPageNo = 1;
  32 + },
  33 + /**
  34 + * 设置当前页码。
  35 + * @param cpn 从1开始,后台是从0开始的
  36 + */
  37 + setCurrentPageNo: function(cpn) {
  38 + currentPageNo = cpn;
  39 + },
  40 + /**
  41 + * 组装查询参数,返回一个promise查询结果。
  42 + * @param params 查询参数
  43 + * @return 返回一个 promise
  44 + */
  45 + getPage: function() {
  46 + var params = currentSearchCondition; // 查询条件
  47 + params.page = currentPageNo - 1; // 服务端页码从0开始
  48 + return service.rest.list(params).$promise;
  49 + },
  50 + /**
  51 + * 获取明细信息。
  52 + * @param id 车辆id
  53 + * @return 返回一个 promise
  54 + */
  55 + getDetail: function(id) {
  56 + var params = {id: id};
  57 + return service.rest.get(params).$promise;
  58 + },
  59 + /**
  60 + * 保存信息。
  61 + * @param obj 车辆详细信息
  62 + * @return 返回一个 promise
  63 + */
  64 + saveDetail: function(obj) {
  65 + return service.rest.save(obj).$promise;
  66 + },
  67 + /**
  68 + * 数据导出。
  69 + * @returns {*|Function|promise|n}
  70 + */
  71 + dataExport: function() {
  72 + return service.dataTools.dataExport().$promise;
  73 + }
  74 + };
  75 +}]);
  76 +
  77 +angular.module('ScheduleApp').controller('BusInfoManageCtrl', [
  78 + 'BusInfoManageService','$state', '$uibModal', 'FileDownload_g',
  79 + function(busInfoManageService, $state, $uibModal, fileDownload) {
  80 + var self = this;
  81 +
  82 + // 切换到form状态
  83 + self.goForm = function() {
  84 + //alert("切换");
  85 + $state.go("busInfoManage_form");
  86 + };
  87 +
  88 + // 导入excel
  89 + self.importData = function() {
  90 + // large方式弹出模态对话框
  91 + var modalInstance = $uibModal.open({
  92 + templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/dataImport.html',
  93 + size: "lg",
  94 + animation: true,
  95 + backdrop: 'static',
  96 + resolve: {
  97 + // 可以传值给controller
  98 + },
  99 + windowClass: 'center-modal',
  100 + controller: "BusInfoManageToolsCtrl",
  101 + controllerAs: "ctrl",
  102 + bindToController: true
  103 + });
  104 + modalInstance.result.then(
  105 + function() {
  106 + console.log("dataImport.html打开");
  107 + },
  108 + function() {
  109 + console.log("dataImport.html消失");
  110 + }
  111 + );
  112 + };
  113 +
  114 + // 导出excel
  115 + self.exportData = function() {
  116 + busInfoManageService.dataExport().then(
  117 + function(result) {
  118 + fileDownload.downloadFile(result.data, "application/octet-stream", "车辆基础信息.xls");
  119 + },
  120 + function(result) {
  121 + console.log("exportData failed:" + result);
  122 + }
  123 + );
  124 + };
  125 + }]);
  126 +
  127 +angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
  128 + var self = this;
  129 + self.data = "TODO";
  130 +
  131 + // 关闭窗口
  132 + self.close = function() {
  133 + $modalInstance.dismiss("cancel");
  134 + };
  135 +
  136 + self.clearInputFile = function() {
  137 + angular.element("input[type='file']").val(null);
  138 + };
  139 +
  140 + // 上传文件组件
  141 + self.uploader = new FileUploader({
  142 + url: "/cars/dataImport",
  143 + filters: [] // 用于过滤文件,比如只允许导入excel
  144 + });
  145 + self.uploader.onAfterAddingFile = function(fileItem)
  146 + {
  147 + console.info('onAfterAddingFile', fileItem);
  148 + console.log(self.uploader.queue.length);
  149 + if (self.uploader.queue.length > 1)
  150 + self.uploader.removeFromQueue(0);
  151 + };
  152 + self.uploader.onSuccessItem = function(fileItem, response, status, headers)
  153 + {
  154 + console.info('onSuccessItem', fileItem, response, status, headers);
  155 + };
  156 + self.uploader.onErrorItem = function(fileItem, response, status, headers)
  157 + {
  158 + console.info('onErrorItem', fileItem, response, status, headers);
  159 + };
  160 +
  161 +}]);
  162 +
  163 +
  164 +angular.module('ScheduleApp').controller('BusInfoManageListCtrl', ['BusInfoManageService','$scope', function(busInfoManageService, $scope) {
  165 + var self = this;
  166 + self.pageInfo = {
  167 + totalItems : 0,
  168 + currentPage : 1,
  169 + infos: []
  170 + };
  171 +
  172 + // 初始创建的时候,获取一次列表数据
  173 + busInfoManageService.getPage().then(
  174 + function(result) {
  175 + self.pageInfo.totalItems = result.totalElements;
  176 + self.pageInfo.currentPage = result.number + 1;
  177 + self.pageInfo.infos = result.content;
  178 + busInfoManageService.setCurrentPageNo(result.number + 1);
  179 + },
  180 + function(result) {
  181 + alert("出错啦!");
  182 + }
  183 + );
  184 +
  185 + //$scope.$watch("ctrl.pageInfo.currentPage", function() {
  186 + // alert("dfdfdf");
  187 + //});
  188 +
  189 + // 翻页的时候调用
  190 + self.pageChanaged = function() {
  191 + busInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
  192 + busInfoManageService.getPage().then(
  193 + function(result) {
  194 + self.pageInfo.totalItems = result.totalElements;
  195 + self.pageInfo.currentPage = result.number + 1;
  196 + self.pageInfo.infos = result.content;
  197 + busInfoManageService.setCurrentPageNo(result.number + 1);
  198 + },
  199 + function(result) {
  200 + alert("出错啦!");
  201 + }
  202 + );
  203 + };
  204 + // 获取查询条件数据
  205 + self.searchCondition = function() {
  206 + return busInfoManageService.getSearchCondition();
  207 + };
  208 + // 重置查询条件
  209 + self.resetSearchCondition = function() {
  210 + busInfoManageService.resetSearchCondition();
  211 + self.pageInfo.currentPage = 1;
  212 + self.pageChanaged();
  213 + };
  214 +}]);
  215 +
  216 +angular.module('ScheduleApp').controller('BusInfoManageFormCtrl', ['BusInfoManageService', '$stateParams', '$state', function(busInfoManageService, $stateParams, $state) {
  217 + var self = this;
  218 +
  219 + // 报废日期 日期控件开关
  220 + self.scrapDateOpen = false;
  221 + self.scrapDate_open = function() {
  222 + self.scrapDateOpen = true;
  223 + };
  224 +
  225 + // 启用日期 日期控件开关
  226 + self.openDateOpen = false;
  227 + self.openDate_open = function() {
  228 + self.openDateOpen = true;
  229 + };
  230 + // 取消日期 日期控件开关
  231 + self.closeDateOpen = false;
  232 + self.closeDate_open = function() {
  233 + self.closeDateOpen = true;
  234 + };
  235 +
  236 + // 欲保存的busInfo信息,绑定
  237 + self.busInfoForSave = {};
  238 +
  239 + // 获取传过来的id,有的话就是修改,获取一遍数据
  240 + var id = $stateParams.id;
  241 + if (id) {
  242 + self.busInfoForSave.id = id;
  243 + busInfoManageService.getDetail(id).then(
  244 + function(result) {
  245 + var key;
  246 + for (key in result) {
  247 + self.busInfoForSave[key] = result[key];
  248 + }
  249 + },
  250 + function(result) {
  251 + alert("出错啦!");
  252 + }
  253 + );
  254 + }
  255 +
  256 + // 提交方法
  257 + self.submit = function() {
  258 + console.log(self.busInfoForSave);
  259 + //if (self.busInfoForSave) {
  260 + // delete $stateParams.id;
  261 + //}
  262 + busInfoManageService.saveDetail(self.busInfoForSave).then(
  263 + function(result) {
  264 + // TODO:弹出框方式以后改
  265 + if (result.status == 'SUCCESS') {
  266 + alert("保存成功!");
  267 + $state.go("busInfoManage");
  268 + } else {
  269 + alert("保存异常!");
  270 + }
  271 + },
  272 + function(result) {
  273 + // TODO:弹出框方式以后改
  274 + alert("出错啦!");
  275 + }
  276 + );
  277 + };
  278 +
  279 +}]);
  280 +
  281 +angular.module('ScheduleApp').controller('BusInfoManageDetailCtrl', ['BusInfoManageService', '$stateParams', function(busInfoManageService, $stateParams) {
  282 + var self = this;
  283 + self.title = "";
  284 + self.busInfoForDetail = {};
  285 + self.busInfoForDetail.id = $stateParams.id;
  286 +
  287 + // 当转向到此页面时,就获取明细信息并绑定
  288 + busInfoManageService.getDetail($stateParams.id).then(
  289 + function(result) {
  290 + var key;
  291 + for (key in result) {
  292 + self.busInfoForDetail[key] = result[key];
  293 + }
  294 +
  295 + self.title = "车辆 " + self.busInfoForDetail.insideCode + " 详细信息";
  296 + },
  297 + function(result) {
  298 + // TODO:弹出框方式以后改
  299 + alert("出错啦!");
  300 + }
  301 + );
302 302 }]);
303 303 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/route.js
1   -// ui route 配置
2   -
3   -/** 车辆基础信息模块配置route */
4   -ScheduleApp.config([
5   - '$stateProvider',
6   - '$urlRouterProvider',
7   - function($stateProvider, $urlRouterProvider) {
8   - // 默认路由
9   - //$urlRouterProvider.otherwise('/busConfig.html');
10   -
11   - $stateProvider
12   - .state("busInfoManage", { // index页面
13   - url: '/busInfoManage',
14   - views: {
15   - "": {
16   - templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/index.html'
17   - },
18   - "busInfoManage_list@busInfoManage": {
19   - templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/list.html'
20   - }
21   - },
22   -
23   - resolve: {
24   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
25   - return $ocLazyLoad.load({
26   - name: 'busInfoManage_module',
27   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
28   - files: [
29   - "assets/bower_components/angular-ui-select/dist/select.min.css",
30   - "assets/bower_components/angular-ui-select/dist/select.min.js",
31   - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",
32   - "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
33   - ]
34   - });
35   - }]
36   - }
37   - })
38   - .state("busInfoManage_form", { // 添加车辆form
39   - url: '/busInfoManage_form',
40   - views: {
41   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/form.html'}
42   - },
43   - resolve: {
44   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
45   - return $ocLazyLoad.load({
46   - name: 'busInfoManage_form_module',
47   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
48   - files: [
49   - "assets/bower_components/angular-ui-select/dist/select.min.css",
50   - "assets/bower_components/angular-ui-select/dist/select.min.js",
51   - "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
52   - ]
53   - });
54   - }]
55   - }
56   - })
57   - .state("busInfoManage_edit", { // 修改车辆form
58   - url: '/busInfoManage_edit/:id',
59   - views: {
60   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/edit.html'}
61   - },
62   - resolve: {
63   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
64   - return $ocLazyLoad.load({
65   - name: 'busInfoManage_edit_module',
66   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
67   - files: [
68   - "assets/bower_components/angular-ui-select/dist/select.min.css",
69   - "assets/bower_components/angular-ui-select/dist/select.min.js",
70   - "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
71   - ]
72   - });
73   - }]
74   - }
75   - })
76   - .state("busInfoManage_detail", { // 车辆详细信息
77   - url: '/busInfoManage_detail/:id',
78   - views: {
79   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/detail.html'}
80   - },
81   - resolve: {
82   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
83   - return $ocLazyLoad.load({
84   - name: 'busInfoManage_detail_module',
85   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
86   - files: [
87   - "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
88   - ]
89   - });
90   - }]
91   - }
92   - })
93   - }
  1 +// ui route 配置
  2 +
  3 +/** 车辆基础信息模块配置route */
  4 +ScheduleApp.config([
  5 + '$stateProvider',
  6 + '$urlRouterProvider',
  7 + function($stateProvider, $urlRouterProvider) {
  8 + // 默认路由
  9 + //$urlRouterProvider.otherwise('/busConfig.html');
  10 +
  11 + $stateProvider
  12 + .state("busInfoManage", { // index页面
  13 + url: '/busInfoManage',
  14 + views: {
  15 + "": {
  16 + templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/index.html'
  17 + },
  18 + "busInfoManage_list@busInfoManage": {
  19 + templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/list.html'
  20 + }
  21 + },
  22 +
  23 + resolve: {
  24 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  25 + return $ocLazyLoad.load({
  26 + name: 'busInfoManage_module',
  27 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  28 + files: [
  29 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  30 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  31 + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",
  32 + "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
  33 + ]
  34 + });
  35 + }]
  36 + }
  37 + })
  38 + .state("busInfoManage_form", { // 添加车辆form
  39 + url: '/busInfoManage_form',
  40 + views: {
  41 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/form.html'}
  42 + },
  43 + resolve: {
  44 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  45 + return $ocLazyLoad.load({
  46 + name: 'busInfoManage_form_module',
  47 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  48 + files: [
  49 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  50 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  51 + "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
  52 + ]
  53 + });
  54 + }]
  55 + }
  56 + })
  57 + .state("busInfoManage_edit", { // 修改车辆form
  58 + url: '/busInfoManage_edit/:id',
  59 + views: {
  60 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/edit.html'}
  61 + },
  62 + resolve: {
  63 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  64 + return $ocLazyLoad.load({
  65 + name: 'busInfoManage_edit_module',
  66 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  67 + files: [
  68 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  69 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  70 + "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
  71 + ]
  72 + });
  73 + }]
  74 + }
  75 + })
  76 + .state("busInfoManage_detail", { // 车辆详细信息
  77 + url: '/busInfoManage_detail/:id',
  78 + views: {
  79 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/busInfoManage/detail.html'}
  80 + },
  81 + resolve: {
  82 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  83 + return $ocLazyLoad.load({
  84 + name: 'busInfoManage_detail_module',
  85 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  86 + files: [
  87 + "pages/scheduleApp/module/basicInfo/busInfoManage/module.js"
  88 + ]
  89 + });
  90 + }]
  91 + }
  92 + })
  93 + }
94 94 ]);
95 95 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js
1   -// 设备信息维护 service controller 等写在一起
2   -
3   -angular.module('ScheduleApp').factory('DeviceInfoManageService', ['DeviceInfoManageService_g', function(service) {
4   - /** 当前的查询条件信息 */
5   - var currentSearchCondition = {};
6   -
7   - /** 当前第几页 */
8   - var currentPageNo = 1;
9   -
10   - return {
11   - /**
12   - * 获取查询条件信息,
13   - * 用于给controller用来和页面数据绑定。
14   - */
15   - getSearchCondition: function() {
16   - return currentSearchCondition;
17   - },
18   - /**
19   - * 重置查询条件信息。
20   - */
21   - resetSearchCondition: function() {
22   - var key;
23   - for (key in currentSearchCondition) {
24   - currentSearchCondition[key] = "";
25   - }
26   - },
27   - /**
28   - * 设置当前页码。
29   - * @param cpn 从1开始,后台是从0开始的
30   - */
31   - setCurrentPageNo: function(cpn) {
32   - currentPageNo = cpn;
33   - },
34   - /**
35   - * 组装查询参数,返回一个promise查询结果。
36   - * @param params 查询参数
37   - * @return 返回一个 promise
38   - */
39   - getPage: function() {
40   - var params = currentSearchCondition; // 查询条件
41   - params.page = currentPageNo - 1; // 服务端页码从0开始
42   - return service.list(params).$promise;
43   - },
44   - /**
45   - * 获取明细信息。
46   - * @param id 车辆id
47   - * @return 返回一个 promise
48   - */
49   - getDetail: function(id) {
50   - var params = {id: id};
51   - return service.get(params).$promise;
52   - },
53   - /**
54   - * 保存信息。
55   - * @param obj 车辆详细信息
56   - * @return 返回一个 promise
57   - */
58   - saveDetail: function(obj) {
59   - return service.save(obj).$promise;
60   - },
61   - /**
62   - * 删除信息。
63   - * @param id 主键id
64   - * @returns {*|Function|promise|n}
65   - */
66   - deleteDetail: function(id) {
67   - return service.delete({id: id}).$promise;
68   - }
69   - };
70   -
71   -}]);
72   -
73   -angular.module('ScheduleApp').controller('DeviceInfoManageCtrl', ['DeviceInfoManageService', '$state', function(deviceInfoManageService, $state) {
74   - var self = this;
75   -
76   - // 切换到form状态
77   - self.goForm = function() {
78   - //alert("切换");
79   - $state.go("deviceInfoManage_form");
80   - }
81   -
82   -
83   -}]);
84   -
85   -angular.module('ScheduleApp').controller('DeviceInfoManageListCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) {
86   - var self = this;
87   - self.pageInfo = {
88   - totalItems : 0,
89   - currentPage : 1,
90   - infos: []
91   - };
92   -
93   - // 初始创建的时候,获取一次列表数据
94   - deviceInfoManageService.getPage().then(
95   - function(result) {
96   - self.pageInfo.totalItems = result.totalElements;
97   - self.pageInfo.currentPage = result.number + 1;
98   - self.pageInfo.infos = result.content;
99   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
100   - },
101   - function(result) {
102   - alert("出错啦!");
103   - }
104   - );
105   -
106   - // 翻页的时候调用
107   - self.pageChanaged = function() {
108   - deviceInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
109   - deviceInfoManageService.getPage().then(
110   - function(result) {
111   - self.pageInfo.totalItems = result.totalElements;
112   - self.pageInfo.currentPage = result.number + 1;
113   - self.pageInfo.infos = result.content;
114   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
115   - },
116   - function(result) {
117   - alert("出错啦!");
118   - }
119   - );
120   - };
121   - // 获取查询条件数据
122   - self.searchCondition = function() {
123   - return deviceInfoManageService.getSearchCondition();
124   - };
125   - // 重置查询条件
126   - self.resetSearchCondition = function() {
127   - deviceInfoManageService.resetSearchCondition();
128   - self.pageInfo.currentPage = 1;
129   - self.pageChanaged();
130   - };
131   -
132   - // 作废/撤销
133   - self.toggleCde = function(id) {
134   - // TODO:
135   - deviceInfoManageService.deleteDetail(id).then(
136   - function(result) {
137   - if (result.message) { // 暂时这样做,之后全局拦截
138   - alert("失败:" + result.message);
139   - } else {
140   - alert("成功!");
141   -
142   - deviceInfoManageService.getPage().then(
143   - function(result) {
144   - self.pageInfo.totalItems = result.totalElements;
145   - self.pageInfo.currentPage = result.number + 1;
146   - self.pageInfo.infos = result.content;
147   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
148   - },
149   - function(result) {
150   - alert("出错啦!");
151   - }
152   - );
153   - }
154   -
155   - },
156   - function(result) {
157   - alert("出错啦!" + result);
158   - }
159   - );
160   - };
161   -
162   -}]);
163   -
164   -angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', '$stateParams', '$state', function(deviceInfoManageService, $stateParams, $state) {
165   - var self = this;
166   -
167   - // 启用日期 日期控件开关
168   - self.qyrqOpen = false;
169   - self.qyrq_open = function() {
170   - self.qyrqOpen = true;
171   - };
172   -
173   - // 欲保存的busInfo信息,绑定
174   - self.deviceInfoForSave = {};
175   -
176   - // 获取传过来的id,有的话就是修改,获取一遍数据
177   - var id = $stateParams.id;
178   - if (id) {
179   - self.deviceInfoForSave.id = id;
180   - deviceInfoManageService.getDetail(id).then(
181   - function(result) {
182   - var key;
183   - for (key in result) {
184   - self.deviceInfoForSave[key] = result[key];
185   - }
186   - // 填写所有的 select 控件选中框数据
187   - // 公司字典
188   - if (self.deviceInfoForSave.gsName) {
189   - angular.forEach(self.gses, function(data) {
190   - if (self.deviceInfoForSave.gsName == data.gsmc) {
191   - self.deviceInfoForSave.gs_selected = data;
192   - }
193   - });
194   - }
195   - },
196   - function(result) {
197   - alert("出错啦!");
198   - }
199   - );
200   - }
201   -
202   - // 提交方法
203   - self.submit = function() {
204   - console.log(self.deviceInfoForSave);
205   - deviceInfoManageService.saveDetail(self.deviceInfoForSave).then(
206   - function(result) {
207   - // TODO:弹出框方式以后改
208   - if (result.status == 'SUCCESS') {
209   - alert("保存成功!");
210   - $state.go("deviceInfoManage");
211   - } else {
212   - alert("保存异常!");
213   - }
214   - },
215   - function(result) {
216   - // TODO:弹出框方式以后改
217   - alert("出错啦!");
218   - }
219   - );
220   - };
221   -
222   -}]);
223   -
224   -angular.module('ScheduleApp').controller('DeviceInfoManageDetailCtrl', ['DeviceInfoManageService', '$stateParams', function(deviceInfoManageService, $stateParams) {
225   - var self = this;
226   - self.title = "";
227   - self.deviceInfoForDetail = {};
228   - self.deviceInfoForDetail.id = $stateParams.id;
229   -
230   - // 当转向到此页面时,就获取明细信息并绑定
231   - deviceInfoManageService.getDetail($stateParams.id).then(
232   - function(result) {
233   - var key;
234   - for (key in result) {
235   - self.deviceInfoForDetail[key] = result[key];
236   - }
237   -
238   - self.title = "车辆 " + self.deviceInfoForDetail.clZbh + "设备信息";
239   - },
240   - function(result) {
241   - // TODO:弹出框方式以后改
242   - alert("出错啦!");
243   - }
244   - );
  1 +// 设备信息维护 service controller 等写在一起
  2 +
  3 +angular.module('ScheduleApp').factory('DeviceInfoManageService', ['DeviceInfoManageService_g', function(service) {
  4 + /** 当前的查询条件信息 */
  5 + var currentSearchCondition = {};
  6 +
  7 + /** 当前第几页 */
  8 + var currentPageNo = 1;
  9 +
  10 + return {
  11 + /**
  12 + * 获取查询条件信息,
  13 + * 用于给controller用来和页面数据绑定。
  14 + */
  15 + getSearchCondition: function() {
  16 + return currentSearchCondition;
  17 + },
  18 + /**
  19 + * 重置查询条件信息。
  20 + */
  21 + resetSearchCondition: function() {
  22 + var key;
  23 + for (key in currentSearchCondition) {
  24 + currentSearchCondition[key] = "";
  25 + }
  26 + },
  27 + /**
  28 + * 设置当前页码。
  29 + * @param cpn 从1开始,后台是从0开始的
  30 + */
  31 + setCurrentPageNo: function(cpn) {
  32 + currentPageNo = cpn;
  33 + },
  34 + /**
  35 + * 组装查询参数,返回一个promise查询结果。
  36 + * @param params 查询参数
  37 + * @return 返回一个 promise
  38 + */
  39 + getPage: function() {
  40 + var params = currentSearchCondition; // 查询条件
  41 + params.page = currentPageNo - 1; // 服务端页码从0开始
  42 + return service.list(params).$promise;
  43 + },
  44 + /**
  45 + * 获取明细信息。
  46 + * @param id 车辆id
  47 + * @return 返回一个 promise
  48 + */
  49 + getDetail: function(id) {
  50 + var params = {id: id};
  51 + return service.get(params).$promise;
  52 + },
  53 + /**
  54 + * 保存信息。
  55 + * @param obj 车辆详细信息
  56 + * @return 返回一个 promise
  57 + */
  58 + saveDetail: function(obj) {
  59 + return service.save(obj).$promise;
  60 + },
  61 + /**
  62 + * 删除信息。
  63 + * @param id 主键id
  64 + * @returns {*|Function|promise|n}
  65 + */
  66 + deleteDetail: function(id) {
  67 + return service.delete({id: id}).$promise;
  68 + }
  69 + };
  70 +
  71 +}]);
  72 +
  73 +angular.module('ScheduleApp').controller('DeviceInfoManageCtrl', ['DeviceInfoManageService', '$state', function(deviceInfoManageService, $state) {
  74 + var self = this;
  75 +
  76 + // 切换到form状态
  77 + self.goForm = function() {
  78 + //alert("切换");
  79 + $state.go("deviceInfoManage_form");
  80 + }
  81 +
  82 +
  83 +}]);
  84 +
  85 +angular.module('ScheduleApp').controller('DeviceInfoManageListCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) {
  86 + var self = this;
  87 + self.pageInfo = {
  88 + totalItems : 0,
  89 + currentPage : 1,
  90 + infos: []
  91 + };
  92 +
  93 + // 初始创建的时候,获取一次列表数据
  94 + deviceInfoManageService.getPage().then(
  95 + function(result) {
  96 + self.pageInfo.totalItems = result.totalElements;
  97 + self.pageInfo.currentPage = result.number + 1;
  98 + self.pageInfo.infos = result.content;
  99 + deviceInfoManageService.setCurrentPageNo(result.number + 1);
  100 + },
  101 + function(result) {
  102 + alert("出错啦!");
  103 + }
  104 + );
  105 +
  106 + // 翻页的时候调用
  107 + self.pageChanaged = function() {
  108 + deviceInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
  109 + deviceInfoManageService.getPage().then(
  110 + function(result) {
  111 + self.pageInfo.totalItems = result.totalElements;
  112 + self.pageInfo.currentPage = result.number + 1;
  113 + self.pageInfo.infos = result.content;
  114 + deviceInfoManageService.setCurrentPageNo(result.number + 1);
  115 + },
  116 + function(result) {
  117 + alert("出错啦!");
  118 + }
  119 + );
  120 + };
  121 + // 获取查询条件数据
  122 + self.searchCondition = function() {
  123 + return deviceInfoManageService.getSearchCondition();
  124 + };
  125 + // 重置查询条件
  126 + self.resetSearchCondition = function() {
  127 + deviceInfoManageService.resetSearchCondition();
  128 + self.pageInfo.currentPage = 1;
  129 + self.pageChanaged();
  130 + };
  131 +
  132 + // 作废/撤销
  133 + self.toggleCde = function(id) {
  134 + // TODO:
  135 + deviceInfoManageService.deleteDetail(id).then(
  136 + function(result) {
  137 + if (result.message) { // 暂时这样做,之后全局拦截
  138 + alert("失败:" + result.message);
  139 + } else {
  140 + alert("成功!");
  141 +
  142 + deviceInfoManageService.getPage().then(
  143 + function(result) {
  144 + self.pageInfo.totalItems = result.totalElements;
  145 + self.pageInfo.currentPage = result.number + 1;
  146 + self.pageInfo.infos = result.content;
  147 + deviceInfoManageService.setCurrentPageNo(result.number + 1);
  148 + },
  149 + function(result) {
  150 + alert("出错啦!");
  151 + }
  152 + );
  153 + }
  154 +
  155 + },
  156 + function(result) {
  157 + alert("出错啦!" + result);
  158 + }
  159 + );
  160 + };
  161 +
  162 +}]);
  163 +
  164 +angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', '$stateParams', '$state', function(deviceInfoManageService, $stateParams, $state) {
  165 + var self = this;
  166 +
  167 + // 启用日期 日期控件开关
  168 + self.qyrqOpen = false;
  169 + self.qyrq_open = function() {
  170 + self.qyrqOpen = true;
  171 + };
  172 +
  173 + // 欲保存的busInfo信息,绑定
  174 + self.deviceInfoForSave = {};
  175 +
  176 + // 获取传过来的id,有的话就是修改,获取一遍数据
  177 + var id = $stateParams.id;
  178 + if (id) {
  179 + self.deviceInfoForSave.id = id;
  180 + deviceInfoManageService.getDetail(id).then(
  181 + function(result) {
  182 + var key;
  183 + for (key in result) {
  184 + self.deviceInfoForSave[key] = result[key];
  185 + }
  186 + // 填写所有的 select 控件选中框数据
  187 + // 公司字典
  188 + if (self.deviceInfoForSave.gsName) {
  189 + angular.forEach(self.gses, function(data) {
  190 + if (self.deviceInfoForSave.gsName == data.gsmc) {
  191 + self.deviceInfoForSave.gs_selected = data;
  192 + }
  193 + });
  194 + }
  195 + },
  196 + function(result) {
  197 + alert("出错啦!");
  198 + }
  199 + );
  200 + }
  201 +
  202 + // 提交方法
  203 + self.submit = function() {
  204 + console.log(self.deviceInfoForSave);
  205 + deviceInfoManageService.saveDetail(self.deviceInfoForSave).then(
  206 + function(result) {
  207 + // TODO:弹出框方式以后改
  208 + if (result.status == 'SUCCESS') {
  209 + alert("保存成功!");
  210 + $state.go("deviceInfoManage");
  211 + } else {
  212 + alert("保存异常!");
  213 + }
  214 + },
  215 + function(result) {
  216 + // TODO:弹出框方式以后改
  217 + alert("出错啦!");
  218 + }
  219 + );
  220 + };
  221 +
  222 +}]);
  223 +
  224 +angular.module('ScheduleApp').controller('DeviceInfoManageDetailCtrl', ['DeviceInfoManageService', '$stateParams', function(deviceInfoManageService, $stateParams) {
  225 + var self = this;
  226 + self.title = "";
  227 + self.deviceInfoForDetail = {};
  228 + self.deviceInfoForDetail.id = $stateParams.id;
  229 +
  230 + // 当转向到此页面时,就获取明细信息并绑定
  231 + deviceInfoManageService.getDetail($stateParams.id).then(
  232 + function(result) {
  233 + var key;
  234 + for (key in result) {
  235 + self.deviceInfoForDetail[key] = result[key];
  236 + }
  237 +
  238 + self.title = "车辆 " + self.deviceInfoForDetail.clZbh + "设备信息";
  239 + },
  240 + function(result) {
  241 + // TODO:弹出框方式以后改
  242 + alert("出错啦!");
  243 + }
  244 + );
245 245 }]);
246 246 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/route.js
1   -// ui route 配置
2   -
3   -/** 车辆设备信息模块配置route */
4   -ScheduleApp.config([
5   - '$stateProvider',
6   - '$urlRouterProvider',
7   - function($stateProvider, $urlRouterProvider) {
8   - // 默认路由
9   - //$urlRouterProvider.otherwise('/busConfig.html');
10   -
11   - $stateProvider
12   - .state("deviceInfoManage", { // index页面
13   - url: '/deviceInfoManage',
14   - views: {
15   - "": {
16   - templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html'
17   - },
18   - "deviceInfoManage_list@deviceInfoManage": {
19   - templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html'
20   - }
21   - },
22   -
23   - resolve: {
24   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
25   - return $ocLazyLoad.load({
26   - name: 'deviceInfoManage_module',
27   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
28   - files: [
29   - "assets/bower_components/angular-ui-select/dist/select.min.css",
30   - "assets/bower_components/angular-ui-select/dist/select.min.js",
31   - "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
32   - ]
33   - });
34   - }]
35   - }
36   - })
37   - .state("deviceInfoManage_form", { // 添加设备信息form
38   - url: '/deviceInfoManage_form',
39   - views: {
40   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html'}
41   - },
42   - resolve: {
43   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
44   - return $ocLazyLoad.load({
45   - name: 'deviceInfoManage_form_module',
46   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
47   - files: [
48   - "assets/bower_components/angular-ui-select/dist/select.min.css",
49   - "assets/bower_components/angular-ui-select/dist/select.min.js",
50   - "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
51   - ]
52   - });
53   - }]
54   - }
55   - })
56   - .state("deviceInfoManage_edit", { // 修改设备信息form
57   - url: '/deviceInfoManage_edit/:id',
58   - views: {
59   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html'}
60   - },
61   - resolve: {
62   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
63   - return $ocLazyLoad.load({
64   - name: 'deviceInfoManage_edit_module',
65   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
66   - files: [
67   - "assets/bower_components/angular-ui-select/dist/select.min.css",
68   - "assets/bower_components/angular-ui-select/dist/select.min.js",
69   - "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
70   - ]
71   - });
72   - }]
73   - }
74   - })
75   - .state("deviceInfoManage_detail", { // 详细信息页面
76   - url: '/deviceInfoManage_detail/:id',
77   - views: {
78   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html'}
79   - },
80   - resolve: {
81   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
82   - return $ocLazyLoad.load({
83   - name: 'deviceInfoManage_detail_module',
84   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
85   - files: [
86   - "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
87   - ]
88   - });
89   - }]
90   - }
91   - })
92   -
93   - }
  1 +// ui route 配置
  2 +
  3 +/** 车辆设备信息模块配置route */
  4 +ScheduleApp.config([
  5 + '$stateProvider',
  6 + '$urlRouterProvider',
  7 + function($stateProvider, $urlRouterProvider) {
  8 + // 默认路由
  9 + //$urlRouterProvider.otherwise('/busConfig.html');
  10 +
  11 + $stateProvider
  12 + .state("deviceInfoManage", { // index页面
  13 + url: '/deviceInfoManage',
  14 + views: {
  15 + "": {
  16 + templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html'
  17 + },
  18 + "deviceInfoManage_list@deviceInfoManage": {
  19 + templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html'
  20 + }
  21 + },
  22 +
  23 + resolve: {
  24 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  25 + return $ocLazyLoad.load({
  26 + name: 'deviceInfoManage_module',
  27 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  28 + files: [
  29 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  30 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  31 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
  32 + ]
  33 + });
  34 + }]
  35 + }
  36 + })
  37 + .state("deviceInfoManage_form", { // 添加设备信息form
  38 + url: '/deviceInfoManage_form',
  39 + views: {
  40 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html'}
  41 + },
  42 + resolve: {
  43 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  44 + return $ocLazyLoad.load({
  45 + name: 'deviceInfoManage_form_module',
  46 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  47 + files: [
  48 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  49 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  50 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
  51 + ]
  52 + });
  53 + }]
  54 + }
  55 + })
  56 + .state("deviceInfoManage_edit", { // 修改设备信息form
  57 + url: '/deviceInfoManage_edit/:id',
  58 + views: {
  59 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html'}
  60 + },
  61 + resolve: {
  62 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  63 + return $ocLazyLoad.load({
  64 + name: 'deviceInfoManage_edit_module',
  65 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  66 + files: [
  67 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  68 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  69 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
  70 + ]
  71 + });
  72 + }]
  73 + }
  74 + })
  75 + .state("deviceInfoManage_detail", { // 详细信息页面
  76 + url: '/deviceInfoManage_detail/:id',
  77 + views: {
  78 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html'}
  79 + },
  80 + resolve: {
  81 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  82 + return $ocLazyLoad.load({
  83 + name: 'deviceInfoManage_detail_module',
  84 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  85 + files: [
  86 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js"
  87 + ]
  88 + });
  89 + }]
  90 + }
  91 + })
  92 +
  93 + }
94 94 ]);
95 95 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js
1   -// 人员信息管理 service controller等写在一起
2   -
3   -angular.module('ScheduleApp').factory('EmployeeInfoManageService', ['EmployeeInfoManageService_g', function(service) {
4   -
5   - /** 当前的查询条件信息 */
6   - var currentSearchCondition = {
7   - //"carCode_like" : "",
8   - //"insideCode_like" : "",
9   - //"equipmentCode_like" : "",
10   - //"carPlate_like" : ""
11   - };
12   -
13   - /** 当前第几页 */
14   - var currentPageNo = 1;
15   -
16   - return {
17   - /**
18   - * 获取查询条件信息,
19   - * 用于给controller用来和页面数据绑定。
20   - */
21   - getSearchCondition: function() {
22   - return currentSearchCondition;
23   - },
24   - /**
25   - * 重置查询条件信息。
26   - */
27   - resetSearchCondition: function() {
28   - var key;
29   - for (key in currentSearchCondition) {
30   - currentSearchCondition[key] = undefined;
31   - }
32   - currentPageNo = 1;
33   - },
34   - /**
35   - * 设置当前页码。
36   - * @param cpn 从1开始,后台是从0开始的
37   - */
38   - setCurrentPageNo: function(cpn) {
39   - currentPageNo = cpn;
40   - },
41   - /**
42   - * 组装查询参数,返回一个promise查询结果。
43   - * @param params 查询参数
44   - * @return 返回一个 promise
45   - */
46   - getPage: function() {
47   - var params = currentSearchCondition; // 查询条件
48   - params.page = currentPageNo - 1; // 服务端页码从0开始
49   - return service.rest.list(params).$promise;
50   - },
51   - /**
52   - * 获取明细信息。
53   - * @param id 车辆id
54   - * @return 返回一个 promise
55   - */
56   - getDetail: function(id) {
57   - var params = {id: id};
58   - return service.rest.get(params).$promise;
59   - },
60   - /**
61   - * 保存信息。
62   - * @param obj 车辆详细信息
63   - * @return 返回一个 promise
64   - */
65   - saveDetail: function(obj) {
66   - return service.rest.save(obj).$promise;
67   - },
68   - /**
69   - * 数据导出。
70   - * @returns {*|Function|promise|n}
71   - */
72   - dataExport: function() {
73   - return service.dataTools.dataExport().$promise;
74   - }
75   - }
76   -
77   -}]);
78   -
79   -angular.module('ScheduleApp').controller('EmployeeInfoManageCtrl', [
80   - 'EmployeeInfoManageService', '$state', '$uibModal', 'FileDownload_g',
81   - function(employeeInfoManageService, $state, $uibModal, fileDownload) {
82   - var self = this;
83   -
84   - // 切换到form状态
85   - self.goForm = function() {
86   - //alert("切换");
87   - $state.go("employeeInfoManage_form");
88   - }
89   -
90   - // 导入excel
91   - self.importData = function() {
92   - // large方式弹出模态对话框
93   - var modalInstance = $uibModal.open({
94   - templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/dataImport.html',
95   - size: "lg",
96   - animation: true,
97   - backdrop: 'static',
98   - resolve: {
99   - // 可以传值给controller
100   - },
101   - windowClass: 'center-modal',
102   - controller: "EmployInfoManageToolsCtrl",
103   - controllerAs: "ctrl",
104   - bindToController: true
105   - });
106   - modalInstance.result.then(
107   - function() {
108   - console.log("dataImport.html打开");
109   - },
110   - function() {
111   - console.log("dataImport.html消失");
112   - }
113   - );
114   - };
115   -
116   - // 导出excel
117   - self.exportData = function() {
118   - employeeInfoManageService.dataExport().then(
119   - function(result) {
120   - fileDownload.downloadFile(result.data, "application/octet-stream", "人员基础信息.xls");
121   - },
122   - function(result) {
123   - console.log("exportData failed:" + result);
124   - }
125   - );
126   - };
127   - }]);
128   -
129   -angular.module('ScheduleApp').controller('EmployInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
130   - var self = this;
131   -
132   - // 关闭窗口
133   - self.close = function() {
134   - $modalInstance.dismiss("cancel");
135   - };
136   -
137   - self.clearInputFile = function() {
138   - angular.element("input[type='file']").val(null);
139   - };
140   -
141   - // 上传文件组件
142   - self.uploader = new FileUploader({
143   - url: "/personnel/dataImport",
144   - filters: [] // 用于过滤文件,比如只允许导入excel
145   - });
146   - self.uploader.onAfterAddingFile = function(fileItem)
147   - {
148   - console.info('onAfterAddingFile', fileItem);
149   - console.log(self.uploader.queue.length);
150   - if (self.uploader.queue.length > 1)
151   - self.uploader.removeFromQueue(0);
152   - };
153   - self.uploader.onSuccessItem = function(fileItem, response, status, headers)
154   - {
155   - console.info('onSuccessItem', fileItem, response, status, headers);
156   - };
157   - self.uploader.onErrorItem = function(fileItem, response, status, headers)
158   - {
159   - console.info('onErrorItem', fileItem, response, status, headers);
160   - };
161   -
162   -}]);
163   -
164   -angular.module('ScheduleApp').controller('EmployeeInfoManageListCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) {
165   - var self = this;
166   - self.pageInfo = {
167   - totalItems : 0,
168   - currentPage : 1,
169   - infos: []
170   - };
171   -
172   - // 初始创建的时候,获取一次列表数据
173   - employeeInfoManageService.getPage().then(
174   - function(result) {
175   - self.pageInfo.totalItems = result.totalElements;
176   - self.pageInfo.currentPage = result.number + 1;
177   - self.pageInfo.infos = result.content;
178   - employeeInfoManageService.setCurrentPageNo(result.number + 1);
179   - },
180   - function(result) {
181   - alert("出错啦!");
182   - }
183   - );
184   -
185   - //$scope.$watch("ctrl.pageInfo.currentPage", function() {
186   - // alert("dfdfdf");
187   - //});
188   -
189   - // 翻页的时候调用
190   - self.pageChanaged = function() {
191   - employeeInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
192   - employeeInfoManageService.getPage().then(
193   - function(result) {
194   - self.pageInfo.totalItems = result.totalElements;
195   - self.pageInfo.currentPage = result.number + 1;
196   - self.pageInfo.infos = result.content;
197   - employeeInfoManageService.setCurrentPageNo(result.number + 1);
198   - },
199   - function(result) {
200   - alert("出错啦!");
201   - }
202   - );
203   - };
204   - // 获取查询条件数据
205   - self.searchCondition = function() {
206   - return employeeInfoManageService.getSearchCondition();
207   - };
208   - // 重置查询条件
209   - self.resetSearchCondition = function() {
210   - employeeInfoManageService.resetSearchCondition();
211   - self.pageInfo.currentPage = 1;
212   - self.pageChanaged();
213   - };
214   -}]);
215   -
216   -angular.module('ScheduleApp').controller('EmployeeInfoManageFormCtrl', ['EmployeeInfoManageService', '$stateParams', '$state', function(employeeInfoManageService, $stateParams, $state) {
217   - var self = this;
218   -
219   - // 欲保存的busInfo信息,绑定
220   - self.employeeInfoForSave = {};
221   -
222   - // 获取传过来的id,有的话就是修改,获取一遍数据
223   - var id = $stateParams.id;
224   - if (id) {
225   - self.employeeInfoForSave.id = id;
226   - employeeInfoManageService.getDetail(id).then(
227   - function(result) {
228   - var key;
229   - for (key in result) {
230   - self.employeeInfoForSave[key] = result[key];
231   - }
232   - },
233   - function(result) {
234   - alert("出错啦!");
235   - }
236   - );
237   - }
238   -
239   - // 提交方法
240   - self.submit = function() {
241   - console.log(self.employeeInfoForSave);
242   - employeeInfoManageService.saveDetail(self.employeeInfoForSave).then(
243   - function(result) {
244   - // TODO:弹出框方式以后改
245   - if (result.status == 'SUCCESS') {
246   - alert("保存成功!");
247   - $state.go("employeeInfoManage");
248   - } else {
249   - alert("保存异常!");
250   - }
251   - },
252   - function(result) {
253   - // TODO:弹出框方式以后改
254   - alert("出错啦!");
255   - }
256   - );
257   - };
258   -
259   -
260   -}]);
261   -
262   -angular.module('ScheduleApp').controller('EmployeeInfoManageDetailCtrl', ['EmployeeInfoManageService', '$stateParams', function(employeeInfoManageService, $stateParams) {
263   - var self = this;
264   - self.title = "";
265   - self.employeeInfoForDetail = {};
266   - self.employeeInfoForDetail.id = $stateParams.id;
267   -
268   - // 当转向到此页面时,就获取明细信息并绑定
269   - employeeInfoManageService.getDetail($stateParams.id).then(
270   - function(result) {
271   - var key;
272   - for (key in result) {
273   - self.employeeInfoForDetail[key] = result[key];
274   - }
275   -
276   - self.title = "员工 " + self.employeeInfoForDetail.personnelName + " 详细信息";
277   - },
278   - function(result) {
279   - // TODO:弹出框方式以后改
280   - alert("出错啦!");
281   - }
282   - );
283   -}]);
284   -
  1 +// 人员信息管理 service controller等写在一起
  2 +
  3 +angular.module('ScheduleApp').factory('EmployeeInfoManageService', ['EmployeeInfoManageService_g', function(service) {
  4 +
  5 + /** 当前的查询条件信息 */
  6 + var currentSearchCondition = {
  7 + //"carCode_like" : "",
  8 + //"insideCode_like" : "",
  9 + //"equipmentCode_like" : "",
  10 + //"carPlate_like" : ""
  11 + };
  12 +
  13 + /** 当前第几页 */
  14 + var currentPageNo = 1;
  15 +
  16 + return {
  17 + /**
  18 + * 获取查询条件信息,
  19 + * 用于给controller用来和页面数据绑定。
  20 + */
  21 + getSearchCondition: function() {
  22 + return currentSearchCondition;
  23 + },
  24 + /**
  25 + * 重置查询条件信息。
  26 + */
  27 + resetSearchCondition: function() {
  28 + var key;
  29 + for (key in currentSearchCondition) {
  30 + currentSearchCondition[key] = undefined;
  31 + }
  32 + currentPageNo = 1;
  33 + },
  34 + /**
  35 + * 设置当前页码。
  36 + * @param cpn 从1开始,后台是从0开始的
  37 + */
  38 + setCurrentPageNo: function(cpn) {
  39 + currentPageNo = cpn;
  40 + },
  41 + /**
  42 + * 组装查询参数,返回一个promise查询结果。
  43 + * @param params 查询参数
  44 + * @return 返回一个 promise
  45 + */
  46 + getPage: function() {
  47 + var params = currentSearchCondition; // 查询条件
  48 + params.page = currentPageNo - 1; // 服务端页码从0开始
  49 + return service.rest.list(params).$promise;
  50 + },
  51 + /**
  52 + * 获取明细信息。
  53 + * @param id 车辆id
  54 + * @return 返回一个 promise
  55 + */
  56 + getDetail: function(id) {
  57 + var params = {id: id};
  58 + return service.rest.get(params).$promise;
  59 + },
  60 + /**
  61 + * 保存信息。
  62 + * @param obj 车辆详细信息
  63 + * @return 返回一个 promise
  64 + */
  65 + saveDetail: function(obj) {
  66 + return service.rest.save(obj).$promise;
  67 + },
  68 + /**
  69 + * 数据导出。
  70 + * @returns {*|Function|promise|n}
  71 + */
  72 + dataExport: function() {
  73 + return service.dataTools.dataExport().$promise;
  74 + }
  75 + }
  76 +
  77 +}]);
  78 +
  79 +angular.module('ScheduleApp').controller('EmployeeInfoManageCtrl', [
  80 + 'EmployeeInfoManageService', '$state', '$uibModal', 'FileDownload_g',
  81 + function(employeeInfoManageService, $state, $uibModal, fileDownload) {
  82 + var self = this;
  83 +
  84 + // 切换到form状态
  85 + self.goForm = function() {
  86 + //alert("切换");
  87 + $state.go("employeeInfoManage_form");
  88 + }
  89 +
  90 + // 导入excel
  91 + self.importData = function() {
  92 + // large方式弹出模态对话框
  93 + var modalInstance = $uibModal.open({
  94 + templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/dataImport.html',
  95 + size: "lg",
  96 + animation: true,
  97 + backdrop: 'static',
  98 + resolve: {
  99 + // 可以传值给controller
  100 + },
  101 + windowClass: 'center-modal',
  102 + controller: "EmployInfoManageToolsCtrl",
  103 + controllerAs: "ctrl",
  104 + bindToController: true
  105 + });
  106 + modalInstance.result.then(
  107 + function() {
  108 + console.log("dataImport.html打开");
  109 + },
  110 + function() {
  111 + console.log("dataImport.html消失");
  112 + }
  113 + );
  114 + };
  115 +
  116 + // 导出excel
  117 + self.exportData = function() {
  118 + employeeInfoManageService.dataExport().then(
  119 + function(result) {
  120 + fileDownload.downloadFile(result.data, "application/octet-stream", "人员基础信息.xls");
  121 + },
  122 + function(result) {
  123 + console.log("exportData failed:" + result);
  124 + }
  125 + );
  126 + };
  127 + }]);
  128 +
  129 +angular.module('ScheduleApp').controller('EmployInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
  130 + var self = this;
  131 +
  132 + // 关闭窗口
  133 + self.close = function() {
  134 + $modalInstance.dismiss("cancel");
  135 + };
  136 +
  137 + self.clearInputFile = function() {
  138 + angular.element("input[type='file']").val(null);
  139 + };
  140 +
  141 + // 上传文件组件
  142 + self.uploader = new FileUploader({
  143 + url: "/personnel/dataImport",
  144 + filters: [] // 用于过滤文件,比如只允许导入excel
  145 + });
  146 + self.uploader.onAfterAddingFile = function(fileItem)
  147 + {
  148 + console.info('onAfterAddingFile', fileItem);
  149 + console.log(self.uploader.queue.length);
  150 + if (self.uploader.queue.length > 1)
  151 + self.uploader.removeFromQueue(0);
  152 + };
  153 + self.uploader.onSuccessItem = function(fileItem, response, status, headers)
  154 + {
  155 + console.info('onSuccessItem', fileItem, response, status, headers);
  156 + };
  157 + self.uploader.onErrorItem = function(fileItem, response, status, headers)
  158 + {
  159 + console.info('onErrorItem', fileItem, response, status, headers);
  160 + };
  161 +
  162 +}]);
  163 +
  164 +angular.module('ScheduleApp').controller('EmployeeInfoManageListCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) {
  165 + var self = this;
  166 + self.pageInfo = {
  167 + totalItems : 0,
  168 + currentPage : 1,
  169 + infos: []
  170 + };
  171 +
  172 + // 初始创建的时候,获取一次列表数据
  173 + employeeInfoManageService.getPage().then(
  174 + function(result) {
  175 + self.pageInfo.totalItems = result.totalElements;
  176 + self.pageInfo.currentPage = result.number + 1;
  177 + self.pageInfo.infos = result.content;
  178 + employeeInfoManageService.setCurrentPageNo(result.number + 1);
  179 + },
  180 + function(result) {
  181 + alert("出错啦!");
  182 + }
  183 + );
  184 +
  185 + //$scope.$watch("ctrl.pageInfo.currentPage", function() {
  186 + // alert("dfdfdf");
  187 + //});
  188 +
  189 + // 翻页的时候调用
  190 + self.pageChanaged = function() {
  191 + employeeInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
  192 + employeeInfoManageService.getPage().then(
  193 + function(result) {
  194 + self.pageInfo.totalItems = result.totalElements;
  195 + self.pageInfo.currentPage = result.number + 1;
  196 + self.pageInfo.infos = result.content;
  197 + employeeInfoManageService.setCurrentPageNo(result.number + 1);
  198 + },
  199 + function(result) {
  200 + alert("出错啦!");
  201 + }
  202 + );
  203 + };
  204 + // 获取查询条件数据
  205 + self.searchCondition = function() {
  206 + return employeeInfoManageService.getSearchCondition();
  207 + };
  208 + // 重置查询条件
  209 + self.resetSearchCondition = function() {
  210 + employeeInfoManageService.resetSearchCondition();
  211 + self.pageInfo.currentPage = 1;
  212 + self.pageChanaged();
  213 + };
  214 +}]);
  215 +
  216 +angular.module('ScheduleApp').controller('EmployeeInfoManageFormCtrl', ['EmployeeInfoManageService', '$stateParams', '$state', function(employeeInfoManageService, $stateParams, $state) {
  217 + var self = this;
  218 +
  219 + // 欲保存的busInfo信息,绑定
  220 + self.employeeInfoForSave = {};
  221 +
  222 + // 获取传过来的id,有的话就是修改,获取一遍数据
  223 + var id = $stateParams.id;
  224 + if (id) {
  225 + self.employeeInfoForSave.id = id;
  226 + employeeInfoManageService.getDetail(id).then(
  227 + function(result) {
  228 + var key;
  229 + for (key in result) {
  230 + self.employeeInfoForSave[key] = result[key];
  231 + }
  232 + },
  233 + function(result) {
  234 + alert("出错啦!");
  235 + }
  236 + );
  237 + }
  238 +
  239 + // 提交方法
  240 + self.submit = function() {
  241 + console.log(self.employeeInfoForSave);
  242 + employeeInfoManageService.saveDetail(self.employeeInfoForSave).then(
  243 + function(result) {
  244 + // TODO:弹出框方式以后改
  245 + if (result.status == 'SUCCESS') {
  246 + alert("保存成功!");
  247 + $state.go("employeeInfoManage");
  248 + } else {
  249 + alert("保存异常!");
  250 + }
  251 + },
  252 + function(result) {
  253 + // TODO:弹出框方式以后改
  254 + alert("出错啦!");
  255 + }
  256 + );
  257 + };
  258 +
  259 +
  260 +}]);
  261 +
  262 +angular.module('ScheduleApp').controller('EmployeeInfoManageDetailCtrl', ['EmployeeInfoManageService', '$stateParams', function(employeeInfoManageService, $stateParams) {
  263 + var self = this;
  264 + self.title = "";
  265 + self.employeeInfoForDetail = {};
  266 + self.employeeInfoForDetail.id = $stateParams.id;
  267 +
  268 + // 当转向到此页面时,就获取明细信息并绑定
  269 + employeeInfoManageService.getDetail($stateParams.id).then(
  270 + function(result) {
  271 + var key;
  272 + for (key in result) {
  273 + self.employeeInfoForDetail[key] = result[key];
  274 + }
  275 +
  276 + self.title = "员工 " + self.employeeInfoForDetail.personnelName + " 详细信息";
  277 + },
  278 + function(result) {
  279 + // TODO:弹出框方式以后改
  280 + alert("出错啦!");
  281 + }
  282 + );
  283 +}]);
  284 +
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/route.js
1   -// ui route 配置
2   -
3   -/** 人员基础信息模块配置route */
4   -ScheduleApp.config([
5   - '$stateProvider',
6   - '$urlRouterProvider',
7   - function($stateProvider, $urlRouterProvider) {
8   - // 默认路由
9   - //$urlRouterProvider.otherwise('/busConfig.html');
10   -
11   - $stateProvider
12   - .state("employeeInfoManage", { // index页面
13   - url: '/employeeInfoManage',
14   - views: {
15   - "": {
16   - templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html'
17   - },
18   - "employeeInfoManage_list@employeeInfoManage": {
19   - templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html'
20   - }
21   - },
22   -
23   - resolve: {
24   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
25   - return $ocLazyLoad.load({
26   - name: 'employeeInfoManage_module',
27   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
28   - files: [
29   - "assets/bower_components/angular-ui-select/dist/select.min.css",
30   - "assets/bower_components/angular-ui-select/dist/select.min.js",
31   - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",
32   - "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
33   - ]
34   - });
35   - }]
36   - }
37   - })
38   - .state("employeeInfoManage_form", { // 添加人员信息form
39   - url: '/employeeInfoManage_form',
40   - views: {
41   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html'}
42   - },
43   - resolve: {
44   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
45   - return $ocLazyLoad.load({
46   - name: 'employeeInfoManage_form_module',
47   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
48   - files: [
49   - "assets/bower_components/angular-ui-select/dist/select.min.css",
50   - "assets/bower_components/angular-ui-select/dist/select.min.js",
51   - "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
52   - ]
53   - });
54   - }]
55   - }
56   - })
57   - .state("employeeInfoManage_edit", { // 修改人员信息form
58   - url: '/employeeInfoManage_edit/:id',
59   - views: {
60   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html'}
61   - },
62   - resolve: {
63   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
64   - return $ocLazyLoad.load({
65   - name: 'employeeInfoManage_edit_module',
66   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
67   - files: [
68   - "assets/bower_components/angular-ui-select/dist/select.min.css",
69   - "assets/bower_components/angular-ui-select/dist/select.min.js",
70   - "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
71   - ]
72   - });
73   - }]
74   - }
75   - })
76   - .state("employeeInfoManage_detail", { // 详细信息页面
77   - url: '/employeeInfoManage_detail/:id',
78   - views: {
79   - "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html'}
80   - },
81   - resolve: {
82   - deps: ['$ocLazyLoad', function($ocLazyLoad) {
83   - return $ocLazyLoad.load({
84   - name: 'employeeInfoManage_detail_module',
85   - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
86   - files: [
87   - "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
88   - ]
89   - });
90   - }]
91   - }
92   - })
93   -
  1 +// ui route 配置
  2 +
  3 +/** 人员基础信息模块配置route */
  4 +ScheduleApp.config([
  5 + '$stateProvider',
  6 + '$urlRouterProvider',
  7 + function($stateProvider, $urlRouterProvider) {
  8 + // 默认路由
  9 + //$urlRouterProvider.otherwise('/busConfig.html');
  10 +
  11 + $stateProvider
  12 + .state("employeeInfoManage", { // index页面
  13 + url: '/employeeInfoManage',
  14 + views: {
  15 + "": {
  16 + templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html'
  17 + },
  18 + "employeeInfoManage_list@employeeInfoManage": {
  19 + templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html'
  20 + }
  21 + },
  22 +
  23 + resolve: {
  24 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  25 + return $ocLazyLoad.load({
  26 + name: 'employeeInfoManage_module',
  27 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  28 + files: [
  29 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  30 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  31 + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",
  32 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
  33 + ]
  34 + });
  35 + }]
  36 + }
  37 + })
  38 + .state("employeeInfoManage_form", { // 添加人员信息form
  39 + url: '/employeeInfoManage_form',
  40 + views: {
  41 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html'}
  42 + },
  43 + resolve: {
  44 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  45 + return $ocLazyLoad.load({
  46 + name: 'employeeInfoManage_form_module',
  47 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  48 + files: [
  49 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  50 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  51 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
  52 + ]
  53 + });
  54 + }]
  55 + }
  56 + })
  57 + .state("employeeInfoManage_edit", { // 修改人员信息form
  58 + url: '/employeeInfoManage_edit/:id',
  59 + views: {
  60 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html'}
  61 + },
  62 + resolve: {
  63 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  64 + return $ocLazyLoad.load({
  65 + name: 'employeeInfoManage_edit_module',
  66 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  67 + files: [
  68 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  69 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  70 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
  71 + ]
  72 + });
  73 + }]
  74 + }
  75 + })
  76 + .state("employeeInfoManage_detail", { // 详细信息页面
  77 + url: '/employeeInfoManage_detail/:id',
  78 + views: {
  79 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html'}
  80 + },
  81 + resolve: {
  82 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  83 + return $ocLazyLoad.load({
  84 + name: 'employeeInfoManage_detail_module',
  85 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  86 + files: [
  87 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js"
  88 + ]
  89 + });
  90 + }]
  91 + }
  92 + })
  93 +
94 94 }]);
95 95 \ No newline at end of file
... ...