Commit d9ea8cf26479b85c25f27b06475f2425e2c7a0b2

Authored by 廖磊
2 parents 66b65718 40893ce8

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
src/main/java/com/bsth/controller/excep/SpeedingController.java
1 1 package com.bsth.controller.excep;
2 2  
  3 +import java.text.ParseException;
  4 +import java.util.ArrayList;
3 5 import java.util.HashMap;
  6 +import java.util.List;
4 7 import java.util.Map;
5 8  
6 9 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -11,11 +14,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
11 14 import org.springframework.web.bind.annotation.RestController;
12 15  
13 16 import com.bsth.controller.BaseController;
  17 +import com.bsth.data.BasicData;
14 18 import com.bsth.entity.excep.Offline;
15 19 import com.bsth.entity.excep.Speeding;
16 20 import com.bsth.entity.sys.SysUser;
17 21 import com.bsth.service.excep.OfflineService;
18 22 import com.bsth.service.excep.SpeedingService;
  23 +import com.bsth.service.gps.entity.GpsSpeed;
19 24 import com.bsth.util.PageObject;
20 25  
21 26 @RestController
... ... @@ -45,5 +50,11 @@ public class SpeedingController extends BaseController<SysUser, Integer>{
45 50 return modelMap;
46 51 }
47 52  
  53 + @RequestMapping(value = "/findPosition", method = RequestMethod.GET)
  54 + public List<Speeding> findPosition(@RequestParam String vehicle,@RequestParam String startdate,@RequestParam String enddate) throws ParseException {
  55 + String deviceid = BasicData.deviceId2NbbmMap.inverse().get(vehicle);
  56 + List<Speeding> listSpeeding = speedingService.findPosition(deviceid,startdate,enddate);
  57 + return listSpeeding;
  58 + }
48 59  
49 60 }
... ...
src/main/java/com/bsth/controller/realcontrol/summary/HoursController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol.summary;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.data.summary.entity.Hours_jsy;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * 汇总数据 -工时
  10 + * Created by panzhao on 2017/7/27.
  11 + */
  12 +@RestController
  13 +@RequestMapping("/summary/hours")
  14 +public class HoursController extends BaseController<Hours_jsy, Long>{
  15 +}
... ...
src/main/java/com/bsth/data/summary/entity/Hours_jsy.java 0 → 100644
  1 +package com.bsth.data.summary.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +import javax.persistence.Transient;
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + * Created by panzhao on 2017/7/26.
  11 + * table:
  12 + * 驾驶员工时
  13 + */
  14 +@Entity
  15 +@Table(name = "z_calc_hoursjsy")
  16 +public class Hours_jsy {
  17 +
  18 + @Id
  19 + private Long id;
  20 +
  21 + /** 公司编码 */
  22 + private String companyId;
  23 +
  24 + /** 分公司编码 */
  25 + private String subCompanyId;
  26 +
  27 + /** 公司名称 */
  28 + @Transient
  29 + private String companyName;
  30 + /** 分公司名称 */
  31 + @Transient
  32 + private String subCompanyName;
  33 +
  34 + /** 线路编码 */
  35 + private String lineCode;
  36 +
  37 + /** 线路名称 */
  38 + private String lineName;
  39 +
  40 + /** 驾驶员工号 */
  41 + private String jsy;
  42 +
  43 + /** 驾驶员姓名 */
  44 + private String jsyName;
  45 +
  46 + /** 车辆自编号 */
  47 + private String nbbm;
  48 +
  49 + /** 路牌 */
  50 + private String lpName;
  51 +
  52 + /** 日期 (班次日期) */
  53 + private String rq;
  54 +
  55 + /** 计划工时(分钟) */
  56 + private Integer hoursJh;
  57 + @Transient
  58 + private String hoursJhStr;
  59 +
  60 + /** 实际工时(分钟) */
  61 + private Integer hoursSj;
  62 + @Transient
  63 + private String hoursSjStr;
  64 +
  65 + /** 来源 0: 从路单结算、 1:人工录入 */
  66 + private int source;
  67 +
  68 + /** 备注 */
  69 + private String remarks;
  70 +
  71 + private Date createDate;
  72 +
  73 + public String getCompanyId() {
  74 + return companyId;
  75 + }
  76 +
  77 + public void setCompanyId(String companyId) {
  78 + this.companyId = companyId;
  79 + }
  80 +
  81 + public String getSubCompanyId() {
  82 + return subCompanyId;
  83 + }
  84 +
  85 + public void setSubCompanyId(String subCompanyId) {
  86 + this.subCompanyId = subCompanyId;
  87 + }
  88 +
  89 + public String getLineCode() {
  90 + return lineCode;
  91 + }
  92 +
  93 + public void setLineCode(String lineCode) {
  94 + this.lineCode = lineCode;
  95 + }
  96 +
  97 + public String getLineName() {
  98 + return lineName;
  99 + }
  100 +
  101 + public void setLineName(String lineName) {
  102 + this.lineName = lineName;
  103 + }
  104 +
  105 + public String getJsy() {
  106 + return jsy;
  107 + }
  108 +
  109 + public void setJsy(String jsy) {
  110 + this.jsy = jsy;
  111 + }
  112 +
  113 + public String getJsyName() {
  114 + return jsyName;
  115 + }
  116 +
  117 + public void setJsyName(String jsyName) {
  118 + this.jsyName = jsyName;
  119 + }
  120 +
  121 + public String getNbbm() {
  122 + return nbbm;
  123 + }
  124 +
  125 + public void setNbbm(String nbbm) {
  126 + this.nbbm = nbbm;
  127 + }
  128 +
  129 + public String getLpName() {
  130 + return lpName;
  131 + }
  132 +
  133 + public void setLpName(String lpName) {
  134 + this.lpName = lpName;
  135 + }
  136 +
  137 + public String getRq() {
  138 + return rq;
  139 + }
  140 +
  141 + public void setRq(String rq) {
  142 + this.rq = rq;
  143 + }
  144 +
  145 +
  146 + public int getSource() {
  147 + return source;
  148 + }
  149 +
  150 + public void setSource(int source) {
  151 + this.source = source;
  152 + }
  153 +
  154 + public String getRemarks() {
  155 + return remarks;
  156 + }
  157 +
  158 + public void setRemarks(String remarks) {
  159 + this.remarks = remarks;
  160 + }
  161 +
  162 + public Date getCreateDate() {
  163 + return createDate;
  164 + }
  165 +
  166 + public void setCreateDate(Date createDate) {
  167 + this.createDate = createDate;
  168 + }
  169 +
  170 + public Integer getHoursJh() {
  171 + return hoursJh;
  172 + }
  173 +
  174 + public void setHoursJh(Integer hoursJh) {
  175 + this.hoursJh = hoursJh;
  176 + }
  177 +
  178 + public Integer getHoursSj() {
  179 + return hoursSj;
  180 + }
  181 +
  182 + public void setHoursSj(Integer hoursSj) {
  183 + this.hoursSj = hoursSj;
  184 + }
  185 +
  186 + public String keys() {
  187 + return this.getLineCode() + "_" + this.getLpName() + "_" + this.getJsy() + "_" + this.getNbbm();
  188 + }
  189 +
  190 + public long getId() {
  191 + return id;
  192 + }
  193 +
  194 + public void setId(long id) {
  195 + this.id = id;
  196 + }
  197 +
  198 + public String getCompanyName() {
  199 + return companyName;
  200 + }
  201 +
  202 + public void setCompanyName(String companyName) {
  203 + this.companyName = companyName;
  204 + }
  205 +
  206 + public String getSubCompanyName() {
  207 + return subCompanyName;
  208 + }
  209 +
  210 + public void setSubCompanyName(String subCompanyName) {
  211 + this.subCompanyName = subCompanyName;
  212 + }
  213 +
  214 + public String getHoursJhStr() {
  215 + return hoursJhStr;
  216 + }
  217 +
  218 + public void setHoursJhStr(String hoursJhStr) {
  219 + this.hoursJhStr = hoursJhStr;
  220 + }
  221 +
  222 + public String getHoursSjStr() {
  223 + return hoursSjStr;
  224 + }
  225 +
  226 + public void setHoursSjStr(String hoursSjStr) {
  227 + this.hoursSjStr = hoursSjStr;
  228 + }
  229 +}
... ...
src/main/java/com/bsth/data/summary/repository/HoursRepository.java 0 → 100644
  1 +package com.bsth.data.summary.repository;
  2 +
  3 +import com.bsth.data.summary.entity.Hours_jsy;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/7/27.
  9 + */
  10 +@Repository
  11 +public interface HoursRepository extends BaseRepository<Hours_jsy, Long> {
  12 +}
