瀏覽代碼

终端状态,长停船舶更新

minghao-chen 2 年之前
父節點
當前提交
b92709b27c

+ 5 - 1
beidou-admin/src/main/java/cn/com/taiji/beidou/web/controller/common/CommonController.java

@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -41,6 +42,8 @@ public class CommonController
 
     private static final String FILE_DELIMETER = ",";
 
+    @Value("${server.port}")
+    private String port;
     /**
      * 通用下载请求
      * 
@@ -87,7 +90,8 @@ public class CommonController
             String filePath = RuoYiConfig.getUploadPath();
             // 上传并返回新文件名称
             String fileName = FileUploadUtils.upload(filePath, file);
-            String url = serverConfig.getUrl() + fileName;
+            String path = serverConfig.getUrl();
+            String url =  path.substring(0,path.lastIndexOf(":")+1)+port+ fileName;
             AjaxResult ajax = AjaxResult.success();
             ajax.put("url", url);
             ajax.put("fileName", fileName);

+ 2 - 2
beidou-admin/src/main/java/cn/com/taiji/beidou/web/controller/ship/ShipStatusController.java

@@ -69,7 +69,7 @@ public class ShipStatusController extends BaseController {
     @GetMapping("/stasisShipById")
     public R<ShipStatusResult> stasisShipById(String devideNo){
         try{
-            return R.ok(shipStatusService.selectById(devideNo,null,"1"));
+            return R.ok(shipStatusService.selectById(devideNo,null,"TRUE"));
         }catch (Exception e){
             return R.fail(e.getMessage());
         }
@@ -81,7 +81,7 @@ public class ShipStatusController extends BaseController {
         ShipStatusReq shipStatusReq = new ShipStatusReq();
         BeanUtils.copyProperties(req,shipStatusReq);
         shipStatusReq.setDevideNo(req.getShipId());
-        shipStatusReq.setIsStasis("1");
+        shipStatusReq.setIsStasis("TRUE");
         startPage(req.getPageNum(),req.getPageSize());
         List<ShipStatusResult> shipStatusResults = shipStatusService.selectShipStatusList(shipStatusReq);
         return getDataTable(shipStatusResults);

+ 1 - 0
beidou-common/src/main/java/cn/com/taiji/beidou/common/constant/Constants.java

@@ -140,6 +140,7 @@ public class Constants
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
             "org.springframework", "org.apache", "cn.com.taiji.beidou.common.utils.file" };
 
+    public static final String ZERO = "0";
 
     public static final String ONE = "1";
 

+ 3 - 6
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/archives/domain/ShipArchivesData.java

@@ -94,12 +94,6 @@ public class ShipArchivesData {
     private String deptName;
 
     /**
-     * 入库时间
-     */
-    @ApiModelProperty("入库时间")
-    private String locationTime;
-
-    /**
      * 经度
      */
     @ApiModelProperty("经度")
@@ -117,4 +111,7 @@ public class ShipArchivesData {
 
     @ApiModelProperty("位置")
     private String location;
+
+    @ApiModelProperty("关注ID")
+    private String focusId;
 }

+ 2 - 1
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/archives/mapper/ShipArchivesMapper.java

