浏览代码

【CHG】改进了智能查询对锚和历史故障。

fenghao 4 年之前
父节点
当前提交
383a2d0598

+ 3 - 0
railway-business/src/main/java/com/railway/business/baseinfo/domain/vo/BusFjxgmdQueryVo.java

@@ -22,6 +22,9 @@ public class BusFjxgmdQueryVo implements Serializable {
     @ApiModelProperty(value = "行别")
     private String xingbie;
 
+    @ApiModelProperty(value = "站场区间")
+    private Long stationId;
+
     @ApiModelProperty(value = "支柱号")
     private String pillarCode;
 

+ 19 - 2
railway-business/src/main/java/com/railway/business/baseinfo/service/impl/BusFjxgmdServiceImpl.java

@@ -1,11 +1,14 @@
 package com.railway.business.baseinfo.service.impl;
 
 import com.railway.business.baseinfo.domain.BusFjxgmd;
+import com.railway.business.baseinfo.domain.BusZzdzxx;
 import com.railway.business.baseinfo.domain.vo.BusFjxgmdQueryVo;
+import com.railway.business.baseinfo.mapper.BusZzdzxxMapper;
 import com.railway.common.enums.DelFlagEnum;
 import com.railway.business.baseinfo.mapper.BusFjxgmdMapper;
 import com.railway.business.baseinfo.service.IBusFjxgmdService;
 import com.railway.common.utils.SecurityUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -21,9 +24,11 @@ import java.util.List;
 public class BusFjxgmdServiceImpl implements IBusFjxgmdService{
 
     private final BusFjxgmdMapper busFjxgmdMapper;
+    private final BusZzdzxxMapper busZzdzxxMapper;
 
-    public BusFjxgmdServiceImpl(BusFjxgmdMapper busFjxgmdMapper) {
+    public BusFjxgmdServiceImpl(BusFjxgmdMapper busFjxgmdMapper, BusZzdzxxMapper busZzdzxxMapper) {
         this.busFjxgmdMapper = busFjxgmdMapper;
+        this.busZzdzxxMapper = busZzdzxxMapper;
     }
 
     /**
@@ -86,9 +91,21 @@ public class BusFjxgmdServiceImpl implements IBusFjxgmdService{
      */
     @Override
     public List<BusFjxgmd> getListByZz(BusFjxgmdQueryVo busFjxgmdQueryVo) {
-        if (busFjxgmdQueryVo.getPillarArea() == null) {
+        if (StringUtils.isBlank(busFjxgmdQueryVo.getPillarArea())) {
             busFjxgmdQueryVo.setPillarArea("500");
         }
+        // 有站场区间,支柱号 查询支柱公里标
+        if (StringUtils.isNoneBlank(busFjxgmdQueryVo.getPillarCode())
+            && busFjxgmdQueryVo.getStationId() != null) {
+            BusZzdzxx busZzdzxx = new BusZzdzxx();
+            busZzdzxx.setPillarCode(busFjxgmdQueryVo.getPillarCode());
+            busZzdzxx.setStationId(busFjxgmdQueryVo.getStationId());
+            List<BusZzdzxx> zzList = busZzdzxxMapper.getList(busZzdzxx);
+            if (zzList != null && zzList.size() > 0) {
+                BusZzdzxx zz = zzList.get(0);
+                busFjxgmdQueryVo.setMarker(zz.getMarker());
+            }
+        }
         return busFjxgmdMapper.getListByZz(busFjxgmdQueryVo);
     }
 }

+ 3 - 0
railway-business/src/main/java/com/railway/business/catenary/domain/vo/BusJlgzQueryVo.java

@@ -21,6 +21,9 @@ public class BusJlgzQueryVo implements Serializable {
   @ApiModelProperty(value = "行别")
   private String xingbie;
 
+  @ApiModelProperty(value = "站场区间")
+  private Long stationId;
+
   @ApiModelProperty(value = "支柱号")
   private String pillarCode;
 

+ 17 - 1
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJlgzServiceImpl.java

@@ -1,5 +1,7 @@
 package com.railway.business.catenary.service.impl;
 
+import com.railway.business.baseinfo.domain.BusZzdzxx;
+import com.railway.business.baseinfo.mapper.BusZzdzxxMapper;
 import com.railway.business.catenary.domain.BusJlgz;
 import com.railway.business.catenary.domain.BusJlgzPic;
 import com.railway.business.catenary.domain.vo.BusJlgzListByZzVo;
@@ -28,10 +30,12 @@ public class BusJlgzServiceImpl implements IBusJlgzService {
 
 	private final BusJlgzMapper busJlgzMapper;
 	private final BusJlgzPicMapper busJlgzPicMapper;
+	private final BusZzdzxxMapper busZzdzxxMapper;
 
-	public BusJlgzServiceImpl(BusJlgzMapper busJlgzMapper, BusJlgzPicMapper busJlgzPicMapper) {
+	public BusJlgzServiceImpl(BusJlgzMapper busJlgzMapper, BusJlgzPicMapper busJlgzPicMapper, BusZzdzxxMapper busZzdzxxMapper) {
 		this.busJlgzMapper = busJlgzMapper;
 		this.busJlgzPicMapper = busJlgzPicMapper;
+		this.busZzdzxxMapper = busZzdzxxMapper;
 	}
 
 	/**
@@ -123,6 +127,18 @@ public class BusJlgzServiceImpl implements IBusJlgzService {
 		if (busJlgzQueryVo.getPillarArea() == null) {
 			busJlgzQueryVo.setPillarArea("500");
 		}
+		// 有站场区间,支柱号 查询支柱公里标
+		if (StringUtils.isNoneBlank(busJlgzQueryVo.getPillarCode())
+				&& busJlgzQueryVo.getStationId() != null) {
+			BusZzdzxx busZzdzxx = new BusZzdzxx();
+			busZzdzxx.setPillarCode(busJlgzQueryVo.getPillarCode());
+			busZzdzxx.setStationId(busJlgzQueryVo.getStationId());
+			List<BusZzdzxx> zzList = busZzdzxxMapper.getList(busZzdzxx);
+			if (zzList != null && zzList.size() > 0) {
+				BusZzdzxx zz = zzList.get(0);
+				busJlgzQueryVo.setMarker(zz.getMarker());
+			}
+		}
 		return busJlgzMapper.getListByZz(busJlgzQueryVo);
 	}
 }

+ 17 - 39
railway-business/src/main/resources/mapper/baseinfo/BusFjxgmdMapper.xml

@@ -219,56 +219,34 @@
   </select>
 
   <select id="getListByZz" resultMap="BaseResultMap">
-    SELECT D.* FROM
-    (
-      SELECT a.id,
+
+      SELECT
+        a.id,
+        v.line_name,
+        v.station_name,
         a.qsgh,
         a.qsglb,
-        v.dept_id,
-        v.station_name,
         a.station_id,
         a.xingbie,
         a.fjlx,
-        v.dept_name,
-        v.line_name,
-        dict1.dict_label AS xingbie_text,
         dict2.dict_label AS fjlx_text,
         ${query.pillarArea} AS pillar_area
       FROM base_fjxgmd a
       LEFT JOIN v_station v ON a.station_id = v.dept_station_id
-      LEFT JOIN sys_dict_data dict1 ON (a.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
       LEFT JOIN sys_dict_data dict2 ON (a.fjlx = dict2.dict_value AND dict2.dict_type = 'fjlx')
       WHERE a.del_flag = '0'
-    ) D ,
-    (
-        SELECT zz.id,
-          zz.pillar_code,
-          zz.marker
-        FROM base_pillar zz
-        LEFT JOIN v_station v ON zz.station_id = v.dept_station_id
-        WHERE 1 = 1
-
-        <if test="query.deptId != null and query.deptId != ''">
-          AND v.dept_id = #{query.deptId}
-        </if>
-        <if test="query.lineId != null and query.lineId != ''">
-          AND v.line_id = #{query.lineId}
-        </if>
-        <if test="query.xingbie != null and query.xingbie != ''">
-          AND zz.xingbie = #{query.xingbie}
-        </if>
-        <if test="query.pillarCode != null and query.pillarCode != ''">
-          AND zz.pillar_code = #{query.pillarCode}
-        </if>
-        <if test="query.marker != null and query.marker != ''">
-          AND zz.marker = #{query.marker}
-        </if>
-
-        AND (zz.marker + 0.0) BETWEEN (zz.marker + 0.0) - (#{query.pillarArea} + 0.0)
-        AND (zz.marker + 0.0) + (#{query.pillarArea} + 0.0)
-    ) H
-    WHERE D.qsglb = H.marker
-    ORDER BY (D.qsgh + 0)
+      <if test="query.lineId != null and query.lineId != ''">
+        AND v.line_id = #{query.lineId}
+      </if>
+      <if test="query.xingbie != null and query.xingbie != ''">
+        AND v.xingbie = #{query.xingbie}
+        AND a.xingbie = #{query.xingbie}
+      </if>
+      <if test="query.marker != null and query.marker != ''">
+        AND (a.qsglb + 0.0) BETWEEN (#{query.marker} + 0.0) - (#{query.pillarArea} + 0.0)
+        AND (#{query.marker} + 0.0) + (#{query.pillarArea} + 0.0)
+      </if>
+      ORDER BY (a.qsglb + 0)
   </select>
 
 </mapper>

+ 4 - 28
railway-business/src/main/resources/mapper/catenary/BusJlgzMapper.xml

@@ -226,47 +226,23 @@
     (
       SELECT jlgz.yylx, jlgz.yylx_text as yylxText, count(1) as total FROM
       (
-        SELECT D.* FROM
-        (
           SELECT
-            dict1.dict_label as xingbie_text,
             dict2.dict_label as yylx_text,
-            <include refid="Base_Column_List"/>
+            t.yylx
           FROM base_jlgz t
           LEFT JOIN v_substation v ON t.substation_id = v.substation_id
-          LEFT JOIN sys_dict_data dict1 ON (t.xingbie = dict1.dict_value AND dict1.dict_type = 'xingbie')
           LEFT JOIN sys_dict_data dict2 ON (t.yylx = dict2.dict_value AND dict2.dict_type = 'gzyy')
           WHERE t.del_flag = '0'
-        ) D,
-        (
-          SELECT
-            zz.id,
-            zz.pillar_code,
-            zz.marker
-          FROM base_pillar zz
-          LEFT JOIN v_station v ON zz.station_id = v.dept_station_id
-          WHERE 1 = 1
-
-          <if test="query.deptId != null and query.deptId != ''">
-            AND v.dept_id = #{query.deptId}
-          </if>
           <if test="query.lineId != null and query.lineId != ''">
             AND v.line_id = #{query.lineId}
           </if>
           <if test="query.xingbie != null and query.xingbie != ''">
-            AND zz.xingbie = #{query.xingbie}
-          </if>
-          <if test="query.pillarCode != null and query.pillarCode != ''">
-            AND zz.pillar_code = #{query.pillarCode}
+            AND t.xingbie = #{query.xingbie}
           </if>
           <if test="query.marker != null and query.marker != ''">
-            AND zz.marker = #{query.marker}
+            AND (t.marker + 0.0) BETWEEN (#{query.marker} + 0.0) - (#{query.pillarArea} + 0.0)
+            AND (#{query.marker} + 0.0) + (#{query.pillarArea} + 0.0)
           </if>
-
-          AND (zz.marker + 0.0) BETWEEN (zz.marker + 0.0) - (#{query.pillarArea} + 0.0)
-          AND (zz.marker + 0.0) + (#{query.pillarArea} + 0.0)
-        ) H
-        WHERE D.marker = H.marker
       ) jlgz
       GROUP BY jlgz.yylx
     ) res right join sys_dict_data dictYylx on res.yylx = dictYylx.dict_value