Merge branch 'dev'

This commit is contained in:
wangliwen 2022-06-28 20:13:40 +08:00
commit f435bb8d49
10 changed files with 144 additions and 25 deletions

View File

@ -173,21 +173,31 @@ public class Controller {
/**
* 根据parentId和checkStatus查询摄像头
* @param parentId
* @param
* @return
*/
@GetMapping("selectByParentId")
@ApiOperation("根据摄像头的组织Id和异常状态查询摄像头")
@ApiImplicitParams({
@ApiImplicitParam(name = "parentId",value = "摄像头的组织Id",required = true,dataType = "String"),
@ApiImplicitParam(name = "checkStatus",value = "异常状态 1正常,0异常",required = true,dataType = "String")
@ApiImplicitParam(name = "checkStatus",value = "异常状态 1正常,0异常",required = true,dataType = "String"),
@ApiImplicitParam(name = "cameraName",value = "摄像头名称",dataType = "String"),
@ApiImplicitParam(name = "gpsX",value = "经度坐标",dataType = "Double"),
@ApiImplicitParam(name = "gpsY",value = "纬度坐标",dataType = "Double"),
@ApiImplicitParam(name = "pageNum",value = "页码",dataType = "Integer"),
@ApiImplicitParam(name = "pageSize",value = "页数大小",dataType = "Integer"),
@ApiImplicitParam(name = "radius",value = "半径",dataType = "Integer")
})
public Result selectByParentId(String parentId,String checkStatus){
public Result selectByParentId(@RequestParam Map queryMap){
if (!queryMap.containsKey("pageNum")) {
queryMap.put("pageNum", null);
queryMap.put("pageSize", null);
}
List<CameraChannel> list = cameraChannelMapper.selectByParentId(parentId,checkStatus);
List<CameraChannel> list = cameraChannelMapper.selectByParentId(queryMap);
Result success = Result.success(list);
success.setCount(cameraChannelMapper.selectByParentIdCount(queryMap));
return success;
}

View File

@ -1,6 +1,5 @@
package io.renren.modules.monitor.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.common.dao.BaseDao;
import io.renren.modules.monitor.dto.CameraChannelDto;
import io.renren.modules.monitor.dto.CameraChannelDto1;
@ -13,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface CameraChannelMapper extends BaseDao<CameraChannel> {
@ -24,9 +24,7 @@ public interface CameraChannelMapper extends BaseDao<CameraChannel> {
@Select("select cc.*,cp.pic_url from t_camera_channel cc LEFT JOIN t_channel_picture cp ON cc.channel_code=cp.channel_code where cc.channel_code = #{channelCode}")
List<CameraChannelDto1> selectByChannelCode(@Param("channelCode") String channelCode);
@Select("select * from t_camera_channel where parent_id = #{parentId} and check_status in (${checkStatus}) ")
List<CameraChannel> selectByParentId(@Param("parentId") String parentId,
@Param("checkStatus") String checkStatus);
List<CameraChannel> selectByParentId(@Param("map") Map queryMap);
@Select("select c.* from t_camera_channel c where channel_code in " +
"(select b.channel_code from t_channel_mtm_label b where b.label_code = #{labelCode}) ")
@ -62,4 +60,5 @@ public interface CameraChannelMapper extends BaseDao<CameraChannel> {
List<CameraChannelNLDto> selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
Integer selectByParentIdCount(@Param("map") Map queryMap);
}

View File

@ -52,4 +52,7 @@ public class TAbilityApplicationDTO extends AuditingBaseDTO implements Serializa
@ApiModelProperty(value = "附件")
private String enclosure;
@ApiModelProperty(value = "摄像头ID数组")
private String cameraList;
}

View File

@ -9,7 +9,6 @@ import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Data
@ApiModel(value = "批量能力申请表单")
public class TAbilityBatchApplicationDTO extends AuditingBaseDTO implements Serializable {
@ -48,4 +47,7 @@ public class TAbilityBatchApplicationDTO extends AuditingBaseDTO implements Seri
@ApiModelProperty(value = "附件")
private String enclosure;
@ApiModelProperty(value = "摄像头ID数组")
private String cameraList;
}

View File

@ -1,8 +1,12 @@
package io.renren.modules.processForm.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
/**
* 能力申请表单
@ -13,7 +17,7 @@ import com.baomidou.mybatisplus.annotation.*;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_ability_application")
public class TAbilityApplicationEntity {
public class TAbilityApplicationEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
@ -87,4 +91,9 @@ public class TAbilityApplicationEntity {
* 流程通过后api网关注册的认证code用于三方接口调用
*/
private String gatewayCode;
/**
* 摄像头ID数组
*/
private String cameraList;
}

View File

@ -451,4 +451,11 @@ public class ResourceController {
}
return null;
}
@GetMapping("/getApplyCameraList")
@ApiOperation("根据流程实例ID获取申请摄像头列表")
@LogOperation("根据流程实例ID获取申请摄像头列表")
public Result getApplyCameraList(@RequestParam Long instanceId) {
return new Result().ok(resourceService.getApplyCameraList(instanceId));
}
}

View File

@ -107,4 +107,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
List<Map> selectDTOPageSpecilTotal(ResourceDTO resourceDTO);
Object getApplyCameraList(Long instanceId);
}

View File