... ...
src/main/java/com/bsth/data/summary/service/HoursService.java 0 → 100644
  1 +package com.bsth.data.summary.service;
  2 +
  3 +import com.bsth.data.summary.entity.Hours_jsy;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by panzhao on 2017/7/27.
  8 + */
  9 +public interface HoursService extends BaseService<Hours_jsy, Long>{
  10 +}
... ...
src/main/java/com/bsth/data/summary/service/impl/HoursServiceImpl.java 0 → 100644
  1 +package com.bsth.data.summary.service.impl;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.summary.entity.Hours_jsy;
  5 +import com.bsth.data.summary.service.HoursService;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import org.springframework.data.domain.Page;
  8 +import org.springframework.data.domain.PageRequest;
  9 +import org.springframework.data.domain.Pageable;
  10 +import org.springframework.data.domain.Sort;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import java.util.ArrayList;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by panzhao on 2017/7/27.
  19 + */
  20 +@Service
  21 +public class HoursServiceImpl extends BaseServiceImpl<Hours_jsy, Long> implements HoursService {
  22 +
  23 + @Override
  24 + public Page<Hours_jsy> list(Map<String, Object> map, Pageable pageable) {
  25 + //排序
  26 + List<Sort.Order> orderList = new ArrayList<>();
  27 + orderList.add(new Sort.Order(Sort.Direction.ASC,"rq"));
  28 + orderList.add(new Sort.Order(Sort.Direction.ASC,"lineName"));
  29 + orderList.add(new Sort.Order(Sort.Direction.ASC,"jsy"));
  30 + orderList.add(new Sort.Order(Sort.Direction.ASC,"nbbm"));
  31 +
  32 + Page<Hours_jsy> page = super.list(map, new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), new Sort(orderList)));
  33 +
  34 + //公司编码转名称
  35 + List<Hours_jsy> list = page.getContent();
  36 + for(Hours_jsy h : list){
  37 + h.setCompanyName(BasicData.businessCodeNameMap.get(h.getCompanyId()));
  38 + h.setSubCompanyName(BasicData.businessFgsCodeNameMap.get(h.getSubCompanyId()+"_"+h.getCompanyId()));
  39 +
  40 + //时间字符串
  41 + h.setHoursJhStr(hoursToString(h.getHoursJh()));
  42 + h.setHoursSjStr(hoursToString(h.getHoursSj()));
  43 + }
  44 + return page;
  45 + }
  46 +
  47 + private String hoursToString(Integer minute){
  48 + if(minute==0)
  49 + return "0";
  50 + int h = minute / 60;
  51 + String str = (h<10?"0"+h:h) + "";
  52 +
  53 + int m = minute % 60;
  54 + if(m != 0)
  55 + str += ("." + (m<10?"0"+m:m));
  56 + return str;
  57 + }
  58 +}
... ...
src/main/java/com/bsth/entity/excep/Speeding.java
... ... @@ -35,7 +35,11 @@ public class Speeding {
35 35 */
36 36 private String lineName;
37 37  
38   -
  38 + /**
  39 + * 线路ID
  40 + */
  41 + private Integer lineId;
  42 +
39 43 /**
40 44 * 上下行(0 上行 , 1 下行 , -1 无效)
41 45 */
... ... @@ -243,4 +247,12 @@ public class Speeding {
243 247 this.endtimestamp = endtimestamp;
244 248 }
245 249  
  250 + public Integer getLineId() {
  251 + return lineId;
  252 + }
  253 +
  254 + public void setLineId(Integer lineId) {
  255 + this.lineId = lineId;
  256 + }
  257 +
246 258 }
... ...
src/main/java/com/bsth/service/excep/SpeedingService.java
1 1 package com.bsth.service.excep;
2 2  
  3 +import java.util.List;
3 4 import java.util.Map;
4 5  
5 6 import com.bsth.entity.excep.Speeding;
... ... @@ -8,4 +9,6 @@ import com.bsth.util.PageObject;
8 9 public interface SpeedingService {
9 10 PageObject <Speeding> Pagequery(Map<String, Object> map) ;
10 11 Map<String, Object> getReport( Map<String, Object> map);
  12 + List<Speeding> findPosition(String deviceid, String startdate,
  13 + String enddate);
11 14 }
... ...
src/main/java/com/bsth/service/excep/impl/SpeedingServiceImpl.java
... ... @@ -7,6 +7,7 @@ import java.sql.SQLException;
7 7 import java.text.ParseException;
8 8 import java.text.SimpleDateFormat;
9 9 import java.util.ArrayList;
  10 +import java.util.Calendar;
10 11 import java.util.Date;
11 12 import java.util.HashMap;
12 13 import java.util.Iterator;
... ... @@ -18,8 +19,10 @@ import org.springframework.stereotype.Service;
18 19 import org.springframework.beans.factory.annotation.Autowired;
19 20  
20 21 import com.bsth.data.BasicData;
  22 +import com.bsth.entity.excep.Outbound;
21 23 import com.bsth.entity.excep.Speeding;
22 24 import com.bsth.service.excep.SpeedingService;
  25 +import com.bsth.service.gps.entity.GpsSpeed;
23 26 import com.bsth.util.EchartConver;
24 27 import com.bsth.util.PageHelper;
25 28 import com.bsth.util.PageObject;
... ... @@ -40,24 +43,17 @@ public class SpeedingServiceImpl implements SpeedingService {
40 43 ResultSet rs = null;
41 44 int page=Integer.parseInt(map.get("page").toString());
42 45 List<Speeding> list=new ArrayList<Speeding>();
43   - String sql="select * from bsth_c_speeding where 1=1 ";
  46 + String sql="select * from bsth_c_speedingmh where 1=1 ";
44 47 Object line=map.get("line");
45   - Object nbbm=map.get("nbbm");
46 48 Object updown=map.get("updown");
47 49 Object startDate=map.get("startDate");
48 50 Object endDate=map.get("endDate");
  51 + Object times=map.get("times");
49 52  
50 53 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
51 54 if(line!=null){
52 55 sql +=" and line like'%"+line.toString().trim()+"%'";
53 56 }
54   -
55   - if(nbbm!=null){
56   - nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
57   - if(nbbm!=null)
58   - sql +=" and vehicle like '%"+nbbm.toString()+"%'";
59   - }
60   -
61 57 if(updown!=null){
62 58 sql +="and up_down like '%"+updown.toString()+"%'";
63 59 }
... ... @@ -65,41 +61,42 @@ public class SpeedingServiceImpl implements SpeedingService {
65 61 if (startDate.toString().length()>0) {
66 62 try {
67 63 Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
68   - sql += " and timestamp >="+t1;
  64 + sql += " and startTimestamp >="+t1;
69 65 } catch (ParseException e) {
70 66 e.printStackTrace();
71 67 }
72 68 }
73   -
74 69 }
75 70 if(endDate!=null){
76 71 if (endDate.toString().length()>0) {
77 72 try {
78 73 Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
79   - sql += " and timestamp <="+t2;
  74 + sql += " and endTimestamp <="+t2;
80 75 } catch (ParseException e) {
81 76 e.printStackTrace();
82 77 }
83 78 }
84 79  
85 80 }
86   -
87   - /*sql +=" order by id limit ?,?";*/
88 81  
  82 + if(times!=null && times.toString().length()>0){
  83 + sql +=" and (endTimestamp-startTimestamp) >="+Integer.valueOf(times.toString())*1000;
  84 + }
  85 +
  86 + sql +=" order by startTimestamp limit ?,?";
89 87  
90 88 try {
91 89 conn = DBUtils_MS.getConnection();
92 90 ps = conn.prepareStatement(sql);
93   - /* ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
  91 + ps.setInt(1, page*10); // O-最大条数 -- M-起始条数
94 92 ps.setInt(2, 10); // O-最小条数 -- M-显示条数
95   -*/ rs = ps.executeQuery();
  93 + rs = ps.executeQuery();
96 94 list = resultSet2Set(rs);
97 95 } catch (SQLException e) {
98 96 e.printStackTrace();
99 97 }finally {
100 98 DBUtils_MS.close(rs, ps, conn);
101 99 }
102   -
103 100 return list;
104 101 }
105 102  
... ... @@ -107,25 +104,27 @@ public class SpeedingServiceImpl implements SpeedingService {
107 104 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
108 105 List<Speeding> list=new ArrayList<Speeding>();
109 106 Speeding speeding;
110   - Float lon, lat;
111 107 Location location;
112 108 while(rs.next()){
113   - lon = rs.getFloat("lon");
114   - lat = rs.getFloat("lat");
115   - location = TransGPS.LocationMake(lon, lat);
116   - location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
117 109 speeding=new Speeding();
118   - speeding.setId(Integer.valueOf(rs.getObject("id").toString()));
119   - speeding.setLon((float)location.getLng());
120   - speeding.setLat((float)location.getLat());
121   - speeding.setLine(Integer.valueOf(rs.getObject("line").toString()));
  110 + speeding.setId(rs.getInt("id"));
  111 + speeding.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString()));
  112 + speeding.setLine(rs.getInt("line"));
