Browse Source

获取事发地上游10公里内的情报板

develop
lau572 8 months ago
parent
commit
63c1ff4a7c
  1. 18
      zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java
  2. 2
      zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java
  3. 6
      zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
  4. 27
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
  5. 10
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml
  6. 7
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml

18
zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java

@ -19,6 +19,7 @@ import com.zc.common.core.httpclient.exception.HttpException;
import com.zc.common.core.httpclient.request.RequestParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Parameter;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Value;
@ -575,4 +576,21 @@ public class DcDeviceController extends BaseController {
return JSON.parseObject(response.body().string(), AjaxResult.class);
}
/**
* @Description 查询上游10公里内的情报板
*
* @author liuwenge
* @date 2024/4/15 14:22
* @param stakeMark
* @param direction
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@ApiOperation("查询上游10公里内的情报板")
@PostMapping("/selectNearBoard")
public AjaxResult selectNearBoard(@ApiParam(value="桩号", name="stakeMark", required=true) @RequestParam ("stakeMark") String stakeMark,
@ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction){
return dcDeviceService.selectNearBoard(stakeMark,direction);
}
}

2
zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java

@ -21,4 +21,6 @@ public interface DcDeviceMapper extends BaseMapper<DcDevice> {
List<DcDevice> numberOfDevicesByType();
List<DcDevice> selectNearCamPile(@Param("direction") String direction,@Param("startMileage") String startMileage,@Param("endMileage") String endMileage);
List<DcDevice> selectNearBoard(@Param("direction") String direction,@Param("startMileage") Integer startMileage,@Param("endMileage") Integer endMileage);
}

6
zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java

@ -2,6 +2,7 @@ package com.zc.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.DcStakeMark;
@ -83,4 +84,9 @@ public interface IDcDeviceService extends IService<DcDevice> {
List<DcDevice> numberOfDevicesByType();
List<DcDevice> selectNearCamPile(String direction,String startMileage,String endMileage);
/**
* 查询上游10公里内的情报板
*/
AjaxResult selectNearBoard(String stakeMark, String direction);
}

27
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -3,9 +3,11 @@ package com.zc.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StakeMarkUtils;
import com.zc.business.constant.RedisKeyConstants;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.DcProduct;
@ -472,5 +474,30 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
public List<DcDevice> selectNearCamPile(String direction,String startMileage,String endMileage){
return dcDeviceMapper.selectNearCamPile(direction,startMileage,endMileage);
}
/**
* @Description 获取事发地上游10公里内的情报板
*
* @author liuwenge
* @date 2024/4/15 14:18
* @param stakeMark 桩号
* @param direction 方向
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@Override
public AjaxResult selectNearBoard(String stakeMark, String direction){
Integer mileage = Integer.valueOf(StakeMarkUtils.formatMetre(stakeMark));
List<DcDevice> boardList = new ArrayList<>();
if ("1".equals(direction)){
Integer start = mileage - 10000;
boardList = dcDeviceMapper.selectNearBoard(direction,start,mileage);
} else if ("3".equals(direction)){
Integer end = mileage + 10000;
boardList = dcDeviceMapper.selectNearBoard(direction,mileage,end);
}
return AjaxResult.success(boardList);
}
}

10
zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

@ -128,5 +128,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and t1.direction = #{direction}
and t2.mileage >= #{startMileage} and t2.mileage &lt;= #{endMileage}
</select>
<select id="selectNearBoard" resultType="com.zc.business.domain.DcDevice">
select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name,
t1.device_code, t1.device_type,t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,
t1.use_state,t1.device_state,t1.other_config,t1.remark,t1.create_time,t1.update_time,t1.facilities_type,
t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude
from dc_device t1
left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction
where t1.device_type = '2' and t1.direction = #{direction}
and t2.mileage >= #{startMileage} and t2.mileage &lt;= #{endMileage}
</select>
</mapper>

7
zc-business/src/main/resources/mapper/business/DcEventMapper.xml

@ -667,7 +667,8 @@
</trim>
where id = #{id}
</update>
<update id="updateDcEventLinkId" parameterType="DcEvent">
<update id="updateDcEventLinkId" parameterType="DcEvent">
update dc_event
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
@ -747,11 +748,11 @@
</select>
<select id="getProcessNode" resultType="java.util.Map">
select t2.node_node,t2.process_node,t3.operation_time,
select t2.node_node nodeNode,t2.process_node processNode,t3.operation_time operationTime,
case when ISNULL(t3.id) then '0' else '1' end status
from dc_event t1
LEFT JOIN dc_process_config t2 on t1.event_type = t2.event_type
left join dc_event_process t3 on t2.node_node = t3.process_id and t3.process_type = '1'
left join dc_event_process t3 on t1.id = t3.event_id and t2.node_node = t3.process_id and t3.process_type = '1'
where t1.id = #{eventId}
</select>

Loading…
Cancel
Save