Browse Source

预警规则模糊查询,勾选区域,预警记录start过滤

minghao-chen 2 years ago
parent
commit
d78bb23f22

+ 14 - 4
beidou-admin/src/main/java/cn/com/taiji/beidou/web/controller/ship/ShipWarningRuleController.java

@@ -73,16 +73,16 @@ public class ShipWarningRuleController extends BaseController {
 
     @ApiOperation("预警规则列表")
     @GetMapping("/warn-rule/list")
-    public TableDataInfo getWarningRuleList(Integer pageNum, Integer pageSize){
+    public TableDataInfo getWarningRuleList(String ruleName, Integer pageNum, Integer pageSize){
         startPage(pageNum,pageSize);
-        List<WarningRuleResult> results = shipWarningModelMapper.selectRuleList(null,null);
+        List<WarningRuleResult> results = shipWarningModelMapper.selectRuleList(ruleName,null,null);
         return getDataTable(results);
     }
 
     @ApiOperation("预警规则列表(预警接入)")
     @GetMapping("/warn-rule/lists")
     public R<List<WarningRuleResult>> lists(){
-        List<WarningRuleResult> results = shipWarningModelMapper.selectRuleList(null,null);
+        List<WarningRuleResult> results = shipWarningModelMapper.selectRuleList(null,null,null);
         if (results==null||results.size()<0){
             return R.fail();
         }
@@ -92,7 +92,7 @@ public class ShipWarningRuleController extends BaseController {
     @ApiOperation("预警规则详情")
     @GetMapping("/warn-rule/get-by-id")
     public R<WarningRuleResult> getWarningRuleById(String id){
-        List<WarningRuleResult> results = shipWarningModelMapper.selectRuleList(null,id);
+        List<WarningRuleResult> results = shipWarningModelMapper.selectRuleList(null,null,id);
         if(results==null||results.size()<1){
             return R.fail();
         }
@@ -169,4 +169,14 @@ public class ShipWarningRuleController extends BaseController {
             return R.fail(e.getMessage());
         }
     }
+
+    @ApiOperation(value = "勾选区域",notes = "参数ids是字符串,多个区域id以英文符号逗号隔开")
+    @PostMapping("/getAreaByIds")
+    public R getWarningAreaById(String ids){
+        try {
+            return R.ok(shipWarningService.findInId(ids));
+        }catch (Exception e){
+            return R.fail(e.getMessage());
+        }
+    }
 }

+ 16 - 1
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/warning/model/mapper/ShipWarningModelMapper.java

@@ -23,7 +23,14 @@ public interface ShipWarningModelMapper {
      */
     List<WarningModelResult> selectModelList(@Param("modelName")String modelName,@Param("id")String id);
 
-    List<WarningRuleResult> selectRuleList(@Param("enabled") String enabled,@Param("id")String id);
+    /**
+     * 规则列表
+     * @param ruleName
+     * @param enabled
+     * @param id
+     * @return
+     */
+    List<WarningRuleResult> selectRuleList(@Param("ruleName")String ruleName,@Param("enabled") String enabled,@Param("id")String id);
 
     /**
      * 启用停用
@@ -233,4 +240,12 @@ public interface ShipWarningModelMapper {
      * @return
      */
     int selectWarningRuleByName(@Param("ruleName")String ruleName,@Param("id")String id);
+
+
+    /**
+     * 根据勾选区域返回对应的区域信息
+     * @param ids
+     * @return
+     */
+    List<WarningAreaVo> findInId(String[] ids);
 }

+ 9 - 0
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/warning/model/service/ShipWarningService.java

@@ -4,6 +4,8 @@ import cn.com.taiji.beidou.ship.warning.model.domain.*;
 import cn.com.taiji.beidou.ship.warning.rule.domain.UpdateEnabledReq;
 import cn.com.taiji.beidou.ship.warning.rule.domain.WarningRuleData;
 
+import java.util.List;
+
 /**
  * @Author CHEN
  * @Date 2022/11/20 9:50
@@ -43,4 +45,11 @@ public interface ShipWarningService {
      * @return
      */
     int delModel(String id);
+
+    /**
+     * 勾选区域
+     * @param ids
+     * @return
+     */
+    List<WarningAreaVo> findInId(String ids);
 }

+ 7 - 0
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/warning/model/service/impl/ShipWarningServiceImpl.java

@@ -253,4 +253,11 @@ public class ShipWarningServiceImpl implements ShipWarningService {
         shipWarningModelMapper.delModelAndParam(id);
         return shipWarningModelMapper.delModel(id);
     }
+
+    @Override
+    public List<WarningAreaVo> findInId(String ids) {
+        String[] array = ids.split(",");
+
+        return shipWarningModelMapper.findInId(array);
+    }
 }

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

@@ -32,7 +32,7 @@
     </resultMap>
 
     <insert id="insertFocusShip" parameterType="focusShipData">
-        insert ax_beidou_focus_ship(
+        insert into ax_beidou_focus_ship(
             focus_id,
             <if test="devideNo != null and devideNo != ''">devide_no,</if>
             <if test="shipId != null and shipId != ''">ship_id,</if>

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

@@ -166,10 +166,9 @@
         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>
-            <if test="warningId != null and warningId != ''">dis.warning_id = #{warningId}</if>
+        where record.start = 'true'
+            <if test="warningId != null and warningId != ''">and dis.warning_id = #{warningId}</if>
             <if test="devideNo != null and devideNo != ''">and record.device_id = #{devideNo}</if>
-        </where>
         ORDER BY dispose_time DESC
         limit 1
     </select>

+ 12 - 0
beidou-ship/src/main/resources/mapper/ShipWarningModelMapper.xml

@@ -35,6 +35,7 @@
         where  rule.del_flag='0'
         <if test="enabled != null">and rule.enabled = #{enabled}</if>
         <if test="id != null and id != ''">and rule.id = #{id}</if>
+        <if test="ruleName != null and ruleName != ''">and rule.name like concat('%',#{ruleName},'%')</if>
         ORDER BY rule.create_time DESC
     </select>
 
@@ -442,4 +443,15 @@
             and id != #{id}
         </if>
     </select>
+
+    <!--按勾选区域查询预警区域-->
+    <select id="findInId" parameterType="string" resultType="warningAreaVo">
+        select id,`name`,location from ax_beidou_warning_area
+        where del_flag = '0'
+        and id in
+        <foreach collection="array" index="index" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>

+ 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}
+            record.rule_id = #{ruleId} and record.start = 'true'
             <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} ORDER BY warning_time DESC
+        where record.device_id = #{devideNo} and record.rule_id = #{ruleId} and record.start = 'true' 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}
+            record.rule_id = #{ruleId} and record.start = 'true'
             <if test="deptId != null and deptId != ''">
                 and dept.xw_dept_id = #{deptId}
             </if>