122 113 //run 时注解
123 114 speeding.setLineName(BasicData.lineCode2NameMap.get(speeding.getLine().toString()));
124   - speeding.setSpeed(Float.valueOf(rs.getObject("speed").toString()));
125   - speeding.setTimestamp((Long.valueOf(rs.getObject("timestamp").toString())));
  115 + speeding.setLineId(BasicData.lineId2CodeMap.inverse().get(speeding.getLine().toString()));
  116 + speeding.setUpDown(rs.getInt("up_down"));
  117 + //将gps的经纬度转成百度的经纬度
  118 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(rs.getFloat("startLon"), rs.getFloat("startLat"))));
  119 + speeding.setLon((float)location.getLng());
  120 + speeding.setLat((float)location.getLat());
  121 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(rs.getFloat("endLon"), rs.getFloat("endLat"))));
  122 + speeding.setEndlon((float)location.getLng());
  123 + speeding.setEndlat((float)location.getLat());
  124 + speeding.setTimestamp((Long.valueOf(rs.getObject("startTimestamp").toString())));
126 125 speeding.setTimestampDate(sdf.format(new Date(speeding.getTimestamp())));
127   - speeding.setUpDown(Integer.valueOf(rs.getObject("up_down").toString()));
128   - speeding.setVehicle(BasicData.deviceId2NbbmMap.get(rs.getObject("vehicle").toString()));
  126 + speeding.setEndtimestamp((Long.valueOf(rs.getObject("endTimestamp").toString())));
  127 + speeding.setEndtimestampDate(sdf.format(new Date(speeding.getEndtimestamp())));
129 128 list.add(speeding);
130 129 }
131 130 return list;
... ... @@ -133,52 +132,49 @@ public class SpeedingServiceImpl implements SpeedingService {
133 132  
134 133 @Override
135 134 public PageObject<Speeding> Pagequery(Map<String, Object> map) {
136   -/* String sql="select count(*) record from bsth_c_speeding where 1=1 ";
  135 + String sql="select count(*) record from bsth_c_speedingmh where 1=1 ";
  136 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
137 137 Object line=map.get("line");
138   - Object nbbm=map.get("nbbm");
139 138 Object updown=map.get("updown");
140 139 Object startDate=map.get("startDate");
141 140 Object endDate=map.get("endDate");
  141 + Object times=map.get("times");
142 142  
143 143 if(line!=null){
144 144 sql +=" and line like'%"+line.toString().trim()+"%'";
145 145 }
146   -
147   - if(nbbm!=null){
148   - nbbm=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
149   - if(nbbm!=null)
150   - sql +=" and vehicle like '%"+nbbm.toString()+"%'";
151   - }
152 146 if(updown!=null){
153 147 sql +="and up_down like '%"+updown.toString()+"%'";
154 148 }
155 149 if(startDate!=null){
156 150 if (startDate.toString().length()>0) {
157 151 try {
158   - Long t1=sdf.parse(startDate.toString()+" 00:00:00").getTime();
159   - sql += " and timestamp >="+t1;
  152 + Long t1 = sdf.parse(startDate.toString()+" 00:00:00").getTime();
  153 + sql += " and startTimestamp >="+t1;
160 154 } catch (ParseException e) {
161 155 e.printStackTrace();
162 156 }
163 157 }
164   -
165 158 }
166 159 if(endDate!=null){
167 160 if (endDate.toString().length()>0) {
168 161 try {
169 162 Long t2=sdf.parse(endDate.toString()+" 23:59:59").getTime();
170   - sql += " and timestamp <="+t2;
  163 + sql += " and endTimestamp <="+t2;
171 164 } catch (ParseException e) {
172 165 e.printStackTrace();
173 166 }
174 167 }
175   -
176 168 }
  169 +
  170 + if(times!=null && times.toString().length()>0){
  171 + sql +=" and (endTimestamp-startTimestamp) >="+Integer.valueOf(times.toString())*1000;
  172 + }
  173 +
177 174 Connection conn = null;
178 175 PreparedStatement ps = null;
179 176 ResultSet rs = null;
180 177 int totalData = 0;
181   -
182 178 try {
183 179 conn = DBUtils_MS.getConnection();
184 180 ps = conn.prepareStatement(sql);
... ... @@ -190,93 +186,14 @@ public class SpeedingServiceImpl implements SpeedingService {
190 186 e.printStackTrace();
191 187 }finally {
192 188 DBUtils_MS.close(rs, ps, conn);
193   - }*/
194   -
195   - //时间转换
196   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
197   - List<Speeding> list=findAll(map);
198   - List<Speeding> listResult = new ArrayList<Speeding>();
199   - int curPage;//页码
200   - int pageData;//每页的记录条数
201   - int start;//起始数据下标
202   - int totalPage;//总页数
203   - int totalData = 0;
204   - if(list.size()>1){
205   - Speeding speedingNow;//下标为i的车辆行驶记录
206   - Speeding speedingLast;//下标为i-1的车辆行驶记录
207   - Speeding spped = null;//整合后的车辆行驶记录
208   - String strNow;
209   - String strLast;
210   - boolean Flag = false;//判断是否有连续超速记录,默认没有
211   - for(int i = 1;i<list.size();i++){
212   - speedingNow = list.get(i);
213   - speedingLast = list.get(i-1);
214   - strNow = speedingNow.getVehicle()+speedingNow.getLine()+speedingNow.getUpDown();
215   - strLast = speedingLast.getVehicle()+speedingLast.getLine()+speedingLast.getUpDown();
216   - if(speedingNow.getSpeed()>60 && speedingLast.getSpeed()>60 && strNow.equals(strLast)){//如果两条连续的记录都是超速且属于同一辆车。
217   - if(Flag==false){//
218   - spped = new Speeding();
219   - spped.setId(speedingLast.getId());//设置连续超速记录Id
220   - spped.setLine(speedingLast.getLine());//设置连续超速记录线路
221   - spped.setLineName(speedingLast.getLineName());//设置连续超速记录线路名称
222   - spped.setVehicle(speedingLast.getVehicle());//设置连续超速记录的车辆编号
223   - spped.setUpDown(speedingLast.getUpDown());//设置上下行
224   - spped.setLon(speedingLast.getLon());//设置开始时经度
225   - spped.setLat(speedingLast.getLat());//设置开始时纬度
226   - spped.setTimestamp(speedingLast.getTimestamp());//设置连续超速记录的开始时间
227   - spped.setTimestampDate(speedingLast.getTimestampDate());//设置连续超速记录的开始时间戳
228   - }
229   - spped.setEndtimestamp(speedingNow.getTimestamp());//设置结束时间戳
230   - spped.setEndtimestampDate(sdf.format(new Date(speedingNow.getTimestamp())));//设置结束时间
231   - spped.setEndlon(speedingNow.getLon());//设置结束时的经度
232   - spped.setEndlat(speedingNow.getLat());//设置结束时的纬度
233   - Flag = true;
234   - }else{
235   - if(Flag){//如果上一条记录超速。
236   - listResult.add(spped);
237   - Flag = false;
238   - }
239   - }
240   - }
241   - Iterator<Speeding> speedIt = listResult.iterator();
242   - while(speedIt.hasNext()){
243   - Speeding speeding = speedIt.next();
244   - if(speeding.getEndtimestamp()-speeding.getTimestamp()<=1000){
245   - speedIt.remove();
246   - }
247   - }
248   -
249   - totalData = listResult.size();//总记录条数。
250   - if(map.get("curPage") == null || map.get("curPage").equals("0")){
251   - curPage = 0;
252   - }else{
253   - curPage = Integer.parseInt((String) map.get("curPage"));
254   - }
255   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
256   - start = (curPage - 0) * pageData; //起始记录下标。
257   - totalPage = totalData % pageData == 0 ? totalData / pageData : totalData / pageData +1;//总页数
258   - if(curPage == totalPage-1){//如果当前页等于总页数。
259   - listResult = listResult.subList(start, totalData);
260   - }else{
261   - listResult = listResult.subList(start, start+pageData);
262   - }
263   - }else{
264   - curPage = 1;
265   - pageData = Integer.parseInt((String) map.get("pageData"));//每页的记录条数
266   - totalPage =1;
267 189 }
268   - Map<String,Object> paramMap = new HashMap<String,Object>();
269   - paramMap.put("totalPage", totalPage);
270   - paramMap.put("curPage", curPage);
271   - paramMap.put("pageData", pageData);
272   - PageHelper pageHelper = new PageHelper(totalData, paramMap);
273   - pageHelper.getMap();
  190 + PageHelper pageHelper = new PageHelper(totalData, map);
  191 + List<Speeding> list=findAll(pageHelper.getMap());
274 192 PageObject<Speeding> pageObject = pageHelper.getPageObject();
275   - pageObject.setDataList(listResult);
  193 + pageObject.setDataList(list);
276 194 return pageObject;
277 195 }
278 196  
279   -
280 197 @Override
281 198 public Map<String, Object> getReport(Map<String, Object> map) {
282 199 String chartStr = "";
... ... @@ -393,5 +310,46 @@ public class SpeedingServiceImpl implements SpeedingService {
393 310 }
394 311  
395 312  
  313 + @Override
  314 + public List<Speeding> findPosition(String deviceid, String startdate,
  315 + String enddate){
  316 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  317 + String sql = "select id,vehicle,line,up_down,lon,lat,speed,timestamp from bsth_c_speeding where vehicle = ? and timestamp >= ? and timestamp <= ? order by timestamp ";
  318 + Connection conn = null;
  319 + PreparedStatement ps = null;
  320 + ResultSet rs = null;
  321 + List<Speeding> listResult = new ArrayList<Speeding>();
  322 + Speeding speed = null;
  323 + try {
  324 + conn = DBUtils_MS.getConnection();
  325 + ps = conn.prepareStatement(sql);
  326 + long startTime = sdf.parse(startdate).getTime();
  327 + long endTime = sdf.parse(enddate).getTime();
  328 + ps.setString(1, deviceid);
  329 + ps.setLong(2,startTime);
  330 + ps.setLong(3,endTime);
  331 + rs = ps.executeQuery();
  332 + Location location;
  333 + while (rs.next()) {
  334 + speed = new Speeding();
  335 + speed.setVehicle(rs.getString("vehicle"));
  336 + location = TransGPS.LocationMake(rs.getFloat("lon"), rs.getFloat("lat"));
  337 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location));
  338 + speed.setLon((float)location.getLng());
  339 + speed.setLat((float)location.getLat());
  340 + speed.setSpeed(rs.getFloat("speed"));
  341 + speed.setTimestamp(rs.getLong("timestamp"));
  342 + // 上下行
  343 + listResult.add(speed);
  344 + }
  345 + } catch (Exception e) {
  346 + e.printStackTrace();
  347 + } finally {
  348 + DBUtils_MS.close(rs, ps, conn);
  349 + }
  350 + return listResult;
  351 +
  352 + }
  353 +