@ -12,6 +12,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.constant.Constant;
import io.renren.common.domain.Tsingtao_xhaProperties;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
import io.renren.modules.resource.dao.AttrDao;
import io.renren.modules.resource.dao.ResourceDao;
import io.renren.modules.resource.dataResource.domain.TsingtaoDataResourceService;
@ -121,6 +124,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private SysDeptDao sysDeptDao;
@Autowired
private TAbilityApplicationDao tAbilityApplicationDao;
@Lazy
@Autowired
private JdbcTemplate jdbcTemplate;
@ -847,6 +853,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return resourceDao.selectDTOPageSpecilTotal(resourceDTO);
}
@Override
public Object getApplyCameraList(Long instanceId) {
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("instance_id", instanceId);
TAbilityApplicationEntity applicationEntity = tAbilityApplicationDao.selectOne(queryWrapper);
String cameraListString = applicationEntity.getCameraList();
return JSONArray.parseObject(cameraListString, List.class);
}
@Override
public Object selectResourceListByType(String type) {
return resourceDao.selectByType(type);

View File

@ -0,0 +1 @@
ALTER TABLE t_ability_application ADD COLUMN `cameraList` json NULL COMMENT '摄像头ID数组';

View File

@ -1,20 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.monitor.mapper.CameraChannelMapper">
<!-- <update id="updateState" parameterType="java.util.List">-->
<!-- <foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">-->
<!-- update CameraChannel set state =#{item.estAmount,jdbcType=NUMERIC}-->
<!-- where t.licai_id = #{item.licaiId,jdbcType=NUMERIC}-->
<!-- </foreach>-->
<!-- </update>-->
<select id="selectAll" resultType="io.renren.modules.monitor.dto.CameraChannelDto">
select c.* from t_camera_channel c
where (c.gps_x NOT IN('0.0','0','','-1000.0') OR c.gps_y NOT IN('0.0','0','','-1000.0'))
AND c.status != 0 AND c.check_status != 0
<!-- <bind name="page" value="(page-1)*pageSize"/>-->
<!-- limit #{page},#{pageSize}-->
</select>
<update id="updateCameraStatus" parameterType="java.util.List">
@ -25,11 +16,91 @@
</update>
<select id="selectNLAll" resultType="io.renren.modules.monitor.dto.CameraChannelNLDto">
SELECT a.label_name,d.* from t_label a RIGHT JOIN (select b.label_code,c.* from t_camera_channel c
LEFT JOIN t_channel_mtm_label b on c.channel_code = b.channel_code) d
on d.label_code = a.label_code
SELECT
a.label_name,
d.*
FROM t_label a
RIGHT JOIN (select b.label_code,c.* FROM t_camera_channel c
LEFT JOIN t_channel_mtm_label b ON c.channel_code = b.channel_code) d
ON d.label_code = a.label_code
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
LIMIT #{page},#{pageSize}
</select>
<select id="selectByParentId" resultType="io.renren.modules.monitor.entity.CameraChannel">
<!--SELECT *
FROM t_camera_channel
WHERE parent_id = #{parentId}
AND check_status IN (${checkStatus})
<if test = "cameraName != null and cameraName != ''">
AND channel_name LIKE CONCAT('%',#{cameraName},'%')
</if> -->
SELECT
*
<if test = "(map.gpsX != null and map.gpsX != '') and (map.gpsY != null and map.gpsY != '')">
, 6371 * acos(cos(radians( ${map.gpsY} ))
* cos(radians( gps_y ))
* cos(radians( gps_x ) - radians( ${map.gpsX} ))
+ sin(radians( ${map.gpsY} ))
* sin(radians( gps_y ))) AS `distance`
</if>
FROM
t_camera_channel
WHERE 1 = 1
<if test = "map.parentId != null and map.parentId != ''">
AND parent_id = #{map.parentId}
</if>
AND check_status IN (${map.checkStatus})
AND gps_x != ''
AND gps_y != ''
AND gps_x IS NOT NULL
AND gps_y IS NOT NULL
<if test = "map.cameraName != null and map.cameraName != ''">
AND channel_name LIKE CONCAT('%',#{map.cameraName},'%')
</if>
<if test = "map.radius != null and map.radius != ''">
HAVING
distance &lt; ${map.radius}
ORDER BY
distance
</if>
<if test = "(map.pageNum != null and map.pageNum != '') and (map.pageSize != null and map.pageSize != '')">
LIMIT ${map.pageNum}, ${map.pageSize}
</if>
</select>
<select id="selectByParentIdCount" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM (
SELECT
*
<if test = "(map.gpsX != null and map.gpsX != '') and (map.gpsY != null and map.gpsY != '')">
, 6371 * acos(cos(radians( ${map.gpsY} ))
* cos(radians( gps_y ))
* cos(radians( gps_x ) - radians( ${map.gpsX} ))
+ sin(radians( ${map.gpsY} ))
* sin(radians( gps_y ))) AS `distance`
</if>
FROM
t_camera_channel
WHERE 1 = 1
<if test = "map.parentId != null and map.parentId != ''">
AND parent_id = #{map.parentId}
</if>
AND check_status IN (${map.checkStatus})
AND gps_x != ''
AND gps_y != ''
AND gps_x IS NOT NULL
AND gps_y IS NOT NULL
<if test = "map.cameraName != null and map.cameraName != ''">
AND channel_name LIKE CONCAT('%',#{map.cameraName},'%')
</if>
<if test = "map.radius != null and map.radius != ''">
HAVING
distance &lt; ${map.radius}
ORDER BY
distance
</if> ) temp
</select>
</mapper>