瀏覽代碼

git-svn-id: https://192.168.57.71/svn/qt@69 12fe181a-e57f-b044-8676-16dc139aa63e

ld_zhoutl 8 年之前
父節點
當前提交
bc04b9e38c

+ 91 - 0
jdc/jdcweb/trunk/src/main/java/com/jsjty/jdc/web/common/ctl/CommonDataCtl.java

@@ -47,7 +47,9 @@ import com.jsjty.jdc.web.command.task.entity.ComandTaskEntity;
 import com.jsjty.jdc.web.common.service.CommonDataService;
 import com.jsjty.jdc.web.common.vo.StatisticsVo;
 import com.jsjty.jdc.web.train.bean.TrainBean;
+import com.jsjty.jdc.web.train.entity.BTlztHuoccc;
 import com.jsjty.jdc.web.train.entity.TrainInfo;
+import com.jsjty.jdc.web.train.service.BTlztHuocccService;
 import com.jsjty.jdc.web.train.service.TrainService;
 import com.xtframe.core.anon.auth.RequiresPermissions;
 import com.xtframe.io.poi.ExcelHelper;
@@ -62,6 +64,8 @@ public class CommonDataCtl extends BaseWebCtl{
     CommonDataService commonDataService;
     @Autowired
     private TrainService trainService;
+    @Autowired
+    private BTlztHuocccService bTlztHuocccService;
 
     /**
      * srchInfos
@@ -724,6 +728,25 @@ public class CommonDataCtl extends BaseWebCtl{
         putPageInfo(model, page, pageInfo);
         return "statistics/stsLcskb";
     }
+    
+    /**
+     * 统计查询
+     * 列车时刻表
+     * @param paramVo
+     * @return
+     */
+    @RequestMapping("stslcskb2")
+    public String stsLcskb2(final StatisticsVo paramVo,Model model,
+            SimplePageRequest page) {
+        page.setOrder("asc");
+        page.setSort("fVcFad");
+        Page<BTlztHuoccc> pageInfo = commonDataService.getLcskbPage2(paramVo, toPageRequest(page));
+        model.addAttribute("list", convertLcskbList2(paramVo, pageInfo.getContent()));
+        model.addAttribute("paramVo", paramVo);
+        // 翻页
+        putPageInfo(model, page, pageInfo);
+        return "statistics/stsLcskb";
+    }
 
     /**
      * 导出
@@ -766,6 +789,74 @@ public class CommonDataCtl extends BaseWebCtl{
         out.close();
     }
     
+    private List<TrainBean> convertLcskbList2(StatisticsVo paramVo, List<BTlztHuoccc> trainInfos) {
+        List<TrainBean> beans = new ArrayList<TrainBean>(trainInfos.size());
+        StringBuilder costSb = new StringBuilder();
+        DateFormat dateFormat = new SimpleDateFormat("yy-MM-dd HH:mm");
+        DateFormat dayFormat = new SimpleDateFormat("yy-MM-dd");
+        for (BTlztHuoccc train : trainInfos) {
+            TrainBean bean = new TrainBean();
+            String trainCode = train.getfVcChec();
+            bean.setTrainno(Integer.parseInt(train.getfNbDaozsx()));
+            bean.setTrainCode(train.getfVcChec());
+            bean.setDepartName(train.getFVcDaozmc());
+            bean.setDepartTime(train.getFVcFad());
+            //  到达日
+            if(StringUtils.isNotEmpty(train.getFNbYunxsj().toString())) {
+                String ddr = "当日到达";
+                int day = train.getFNbYunxsj().intValue();
+                if(0 == day) ddr = "当日到达";
+                else if(1 == day) ddr = "次日到达";
+                else if(2 == day) ddr = "第三日到达";
+                bean.setDdr(ddr);
+            }
+            if(StringUtils.isEmpty(paramVo.getSfz()) && StringUtils.isNotEmpty(paramVo.getDdz())) {
+                List<BTlztHuoccc> firtInfos = bTlztHuocccService.findFirstByTraincode(trainCode);
+                if (firtInfos.size() > 0) {
+                    BTlztHuoccc firt = firtInfos.get(0);
+                    bean.setDepartName(firt.getFVcDaozmc());
+                }
+            }
+            List<BTlztHuoccc> lastInfos = bTlztHuocccService.findLastByTraincode(trainCode);
+            if (lastInfos.size() > 0) {
+                BTlztHuoccc last = lastInfos.get(0);
+                if(StringUtils.isNotEmpty(paramVo.getSfz()) && StringUtils.isNotEmpty(paramVo.getDdz())) {
+                    bean.setArriveName(paramVo.getDdz());
+                } else {
+                    bean.setArriveName(last.getFVcDaozmc());
+                }
+                bean.setArriveTime(last.getFVcDaod());
+                int startDay = train.getFNbYunxsj().intValue();
+                int arriveDay = last.getFNbYunxsj().intValue();
+                bean.setDays(String.valueOf(arriveDay - startDay));
+                try {
+                    Date departDate = dateFormat.parse(dayFormat.format(new Date()) + " " + bean.getDepartTime());
+                    Date arriveDate = dateFormat.parse(dayFormat.format(new Date()) + " " + bean.getArriveTime());
+                    long cost = arriveDate.getTime() - departDate.getTime() + (arriveDay - startDay) * 24 * 60 * 60
+                            * 1000;
+                    int h = (int) (cost / 3600000);
+                    int m = (int) (cost % 3600000) / 60000;
+                    costSb.setLength(0);
+                    if (h < 10) {
+                        costSb.append("0");
+                    }
+                    costSb.append(h);
+                    costSb.append(":");
+                    if (m < 10) {
+                        costSb.append("0");
+                    }
+                    costSb.append(m);
+                    bean.setCost(costSb.toString());
+                }
+                catch (ParseException e) {
+                    e.printStackTrace();
+                }
+            }
+            beans.add(bean);
+        }
+        return beans;
+    }
+    
     private List<TrainBean> convertLcskbList(StatisticsVo paramVo, List<TrainInfo> trainInfos) {
         List<TrainBean> beans = new ArrayList<TrainBean>(trainInfos.size());
         StringBuilder costSb = new StringBuilder();

+ 9 - 0
jdc/jdcweb/trunk/src/main/java/com/jsjty/jdc/web/common/service/CommonDataService.java

@@ -24,6 +24,7 @@ import com.jsjty.jdc.web.basic.entity.TdetailSsfwq;
 import com.jsjty.jdc.web.basic.entity.TdetailSuidao;
 import com.jsjty.jdc.web.command.task.entity.ComandTaskEntity;
 import com.jsjty.jdc.web.common.vo.StatisticsVo;
+import com.jsjty.jdc.web.train.entity.BTlztHuoccc;
 import com.jsjty.jdc.web.train.entity.TrainInfo;
 
 public interface CommonDataService {
@@ -198,6 +199,14 @@ public interface CommonDataService {
     public Page<TrainInfo> getLcskbPage(final StatisticsVo paramVo, PageRequest pageRequest);
     
     /**
+     * 根据条件返回分页信息
+     * 列车时刻表
+     * @param paramVo
+     * @return
+     */
+    public Page<BTlztHuoccc> getLcskbPage2(final StatisticsVo paramVo, PageRequest pageRequest);
+    
+    /**
      * 查询信息
      * 列车时刻表
      * @param paramVo

+ 51 - 5
jdc/jdcweb/trunk/src/main/java/com/jsjty/jdc/web/common/service/impl/CommonDataServiceImpl.java

@@ -1,6 +1,5 @@
 package com.jsjty.jdc.web.common.service.impl;
 
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -23,8 +22,6 @@ import org.springframework.data.jpa.domain.Specification;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Service;
 
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.jsjty.jdc.common.CommonUtil;
 import com.jsjty.jdc.web.air.dao.AirRealtimeDao;
 import com.jsjty.jdc.web.air.entity.FlightDynamic;
@@ -49,10 +46,9 @@ import com.jsjty.jdc.web.basic.service.BasicDetailService;
 import com.jsjty.jdc.web.command.task.entity.ComandTaskEntity;
 import com.jsjty.jdc.web.common.service.CommonDataService;
 import com.jsjty.jdc.web.common.vo.StatisticsVo;
+import com.jsjty.jdc.web.train.entity.BTlztHuoccc;
 import com.jsjty.jdc.web.train.entity.TrainInfo;
-import com.xtframe.core.exception.BizException;
 import com.xtframe.sec.support.SecurityMgr;
-import com.xtframe.util.DateTime;
 
 @Service
 public class CommonDataServiceImpl implements CommonDataService {
@@ -886,6 +882,56 @@ public class CommonDataServiceImpl implements CommonDataService {
         Page<TrainInfo> pageInfo = securityMgr.getQueryService().findAll(spec, pageRequest, TrainInfo.class);
         return pageInfo;
     }
+    
+    /**
+     * 根据条件返回分页信息
+     * 列车时刻表
+     * @param paramVo
+     * @return
+     */
+    public Page<BTlztHuoccc> getLcskbPage2(final StatisticsVo paramVo, PageRequest pageRequest) {
+        Specification<BTlztHuoccc> spec = new Specification<BTlztHuoccc>() {
+            @Override
+            public Predicate toPredicate(Root<BTlztHuoccc> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+                List<Predicate> list = new ArrayList<Predicate>();
+                if (StringUtils.isNotEmpty(paramVo.getSfz())) {
+                    list.add(cb.equal(root.get("fVcDaozmc").as(String.class), paramVo.getSfz()));
+                    if (StringUtils.isEmpty(paramVo.getDdz())) {
+                        list.add(cb.notEqual(root.get("fVcDaod").as(String.class), "--"));
+                    }
+                }
+                if (StringUtils.isNotEmpty(paramVo.getDdz())) {
+                    list.add(cb.equal(root.get("fVcDaozmc").as(String.class), paramVo.getDdz()));
+                }
+                if (StringUtils.isNotBlank(paramVo.getSkbcc())) {
+                    list.add(cb.like(root.get("fVcChec").as(String.class), "%" + paramVo.getSkbcc() + "%"));
+                }
+                // 子查询
+                if (StringUtils.isNotEmpty(paramVo.getSfz()) && StringUtils.isNotEmpty(paramVo.getDdz())) {
+                    list.add(cb.notEqual(root.get("fVcFad").as(String.class), "--"));
+                    Subquery<BTlztHuoccc> subquery = query.subquery(BTlztHuoccc.class);
+                    Root<BTlztHuoccc> trainRoot = subquery.from(BTlztHuoccc.class);
+                    subquery.select(trainRoot);
+                    List<Predicate> subQueryPredicates = new ArrayList<Predicate>();
+                    subQueryPredicates.add(cb.equal(root.get("fVcChec").as(String.class), trainRoot.get("fVcChec")
+                            .as(String.class)));
+                    subQueryPredicates.add(cb.greaterThan(trainRoot.get("fNbDaozsx").as(Integer.class),
+                            root.get("fNbDaozsx").as(Integer.class)));
+                    subQueryPredicates.add(cb.equal(trainRoot.get("fVcDaozmc").as(String.class), paramVo.getDdz()));
+                    subquery.where(subQueryPredicates.toArray(new Predicate[] {}));
+                    list.add(cb.exists(subquery));
+                }
+                else {
+                    if (StringUtils.isEmpty(paramVo.getSfz()) && StringUtils.isEmpty(paramVo.getDdz())) {
+                        list.add(cb.equal(root.get("fVcDaod").as(String.class), "--"));
+                    }
+                }
+                return cb.and(list.toArray(new Predicate[] {}));
+            }
+        };
+        Page<BTlztHuoccc> pageInfo = securityMgr.getQueryService().findAll(spec, pageRequest, BTlztHuoccc.class);
+        return pageInfo;
+    }
 
     /**
      * 查询信息

+ 122 - 14
jdc/jdcweb/trunk/src/main/webapp/static/xt/js/sys/basic_info.js

@@ -963,8 +963,8 @@ function showAirDetailInfo(result, marker) {
     htmlStr += '<div class="item" style="padding:6px;"> <div class="header">飞行高度:' + marker.high + '英尺</div></div>';
     htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "起飞机场", fromPort);
     htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "目的机场", toPort);
-    htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "起飞时间", longToDate(result.departure));
-    htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "到达时间", longToDate(result.arrival));
+    htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "起飞时间", longToDate(result.departure*1000));
+    htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "到达时间", longToDate(result.arrival*1000));
     htmlStr += $.formatString('<div class="item" style="padding:6px;"> <div class="header">{0}:  {1}</div></div>', "装载能力", "");
     htmlStr += $.formatString('<img src="{0}" style="width: 318px;height:215px;margin-left:5px;margin-right:5px;"> </img>', 
             basePath+"/airimg?hbh="+result.flight+"&xingh="+result.xingh+"&webPath="+result.image);
@@ -1333,9 +1333,9 @@ function showFjcwt(xingh) {
  *初始化基础数据复选框监听
  *
  */
-function initEventInfoEvent(basicType) {
+function initEventInfoEvent(type) {
     var targetMarkerLayer;
-    if (basicType == tc_tfsjchk) {
+    if (type == tc_tfsjchk) {
         targetMarkerLayer = tfsjMarkerlayer;
     } else {
         targetMarkerLayer = glyhMarkerlayer;
@@ -1357,17 +1357,12 @@ function initEventInfoEvent(basicType) {
     		}
     	}
 	}
-	$.post(basePath + "/eventInfo", {type: basicType, lonlatStr:lonlatStr}, function (result) {
+	$.post(basePath + "/gzcx/jtlk", {type: type, lonlatStr:lonlatStr}, function (result) {
         var len = result.length;
         targetMarkerLayer.clearMarkers();
         for (var i = 0; i < len; i++) {
             var icon = "";
-//            if (basicType == "tfsjchk") {
-//                icon = "assets/images/basic/tfsj.png";
-//            } else {
-//                icon = "assets/images/basic/yhsg.png";
-//            }
-            icon = "assets/images/event/"+result[i].shijlx+".png";
+            icon = "assets/images/event/"+result[i].fvcShijlx+".png";
             addEventMarker(result[i], icon, targetMarkerLayer);
         }
     }, 'json');
@@ -1411,8 +1406,9 @@ function openEventInfoWin(objMarker) {
  */
 function getEvnetWinInfo(result) {
     var content = '<div class="ui middle aligned selection list " style="padding-left: 20px;padding-top: 20px">';
-    content += $.formatString('<div class="item"> <div class="header">{0}:  {1}</div></div>', "路段名称", result.ludmc);
-    content += $.formatString('<div class="item">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {0}({1})</div>', result.shijnr, result.xiugsj);
+    content += $.formatString('<div class="item"> <div class="header">{0}:  {1}</div></div>', "路段名称", result.fvcLuxmc);
+    content += $.formatString('<div class="item">&emsp;&emsp; {0}({1})</div>', 
+            result.fvcShijnr, longToDate(result.fdtShifsj));
     content += '</div>';
     return content;
 }
@@ -2078,4 +2074,116 @@ function showHbxx(hbh) {
         layer.title(title, taskHbIndex);
         layer.iframeSrc(taskHbIndex, url);
     }
-}
+}
+
+/**
+ * 公众出行添加marker共通
+ * @param name
+ * @param basicType
+ */
+function addGzczMarker(name, basicType) {
+    var url = basePath;
+    if (name == tc_keyunzhan) {
+        url += "/gzcx/keyunzhan";
+    } else if (name == tc_kjdq) {
+        url += "/gzcx/kuajdq";
+    } else if (name == tc_cjqd) {
+        url += "/gzcx/changjqd";
+    } else if (name == tc_suidao) {
+        url += "/gzcx/suid";
+    } else if (name == tc_jiancezhan) {
+        url += "/gzcx/jiancz";
+    } else if (name == tc_ssfwq) {
+        url += "/gzcx/fuwq";
+    } else if (name == tc_shoufeizhan) {
+        url += "/gzcx/shoufz";
+    }
+    $.get(url, {type: name}, function (result) {
+        var len = result.length;
+        var targetLayer = $.getBasicLayer(name, basicType);
+        targetLayer.clearMarkers();
+        for (var i = 0; i < len; i++) {
+            addRoadMarkerBasic(result[i], name, targetLayer);
+        }
+    }, 'json');
+}
+
+/**
+ * 添加坐标数据
+ * @param lat
+ * @param lon
+ *
+ */
+function addRoadMarkerBasic(obj, name, targetMarkerlayer) {
+    var icon_url = $.getBasicIcon(name);
+    var size = new SuperMap.Size(31, 31);
+    var icon = new SuperMap.Icon(icon_url, size, null);
+    var marker = new SuperMap.Marker(new SuperMap.LonLat(obj.lon, obj.lat), icon);
+    marker.events.on({
+        "click": function (params) {
+            /*if(name == tc_keyunzhan) {
+                // 设置地图中心点,并设置缩放比例值
+                setMapCenter(obj.lat, obj.lon, 11);
+            }*/
+            //设置点击图标大小变化
+            setClickIcon(params);
+            //设置当前弹出图层类型
+            setCurrentTcType(name);
+            openRoadBasicInfoWin(name, marker);
+        },
+        "scope": marker
+    });
+    marker.attr = obj;
+    targetMarkerlayer.addMarker(marker);
+
+}
+
+/**
+ *打开信息窗口
+ *
+ */
+function openRoadBasicInfoWin(name, objMarker) {
+    var height = 300;
+    var width = 320;
+    var content = "";
+    var marker = objMarker;
+    var obj = marker.attr;
+    if(name == tc_keyunzhan) {
+        content = '<div class="ui middle aligned selection list " style="padding-left: 0px;padding-top: 5px">';
+        content += $.formatString('<div class="item"> <div class="header">名&emsp;&emsp;称:{0}</div></div>', nullToEmpty(obj.fvcZhanm));
+        content += $.formatString('<div class="item"> <div class="header">地&emsp;&emsp;址:{0}</div></div>', nullToEmpty(obj.fvcZhanz));
+        content += $.formatString('<div class="item"> <div class="header">隶属企业:{0}</div></div>', nullToEmpty(obj.fvcJingjlsdw));
+        content += $.formatString('<div class="item"> <div class="header">联系电话:{0}</div></div>', nullToEmpty(obj.fvcLianxdh));
+        content += $.formatString('<div class="item"> <div class="header">客运等级:{0}</div></div>', nullToEmpty(obj.fvcZhanj));
+        content += $.formatString('<div class="item"> <div class="header">跨省班线:{0}班</div></div>', nullToEmpty(obj.fnbKuasbxsl));
+        content += $.formatString('<div class="item"> <div class="header">跨市班线:{0}班</div></div>', nullToEmpty(obj.fnbKuashibxsl));
+        content += $.formatString('<div class="item"> <div class="header">县际班线:{0}班</div></div>', nullToEmpty(obj.fnbXianj));
+        content += $.formatString('<div class="item"> <div class="header">公交路线:{0}</div></div>', nullToEmpty(obj.fvcBusline));
+        openrbwin(marker.attr.fvcZhanm, content, height, width);
+   /* } else if (name == tc_kjdq) {
+    } else if (name == tc_cjqd) {
+    } else if (name == tc_suidao) {
+    } else if (name == tc_jiancezhan) {
+    } else if (name == tc_ssfwq) {
+    } else if (name == tc_shoufeizhan) {*/
+    } else {
+        $.get(basePath + "/detail/" + marker.attr.gid + "/" + marker.attr.tablename, function (result) {
+            content = getBasicInfo(marker.attr, result);
+            if (marker.attr && result) {
+                if(tc_cjqd == marker.attr.tablename ||
+                       tc_jiancezhan == marker.attr.tablename) {
+                    // 长江汽渡
+                    height = 160;
+                    width = 260;
+                } else if(tc_shoufeizhan == marker.attr.tablename ||
+                        tc_fwq == marker.attr.tablename) {
+                    // 长江汽渡
+                    height = 180;
+                    width = 260;
+                }
+                openrbwin(marker.attr.name, content, height, width);
+            }
+        }, 'json');
+    }
+
+}

+ 6 - 65
jdc/jdcweb/trunk/src/main/webapp/static/xt/js/sys/common_road.js

@@ -303,7 +303,12 @@ function initRoadBasicInfoEvent(name, basicType) {
         	}
     	}
         findAllCamera(name, basicType, lonlatStr, "road");
-    } else {
+    } else if (name == tc_keyunzhan) {
+        /*|| name == tc_kjdq || name == tc_cjqd
+        || name == tc_suidao || name == tc_jiancezhan || name == tc_ssfwq
+        || name == tc_shoufeizhan*/
+        addGzczMarker(name, basicType);
+    } else{
         $.get(basePath + "/basicInfo", {type: name, name:roadName}, function (result) {
             var len = result.length;
             var targetLayer = $.getBasicLayer(name, basicType);
@@ -316,70 +321,6 @@ function initRoadBasicInfoEvent(name, basicType) {
 }
 
 
-/**
- * 添加坐标数据
- * @param lat
- * @param lon
- *
- */
-function addRoadMarkerBasic(obj, name, targetMarkerlayer) {
-    var icon_url = $.getBasicIcon(name);
-    var size = new SuperMap.Size(31, 31);
-    var icon = new SuperMap.Icon(icon_url, size, null);
-    var marker = new SuperMap.Marker(new SuperMap.LonLat(obj.lon, obj.lat), icon);
-    marker.events.on({
-        "click": function (params) {
-        	/*if(name == tc_keyunzhan) {
-        		// 设置地图中心点,并设置缩放比例值
-    	        setMapCenter(obj.lat, obj.lon, 11);
-        	}*/
-            //设置点击图标大小变化
-            setClickIcon(params);
-            //设置当前弹出图层类型
-            setCurrentTcType(name);
-            openRoadBasicInfoWin(marker);
-        },
-        "scope": marker
-    });
-    marker.attr = obj;
-    targetMarkerlayer.addMarker(marker);
-
-}
-
-/**
- *打开信息窗口
- *
- */
-function openRoadBasicInfoWin(objMarker) {
-    var marker = objMarker;
-    $.get(basePath + "/detail/" + marker.attr.gid + "/" + marker.attr.tablename, function (result) {
-        var content = getRoadBasicInfo(marker.attr, result);
-        if (marker.attr && result) {
-            var height = 300;
-            var width = 320;
-            if(tc_cjqd == marker.attr.tablename ||
-                   tc_jiancezhan == marker.attr.tablename) {
-                // 长江汽渡
-                height = 160;
-                width = 260;
-            } else if(tc_shoufeizhan == marker.attr.tablename ||
-                    tc_fwq == marker.attr.tablename) {
-                // 长江汽渡
-                height = 180;
-                width = 260;
-            }
-            openrbwin(marker.attr.name, content, height, width);
-        }
-    }, 'json');
-
-}
-
-
-function getRoadBasicInfo(obj, detail) {
-    return getBasicInfo(obj, detail);
-}
-
-
 
 
 

+ 2 - 2
jdc/jdcweb/trunk/src/main/webapp/static/xt/js/sys/main.js

@@ -324,11 +324,11 @@ function nullToEmpty(obj) {
  * @param obj
  * @returns
  */
-function longToDate(obj) {
+function longToDate(obj, multiFlg) {
     if(null == obj || typeof(obj) =="undefined" || 0 == obj) {
         return "";
     } else {
-        var now = new Date(obj*1000);
+        var now = new Date(obj);
         var years = now.getFullYear();
         var months = now.getMonth()+1;
         var days = now.getDate();