396 354  
397 355 }
... ...
src/main/resources/fatso/start.js
... ... @@ -16,7 +16,7 @@ var platform = process.platform;
16 16 var iswin = platform=='win32';
17 17 var separator = platform=='win32'?'\\':'/';
18 18 //不参与的目录
19   -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+separator+'authorize_all']
  19 +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+separator+'authorize_all', 'summary']
20 20 ,ep = new EventProxy()
21 21 ,pName = 'bsth_control'
22 22 ,path = process.cwd()
... ...
src/main/resources/static/pages/excep/boundList.html
... ... @@ -262,8 +262,8 @@ $(function(){
262 262 }
263 263 }
264 264 });
265   - page = num - 1;
266   - jsDoQuery(params, false);
  265 + page = num - 1;
  266 + jsDoQuery(params, false);
267 267 }
268 268 });
269 269 }
... ...
src/main/resources/static/pages/excep/js/speeding-map.js
... ... @@ -3,33 +3,23 @@
3 3 *
4 4 * - - - - - -》init:地图初始化
5 5 *
6   - * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据
7   - *
8 6 * - - - - - -》getDistanceAndDuration:获取距离与时间
9 7 *
10   - * - - - - - -》pointsPolygon:地图画多边行
11   - *
12   - * - - - - - -》pointsCircle:画圆
13   - *
14   - * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标
15   - *
16 8 * - - - - - -》drawingUpline:在地图上画出上行线路走向
17 9 *
18   - * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划)
19   - *
20   - * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划)
21   - *
22   - * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划)
  10 + * - - - - - -》stationsPointsToLibraryPoint:根据站点坐标匹配库中的公交站点(手动规划)
