Browse Source

Merge branch 'company'

liyg 1 năm trước cách đây
mục cha
commit
901337505c

+ 50 - 4
src/main/java/com/steerinfo/inPlantNavigation/controller/MapVertexController.java

@@ -1,8 +1,11 @@
 package com.steerinfo.inPlantNavigation.controller;
 
+import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 
+import com.steerinfo.framework.service.pagehelper.PageHelper;
 import com.steerinfo.inPlantNavigation.exception.VertexAngEdgeException;
 import com.steerinfo.inPlantNavigation.model.IPMMSVertex;
 import com.steerinfo.inPlantNavigation.model.IPMMSVertexEdge;
@@ -15,10 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * MapVertex RESTful接口:
@@ -43,6 +44,9 @@ public class MapVertexController extends BaseRESTfulController {
     @Autowired
     IMapVertexEdgeService mapVertexEdgeService;
 
+    @Autowired
+    ColumnDataUtil columnDataUtil;
+
     @ApiOperation(value="导入顶点数据,开发用")
     @GetMapping(value = "/importVertex")
     public RESTfulResult importVertex() throws IOException {
@@ -87,4 +91,46 @@ public class MapVertexController extends BaseRESTfulController {
     public RESTfulResult findSelections(){
         return success(mapVertexService.findSelections());
     }
+
+    @PostMapping("/getMapVertex")
+    public RESTfulResult getMapVertex(@RequestBody Map<String,Object> map,
+                                      @RequestParam(required = false,defaultValue = "527",name = "apiId")Integer apiId,
+                                      @RequestParam(required = false,defaultValue = "1",name = "pageNum")Integer pageNum,
+                                      @RequestParam(required = false,defaultValue = "20",name = "pageSize")Integer pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        List<Map<String,Object>> list= mapVertexService.getMapVertex(map);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, list,list);
+        return success(pageList);
+    }
+
+    @PostMapping("/getMapEdge")
+    public RESTfulResult getMapEdge(@RequestBody Map<String,Object> map,
+                                      @RequestParam(required = false,defaultValue = "528",name = "apiId")Integer apiId,
+                                      @RequestParam(required = false,defaultValue = "1",name = "pageNum")Integer pageNum,
+                                      @RequestParam(required = false,defaultValue = "20",name = "pageSize")Integer pageSize){
+        PageHelper.startPage(pageNum, pageSize);
+        List<Map<String,Object>> list= mapVertexService.getMapEdge(map);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, list,list);
+        return success(pageList);
+    }
+
+    @PostMapping("/addMapVertex")
+    public RESTfulResult addMapVertex(@RequestBody Map<String,Object> map){;
+        return success(mapVertexService.addMapVertex(map));
+    }
+
+    @PostMapping("/addMapEdge")
+    public RESTfulResult addMapEdge(@RequestBody Map<String,Object> map){;
+        return success(mapVertexService.addMapEdge(map));
+    }
+
+    @PostMapping("/delMapVertex")
+    public RESTfulResult delMapVertex(@RequestBody Map<String,Object> map){;
+        return success(mapVertexService.delMapVertex(map));
+    }
+
+    @PostMapping("/delMapEdge")
+    public RESTfulResult delMapEdge(@RequestBody Map<String,Object> map){;
+        return success(mapVertexService.delMapEdge(map));
+    }
 }

+ 16 - 0
src/main/java/com/steerinfo/inPlantNavigation/mapper/MapVertexMapper.java

