批量删除执法记录仪文件信息等修复
This commit is contained in:
parent
f2f27114a8
commit
7b3b14f889
@ -23,6 +23,7 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -120,6 +121,22 @@ public class PoliceCameraItemFileController {
|
|||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperLog(operModul = "执法记录仪文件管理", operType = "批量删除", operDesc = "批量删除执法记录仪文件信息")
|
||||||
|
@ApiOperation(value = "批量删除执法记录仪文件信息", notes = "批量删除执法记录仪文件信息", httpMethod = "POST")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "执法记录仪文件管理ids(多个,分隔)", paramType = "body", required = true, dataType = "String")
|
||||||
|
@PostMapping(value = "/deleteBatch")
|
||||||
|
public Result deleteBatch(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||||
|
Result result = new Result<>();
|
||||||
|
String ids = MapUtils.getString(map, "ids");
|
||||||
|
if (ids == null || "".equals(ids.trim())) {
|
||||||
|
result.error500("参数不识别!");
|
||||||
|
} else {
|
||||||
|
policeCameraItemFileService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
Result.success("删除成功!");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
package com.zhgd.xmgl.modules.video.entity.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GroupVideoNumBo {
|
||||||
|
private Integer totalNum;
|
||||||
|
private Long groupId;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.zhgd.xmgl.modules.video.entity.vo;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.modules.video.entity.VideoGroup;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VideoGroupVo extends VideoGroup {
|
||||||
|
@ApiModelProperty("摄像头数量")
|
||||||
|
private Integer totalNum;
|
||||||
|
}
|
||||||
@ -5,11 +5,13 @@ import com.zhgd.annotation.DataScope;
|
|||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||||
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
||||||
|
import com.zhgd.xmgl.modules.video.entity.bo.GroupVideoNumBo;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.vo.CountStatusVo;
|
import com.zhgd.xmgl.modules.xz.entity.vo.CountStatusVo;
|
||||||
import com.zhgd.xmgl.modules.yunlianwanwu.middle.entity.VideoItemConfigBo;
|
import com.zhgd.xmgl.modules.yunlianwanwu.middle.entity.VideoItemConfigBo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -183,4 +185,6 @@ public interface VideoItemMapper extends BaseMapper<VideoItem> {
|
|||||||
List<CountStatusVo> countStatusTrend(Map<String, Object> param);
|
List<CountStatusVo> countStatusTrend(Map<String, Object> param);
|
||||||
|
|
||||||
List<TrendOneVo> getExceedSpeedTrend(Map<String, Object> map);
|
List<TrendOneVo> getExceedSpeedTrend(Map<String, Object> map);
|
||||||
|
|
||||||
|
List<GroupVideoNumBo> getGroupVideoNumList(HashMap<String, Object> paramMap);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,7 +175,7 @@
|
|||||||
and t2.project_sn = #{projectSn}
|
and t2.project_sn = #{projectSn}
|
||||||
order by t1.sort_num
|
order by t1.sort_num
|
||||||
<if test="deviceState != null and deviceState != ''">
|
<if test="deviceState != null and deviceState != ''">
|
||||||
and ti.device_state = #{deviceState}
|
and t1.device_state = #{deviceState}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectUserVideoList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
<select id="selectUserVideoList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||||
@ -366,4 +366,16 @@
|
|||||||
group by date
|
group by date
|
||||||
) as t
|
) as t
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getGroupVideoNumList" resultType="com.zhgd.xmgl.modules.video.entity.bo.GroupVideoNumBo">
|
||||||
|
SELECT
|
||||||
|
vg.id as groupId
|
||||||
|
,count(distinct t1.item_id) totalNum
|
||||||
|
FROM video_item t1
|
||||||
|
INNER JOIN project_video_config t2 ON t2.id = t1.video_id
|
||||||
|
INNER JOIN video_group vg ON vg.id = t1.group_id
|
||||||
|
WHERE t2.is_enable = 1
|
||||||
|
AND vg.project_sn=#{projectSn}
|
||||||
|
group by vg.id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package com.zhgd.xmgl.modules.video.service.impl;
|
package com.zhgd.xmgl.modules.video.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@ -11,20 +12,19 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
|
|||||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||||
import com.zhgd.xmgl.modules.video.entity.VideoGroup;
|
import com.zhgd.xmgl.modules.video.entity.VideoGroup;
|
||||||
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
||||||
|
import com.zhgd.xmgl.modules.video.entity.bo.GroupVideoNumBo;
|
||||||
|
import com.zhgd.xmgl.modules.video.entity.vo.VideoGroupVo;
|
||||||
import com.zhgd.xmgl.modules.video.mapper.VideoGroupMapper;
|
import com.zhgd.xmgl.modules.video.mapper.VideoGroupMapper;
|
||||||
import com.zhgd.xmgl.modules.video.mapper.VideoItemMapper;
|
import com.zhgd.xmgl.modules.video.mapper.VideoItemMapper;
|
||||||
import com.zhgd.xmgl.modules.video.service.IVideoGroupService;
|
import com.zhgd.xmgl.modules.video.service.IVideoGroupService;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.XzProjectOrg;
|
|
||||||
import com.zhgd.xmgl.util.ListUtils;
|
import com.zhgd.xmgl.util.ListUtils;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
import org.apache.commons.collections.MapUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,6 +122,36 @@ public class VideoGroupServiceImpl extends ServiceImpl<VideoGroupMapper, VideoGr
|
|||||||
@Override
|
@Override
|
||||||
public JSONArray treeList(HashMap<String, Object> paramMap) {
|
public JSONArray treeList(HashMap<String, Object> paramMap) {
|
||||||
QueryWrapper<VideoGroup> queryWrapper = QueryGenerator.initPageQueryWrapper(VideoGroup.class, paramMap);
|
QueryWrapper<VideoGroup> queryWrapper = QueryGenerator.initPageQueryWrapper(VideoGroup.class, paramMap);
|
||||||
return ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list(queryWrapper))), "id", "parentId", "children");
|
List<VideoGroup> groups = list(queryWrapper);
|
||||||
|
List<GroupVideoNumBo> videoNumBos = videoItemMapper.getGroupVideoNumList(paramMap);
|
||||||
|
Map<Long, GroupVideoNumBo> videoNumMap = videoNumBos.stream().collect(Collectors.toMap(GroupVideoNumBo::getGroupId, Function.identity(), (o1, o2) -> o1));
|
||||||
|
List<VideoGroupVo> videoGroupVos = BeanUtil.copyToList(groups, VideoGroupVo.class);
|
||||||
|
for (VideoGroupVo vo : videoGroupVos) {
|
||||||
|
vo.setTotalNum(Optional.ofNullable(videoNumMap.get(vo.getId())).map(GroupVideoNumBo::getTotalNum).orElse(0));
|
||||||
|
}
|
||||||
|
JSONArray jsonArray = ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(videoGroupVos)), "id", "parentId", "children");
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||||
|
getTotalNum(jsonObject, "children");
|
||||||
|
}
|
||||||
|
return jsonArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Integer getTotalNum(JSONObject jsonObject, String childName) {
|
||||||
|
JSONArray children = jsonObject.getJSONArray(childName);
|
||||||
|
Integer thisNum = jsonObject.getInteger("totalNum");
|
||||||
|
Integer totalChildNum = 0;
|
||||||
|
if (CollUtil.isNotEmpty(children)) {
|
||||||
|
for (int i = 0; i < children.size(); i++) {
|
||||||
|
JSONObject child = children.getJSONObject(i);
|
||||||
|
Integer childNum = getTotalNum(child, childName);
|
||||||
|
// 累加子节点的统计结果
|
||||||
|
totalChildNum += childNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int total = thisNum + totalChildNum;
|
||||||
|
jsonObject.put("totalNum", total);
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,8 +71,9 @@ public class UniPushController {
|
|||||||
if (apiResult.isSuccess()){
|
if (apiResult.isSuccess()){
|
||||||
result.successMsg("操作成功");
|
result.successMsg("操作成功");
|
||||||
}else{
|
}else{
|
||||||
result.error500(apiResult.getMsg());
|
// result.error500(apiResult.getMsg());
|
||||||
}
|
}
|
||||||
|
result.code(200);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("error:", e);
|
log.error("error:", e);
|
||||||
result.error500("操作失败");
|
result.error500("操作失败");
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.zhgd.xmgl.push.service.impl;
|
package com.zhgd.xmgl.push.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.getui.push.v2.sdk.api.UserApi;
|
||||||
import com.getui.push.v2.sdk.common.ApiResult;
|
import com.getui.push.v2.sdk.common.ApiResult;
|
||||||
import com.getui.push.v2.sdk.dto.req.Audience;
|
import com.getui.push.v2.sdk.dto.req.Audience;
|
||||||
import com.getui.push.v2.sdk.dto.req.CidAliasListDTO;
|
import com.getui.push.v2.sdk.dto.req.CidAliasListDTO;
|
||||||
@ -154,8 +155,11 @@ public class UniPushServiceImpl implements UniPushService {
|
|||||||
list.add(cidAlias);
|
list.add(cidAlias);
|
||||||
cidAliasListDTO.setDataList(list);
|
cidAliasListDTO.setDataList(list);
|
||||||
if (pushApiHelper != null) {
|
if (pushApiHelper != null) {
|
||||||
ApiResult result = pushApiHelper.getUserApi().bindAlias(cidAliasListDTO);
|
UserApi userApi = pushApiHelper.getUserApi();
|
||||||
return result;
|
if (userApi != null) {
|
||||||
|
return userApi.bindAlias(cidAliasListDTO);
|
||||||
|
}
|
||||||
|
return ApiResult.fail("配置初始化失败", 5000);
|
||||||
} else {
|
} else {
|
||||||
return ApiResult.fail("配置初始化失败", 5000);
|
return ApiResult.fail("配置初始化失败", 5000);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user