23 11 */
24 12  
25 13 var SpeedingMap = function () {
26 14  
27   - /** WorldsBMap 全局变量定义 mapBValue:地图对象;polygon:多边形;polyUpline:走向折线;circle:圆 *//*
28   - var mapBValue = '';polygon='',polyUpline='',circle='',iseditStatus = false;*/
  15 + /** SpeedingMap 全局变量定义 mapBValue:地图对象;polyUpline:走向折线;sectionList:截取过的路段 ;pointIndex:计算路段被切的次数;
  16 + * firstPoint:截取路段的第一个点;iseditStatus:路段是否在编辑状态;isCutSection : 获取路段是否在截取状态*/
  17 + var mapBValue = '', polyUpline='', sectionList = [], pointIndex = 0, iseditStatus = false, firstPoint = {}, isCutSection = false;
29 18  
30 19 var Bmap = {
31 20  
32 21 init : function() {
  22 +
33 23 // 设置中心点,
34 24 var CENTER_POINT = {lng : 121.528733,lat : 31.237425};
35 25  
... ... @@ -40,7 +30,7 @@ var SpeedingMap = function () {
40 30 mapBValue = new BMap.Map("speedingMap");
41 31  
42 32 //中心点和缩放级别
43   - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15);
  33 + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat),15);
44 34  
45 35 //启用地图拖拽事件,默认启用(可不写)
46 36 mapBValue.enableDragging();
... ... @@ -56,7 +46,10 @@ var SpeedingMap = function () {
56 46  
57 47 return mapBValue;
58 48 },
59   -
  49 + /** 获取第一个切路段的点 @return Point*/
  50 + getFirstPoint : function() {
  51 + return firstPoint;
  52 + },
60 53 /** 获取地图对象 @return 地图对象map */
61 54 getmapBValue : function() {
62 55  
... ... @@ -64,10 +57,337 @@ var SpeedingMap = function () {
64 57  
65 58 },
66 59  
67   - /* drawTravelRoute:function(data){
68   - var driving = Bmap.DrivingRoute(map, {renderOptions:{map: map}})
  60 + getPolyUpline : function() {
  61 +
  62 + return polyUpline;
  63 + },
  64 +
  65 + /** 获取截取过的路段 @return 路段对象List */
  66 + getSectionList : function() {
  67 +
  68 + return sectionList;
  69 +
  70 + },
  71 + setSectionList : function(list) {
  72 +
  73 + sectionList = list;
  74 + },
  75 + initCutSectionPoint : function() {
  76 + sectionList = [];
  77 + var tbodyHtml = template('section_list',{list : sectionList});
  78 + $('#section_table tbody').html(tbodyHtml);
  79 + },
  80 + /** 获取切路段的点下标 @return int*/
  81 + setPointIndex : function(index) {
  82 + pointIndex = index;
  83 + },
  84 + getPointIndex : function() {
  85 +
  86 + return pointIndex;
  87 +
  88 + },
  89 + /** 获取路段是否在编辑状态 @return boolean*/
  90 + getIsEditStatus : function() {
  91 + return iseditStatus;
  92 + },
  93 + setIsEditStatus : function(v) {
  94 + iseditStatus = v ;
  95 + },
  96 +
  97 + /** 获取路段是否在截取状态 @return boolean*/
  98 + getIsCutSection : function() {
  99 + return isCutSection;
  100 + },
  101 + setIsCutSection : function(v) {
  102 + isCutSection = v ;
  103 + },
  104 +
  105 + /** 获取距离与时间 @param <points:坐标点集合> */
  106 + getDistanceAndDuration : function(points,callback){
  107 +
  108 + // 获取长度
  109 + var len = points.length;
  110 + (function(){
  111 +
  112 + if (!arguments.callee.count) {
  113 +
  114 + arguments.callee.count = 0;
  115 +
  116 + }
  117 +
  118 + arguments.callee.count++;
  119 +
  120 + var index = parseInt(arguments.callee.count) - 1;
  121 +
  122 + if (index >= len-1) {
  123 +
  124 + callback && callback(points);
  125 +
  126 + return;
  127 + }
  128 +
  129 + // 当函数被调用时,它的arguments.callee对象就会指向自身,也就是一个对自己的引用。(当前正在执行的函数。)
  130 + var f = arguments.callee;
  131 + // 起点坐标 <坐标格式:40.056878,116.30815>
  132 + var origin = points[index].potion.lat + ',' + points[index].potion.lng;
  133 +
  134 + // 终点坐标 <坐标格式:40.056878,116.30815>
  135 + var destination = points[index+1].potion.lat + ',' + points[index+1].potion.lng;
  136 + var region = '上海';
  137 +
  138 + var origin_region = '上海';
  139 +
  140 + var destination_region = '上海';
  141 +
  142 + var output = 'json';
  143 +
  144 + var ak_My = 'wjlITmXeCek5MxyU3ZUBkTeU8B0o0npk';
  145 +
  146 + /**
  147 + * origin:起点名称或经纬度;
  148 + *
  149 + * destination:终点名称或经纬度;
  150 + *
  151 + * origin_region:起始点所在城市,驾车导航时必填。
  152 + *
  153 + * destination_region:终点所在城市,驾车导航时必填。
  154 + *
  155 + * output :表示输出类型,可设置为xml或json,默认为xml。
  156 + *
  157 + **/
  158 + var paramsB = {origin:origin,destination:destination,region:region,origin_region:origin_region,destination_region:destination_region,output:output,ak:ak_My};
  159 +
  160 + /** @description :未认证开发者默认配额为:2000次/天。 */
  161 + $.ajax({
  162 +
  163 + // 百度地图根据坐标获取两点之间的时间与距离
  164 + url: 'http://api.map.baidu.com/direction/v1?mode=transit',
  165 +
  166 + data: paramsB,
  167 +
  168 + dataType: 'jsonp',
  169 +
  170 + success: function(r){
  171 +
  172 + if(r) {
  173 +
  174 + if(r.message=='ok') {
  175 +
  176 + if(r.result.taxi==null) {
  177 +
  178 + // 获取距离(单位:米)
  179 + points[index+1].distance = 0;
  180 +
  181 + // 获取时间(单位:秒)
  182 + points[index+1].duration = 0;
  183 +
  184 + }else {
  185 +
  186 + // 获取距离(单位:米)
  187 + points[index+1].distance = r.result.taxi.distance;
  188 +
  189 + // 获取时间(单位:秒)
  190 + points[index+1].duration = r.result.taxi.duration;
  191 +
  192 + }
  193 +
  194 +
  195 + }
  196 +
  197 + }
  198 +
  199 + f();
  200 + }
  201 + });
  202 +
  203 + })();
  204 +
  205 + },
  206 + // 在地图上画出上行线路走向
  207 + drawingUpline01 : function (polylineArray,polyline_center,data) {
  208 + var polyUpline01 = 'polyline' + '_' + data.sectionrouteId;
  209 + // 创建线路走向
  210 + polyUpline01 = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
  211 + polyUpline01.data = data;
  212 + // 把折线添加到地图上
  213 + mapBValue.addOverlay(polyUpline01);
  214 + var sectionPoint = [];
  215 + // 线路单击事件
  216 + polyUpline01.addEventListener('click',function(e) {
  217 + if(SpeedingMap.getIsEditStatus()) {
  218 + layer.msg('请先保存正在编辑的路段信息...');
  219 + return false;
  220 + }
  221 + if(SpeedingMap.getIsCutSection()) {
  222 + layer.msg('请先撤销所有切路段的点...');
  223 + return false;
  224 + }
  225 + polyUpline01.enableEditing();
  226 + SpeedingMap.setIsEditStatus(true);
  227 + });
  228 +
  229 + // 添加路段双击事件
  230 + polyUpline01.addEventListener("dblclick",function(e){
  231 + if(SpeedingMap.getIsCutSection()) {
  232 + layer.msg('请先撤销所有切路段的点...');
  233 + return false;
  234 + }
  235 + SpeedingMap.setIsEditStatus(false);
  236 + // 关闭
  237 + layer.closeAll();
  238 + polyUpline01.disableEditing();
  239 + EditSectionObj.setEitdSection(polyUpline01.data);
  240 + // 获取折线坐标集合
  241 + var editPloyLineArray = polyUpline01.getPath();
  242 + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
  243 + sectionList = [];
  244 + var tbodyHtml = template('section_list',{list : sectionList});
  245 + // 截取路段
  246 + $('#section_table tbody').html(tbodyHtml);
  247 + // 加载修改路段弹出层mobal页面
  248 + $.get('editsection.html', function(m){
  249 + $(pjaxContainer).append(m);
  250 + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [SpeedingMap,GetAjaxData,EditSectionObj,PublicFunctions]);
  251 + });
  252 + });
  253 +
  254 + // 路段右击事件
  255 + var editSection = function(e,ee,marker){
  256 + if(SpeedingMap.getIsEditStatus()) {
  257 + layer.msg('请先保存正在编辑的路段信息...');
  258 + return false;
  259 + }
  260 + var lng = e.lng;
  261 + var lat = e.lat;
  262 + var sectionName = null;
  263 + var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点
  264 + marker.isFlag = true;
  265 + if(pointIndex == 0) {
  266 + sectionPoint[pointIndex] = {lng:lng , lat:lat};
  267 + layer.msg('进入切路段状态,请选择本路段的终点!');
  268 + mapBValue.addOverlay(marker);// 添加覆盖物
  269 + firstPoint = {lng:lng, lat:lat};
  270 + pointIndex++;
  271 + EditSectionObj.setEitdSection(polyUpline01.data);
  272 + // 获取折线坐标集合
  273 + var editPloyLineArray = polyUpline01.getPath();
  274 + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray));
  275 + } else if (pointIndex > 0) {
  276 + layer.prompt({title: '请输入路段名!'}, function(sectionName, index){
  277 + pointList = [];
  278 + sectionPoint[pointIndex] = {lng:lng , lat:lat};
  279 + pointList[0] = sectionPoint[pointIndex-1];
  280 + pointList[1] = sectionPoint[pointIndex];
  281 + sectionList.push({name:sectionName, section:pointList});
  282 + layer.close(index);
  283 + layer.msg('路段截取成功,请选择下一个路段的终点');
  284 + mapBValue.addOverlay(marker);// 添加覆盖物
  285 + var tbodyHtml = template('section_list',{list : sectionList});
  286 + // 截取路段
  287 + $('#section_table tbody').html(tbodyHtml);
  288 + pointIndex++;
  289 + });
  290 + }
  291 + SpeedingMap.setIsCutSection(true);
  292 + }
  293 + var markerMenu=new BMap.ContextMenu();
  294 + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01)));
  295 + polyUpline01.addContextMenu(markerMenu);
  296 +
  297 +
  298 + var PanOptions_ ={noAnimation :true};
  299 + mapBValue.reset();
  300 + mapBValue.panTo(polyline_center,PanOptions_);
  301 + mapBValue.panBy(500,-510,PanOptions_);
  302 + mapBValue.setZoom(14);
  303 + },
  304 + // 删除点刷新cutSectionTable
  305 + refreshCutSectionTable : function() {
  306 + var tbodyHtml = template('section_list',{list : sectionList});
  307 + $('#section_table tbody').html(tbodyHtml);
  308 + },
  309 + // 删除点刷新覆盖物
  310 + deleteCutSectionPoint : function(point) {
  311 + var lng = point.lng;
  312 + var lat = point.lat;
  313 + var allOverlay = mapBValue.getOverlays();
  314 + // 删除最后一个点
  315 + for (var i = 0; i < allOverlay.length -1; i++){
  316 + if(allOverlay[i].isFlag) {
  317 + if(allOverlay[i].point.lng == lng && allOverlay[i].point.lat == lat){
  318 + mapBValue.removeOverlay(allOverlay[i]);
  319 + break;
  320 + }
  321 + }
  322 + }
  323 + },
  324 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  325 + drawingUpStationPoint : function(point_center,stationName,s) {
  326 +
  327 + // 自定义标注物图片
  328 + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/gjzd.png',new BMap.Size(10, 10));
  329 +
  330 + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
  331 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  332 + + '</div>'
  333 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">'+ s+'</span>'+ stationName+'</label>';
  334 +
  335 +
  336 + var myRichMarker1 = new BMapLib.RichMarker(html2, point_center,{
  337 + "anchor" : new BMap.Size(-10,8),
  338 + "enableDragging" : true});
  339 +
  340 +
  341 + myRichMarker1.disableDragging();
  342 + mapBValue.addOverlay(myRichMarker1);
  343 +
  344 +
  345 + // 创建标注物
  346 + marker = new BMap.Marker(point_center,{icon : icon_target});
  347 +
  348 + // 允许覆盖物在map.clearOverlays方法中被清除。
  349 + marker.enableMassClear();
  350 +
  351 + mapBValue.addOverlay(marker);
  352 + },
  353 +
  354 + // 根据站点坐标匹配库中的公交站点(手动规划)
  355 + stationsPointsToLibraryPoint : function(arra,callback) {
  356 + // 获取长度
  357 + var len = arra.length;
  358 + var station = {};
  359 + var stationList = [];
  360 + (function(){
  361 + if (!arguments.callee.count) {
  362 + arguments.callee.count = 0;
  363 + }
  364 + arguments.callee.count++;
  365 + var index = parseInt(arguments.callee.count) - 1;
  366 + if (index >= len) {
  367 + callback && callback(stationList);
  368 + return ;
  369 + }
  370 + var f = arguments.callee;
  371 + station = arra[index];
  372 + if(arra[index].name!=''){
  373 +
  374 + $.get('/station/matchStation',station,function(resultStation) {
  375 + stationList.push({name:resultStation.name ,wgs:arra[index].wgs,potion:{lng:resultStation.potion_lng, lat:resultStation.potion_lat}, isHave:resultStation.isHave , id:resultStation.id});
  376 + f();
  377 + });
  378 + }else {
  379 + f();
  380 + }
  381 + })()
  382 + },
  383 + clearMarkAndOverlays : function() {
  384 +
  385 + // 清楚地图覆盖物
  386 + mapBValue.clearOverlays();
  387 +
  388 + mapBValue.removeOverlay();
69 389  
70   - }*/
  390 + }