@@ -14,6 +14,18 @@ import java.util.Map;
 
 @Mapper
 public interface MapVertexMapper extends IBaseMapper<MapVertex, BigDecimal> {
+    @Select("select seq__OTMS_MAPVERTEX.nextval from dual")
+    BigDecimal selectMaxVertextId();
+
+    @Select("select count(*) from MAP_VERTEX where ADDRESS_NAME = #{address}")
+    int isVertexExist(Map<String, Object> map);
+
+    @Select("select seq__OTMS_MAPVERTEXEDGE.nextval from dual")
+    BigDecimal selectMaxEdgeId();
+
+    @Select("select count(*) from MAP_VERTEX_EDGE where INVERTEX_ID = #{startId} AND OUTVERTEX_ID = #{endId}")
+    int isEdgeExist(Map<String, Object> map);
+
     //@Select("SELECT * FROM MAP_VERTEX WHERE STATUS=0")
     List<MapVertex> findAllAvailable();
 
@@ -27,4 +39,8 @@ public interface MapVertexMapper extends IBaseMapper<MapVertex, BigDecimal> {
     String getVertexIdByWarehouseId(String warehouseId);
     //查询导航选项,不包含路口、拐点等
     ArrayList<MapVertex> findSelections();
+
+    List<Map<String, Object>> getMapVertex(Map<String, Object> map);
+
+    List<Map<String, Object>> getMapEdge(Map<String, Object> map);
 }

+ 12 - 0
src/main/java/com/steerinfo/inPlantNavigation/service/IMapVertexService.java

@@ -42,4 +42,16 @@ public interface IMapVertexService {
     //根据订单号判断订单状况,找当前起点终点并返回最短路径
     ArrayList<MapVertex> getPathByOrderID(String orderId,String startStep,String endStep,Map<String, MapVertex> vertexList,Map<String, List<MapVertexEdge>> vertexEdgeList) throws VertexAngEdgeException;
 
+    //查询顶点
+    List<Map<String, Object>> getMapVertex(Map<String,Object> map);
+    //查询边
+    List<Map<String, Object>> getMapEdge(Map<String,Object> map);
+    //新增顶点
+    String addMapVertex(Map<String, Object> map);
+    //新增边
+    String addMapEdge(Map<String, Object> map);
+    //删除点
+    Object delMapVertex(Map<String, Object> map);
+    //删除边
+    Object delMapEdge(Map<String, Object> map);
 }

+ 61 - 0
src/main/java/com/steerinfo/inPlantNavigation/service/impl/MapVertexServiceImpl.java

@@ -1,7 +1,9 @@
 package com.steerinfo.inPlantNavigation.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.inPlantNavigation.exception.VertexAngEdgeException;
+import com.steerinfo.inPlantNavigation.mapper.MapVertexEdgeMapper;
 import com.steerinfo.inPlantNavigation.mapper.MapVertexMapper;
 import com.steerinfo.inPlantNavigation.model.IPMMSVertex;
 import com.steerinfo.inPlantNavigation.model.IPMMSVertexEdge;
@@ -37,6 +39,9 @@ public class MapVertexServiceImpl implements IMapVertexService {
     @Autowired
     private MapVertexMapper mapVertexMapper;
 
+    @Autowired
+    private MapVertexEdgeMapper mapVertexEdgeMapper;
+
 
     @Override
     public int importVertex(String filePath) throws IOException {
@@ -317,4 +322,60 @@ public class MapVertexServiceImpl implements IMapVertexService {
         }
         return point;
     }
+
+    @Override
+    public List<Map<String, Object>> getMapVertex(Map<String, Object> map) {
+        return mapVertexMapper.getMapVertex(map);
+    }
+
+    @Override
+    public List<Map<String, Object>> getMapEdge(Map<String, Object> map) {
+        return mapVertexMapper.getMapEdge(map);
+    }
+
+    @Override
+    public String addMapVertex(Map<String, Object> map) {
+        MapVertex mapVertex=new MapVertex();
+        if(mapVertexMapper.isVertexExist(map)>0){
+            return "已存在!请勿重复新增!";
+        }
+        mapVertex.setVertexId(mapVertexMapper.selectMaxVertextId());
+        mapVertex.setLongitude(DataChange.dataToBigDecimal(map.get("lon")));
+        mapVertex.setLatitude(DataChange.dataToBigDecimal(map.get("lat")));
+        mapVertex.setStatus(BigDecimal.ZERO);
+        mapVertex.setInsertUpdateRemark(""+map.get("insertUpdateRemark"));
+        mapVertex.setAddressName(""+map.get("address"));
+        return "新增"+mapVertexMapper.insertSelective(mapVertex)+"个成功!";
+    }
+
+    @Override
+    public String addMapEdge(Map<String, Object> map) {
+        MapVertexEdge mapVertexEdge = new MapVertexEdge();
+        if(mapVertexMapper.isEdgeExist(map)>0){
+            return "已存在!请勿重复新增!";
+        }
+        //正
+        mapVertexEdge.setVertexedgeId(mapVertexMapper.selectMaxEdgeId());
+        mapVertexEdge.setOutvertexId(DataChange.dataToBigDecimal(map.get("startId")));
+        mapVertexEdge.setInvertexId(DataChange.dataToBigDecimal(map.get("endId")));
+        mapVertexEdge.setWeigh(DataChange.dataToBigDecimal(map.get("weight")));
+        mapVertexEdgeMapper.insertSelective(mapVertexEdge);
+        //反
+        mapVertexEdge.setVertexedgeId(mapVertexMapper.selectMaxEdgeId());
+        mapVertexEdge.setOutvertexId(DataChange.dataToBigDecimal(map.get("endId")));
+        mapVertexEdge.setInvertexId(DataChange.dataToBigDecimal(map.get("startId")));
+        mapVertexEdge.setWeigh(DataChange.dataToBigDecimal(map.get("weight")));
+        mapVertexEdgeMapper.insertSelective(mapVertexEdge);
+        return "新增成功!";
+    }
+
+    @Override
+    public Object delMapVertex(Map<String, Object> map) {
+        return "删除"+mapVertexMapper.deleteByPrimaryKey(DataChange.dataToBigDecimal(map.get("vertexId")))+"个成功!";
+    }
+
+    @Override
+    public Object delMapEdge(Map<String, Object> map) {
+        return "删除"+mapVertexEdgeMapper.deleteByPrimaryKey(DataChange.dataToBigDecimal(map.get("vertexEdgeId")))+"个成功!";
+    }
 }

+ 12 - 12
src/main/resources/application-prod.yml

@@ -1,15 +1,15 @@
 #正式环境
 spring:
   datasource:
-    url: jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri
-    password: Dil123789
+    url: jdbc:oracle:thin:@192.168.1.51:1521:steerinfo
+    password: dil
     username: dil
     driver-class-name: oracle.jdbc.OracleDriver
   application:
     name: dil-dazhou-otms-prod
   #Redis相关配置
   redis:
-    host: 172.16.33.166
+    host: 192.168.3.81
     port: 6379
     password: adhykdj
   cache:
@@ -23,22 +23,22 @@ piction:
 #feign设置
 openfeign:
   ColumnDataFeign:
-    url: ${COLUMNDATAFEIGN_URL:172.16.33.166:8083}
+    url: ${COLUMNDATAFEIGN_URL:192.168.3.81:8083}
   BmsShipFeign:
-    url: ${BMSSHIPFEIGN_URL:172.16.33.166:8078}
+    url: ${BMSSHIPFEIGN_URL:192.168.3.81:8078}
   BmsTruckFeign:
-    url: ${BMSTRUCKFEIGN_URL:172.16.33.166:8076}
+    url: ${BMSTRUCKFEIGN_URL:192.168.3.81:8076}
   WmshBoundFeign:
-    url: ${WMSHBOUNDFEIGN_URL:172.16.33.166:8070}
+    url: ${WMSHBOUNDFEIGN_URL:192.168.3.81:8070}
   WMSFeign:
-    url: ${WMSFEIGN_URL:172.16.33.166:8093}
+    url: ${WMSFEIGN_URL:192.168.3.81:8093}
   OmsFeign:
-    url: ${OMSFEIGN_URL:172.16.33.166:8095}
+    url: ${OMSFEIGN_URL:192.168.3.81:8095}
   JoinFeign:
-    url: ${JOINFEIGN_URL:172.16.33.166:8066}
+    url: ${JOINFEIGN_URL:192.168.3.81:8066}
   QmsFeign:
-    url: ${QMSFEIGN_URL:172.16.33.166:8047}
+    url: ${QMSFEIGN_URL:192.168.3.81:8047}
   ImFeign:
-    url: ${IMFEIGN_URL:172.16.33.166:8055}
+    url: ${IMFEIGN_URL:192.168.3.81:8055}
 server:
   port: 8038

+ 40 - 2
src/main/resources/com/steerinfo/inPlantNavigation/mapper/MapVertexMapper.xml

@@ -405,8 +405,46 @@
 
   <select id="findSelections" resultMap="BaseResultMap">
     SELECT  MV.*,LOCATION_MAPPING_ID
-    FROM MAP_VERTEX MV,MAP_LOCATION_MAPPING MLM
-    WHERE MV.VERTEX_ID = MLM.VERTEX_ID
+    FROM MAP_VERTEX MV
+    LEFT JOIN MAP_LOCATION_MAPPING MLM
+    ON MV.VERTEX_ID = MLM.VERTEX_ID
+    WHERE MLM.VERTEX_ID IS NOT NULL OR MV.INSERT_UPDATE_REMARK = '非路口'
     ORDER BY LOCATION_MAPPING_ID
     </select>
+    <select id="getMapVertex" resultType="java.util.Map">
+      SELECT VERTEX_ID "vertexId",
+             ADDRESS_NAME "addressName",
+             LONGITUDE "longtitude",
+             LATITUDE "latitude",
+             STATUS "status"
+      FROM MAP_VERTEX
+      <where>
+        <if test="con!=null and con!=''">
+          ADDRESS_NAME like Concat(Concat('%',#{con}),'%')
+        </if>
+      </where>
+      ORDER BY VERTEX_ID DESC
+    </select>
+  <select id="getMapEdge" resultType="java.util.Map">
+    SELECT
+      MV1 .ADDRESS_NAME "startName",
+      MV1 .LONGITUDE "longtitudeS",
+      MV1 .LATITUDE "latitudeS",
+      MV2 .ADDRESS_NAME "endName",
+      MV2 .LONGITUDE "longtitudeE",
+      MV2 .LATITUDE "latitudeE",
+      MVE .VERTEXEDGE_ID "vertexEdgeId",
+      MVE .WEIGH "weight"
+    FROM MAP_VERTEX_EDGE MVE
+   LEFT JOIN MAP_VERTEX MV1 ON MVE .OUTVERTEX_ID = MV1 .VERTEX_ID
+   LEFT JOIN MAP_VERTEX MV2 ON MVE .INVERTEX_ID = MV2 .VERTEX_ID
+    <where>
+      MV1 .ADDRESS_NAME IS NOT NULL
+      AND MV2 .ADDRESS_NAME IS NOT NULL
+      <if test="con!=null and con!=''">
+      AND  MV1 .ADDRESS_NAME || MV2 .ADDRESS_NAME like Concat(Concat('%',#{con}),'%')
+      </if>
+    </where>
+    ORDER BY MVE .VERTEXEDGE_ID DESC
+  </select>
 </mapper>