@@ -43,9 +43,10 @@ public interface ShipArchivesMapper{
     /**
      * 船只详情
      * @param devideNo
+     * @param userId
      * @return
      */
-    ShipArchivesData selectById(@Param("devideNo") String devideNo);
+    ShipArchivesData selectById(@Param("devideNo") String devideNo,@Param("userId") String userId);
 
     /**
      * 处置详情

+ 8 - 1
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/archives/service/impl/ShipArchivesServiceImpl.java

@@ -37,13 +37,20 @@ public class ShipArchivesServiceImpl implements ShipArchivesService {
         }else if(Constants.THREE.equals(online)){
             req.setOnline("MARK");
         }
+        String inPort = req.getInPort();
+        if(Constants.ZERO.equals(inPort)){
+            req.setInPort("FALSE");
+        }else if(Constants.ONE.equals(inPort)){
+            req.setInPort("TRUE");
+        }
         List<ShipArchivesData> list = shipArchivesMapper.selectShipArchivesList(req);
         return list;
     }
 
     @Override
     public ShipArchivesData findShipById(String devideNo) {
-        ShipArchivesData data = shipArchivesMapper.selectById(devideNo);
+        String userId = String.valueOf(SecurityUtils.getUserId());
+        ShipArchivesData data = shipArchivesMapper.selectById(devideNo,userId);
         if(null==data.getLastStatus()){
             data.setLastStatus(1);
         }

+ 4 - 1
beidou-ship/src/main/resources/mapper/FocusShipMapper.xml

@@ -56,12 +56,15 @@
     <select id="selectById" parameterType="long" resultMap="focusShipDetail">
         select focus.user_id,focus.focus_id as focus_id,focus.focus_type,focus.create_time as focus_create,
             (CASE st.is_online WHEN 'ONLINE' THEN 1 WHEN 'OFFLINE' THEN 2 WHEN 'MARK' THEN 3 ELSE 1 END ) AS STATUS,
-            dept.pscmc as dept_name,location.kwh,location.location,archives.*
+            dept.pscmc as dept_name,location.kwh,location.location,IFNULL(dispose.dispose_type,'0') as device_status,
+            archives.*
             from ax_beidou_ship_archives archives
             INNER JOIN ax_beidou_focus_ship focus on archives.devide_no = focus.devide_no
             INNER JOIN ax_beidou_dept dept on archives.police_station_id = dept.pscbh
             INNER JOIN ax_beidou_ship_status st on st.device_id = focus.devide_no
             LEFT JOIN ax_beidou_ship_location location on focus.devide_no = location.device_id
+            LEFT JOIN (select id,devide_no,dispose_type from ax_beidou_ship_dispose
+            where devide_no=#{devideNo} ORDER BY id DESC limit 1) as dispose on dispose.devide_no = archives.devide_no
             where focus.focus_id = #{focusId}
     </select>
 

+ 10 - 11
beidou-ship/src/main/resources/mapper/ShipArchivesMapper.xml

@@ -23,7 +23,6 @@
         <result property="ownerType"    column="owner_type"    />
         <result property="lastStatus"    column="status"    />
         <result property="deviceStatus"    column="device_status"    />
-        <result property="locationTime"    column="location_time"    />
         <result property="longitude"    column="longitude"    />
         <result property="latitude"    column="latitude"    />
         <result property="location"    column="location"    />
@@ -110,7 +109,7 @@
         SELECT
         archives.*,
         ( CASE sta.is_online WHEN 'ONLINE' THEN 1 WHEN 'OFFLINE' THEN 2 WHEN 'MARK' THEN 3 ELSE 1 END ) AS STATUS,
-        ( CASE ISNULL(disp.dispose_type) WHEN 0 THEN disp.dispose_type WHEN 1 THEN 1 END) AS device_status,
+        ( CASE ISNULL(dispose_temp.dispose_type) WHEN 0 THEN dispose_temp.dispose_type WHEN 1 THEN 1 END) AS device_status,
         dept.pscmc AS dept_name,
         location.longitude,
         location.latitude,
@@ -121,9 +120,8 @@
         LEFT JOIN ax_beidou_ship_status sta ON archives.devide_no = sta.device_id
         INNER JOIN ax_beidou_dept dept ON archives.police_station_id = dept.pscbh
         LEFT JOIN ax_beidou_ship_location location ON archives.devide_no = location.device_id
-        LEFT JOIN ax_beidou_ship_dispose disp ON archives.devide_no = disp.devide_no
-        <!--LEFT JOIN (select devide_no,max(id) as id from ax_beidou_ship_dispose GROUP BY devide_no) as dispose on dispose.devide_no = archives.devide_no
-        LEFT JOIN ax_beidou_ship_dispose dispose_temp on dispose.id = dispose_temp.id-->
+        LEFT JOIN (select devide_no,max(id) as id from ax_beidou_ship_dispose GROUP BY devide_no) as dispose on dispose.devide_no = archives.devide_no
+        LEFT JOIN ax_beidou_ship_dispose dispose_temp on dispose.id = dispose_temp.id
         where
             1=1
         <if test="shipId != null and shipId != ''">and (archives.ship_id like concat('%', #{shipId},'%') or archives.devide_no like concat('%', #{devideNo},'%'))</if>
@@ -137,14 +135,15 @@
     <select id="selectById" parameterType="string" resultMap="ShipResult">
         select archives.*,
         (CASE sta.is_online WHEN 'ONLINE' THEN 1  WHEN 'OFFLINE' THEN 2 WHEN 'MARK' THEN 3 END) as status,
-        dispose_temp.dispose_type as device_status,location.kwh as kwh,
+        IFNULL(dispose.dispose_type,'0') as device_status,location.kwh as kwh,focus.focus_id as focusId,
         dept.pscmc as dept_name
         from ax_beidou_ship_archives archives
         LEFT JOIN ax_beidou_ship_status sta ON archives.devide_no = sta.device_id
         INNER JOIN ax_beidou_dept dept on archives.police_station_id = dept.pscbh
-        LEFT JOIN (select devide_no,max(id) as id from ax_beidou_ship_dispose GROUP BY devide_no) as dispose on dispose.devide_no = archives.devide_no
-        LEFT JOIN ax_beidou_ship_dispose dispose_temp on dispose.id = dispose_temp.id
+        LEFT JOIN (select id,devide_no,dispose_type from ax_beidou_ship_dispose
+        where devide_no=#{devideNo} ORDER BY id DESC limit 1) as dispose on dispose.devide_no = archives.devide_no
         LEFT JOIN ax_beidou_ship_location location on archives.devide_no = location.device_id
+        LEFT JOIN ax_beidou_focus_ship focus on archives.devide_no = focus.devide_no and focus.user_id=#{userId}
         where  archives.devide_no=#{devideNo}
     </select>
 
@@ -153,8 +152,8 @@
             SUM(CASE sta.is_online WHEN 'MARK' THEN 1 ELSE 0 END ) as mark,
             SUM(CASE sta.is_online WHEN 'ONLINE' THEN 1 ELSE 0 END ) as onlineTotal,
             SUM(CASE sta.is_online WHEN 'OFFLINE' THEN 1 ELSE 0 END ) as offlineTotal,
-            SUM(CASE sta.is_inport WHEN 1 THEN 1 ELSE 0 END)  as inport,
-            SUM(CASE sta.is_inport WHEN 0 THEN 1 ELSE 0 END)  as offport
+            SUM(CASE sta.is_inport WHEN 'TRUE' THEN 1 ELSE 0 END)  as inport,
+            SUM(CASE sta.is_inport WHEN 'FALSE' THEN 1 ELSE 0 END)  as offport
             from ax_beidou_ship_archives archives
             LEFT JOIN ax_beidou_ship_status sta ON archives.devide_no = sta.device_id
             where 1=1
@@ -166,7 +165,7 @@
         select dis.id,dis.warning_id,dis.dispose_type,dis.dispose_suggestion,dis.dispose_picture,
          dis.dispose_user_id,dis.dispose_time,record.warning_time from ax_beidou_ship_dispose dis
         inner join ax_beidou_warning_record record on dis.warning_id = record.id
-        where record.start = 'true'
+        where (record.`start` is null or record.`start` != 'false')
             <if test="warningId != null and warningId != ''">and dis.warning_id = #{warningId}</if>
             <if test="devideNo != null and devideNo != ''">and record.device_id = #{devideNo}</if>
         ORDER BY dispose_time DESC

+ 7 - 3
beidou-ship/src/main/resources/mapper/ShipStatusMapper.xml

@@ -43,6 +43,7 @@
         st.is_inport,location.longitude,location.latitude,location.location,st.online_change_time,
 		location.kwh as kwh,
         dept.pscmc as dept_name,
+        IFNULL(dispose.dispose_type,'0') as device_status,
         <if test="isOnline != null and isOnline != ''">
         TIMESTAMPDIFF(DAY,st.online_change_time,NOW()) as number_day
         </if>
@@ -53,6 +54,8 @@
         inner join ax_beidou_ship_archives archives on st.device_id = archives.devide_no
         inner join ax_beidou_dept dept on archives.police_station_id = dept.pscbh
         LEFT JOIN ax_beidou_ship_location location on archives.devide_no = location.device_id
+        LEFT JOIN (select id,devide_no,dispose_type from ax_beidou_ship_dispose
+        where devide_no=#{devideNo} ORDER BY id DESC limit 1) as dispose on dispose.devide_no = archives.devide_no
         where  1=1
         <if test="devideNo != null and devideNo != ''">
             and st.device_id = #{devideNo}
@@ -67,7 +70,8 @@
     </select>
 
     <select id="selectShipStatusList" parameterType="shipStatusReq" resultMap="shipStatusResult">
-        select archives.*,(CASE st.is_online WHEN 'ONLINE' THEN 1  WHEN 'OFFLINE' THEN 2 WHEN 'MARK' THEN 3 END) as is_online,
+        select archives.*,
+        (CASE st.is_online WHEN 'ONLINE' THEN 1  WHEN 'OFFLINE' THEN 2 WHEN 'MARK' THEN 3 END) as is_online,
         st.is_inport,location.longitude,location.latitude,location.location,
         st.online_change_time ,
         location.kwh as kwh,
@@ -91,7 +95,7 @@
         </if>
         <if test="isStasis != null and isStasis != ''">
             and st.is_anchor = #{isStasis}
-            and TIMESTAMPDIFF(MINUTE,st.anchor_change_time,NOW())>24*60*7
+--             and TIMESTAMPDIFF(MINUTE,st.anchor_change_time,NOW())>24*60*7
         </if>
         <if test="shipId != null and shipId != ''">and (archives.ship_id like concat('%', #{shipId},'%') or archives.devide_no like concat('%', #{devideNo},'%'))</if>
         <if test="deptId != null and deptId != ''">and dept.xw_dept_id like concat('%',#{deptId},'%')</if>
@@ -128,7 +132,7 @@
         <if test="deptId != null and deptId != ''">
         inner join ax_beidou_dept dept on archives.police_station_id = dept.pscbh
         </if>
-        where st.is_anchor='1' and TIMESTAMPDIFF(MINUTE,st.anchor_change_time,NOW())>24*60*7
+        where st.is_anchor='TRUE' and TIMESTAMPDIFF(MINUTE,st.anchor_change_time,NOW())>24*60*7
         <if test="shipId != null and shipId != ''">and (archives.ship_id like concat('%', #{shipId},'%') or archives.devide_no like concat('%', #{devideNo},'%'))</if>
         <if test="deptId != null and deptId != ''">and dept.xw_dept_id like concat('%',#{deptId},'%')</if>
     </select>

+ 3 - 3
beidou-ship/src/main/resources/mapper/WarningRecordMapper.xml

@@ -39,7 +39,7 @@
         INNER JOIN ax_beidou_dept dept ON archives.police_station_id = dept.pscbh
         </if>
         <where>
-            record.rule_id = #{ruleId} and record.start = 'true'
+            record.rule_id = #{ruleId} and (record.`start` is null or record.`start` != 'false')
             <if test="deptId != null and deptId != ''">
                 and dept.xw_dept_id like concat('%',#{deptId},'%')
             </if>
@@ -57,7 +57,7 @@
        select record.id,warning_time as warningTime,dis.id as disposeId
         from ax_beidou_warning_record record
         LEFT JOIN ax_beidou_ship_dispose dis ON dis.warning_id = record.id
-        where record.device_id = #{devideNo} and record.rule_id = #{ruleId} and record.start = 'true' ORDER BY warning_time DESC
+        where record.device_id = #{devideNo} and record.rule_id = #{ruleId} and (record.`start` is null or record.`start` != 'false') ORDER BY warning_time DESC
     </select>
 
     <select id="warningRecordExcel" parameterType="string" resultType="warningRecordExcel">
@@ -68,7 +68,7 @@
         INNER JOIN ax_beidou_dept dept ON archives.police_station_id = dept.pscbh
         LEFT JOIN ax_beidou_ship_location location ON location.device_id = record.device_id
         <where>
-            record.rule_id = #{ruleId} and record.start = 'true'
+            record.rule_id = #{ruleId} and (record.`start` is null or record.`start` != 'false')
             <if test="deptId != null and deptId != ''">
                 and dept.xw_dept_id = #{deptId}
             </if>