71 391  
72 392 }
73 393  
... ...
src/main/resources/static/pages/excep/speedingListmh.html
... ... @@ -59,15 +59,16 @@
59 59 <option value="1">下行</option>
60 60 <option value="-1">无效</option>
61 61 </select>
62   - </td>
  62 + </td>
63 63 <td>
64 64 <input class="form-control" type="date" name="startDate" />
65   - -
66   - <input class="form-control" type="date" name="endDate" />
67 65 </td>
68 66 <td>
  67 + <input class="form-control" type="date" name="endDate" />
69 68 </td>
70 69 <td>
  70 + >=<input class="form-control" type="text" name="times" style="width:50px;display:inline!important"
  71 + onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"/>
71 72 </td>
72 73 <td>
73 74 </td>
... ... @@ -104,9 +105,9 @@
104 105 {{obj.vehicle}}
105 106 </td>
106 107 <td>
107   - {{if obj.up_down==0}}
  108 + {{if obj.upDown==0}}
108 109 上行
109   - {{else if obj.up_down==1}}
  110 + {{else if obj.upDown==1}}
110 111 下行
111 112 {{else}}
112 113 无效
... ... @@ -124,9 +125,9 @@
124 125 <td>
125 126 <a class="btn default blue-stripe btn-sm lookTrajectory" data-vehicle ="{{obj.vehicle}}"
126 127 data-startdate="{{obj.timestampDate}}" data-enddate="{{obj.endtimestampDate}}"
127   - data-lon="{{obj.lon}}" data-lat="{{obj.lat}}"
128   - data-endlon="{{obj.endlon}}" data-endlat="{{obj.endlat}}" >
129   - 查看轨迹
  128 + data-lon="{{obj.lon}}" data-lat="{{obj.lat}}" data-endlon="{{obj.endlon}}"
  129 + data-endlat="{{obj.endlat}}" data-lineid="{{obj.lineId}}" data-updown="{{obj.upDown}}">
  130 + 查看轨迹
130 131 </a>
131 132 </td>
132 133 <td>
... ... @@ -163,7 +164,7 @@ $(function(){
163 164 var parameter = new Object();
164 165 parameter.endDate = $("input[name='endDate']")[0].value;
165 166 parameter.startDate = $("input[name='startDate']")[0].value;
166   -
  167 + jsDoQuery(parameter, true);
167 168 //搜索线路
168 169 $.get('/basic/lineCode2Name',function(result){
169 170 var data=[];
... ... @@ -171,11 +172,7 @@ $(function(){
171 172 for(var code in result){
172 173 data.push({id: code, text: result[code]});
173 174 }
174   - initPinYinSelect2($('#line'),data,function(ldmcSelector) {
175   - ldmcSelector.select2("val",data[1].id);//因为数据量太大,所以默认一条线路作为查询参数
176   - });
177   - parameter.line = data[1].id;
178   - jsDoQuery(parameter,true);
  175 + initPinYinSelect2('#line',data,'');
179 176 });
180 177  
181 178 //时间戳转换为年月日
... ... @@ -222,12 +219,12 @@ $(function(){
222 219 params['order'] = 'lastLoginDate';
223 220 params['page'] = page;
224 221 var i = layer.load(2);
225   - $.get('/gps/pagequery' ,params, function(data){
226   - var bodyHtm = template('speeding_list_temp', {list: data.list});
  222 + $get('/speeding/pagequery' ,params, function(data){
  223 + var bodyHtm = template('speeding_list_temp', {list: data.dataList});
227 224 $('#datatable_speeding tbody').html(bodyHtm)
228 225 .find('.icheck').iCheck(icheckOptions)
229 226 .on('ifChanged', iCheckChange);
230   - if(pagination){
  227 + if(pagination && data.dataList.length > 0){
231 228 //重新分页
232 229 initPagination = true;
233 230 showPagination(data);
... ... @@ -241,8 +238,10 @@ $(function(){
241 238 var lat = $(this).data('lat');
242 239 var endLon = $(this).data('endlon');
243 240 var endLat = $(this).data('endlat');
  241 + var lineid = $(this).data('lineid');
  242 + var upDown = $(this).data('updown');
244 243 var storage = window.localStorage;
245   - storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat);
  244 + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown);
246 245 $.get('/pages/excep/speedingMap.html?',function (result) {
247 246 layer.open({
248 247 type: 1,
... ... @@ -288,25 +287,24 @@ $(function(){
288 287 initPagination = false;
289 288 return;
290 289 }
291   - page = num - 1;
292 290 var cells = $('tr.filter')[0].cells
293 291 ,params = {}
294 292 ,name;
295   - $.each(cells, function(i, cell){
296   - var items = $('input,select', cell);
297   - for(var j = 0, item; item = items[j++];){
298   - name = $(item).attr('name');
299   - if(name){
300   - params[name] = $(item).val();
301   - }
  293 + $.each(cells, function(i, cell){
  294 + var items = $('input,select', cell);
  295 + for(var j = 0, item; item = items[j++];){
  296 + name = $(item).attr('name');
  297 + if(name){
  298 + params[name] = $(item).val();
302 299 }
303   - });
304   - jsDoQuery(params, false);
  300 + }
  301 + });
  302 + page = num - 1;
  303 + jsDoQuery(params, false);
305 304 }
306 305 });
307 306 }
308 307  
309   -
310 308 //删除
311 309 $('#removeButton').on('click', function(){
312 310 if($(this).attr('disabled'))
... ... @@ -334,7 +332,6 @@ $(&#39;#nbbm&#39;).select2({
334 332 xlbm:$('#line').val()};
335 333 },
336 334 processResults: function (data) {
337   - console.log(data);
338 335 return {
339 336 results: data
340 337 };
... ...
src/main/resources/static/pages/excep/speedingMap.html
... ... @@ -20,6 +20,8 @@
20 20 }
21 21 </style>
22 22 <script type="text/javascript" src="/pages/excep/js/speeding-map.js"></script>
  23 +<script type="text/javascript" src="/pages/excep/js/line-list-function.js"></script>
  24 +
23 25 <script type="text/javascript">
24 26 $(function(){
25 27 var dataArr = window.localStorage.zbhAndDate.split(",");//获取页面传递过来的车辆自编号以及超速起始时间和超速结束时间
... ... @@ -30,13 +32,15 @@ $(function(){
30 32 var lat = dataArr[4];//起点纬度
31 33 var endLon = dataArr[5];//终点经度
32 34 var endLat = dataArr[6];//终点纬度
  35 + var lineid = dataArr[7];
  36 + var directionData = dataArr[8];
33 37 var pointObj;//坐标和速度组成的对象
34 38 var Points = [];//坐标和速度对象的集合
35 39 var coordinateArr = [];//坐标点数组
36 40 $.ajax({
37 41 type: "GET",
38 42 async:false,
39   - url: '/gps/findPosition',
  43 + url: '/speeding/findPosition',
40 44 data: {vehicle:vehicle,startdate:startdate,enddate:enddate},
41 45 success: function(data){
42 46 $.each(data,function(i,item){
... ... @@ -44,6 +48,7 @@ $(function(){
44 48 pointObj = new Object();
45 49 pointObj.coordinate = new BMap.Point(item.lon,item.lat);
46 50 pointObj.speed = item.speed;
  51 + pointObj.vehicle = item.vehicle;
47 52 Points.push(pointObj);
48 53 }
49 54 });
... ... @@ -51,38 +56,44 @@ $(function(){
51 56 });
52 57 setTimeout(function(){
53 58 var map = SpeedingMap.init();//创建地图
  59 + $get('/sectionroute/findSection',{'line.id_eq' : lineid , 'directions_eq' :directionData},function(data) {
  60 + // 在地图上画出线路走向
  61 + PublicFunctions.linePanlThree(lineid,data,directionData);
  62 + });
54 63 var myP1 = new BMap.Point(lon,lat); //起点
55 64 var myP2 = new BMap.Point(endLon,endLat); //终点
56   - var centerLon = (parseFloat(lon)+parseFloat(endLon))/2;
  65 +/* var centerLon = (parseFloat(lon)+parseFloat(endLon))/2;
57 66 var centerLat = (parseFloat(lat)+parseFloat(endLat))/2;
58   - map.centerAndZoom(new BMap.Point(centerLon,centerLat),18);//地图中心点坐标
59   -
  67 + map.centerAndZoom(new BMap.Point(centerLon,centerLat),18);//地图中心点坐标 */
60 68 for(i in Points){
61 69 coordinateArr.push(Points[i].coordinate);
62 70 }
63   - var polyline = new BMap.Polyline(coordinateArr, {strokeColor:"blue", strokeWeight:5, strokeOpacity:0.5});//创建折线
  71 + var polyline = new BMap.Polyline(coordinateArr, {strokeColor:"red", strokeWeight:5, strokeOpacity:0.5});//创建折线
64 72 var myIcon = new BMap.Icon("/pages/excep/img/bus.png", new BMap.Size(32, 70), {//小车图片
65 73 imageOffset: new BMap.Size(5,20) //图片的偏移量。为了是图片底部中心对准坐标点。
66 74 });
67 75  
  76 + var carMk;
68 77 $(document).on('click', '#run', function() {
69   - map.clearOverlays();//清空上一次的轨迹
  78 + map.centerAndZoom(new BMap.Point(lon,lat),16);//地图中心点坐标 */
  79 + if(typeof(carMk)!="undefined"){
  80 + map.removeOverlay(carMk);//清空上一次的轨迹
  81 + }
  82 + carMk = new BMap.Marker(coordinateArr[0],{icon:myIcon});
70 83 map.addOverlay(polyline);//增加折线
71 84 var paths = coordinateArr.length;//获得有几个点
72   - var carMk = new BMap.Marker(coordinateArr[0],{icon:myIcon});
73 85 map.addOverlay(carMk);
74   - var sContent ="车辆即时速度:"+Points[0].speed;
  86 + var sContent ="车辆编号:"+Points[0].vehicle+"</br>车辆速度:"+Points[0].speed+"km/h";
75 87 var infoWindow = new BMap.InfoWindow(sContent);// 创建信息窗口对象
76 88 map.openInfoWindow(infoWindow,coordinateArr[0]); //开启信息窗口
77 89 i=0;
78   -
79 90 setTimeout(function(){
80 91 resetMkPoint(0);
81 92 },500);
82 93  
83 94 function resetMkPoint(i){
84 95 carMk.setPosition(coordinateArr[i]);
85   - sContent ="车辆即时速度是:"+Points[i].speed;
  96 + sContent ="车辆编号:"+Points[i].vehicle+"</br>车辆速度:"+Points[i].speed+"km/h";
86 97 infoWindow = new BMap.InfoWindow(sContent);// 创建信息窗口对象
87 98 map.openInfoWindow(infoWindow,coordinateArr[i]); //开启信息窗口
88 99 if(i < paths-1){
... ... @@ -91,9 +102,10 @@ $(function(){
91 102 resetMkPoint(i);
92 103 },500);
93 104 }
94   - };
  105 + };
  106 +
95 107 });
96   -}, 500);
  108 + }, 500);
97 109 });
98 110 </script>
99 111  
... ...
src/main/resources/static/pages/permission/authorize_all/authorize.html
... ... @@ -607,7 +607,6 @@
607 607 secondMap[sid].childs.sort(naturalSort);
608 608 }
609 609  
610   - console.log('secondMap', secondMap);
611 610 return secondMap;
612 611 }
613 612  
... ...
src/main/resources/static/pages/summary/work_hours/list.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
  7 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  8 + <!-- flatpickr -->
  9 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css">
  10 + <style>
  11 + html,body{
  12 + height: 100%;
  13 + }
  14 + .ct_page{
  15 + padding: 25px 15px;
  16 + height: 100%;
  17 + height: calc(100% - 50px);
  18 + }
  19 +
  20 + .ct_cont{
  21 + height: calc(100% - 41px);
  22 + }
  23 +
  24 + .ct_cont>div>div.uk-card{
  25 + height: 99%;
  26 + }
  27 +
  28 + .loading{
  29 + height: 100%;
  30 + text-align: center;
  31 + }
  32 + .loading .uk-spinner{
  33 + margin-top: 200px;
  34 + }
  35 + .loading circle{
  36 + stroke: red;
  37 + }
  38 +
  39 + .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{
  40 + opacity: 0.6 !important;
  41 + padding: 0 !important;
  42 + }
  43 +
  44 + .ct_table_wrap.day th:nth-of-type(1),.ct_table_wrap.day td:nth-of-type(1){
  45 + width: 10%;
  46 + }
  47 + .ct_table_wrap.day th:nth-of-type(2),.ct_table_wrap.day td:nth-of-type(2){
  48 + width: 10%;
  49 + }
  50 + .ct_table_wrap.day th:nth-of-type(3),.ct_table_wrap.day td:nth-of-type(3){
  51 + width: 10%;
  52 + }
  53 + .ct_table_wrap.day th:nth-of-type(4),.ct_table_wrap.day td:nth-of-type(4){
  54 + width: 10%;
  55 + }
  56 + .ct_table_wrap.day th:nth-of-type(5),.ct_table_wrap.day td:nth-of-type(5){
  57 + width: 5%;
  58 + }
  59 + .ct_table_wrap.day th:nth-of-type(6),.ct_table_wrap.day td:nth-of-type(6){
  60 + width: 15%;
  61 + }
  62 + .ct_table_wrap.day th:nth-of-type(7),.ct_table_wrap.day td:nth-of-type(7){
  63 + width: 10%;
  64 + }
  65 + .ct_table_wrap.day th:nth-of-type(8),.ct_table_wrap.day td:nth-of-type(8){
  66 + width: 10%;
  67 + }
  68 + .ct_table_wrap.day th:nth-of-type(9),.ct_table_wrap.day td:nth-of-type(9){
  69 + width: 10%;
  70 + }
  71 + .ct_table_wrap.day th:nth-of-type(10),.ct_table_wrap.day td:nth-of-type(10){
  72 + width: 10%;
  73 + }
  74 +
  75 + .ct_search_form_wrap{
  76 + border-bottom: 1px solid #e5e5e5;
  77 + padding: 10px 0 25px 10px;
  78 + }
  79 + .ct_search_form_wrap .ct_field{
  80 + display: inline-block;
  81 + margin: 0 5px;
  82 + }
  83 +
  84 + .ct_search_form_wrap .ct_field label{
  85 + font-size: 14px;
  86 + }
  87 +
  88 + .ct_search_form_wrap .ct_field input{
  89 + width: 110px;
  90 + }
  91 +
  92 + .ct_search_form_wrap .ct_field select{
  93 + width: auto;
  94 + min-width: 100px;
  95 + }
  96 +
  97 + .ct_search_form_wrap .uk-button{
  98 + padding: 0 14px;
  99 + }
  100 +
  101 + .ct_search_form_wrap .uk-button i{
  102 + vertical-align: middle;
  103 + margin-top: -2px;
  104 + margin-right: 7px;
  105 + }
  106 +
  107 + .ct_table_wrap{
  108 + font-size: 14px;
  109 + height: calc(100% - 77px);
  110 + }
  111 +
  112 + .t_body_wrap{
  113 + height: calc(100% - 41px);
  114 + overflow: auto;
  115 + position: relative;
  116 + }
  117 + </style>
  118 +</head>
  119 +
  120 +<body>
  121 +<div class="loading">
  122 + <div uk-spinner></div>
  123 +</div>
  124 +<div class="ct_page" style="display: none;">
  125 + <h2 class="uk-heading-line uk-heading-bullet"><span>工时统计</span></h2>
  126 + <div class="ct_cont" >
  127 + <div class="ct_search_form_wrap">
  128 + <form>
  129 + <div class="ct_field">
  130 + <label>公司:
  131 + <select class="uk-select" name="companyId_eq">
  132 + </select>
  133 + </label>
  134 + </div>
  135 + <div class="ct_field">
  136 + <label>分公司:
  137 + <select class="uk-select" name="subCompanyId_eq">
  138 + </select>
  139 + </label>
  140 + </div>
  141 + <div class="ct_field">
  142 + <label>线路:
  143 + <select class="uk-select" name="lineCode_eq">
  144 + <option value="81101">航头4路</option>
  145 + </select>
  146 + </label>
  147 + </div>
  148 + <div class="ct_field">
  149 + <label>日期:
  150 + <input class="uk-input" name="rq_eq" >
  151 + </label>
  152 + </div>
  153 + <div class="ct_field">
  154 + <label>驾驶员:
  155 + <input class="uk-input" name="jsy_eq" placeholder="工号">
  156 + </label>
  157 + </div>
  158 + <div class="ct_field">
  159 + <label>车辆:
  160 + <input class="uk-input" name="nbbm_eq" >
  161 + </label>
  162 + </div>
  163 + <div class="ct_field">
  164 + <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button>
  165 + <span id="add_hours_icon" uk-icon="icon: plus" style="vertical-align: bottom;margin-left: 5px;" title="录入工休和非营运工时" uk-tooltip></span>
  166 + </div>
  167 + </form>
  168 + </div>
  169 + <div class="ct_table_wrap day">
  170 + <table class="uk-table uk-table-small" style="margin-bottom: 0;">
  171 + <thead>
  172 + <tr>
  173 + <th>日期</th>
  174 + <th>公司</th>
  175 + <th>分公司</th>
  176 + <th>线路</th>
  177 + <th>路牌</th>
  178 + <th>驾驶员</th>
  179 + <th>车辆</th>
  180 + <th>计划工时 &nbsp;<i uk-icon="icon: question; ratio:.7" title="格式:小时.分钟" uk-tooltip></i ></th>
  181 + <th>实际工时</th>
  182 + <th>备注</th>
  183 + </tr>
  184 + </thead>
  185 + </table>
  186 + <div class="t_body_wrap">
  187 + <table class="uk-table uk-table-divider uk-table-hover uk-table-small ct_jsy_day_table">
  188 + <tbody>
  189 + </tbody>
  190 + </table>
  191 + </div>
  192 + </div>
  193 + </div>
  194 +</div>
  195 +
  196 +<!--<div id="hours_add_modal" uk-modal>
  197 + <div class="uk-modal-dialog uk-modal-body">
  198 + <button class="uk-modal-close-default" type="button" uk-close></button>
  199 + <h2 class="uk-modal-title">Default</h2>
  200 + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  201 + </div>
  202 +</div>-->
  203 +
  204 +<script id="hours_jsy_day_list_temp" type="text/html">
  205 + {{each list as obj i}}
  206 + <tr>
  207 + <td>{{obj.rq}}</td>
  208 + <td>{{obj.companyName}}</td>
  209 + <td>{{obj.subCompanyName}}</td>
  210 + <td>{{obj.lineName}}</td>
  211 + <td>{{obj.lpName}}</td>
  212 + <td>{{obj.jsy}}/{{obj.jsyName}}</td>
  213 + <td>{{obj.nbbm}}</td>
  214 + <td>{{obj.hoursJhStr}}</td>
  215 + <td>{{obj.hoursSjStr}}</td>
  216 + <td>{{obj.remarks}}</td>
  217 + </tr>
  218 + {{/each}}
  219 +</script>
  220 +
  221 +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
  222 +<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
  223 +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
  224 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  225 +<!-- EventProxy -->
  226 +<script src="/assets/js/eventproxy.js"></script>
  227 +<!-- art-template 模版引擎 -->
  228 +<script src="/assets/plugins/template.js"></script>
  229 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  230 +<!-- jquery.serializejson JSON序列化插件 -->
  231 +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
  232 +<!-- flatpickr -->
  233 +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script>
  234 +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script>
  235 +<script>
  236 +
  237 + var f = $('form', '');
  238 + var page=0, pageSize=120;
  239 +
  240 + var ep = EventProxy.create('query_comps', 'query_lines', function () {
  241 + $('[name=companyId_eq]', f).trigger('change');//公司change
  242 + query();
  243 +
  244 + $('.loading').remove();
  245 + $('.ct_page').show();
  246 + });
  247 +
  248 + //点击搜索
  249 + $('button.search', f).on('click', query);
  250 +
  251 + function query() {
  252 + var data = f.serializeJSON();
  253 + data.page = page;
  254 + data.size = pageSize;
  255 +
  256 + $.get('/summary/hours', data, function (rs) {
  257 + //console.log('data', rs);
  258 + var htmlStr = template('hours_jsy_day_list_temp', {list: rs.content});
  259 + $('.ct_jsy_day_table tbody').html(htmlStr);
  260 +
  261 + $('.t_body_wrap').perfectScrollbar('update');
  262 + });
  263 + }
  264 +
  265 + //日期选择器
  266 + $('[name=rq_eq]', f).val('2017-07-25');
  267 + flatpickr('.ct_search_form_wrap [name=rq_eq]', {"locale": "zh", maxDate: '2017-07-25', minDate: '2017-07-01'});
  268 +
  269 + var comps;
  270 + //构建公司级联下拉框
  271 + $.get('/user/companyData', function (rs) {
  272 + comps = rs;
  273 + var opts = '';
  274 + for(var i=0,obj;obj=comps[i++];){
  275 + opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>';
  276 + }
  277 + $('[name=companyId_eq]', f).html(opts);
  278 + ep.emit('query_comps');
  279 + });
  280 +
  281 + var lineMapps;
  282 + //加载线路信息
  283 + $.get('/line/all', {'destroy_eq': 0}, function (rs) {
  284 + rs.sort(function (a, b) {
  285 + return a.name.localeCompare(b.name);
  286 + });
  287 + lineMapps={};
  288 + var k;
  289 + $.each(rs, function () {
  290 + k = this.company+'_'+this.brancheCompany;
  291 + if(!lineMapps[k])
  292 + lineMapps[k]=[];
  293 + lineMapps[k].push(this);
  294 + });
  295 +
  296 + ep.emit('query_lines');
  297 + });
  298 +
  299 + $('[name=companyId_eq]', f).on('change', function () {
  300 + var code = $(this).val(), subs=[];
  301 + $.each(comps, function () {
  302 + if(this.companyCode==code)
  303 + subs=this.children;
  304 + });
  305 +
  306 + var opts='';
  307 + $.each(subs, function () {
  308 + opts += '<option value="'+this.code+'">'+this.name+'</option>';
  309 + });
  310 + $('[name=subCompanyId_eq]', f).html(opts).trigger('change');
  311 + });
  312 +
  313 + $('[name=subCompanyId_eq]', f).on('change', function () {
  314 + var k = $('[name=companyId_eq]', f).val() + '_' + $(this).val();
  315 + var array = lineMapps[k];
  316 + var opts = '';
  317 + if(array){
  318 + $.each(array, function () {
  319 + opts += '<option value="'+this.lineCode+'">'+this.name+'</option>';
  320 + });
  321 + }
  322 + $('[name=lineCode_eq]', f).html(opts);
  323 + });
  324 +
  325 + //
  326 + //滚动条
  327 + $('.t_body_wrap').perfectScrollbar({suppressScrollX: true});
  328 +
  329 + $(document).on('submit', 'form', function () {
  330 + return false;
  331 + });
  332 +
  333 + $('#add_hours_icon').on('click', function () {
  334 + UIkit.notification('暂不开放!', 'danger');
  335 + });
  336 +</script>
  337 +</body>
  338 +</html>
0 339 \ No newline at end of file
... ...
src/main/resources/static/pages/summary/work_hours/main.html 0 → 100644
  1 +<!-- 工时统计 -->
  2 +<iframe src="/pages/summary/work_hours/list.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe>
0 3 \ No newline at end of file
... ...