测试用例活动单元
This commit is contained in:
parent
7ee6ce6389
commit
4b3e1cb9f7
|
|
@ -0,0 +1,352 @@
|
|||
package com.dkl.large.controller;
|
||||
|
||||
import com.dkl.common.core.domain.AjaxResult;
|
||||
import com.dkl.common.core.page.TableDataInfo;
|
||||
import com.dkl.large.domain.DklMonitoringPoints;
|
||||
import com.dkl.large.service.IDklMonitoringPointsService;
|
||||
import com.koal.kms.sdk.ed.KmsSdkException;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* 监控点信息Controller单元测试
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@WithMockUser(roles = "ADMIN") // 模拟登录用户,满足权限校验
|
||||
public class DklMonitoringPointsControllerTest {
|
||||
|
||||
// 注入被测试的Controller(自动注入Mock的依赖)
|
||||
@InjectMocks
|
||||
private DklMonitoringPointsController monitoringPointsController;
|
||||
|
||||
// 模拟Controller依赖的Service层
|
||||
@Mock
|
||||
private IDklMonitoringPointsService monitoringPointsService;
|
||||
|
||||
// 测试用例基础数据
|
||||
private DklMonitoringPoints testPoint;
|
||||
private List<DklMonitoringPoints> testPointList;
|
||||
|
||||
/**
|
||||
* 每个测试方法执行前初始化测试数据
|
||||
*/
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
// 初始化单个监控点数据
|
||||
testPoint = new DklMonitoringPoints();
|
||||
testPoint.setId(1L);
|
||||
testPoint.setPointName("测试监控点");
|
||||
testPoint.setDelFlag("0");
|
||||
|
||||
// 初始化监控点列表
|
||||
testPointList = new ArrayList<>();
|
||||
testPointList.add(testPoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试查询监控点列表(list接口)
|
||||
*/
|
||||
@Test
|
||||
void testList() throws KmsSdkException {
|
||||
// 1. 模拟Service层返回数据
|
||||
when(monitoringPointsService.selectDklMonitoringPointsList(any(DklMonitoringPoints.class)))
|
||||
.thenReturn(testPointList);
|
||||
|
||||
// 2. 调用Controller接口
|
||||
TableDataInfo result = monitoringPointsController.list(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertEquals(testPointList.size(), result.getRows().size());
|
||||
assertEquals(testPointList.get(0).getId(), ((DklMonitoringPoints) result.getRows().get(0)).getId());
|
||||
|
||||
// 4. 验证Service方法被调用
|
||||
verify(monitoringPointsService, times(1)).selectDklMonitoringPointsList(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试查询监控点消息(listMessage接口)
|
||||
*/
|
||||
@Test
|
||||
void testListMessage() throws KmsSdkException {
|
||||
// 1. 模拟Service返回消息
|
||||
String mockMessage = "查询成功";
|
||||
when(monitoringPointsService.selectDklMonitoringPointsListMeaasge(any(DklMonitoringPoints.class)))
|
||||
.thenReturn(mockMessage);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.listMessage(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals(mockMessage, result.getData());
|
||||
|
||||
// 4. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).selectDklMonitoringPointsListMeaasge(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试查询所有有效监控点(listAll接口)
|
||||
*/
|
||||
@Test
|
||||
void testListAll() throws KmsSdkException {
|
||||
// 1. 模拟Service返回数据
|
||||
when(monitoringPointsService.selectDklMonitoringPointsList(any(DklMonitoringPoints.class)))
|
||||
.thenReturn(testPointList);
|
||||
|
||||
// 2. 调用接口
|
||||
TableDataInfo result = monitoringPointsController.listAll(testPoint);
|
||||
|
||||
// 3. 验证delFlag被设置为0
|
||||
assertEquals("0", testPoint.getDelFlag());
|
||||
|
||||
// 4. 验证返回结果
|
||||
assertNotNull(result);
|
||||
assertEquals(testPointList.size(), result.getRows().size());
|
||||
|
||||
// 5. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).selectDklMonitoringPointsList(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试外部查询所有监控点(listOutAll接口)
|
||||
*/
|
||||
@Test
|
||||
void testListOutAll() throws KmsSdkException {
|
||||
// 1. 模拟Service返回数据
|
||||
when(monitoringPointsService.selectDklMonitoringPointsList(any(DklMonitoringPoints.class)))
|
||||
.thenReturn(testPointList);
|
||||
|
||||
// 2. 调用接口
|
||||
TableDataInfo result = monitoringPointsController.listOutAll(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertEquals(testPointList.size(), result.getRows().size());
|
||||
|
||||
// 4. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).selectDklMonitoringPointsList(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试导出监控点列表(export接口)
|
||||
*/
|
||||
@Test
|
||||
void testExport() throws KmsSdkException {
|
||||
// 1. 模拟Service返回数据
|
||||
when(monitoringPointsService.selectDklMonitoringPointsList(any(DklMonitoringPoints.class)))
|
||||
.thenReturn(testPointList);
|
||||
|
||||
// 2. 构建Mock响应对象
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
// 3. 调用导出接口
|
||||
monitoringPointsController.export(response, testPoint);
|
||||
|
||||
// 4. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).selectDklMonitoringPointsList(any(DklMonitoringPoints.class));
|
||||
|
||||
// 5. 验证响应状态(非空即可,Excel导出核心逻辑在ExcelUtil,此处仅验证流程)
|
||||
assertEquals(200, response.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试获取监控点详情(getInfo接口)
|
||||
*/
|
||||
@Test
|
||||
void testGetInfo() throws KmsSdkException {
|
||||
// 1. 模拟Service返回单个监控点
|
||||
when(monitoringPointsService.selectDklMonitoringPointsById(anyLong())).thenReturn(testPoint);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.getInfo(1L);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals(testPoint.getId(), ((DklMonitoringPoints) result.getData()).getId());
|
||||
|
||||
// 4. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).selectDklMonitoringPointsById(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试新增监控点(add接口)- 名称唯一,新增成功
|
||||
*/
|
||||
@Test
|
||||
void testAdd_Success() throws KmsSdkException {
|
||||
// 1. 模拟Service校验名称唯一、新增成功
|
||||
when(monitoringPointsService.checkPointsNameUnique(any(DklMonitoringPoints.class))).thenReturn(true);
|
||||
when(monitoringPointsService.insertDklMonitoringPoints(any(DklMonitoringPoints.class))).thenReturn(1);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.add(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals(1, result.getData()); // toAjax(1) 返回成功
|
||||
|
||||
// 4. 验证监控点的系统字段被设置
|
||||
assertNotNull(testPoint.getCreateTime());
|
||||
assertNotNull(testPoint.getUpdateTime());
|
||||
assertNotNull(testPoint.getCreateBy());
|
||||
assertNotNull(testPoint.getUpdateBy());
|
||||
assertEquals("0", testPoint.getDelFlag());
|
||||
|
||||
// 5. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).checkPointsNameUnique(any(DklMonitoringPoints.class));
|
||||
verify(monitoringPointsService, times(1)).insertDklMonitoringPoints(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试新增监控点(add接口)- 名称重复,新增失败
|
||||
*/
|
||||
@Test
|
||||
void testAdd_Fail_NameDuplicate() throws KmsSdkException {
|
||||
// 1. 模拟Service校验名称重复
|
||||
when(monitoringPointsService.checkPointsNameUnique(any(DklMonitoringPoints.class))).thenReturn(false);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.add(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertFalse(result.isSuccess());
|
||||
assertEquals("新增监控点信息'测试监控点'失败,名称已存在", result.getMsg());
|
||||
|
||||
// 4. 验证新增方法未被调用
|
||||
verify(monitoringPointsService, never()).insertDklMonitoringPoints(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试修改监控点(edit接口)- 名称唯一,修改成功
|
||||
*/
|
||||
@Test
|
||||
void testEdit_Success() throws KmsSdkException {
|
||||
// 1. 模拟Service校验名称唯一、修改成功
|
||||
when(monitoringPointsService.checkPointsNameUnique(any(DklMonitoringPoints.class))).thenReturn(true);
|
||||
when(monitoringPointsService.updateDklMonitoringPoints(any(DklMonitoringPoints.class))).thenReturn(1);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.edit(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals(1, result.getData());
|
||||
|
||||
// 4. 验证系统字段被设置
|
||||
assertNotNull(testPoint.getUpdateTime());
|
||||
assertNotNull(testPoint.getUpdateBy());
|
||||
|
||||
// 5. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).checkPointsNameUnique(any(DklMonitoringPoints.class));
|
||||
verify(monitoringPointsService, times(1)).updateDklMonitoringPoints(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试修改监控点(edit接口)- 名称重复,修改失败
|
||||
*/
|
||||
@Test
|
||||
void testEdit_Fail_NameDuplicate() throws KmsSdkException {
|
||||
// 1. 模拟Service校验名称重复
|
||||
when(monitoringPointsService.checkPointsNameUnique(any(DklMonitoringPoints.class))).thenReturn(false);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.edit(testPoint);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertFalse(result.isSuccess());
|
||||
assertEquals("修改监控点信息'测试监控点'失败,名称已存在", result.getMsg());
|
||||
|
||||
// 4. 验证修改方法未被调用
|
||||
verify(monitoringPointsService, never()).updateDklMonitoringPoints(any(DklMonitoringPoints.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试删除监控点(remove接口)
|
||||
*/
|
||||
@Test
|
||||
void testRemove() {
|
||||
// 1. 模拟Service删除成功
|
||||
int[] ids = {1, 2};
|
||||
when(monitoringPointsService.deleteDklMonitoringPointsByIds(any(int[].class))).thenReturn(2);
|
||||
|
||||
// 2. 调用接口
|
||||
AjaxResult result = monitoringPointsController.remove(ids);
|
||||
|
||||
// 3. 验证结果
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals(2, result.getData());
|
||||
|
||||
// 4. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).deleteDklMonitoringPointsByIds(any(int[].class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试导入模板下载(importTemplate接口)
|
||||
*/
|
||||
@Test
|
||||
void testImportTemplate() {
|
||||
// 1. 构建Mock响应
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
// 2. 调用接口(无返回值,仅验证无异常)
|
||||
assertDoesNotThrow(() -> monitoringPointsController.importTemplate(response));
|
||||
|
||||
// 3. 验证响应状态
|
||||
assertEquals(200, response.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试导入监控点数据(importData接口)
|
||||
*/
|
||||
@Test
|
||||
void testImportData() throws Exception {
|
||||
// 1. 模拟上传文件
|
||||
MockMultipartFile file = new MockMultipartFile(
|
||||
"file",
|
||||
"monitoring_points.xlsx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
new ByteArrayInputStream("test data".getBytes())
|
||||
);
|
||||
|
||||
// 2. 模拟Service返回导入结果
|
||||
String mockMessage = "导入成功,共导入1条数据";
|
||||
when(monitoringPointsService.importDate(anyList(), anyString())).thenReturn(mockMessage);
|
||||
|
||||
// 3. 调用接口
|
||||
AjaxResult result = monitoringPointsController.importData(file);
|
||||
|
||||
// 4. 验证结果
|
||||
assertNotNull(result);
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals(mockMessage, result.getData());
|
||||
|
||||
// 5. 验证Service调用
|
||||
verify(monitoringPointsService, times(1)).importDate(anyList(), anyString());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
package com.dkl.large.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.dkl.common.annotation.Excel;
|
||||
import com.dkl.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 监控点信息对象 dkl_monitoring_points
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@Data
|
||||
public class DklMonitoringPoints extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private int id;
|
||||
|
||||
/** 监控点类型 */
|
||||
// @Excel(name = "监控点类型")
|
||||
private String monitoringType;
|
||||
@Excel(name = "监控点类型")
|
||||
private String monitoringTypeName;
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String pointName;
|
||||
|
||||
/** 区域 */
|
||||
// @Excel(name = "区域")
|
||||
private String pointRegion;
|
||||
/** 区域名称 */
|
||||
@Excel(name = "区域")
|
||||
@TableField(exist = false)
|
||||
private String regionname;
|
||||
/** 值班人员 */
|
||||
@Excel(name = "值班人员")
|
||||
private String dutyPeople;
|
||||
|
||||
/** 值班联系方式 */
|
||||
@Excel(name = "值班联系方式")
|
||||
private String dutyPhone;
|
||||
|
||||
/** 地址 */
|
||||
@Excel(name = "地址")
|
||||
private String pointAddress;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
private String lng;
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
private String lat;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 最大承载量 */
|
||||
@Excel(name = "最大承载量")
|
||||
private Long loadBearingMax;
|
||||
|
||||
/** 部门id*/
|
||||
private Long deptId;
|
||||
|
||||
/** 开始时间 */
|
||||
@TableField(exist = false)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@TableField(exist = false)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/** 是否为风险点 */
|
||||
@Excel(name = "风险点", readConverterExp = "Y=是,N=否")
|
||||
private String isRisk;
|
||||
|
||||
private String sigenCode;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package com.dkl.large.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.dkl.large.domain.DklMonitoringCameraData;
|
||||
import com.dkl.large.domain.DklMonitoringPoints;
|
||||
import com.dkl.large.domain.vo.DklMonitoringCameraDataVo;
|
||||
import com.dkl.large.domain.vo.HeatVo;
|
||||
import com.dkl.large.domain.vo.RegionalVo;
|
||||
import com.dkl.large.domain.vo.RiskVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 监控点信息Mapper接口
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
public interface DklMonitoringPointsMapper
|
||||
{
|
||||
/**
|
||||
* 查询监控点信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 监控点信息
|
||||
*/
|
||||
public DklMonitoringPoints selectDklMonitoringPointsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询监控点信息列表
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 监控点信息集合
|
||||
*/
|
||||
public List<DklMonitoringPoints> selectDklMonitoringPointsList(DklMonitoringPoints dklMonitoringPoints);
|
||||
|
||||
/**
|
||||
* 新增监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints);
|
||||
|
||||
/**
|
||||
* 修改监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints);
|
||||
|
||||
/**
|
||||
* 删除监控点信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDklMonitoringPointsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除监控点信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDklMonitoringPointsByIds(int[] ids);
|
||||
|
||||
/***
|
||||
* @Author :rq
|
||||
* @Description :获取监测点数量
|
||||
* @Date :2025/06/12 11:00
|
||||
* @Param :[]
|
||||
* @return :int
|
||||
**/
|
||||
public String getDklMonitoringPointsCount();
|
||||
|
||||
/**
|
||||
* 监控点热力图
|
||||
*
|
||||
* @param dataVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<HeatVo> heatMap(@Param("dataVo") HeatVo dataVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域展示图
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RegionalVo> regionalStatistics(@Param("regionalVo")RegionalVo regionalVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域数据
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<DklMonitoringPoints> regionalDataList(@Param("regionalVo")RegionalVo regionalVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域数据
|
||||
*
|
||||
* @param riskVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RiskVo> riskDataList(@Param("riskVo")RiskVo riskVo);
|
||||
|
||||
|
||||
/**
|
||||
* @Author :rq
|
||||
* @Description :大客流基础信息统计首页
|
||||
* @Date :2025/07/11 10:42
|
||||
**/
|
||||
public List<RiskVo> homePointsStatistics(RiskVo riskVo);
|
||||
|
||||
/**
|
||||
* @Author :rq
|
||||
* @Description :大客流基础信息统计首页
|
||||
* @Date :2025/07/11 10:42
|
||||
**/
|
||||
public List<RiskVo> homePointsStatisticsPeople(RiskVo riskVo);
|
||||
|
||||
|
||||
public DklMonitoringPoints checkPointsNameUnique(@Param("pointName") String pointName);
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package com.dkl.large.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.koal.kms.sdk.ed.KmsSdkException;
|
||||
import com.dkl.large.domain.DklActivity;
|
||||
import com.dkl.large.domain.DklMonitoringCameraData;
|
||||
import com.dkl.large.domain.DklMonitoringPoints;
|
||||
import com.dkl.large.domain.vo.DklMonitoringCameraDataVo;
|
||||
import com.dkl.large.domain.vo.HeatVo;
|
||||
import com.dkl.large.domain.vo.RegionalVo;
|
||||
import com.dkl.large.domain.vo.RiskVo;
|
||||
|
||||
/**
|
||||
* 监控点信息Service接口
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
public interface IDklMonitoringPointsService
|
||||
{
|
||||
/**
|
||||
* 查询监控点信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 监控点信息
|
||||
*/
|
||||
public DklMonitoringPoints selectDklMonitoringPointsById(Long id) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 查询监控点信息列表
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 监控点信息集合
|
||||
*/
|
||||
|
||||
public List<DklMonitoringPoints> selectDklMonitoringPointsList(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
public String selectDklMonitoringPointsListMeaasge(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
/**
|
||||
* 新增监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 修改监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 批量删除监控点信息
|
||||
*
|
||||
* @param ids 需要删除的监控点信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDklMonitoringPointsByIds(int[] ids);
|
||||
|
||||
/**
|
||||
* 删除监控点信息信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDklMonitoringPointsById(Long id);
|
||||
|
||||
/**
|
||||
* 监控点热力图
|
||||
*
|
||||
* @param dataVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<HeatVo> heatMap(HeatVo dataVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域展示图
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RegionalVo> regionalStatistics(RegionalVo regionalVo);
|
||||
|
||||
/**
|
||||
* 大客流总数区域数据
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<DklMonitoringPoints> regionalDataList(RegionalVo regionalVo) throws KmsSdkException;
|
||||
|
||||
/**
|
||||
* 大客流风险预警信息
|
||||
*
|
||||
* @param riskVo
|
||||
* @return 结果
|
||||
*/
|
||||
public List<RiskVo> riskDataList(RiskVo riskVo);
|
||||
/**
|
||||
* @Author :rq
|
||||
* @Description :
|
||||
* @Date :2025/07/11 10:42
|
||||
**/
|
||||
public List<RiskVo> homePointsStatistics(RiskVo riskVo);
|
||||
|
||||
/**
|
||||
* @Author :rq
|
||||
* @Description :大客流基础信息统计首页
|
||||
* @Date :2025/07/11 10:42
|
||||
**/
|
||||
public List<RiskVo> homePointsStatisticsPeople(RiskVo riskVo);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param dklMonitoringPointsList 数据列表
|
||||
* @param operName 操作用户
|
||||
* @return 结果
|
||||
*/
|
||||
public String importDate(List<DklMonitoringPoints> dklMonitoringPointsList, String operName) throws KmsSdkException;
|
||||
|
||||
public boolean checkPointsNameUnique(DklMonitoringPoints dklMonitoringPoints);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,505 @@
|
|||
package com.dkl.large.service.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.koal.kms.sdk.ed.KmsSdkException;
|
||||
import com.dkl.common.constant.UserConstants;
|
||||
import com.dkl.common.core.domain.entity.SysDept;
|
||||
import com.dkl.common.core.domain.entity.SysDictData;
|
||||
import com.dkl.common.exception.ServiceException;
|
||||
import com.dkl.common.utils.DateUtils;
|
||||
import com.dkl.common.utils.StringUtils;
|
||||
import com.dkl.large.domain.DklActivity;
|
||||
import com.dkl.large.domain.DklMonitoringCameraData;
|
||||
import com.dkl.large.domain.vo.DklMonitoringCameraDataVo;
|
||||
import com.dkl.large.domain.vo.HeatVo;
|
||||
import com.dkl.large.domain.vo.RegionalVo;
|
||||
import com.dkl.large.domain.vo.RiskVo;
|
||||
import com.dkl.large.utli.EnciphermentUtil;
|
||||
import com.dkl.system.mapper.SysDictDataMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.dkl.large.mapper.DklMonitoringPointsMapper;
|
||||
import com.dkl.large.domain.DklMonitoringPoints;
|
||||
import com.dkl.large.service.IDklMonitoringPointsService;
|
||||
|
||||
import static com.dkl.common.utils.SecurityUtils.getDeptId;
|
||||
import static com.dkl.common.utils.SecurityUtils.getUsername;
|
||||
import static org.springframework.util.SerializationUtils.serialize;
|
||||
|
||||
/**
|
||||
* 监控点信息Service业务层处理
|
||||
*
|
||||
* @author Dkl
|
||||
* @date 2025-06-10
|
||||
*/
|
||||
@Service
|
||||
public class DklMonitoringPointsServiceImpl implements IDklMonitoringPointsService
|
||||
{
|
||||
@Autowired
|
||||
private DklMonitoringPointsMapper dklMonitoringPointsMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper sysDictDataMapper;
|
||||
//手机号正则
|
||||
private static final String PHONE_REGEX = "^((0\\d{2,3}-\\d{7,8})|(1[3456789]\\d{9}))$";
|
||||
//经度
|
||||
private static final String LNG_REGEX = "^-?\\d{1,3}(\\.\\d+)?$";
|
||||
//维度
|
||||
private static final String LAT_REGEX = "^-?\\d{1,2}(\\.\\d+)?$";
|
||||
/**
|
||||
* 查询监控点信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 监控点信息
|
||||
*/
|
||||
@Override
|
||||
public DklMonitoringPoints selectDklMonitoringPointsById(Long id) throws KmsSdkException {
|
||||
DklMonitoringPoints dklMonitoringPoints = dklMonitoringPointsMapper.selectDklMonitoringPointsById(id);
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPoints.getDutyPeople())&&StringUtils.isNotEmpty(dklMonitoringPoints.getDutyPhone())) {
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
return dklMonitoringPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询监控点信息列表
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 监控点信息
|
||||
*/
|
||||
@Override
|
||||
public List<DklMonitoringPoints> selectDklMonitoringPointsList(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
List<DklMonitoringPoints> list = dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoints);
|
||||
|
||||
|
||||
|
||||
for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPeople())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPeople = dklMonitoringPointsInfo.getDutyPeople();
|
||||
dklMonitoringPointsInfo.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPhone())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPhone = dklMonitoringPointsInfo.getDutyPhone();
|
||||
dklMonitoringPointsInfo.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectDklMonitoringPointsListMeaasge(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
|
||||
List<DklMonitoringPoints> list = dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoints);
|
||||
for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPeople())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPeople = dklMonitoringPointsInfo.getDutyPeople();
|
||||
dklMonitoringPointsInfo.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPhone())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
String dutyPhone = dklMonitoringPointsInfo.getDutyPhone();
|
||||
dklMonitoringPointsInfo.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
byte[] bytes = serialize(dklMonitoringPointsInfo.getDutyPeople()+","+dklMonitoringPointsInfo.getDutyPhone());
|
||||
String isor = EnciphermentUtil.kmsSign(bytes);
|
||||
if (!isor.equals(dklMonitoringPointsInfo.getSigenCode())) {
|
||||
successMsg.append("名称为"+dklMonitoringPointsInfo.getPointName()+"的数据被篡改");
|
||||
}
|
||||
}
|
||||
|
||||
// List<DklMonitoringPoints> list = dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoints);
|
||||
|
||||
|
||||
|
||||
// for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
// String dutyPeople = null;
|
||||
// String dutyPhone = null;
|
||||
// if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPeople())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
// dutyPeople = EnciphermentUtil.kmsDencrypt(dklMonitoringPointsInfo.getDutyPeople());
|
||||
// }
|
||||
// if (StringUtils.isNotEmpty(dklMonitoringPointsInfo.getDutyPhone())&&("0").equals(dklMonitoringPointsInfo.getDelFlag())) {
|
||||
// dutyPhone = EnciphermentUtil.kmsDencrypt(dklMonitoringPointsInfo.getDutyPhone());
|
||||
// }
|
||||
// // (序列化)
|
||||
// byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
// String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
// dklMonitoringPointsInfo.setSigenCode(sigenCode);
|
||||
// dklMonitoringPointsMapper.updateDklMonitoringPoints(dklMonitoringPointsInfo);
|
||||
// }
|
||||
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
dklMonitoringPoints.setCreateTime(DateUtils.getNowDate());
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsEncrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsEncrypt(dutyPhone));
|
||||
// (序列化)
|
||||
byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
dklMonitoringPoints.setSigenCode(sigenCode);
|
||||
return dklMonitoringPointsMapper.insertDklMonitoringPoints(dklMonitoringPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改监控点信息
|
||||
*
|
||||
* @param dklMonitoringPoints 监控点信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDklMonitoringPoints(DklMonitoringPoints dklMonitoringPoints) throws KmsSdkException {
|
||||
dklMonitoringPoints.setUpdateTime(DateUtils.getNowDate());
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsEncrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsEncrypt(dutyPhone));
|
||||
// (序列化)
|
||||
byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
dklMonitoringPoints.setSigenCode(sigenCode);
|
||||
return dklMonitoringPointsMapper.updateDklMonitoringPoints(dklMonitoringPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除监控点信息
|
||||
*
|
||||
* @param ids 需要删除的监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDklMonitoringPointsByIds(int[] ids)
|
||||
{
|
||||
return dklMonitoringPointsMapper.deleteDklMonitoringPointsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监控点信息信息
|
||||
*
|
||||
* @param id 监控点信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDklMonitoringPointsById(Long id)
|
||||
{
|
||||
return dklMonitoringPointsMapper.deleteDklMonitoringPointsById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 监控点热力图
|
||||
*
|
||||
* @param dataVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<HeatVo> heatMap(HeatVo dataVo) {
|
||||
return dklMonitoringPointsMapper.heatMap(dataVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 大客流总数区域展示图
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<RegionalVo> regionalStatistics(RegionalVo regionalVo) {
|
||||
return dklMonitoringPointsMapper.regionalStatistics(regionalVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 大客流总数区域数据
|
||||
*
|
||||
* @param regionalVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<DklMonitoringPoints> regionalDataList(RegionalVo regionalVo) throws KmsSdkException {
|
||||
List<DklMonitoringPoints> list = dklMonitoringPointsMapper.regionalDataList(regionalVo);
|
||||
for (DklMonitoringPoints dklMonitoringPointsInfo : list) {
|
||||
String dutyPeople = dklMonitoringPointsInfo.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPointsInfo.getDutyPhone();
|
||||
dklMonitoringPointsInfo.setDutyPeople(EnciphermentUtil.kmsDencrypt(dutyPeople));
|
||||
dklMonitoringPointsInfo.setDutyPhone(EnciphermentUtil.kmsDencrypt(dutyPhone));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 大客流风险预警信息
|
||||
*
|
||||
* @param riskVo
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<RiskVo> riskDataList(RiskVo riskVo) {
|
||||
return dklMonitoringPointsMapper.riskDataList(riskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RiskVo> homePointsStatistics(RiskVo riskVo) {
|
||||
return dklMonitoringPointsMapper.homePointsStatistics(riskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RiskVo> homePointsStatisticsPeople(RiskVo riskVo) {
|
||||
return dklMonitoringPointsMapper.homePointsStatisticsPeople(riskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importDate(List<DklMonitoringPoints> dklMonitoringPointsList, String operName) throws KmsSdkException {
|
||||
//区域集合
|
||||
List<SysDictData> areaDict=sysDictDataMapper.selectDictDataByType("activity_area");
|
||||
//区监控点类型
|
||||
List<SysDictData> pointType=sysDictDataMapper.selectDictDataByType("monitoring_point_type");
|
||||
//所有大客流活动
|
||||
DklMonitoringPoints dklMonitoringPoint = new DklMonitoringPoints();
|
||||
dklMonitoringPoint.setDelFlag("0");
|
||||
List<DklMonitoringPoints> dklMonitoringPointAll= dklMonitoringPointsMapper.selectDklMonitoringPointsList(dklMonitoringPoint);
|
||||
if (StringUtils.isNull(dklMonitoringPointsList) || dklMonitoringPointsList.size() == 0) {
|
||||
throw new ServiceException("导入数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (int i = 0; i < dklMonitoringPointsList.size(); i++) {
|
||||
try
|
||||
{
|
||||
//名称
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getPointName())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据名称为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getPointName().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据名称长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//地址
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getPointAddress())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1)+ "条数据地址为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getPointAddress().length()>=50){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据地址长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
//区域
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getRegionname())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1)+ "条数据区域为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getRegionname().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据区域长度过长");
|
||||
}else{
|
||||
for (SysDictData sysDictData : areaDict) {
|
||||
if (sysDictData.getDictLabel().equals(dklMonitoringPointsList.get(i).getRegionname())) {
|
||||
dklMonitoringPointsList.get(i).setPointRegion(sysDictData.getDictValue());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getPointRegion())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据区域未找到");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//监控点类型
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getMonitoringTypeName())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1)+ "条数据监控点类型为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getMonitoringTypeName().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据监控点类型长度过长");
|
||||
}else{
|
||||
for (SysDictData sysDictData : pointType) {
|
||||
if (sysDictData.getDictLabel().equals(dklMonitoringPointsList.get(i).getMonitoringTypeName())) {
|
||||
dklMonitoringPointsList.get(i).setMonitoringType(sysDictData.getDictValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getMonitoringType())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1) + "条数据监控点类型未找到");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//值班人员
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getDutyPeople())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班人员为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getDutyPeople().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班人员长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
//值班联系方式
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getDutyPhone())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班联系方式为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getDutyPhone().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班联系方式长度过长");
|
||||
}else if (!Pattern.matches(PHONE_REGEX, dklMonitoringPointsList.get(i).getDutyPhone())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值班联系方式有误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//经度
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getLng())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据经度为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getLng().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据经度长度过长");
|
||||
}else if (!Pattern.matches(LNG_REGEX, dklMonitoringPointsList.get(i).getLng())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值经度有误");
|
||||
}
|
||||
}
|
||||
|
||||
//纬度
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getLat())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据纬度为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getLat().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据纬度长度过长");
|
||||
}else if (!Pattern.matches(LAT_REGEX, dklMonitoringPointsList.get(i).getLat())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据值纬度有误");
|
||||
}
|
||||
}
|
||||
|
||||
//最大承载量
|
||||
if (dklMonitoringPointsList.get(i).getLoadBearingMax()<=0){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据最大承载量为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getLoadBearingMax()>=999999999){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据最大承载量长度过长");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//风险点
|
||||
if (StringUtils.isEmpty(dklMonitoringPointsList.get(i).getIsRisk())){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据是否风险点为空");
|
||||
}else{
|
||||
if (dklMonitoringPointsList.get(i).getIsRisk().length()>=30){
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" +(i+1)+ "条数据是否风险点长度过长");
|
||||
}else{
|
||||
if (!("Y").equals(dklMonitoringPointsList.get(i).getIsRisk())&&!("N").equals(dklMonitoringPointsList.get(i).getIsRisk())) {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/> 第" + (i+1) + "条数据是否风险点长有误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}
|
||||
else {
|
||||
|
||||
List<DklMonitoringPoints> lists = Stream.of(dklMonitoringPointAll, dklMonitoringPointsList)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
boolean hasDuplicates = lists.stream()
|
||||
.map(DklMonitoringPoints::getPointName)
|
||||
.distinct()
|
||||
.count() != lists.size();
|
||||
if (hasDuplicates) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共导入数据中有和系统原数据名称相同的数据");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
|
||||
} else {
|
||||
for (DklMonitoringPoints dklMonitoringPoints : dklMonitoringPointsList) {
|
||||
//添加系统信息
|
||||
dklMonitoringPoints.setDelFlag("0");
|
||||
dklMonitoringPoints.setCreateTime(new Date());
|
||||
dklMonitoringPoints.setCreateBy(getUsername());
|
||||
dklMonitoringPoints.setDeptId(getDeptId());
|
||||
dklMonitoringPoints.setUpdateTime(new Date());
|
||||
dklMonitoringPoints.setUpdateBy(getUsername());
|
||||
String dutyPeople = dklMonitoringPoints.getDutyPeople();
|
||||
String dutyPhone = dklMonitoringPoints.getDutyPhone();
|
||||
dklMonitoringPoints.setDutyPeople(EnciphermentUtil.kmsEncrypt(dutyPeople));
|
||||
dklMonitoringPoints.setDutyPhone(EnciphermentUtil.kmsEncrypt(dutyPhone));
|
||||
// (序列化)
|
||||
byte[] bytes = serialize(dutyPeople+","+dutyPhone);
|
||||
String sigenCode = EnciphermentUtil.kmsSign(bytes);
|
||||
dklMonitoringPoints.setSigenCode(sigenCode);
|
||||
dklMonitoringPointsMapper.insertDklMonitoringPoints(dklMonitoringPoints);
|
||||
}
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPointsNameUnique(DklMonitoringPoints dklMonitoringPoints) {
|
||||
Long deptId = StringUtils.isNull(dklMonitoringPoints.getId()) ? -1L : dklMonitoringPoints.getId();
|
||||
DklMonitoringPoints info = dklMonitoringPointsMapper.checkPointsNameUnique(dklMonitoringPoints.getPointName());
|
||||
if (StringUtils.isNotNull(info) && info.getId() != deptId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
<?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="com.dkl.large.mapper.DklMonitoringPointsMapper">
|
||||
|
||||
<resultMap type="DklMonitoringPoints" id="DklMonitoringPointsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="monitoringType" column="monitoring_type" />
|
||||
<result property="pointName" column="point_name" />
|
||||
<result property="pointRegion" column="point_region" />
|
||||
<result property="dutyPeople" column="duty_people" />
|
||||
<result property="dutyPhone" column="duty_phone" />
|
||||
<result property="pointAddress" column="point_address" />
|
||||
<result property="lng" column="lng" />
|
||||
<result property="lat" column="lat" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loadBearingMax" column="load_bearing_max" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="isRisk" column="is_risk" />
|
||||
<result property="sigenCode" column="sigen_code" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDklMonitoringPointsVo">
|
||||
select dmp.id, dmp.sigen_code , dmp.monitoring_type, dmp.point_name, dmp.point_region, dmp.duty_people, dmp.duty_phone, dmp.point_address, dmp.lng, dmp.lat, dmp.create_by, dmp.create_time,
|
||||
dmp.update_by, dmp.update_time,dmp.is_risk, dmp.del_flag, dmp.load_bearing_max, dmp.dept_id,sdd.dict_label as regionname ,sdd1.dict_label as monitoringTypeName from dkl_monitoring_points AS dmp
|
||||
left join sys_dept d on dmp.dept_id = d.dept_id
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = dmp.point_region
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
LEFT JOIN sys_dict_data sdd1 ON sdd1.dict_value = dmp.monitoring_type
|
||||
AND sdd1.dict_type = 'monitoring_point_type'
|
||||
</sql>
|
||||
|
||||
<select id="selectDklMonitoringPointsList" parameterType="DklMonitoringPoints" resultMap="DklMonitoringPointsResult">
|
||||
<include refid="selectDklMonitoringPointsVo"/>
|
||||
<where>
|
||||
<if test="monitoringType != null and monitoringType != ''"> and dmp.monitoring_type = #{monitoringType}</if>
|
||||
<if test="pointName != null and pointName != ''"> and dmp.point_name like concat('%', #{pointName}, '%')</if>
|
||||
<if test="pointRegion != null and pointRegion != ''"> and dmp.point_region = #{pointRegion}</if>
|
||||
<if test="dutyPeople != null and dutyPeople != ''"> and dmp.duty_people like concat('%', #{dutyPeople}, '%')</if>
|
||||
<if test="dutyPhone != null and dutyPhone != ''"> and dmp.duty_phone = #{dutyPhone}</if>
|
||||
<if test="pointAddress != null and pointAddress != ''"> and dmp.point_address = #{pointAddress}</if>
|
||||
<if test="lng != null and lng != ''"> and dmp.lng = #{lng}</if>
|
||||
<if test="lat != null and lat != ''"> and dmp.lat = #{lat}</if>
|
||||
<if test="loadBearingMax != null "> and dmp.load_bearing_max = #{loadBearingMax}</if>
|
||||
<if test="deptId != null "> and dmp.dept_id = #{deptId}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and dmp.del_flag = #{delFlag}</if>
|
||||
<if test="isRisk != null and isRisk != ''"> and dmp.is_risk = #{isRisk}</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND dmp.create_time BETWEEN #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by dmp.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDklMonitoringPointsById" parameterType="Long" resultMap="DklMonitoringPointsResult">
|
||||
<include refid="selectDklMonitoringPointsVo"/>
|
||||
where dmp.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDklMonitoringPoints" parameterType="DklMonitoringPoints">
|
||||
insert into dkl_monitoring_points
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="monitoringType != null">monitoring_type,</if>
|
||||
<if test="pointName != null">point_name,</if>
|
||||
<if test="pointRegion != null">point_region,</if>
|
||||
<if test="dutyPeople != null">duty_people,</if>
|
||||
<if test="dutyPhone != null">duty_phone,</if>
|
||||
<if test="pointAddress != null">point_address,</if>
|
||||
<if test="lng != null">lng,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="loadBearingMax != null">load_bearing_max,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="isRisk != null">is_risk,</if>
|
||||
<if test="sigenCode != null">sigen_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="monitoringType != null">#{monitoringType},</if>
|
||||
<if test="pointName != null">#{pointName},</if>
|
||||
<if test="pointRegion != null">#{pointRegion},</if>
|
||||
<if test="dutyPeople != null">#{dutyPeople},</if>
|
||||
<if test="dutyPhone != null">#{dutyPhone},</if>
|
||||
<if test="pointAddress != null">#{pointAddress},</if>
|
||||
<if test="lng != null">#{lng},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="loadBearingMax != null">#{loadBearingMax},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="isRisk != null">#{isRisk},</if>
|
||||
<if test="sigenCode != null">#{sigenCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDklMonitoringPoints" parameterType="DklMonitoringPoints">
|
||||
update dkl_monitoring_points
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="monitoringType != null">monitoring_type = #{monitoringType},</if>
|
||||
<if test="pointName != null">point_name = #{pointName},</if>
|
||||
<if test="pointRegion != null">point_region = #{pointRegion},</if>
|
||||
<if test="dutyPeople != null">duty_people = #{dutyPeople},</if>
|
||||
<if test="dutyPhone != null">duty_phone = #{dutyPhone},</if>
|
||||
<if test="pointAddress != null">point_address = #{pointAddress},</if>
|
||||
<if test="lng != null">lng = #{lng},</if>
|
||||
<if test="lat != null">lat = #{lat},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="loadBearingMax != null">load_bearing_max = #{loadBearingMax},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="isRisk != null">is_risk = #{isRisk},</if>
|
||||
<if test="sigenCode != null">sigen_code = #{sigenCode},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteDklMonitoringPointsById" parameterType="int">
|
||||
update dkl_monitoring_points set del_flag = 2 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteDklMonitoringPointsByIds" parameterType="int">
|
||||
update dkl_monitoring_points set del_flag = 2 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getDklMonitoringPointsCount" parameterType="string">
|
||||
SELECT COUNT(*) FROM dkl_monitoring_points WHERE del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="heatMap" parameterType="HeatVo" resultType="HeatVo">
|
||||
SELECT
|
||||
mp.id,
|
||||
mp.monitoring_type,
|
||||
mp.point_name,
|
||||
mp.point_address,
|
||||
mp.lng,
|
||||
mp.lat,
|
||||
CONCAT(a.dayTime, ' ', a.hTime) as dayTime,
|
||||
a.numberPeople,
|
||||
CAST( a.numberPeople / mp.load_bearing_max AS DECIMAL( 10, 3 ) )*100 AS capacityFactor
|
||||
FROM(
|
||||
SELECT
|
||||
mcd.camera_id,
|
||||
SUM( mcd.number_people ) AS numberPeople,
|
||||
to_char( mcd.acquisition_time, 'YYYY-MM-DD' ) AS dayTime,
|
||||
to_char( mcd.acquisition_time, 'HH24:MI' ) AS hTime
|
||||
FROM
|
||||
dkl_monitoring_camera_data mcd
|
||||
WHERE
|
||||
mcd.del_flag = '0'
|
||||
<if test="dataVo.startTime != null">
|
||||
AND mcd.acquisition_time >= DATE_TRUNC( 'day', #{dataVo.startTime} :: DATE)
|
||||
</if>
|
||||
<if test="dataVo.endTime != null">
|
||||
AND mcd.acquisition_time <![CDATA[ <= ]]> DATE_TRUNC( 'day', #{dataVo.endTime} :: DATE + INTERVAL '1 day' )
|
||||
</if>
|
||||
GROUP BY
|
||||
mcd.camera_id,
|
||||
dayTime,
|
||||
hTime
|
||||
) a
|
||||
LEFT JOIN dkl_monitoring_camera AS mc ON mc."id" = a.camera_id
|
||||
LEFT JOIN dkl_monitoring_points AS mp ON mp."id" = mc.points_id
|
||||
WHERE
|
||||
mc.del_flag = '0'
|
||||
AND mp.del_flag = '0'
|
||||
<if test="dataVo.monitoringType != null and dataVo.monitoringType != ''">
|
||||
AND mp.monitoring_type = #{dataVo.monitoringType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="regionalStatistics" parameterType="RegionalVo" resultType="RegionalVo">
|
||||
<!-- SELECT-->
|
||||
<!-- sdd.dict_label as regionname,-->
|
||||
<!-- COALESCE(A.numberPeople,0) AS loadBearingMax-->
|
||||
<!-- FROM-->
|
||||
<!-- sys_dict_data sdd-->
|
||||
<!-- LEFT JOIN (-->
|
||||
<!-- SELECT-->
|
||||
<!-- mp.point_region,-->
|
||||
<!-- SUM ( mcd.number_people ) AS numberPeople-->
|
||||
<!-- FROM-->
|
||||
<!-- dkl_monitoring_camera_data mcd-->
|
||||
<!-- LEFT JOIN dkl_monitoring_camera AS mc ON mc."id" = mcd.camera_id-->
|
||||
<!-- LEFT JOIN dkl_monitoring_points AS mp ON mp."id" = mc.points_id-->
|
||||
<!-- WHERE-->
|
||||
<!-- mcd.del_flag = '0'-->
|
||||
<!-- AND mc.del_flag = '0'-->
|
||||
<!-- AND mp.del_flag = '0'-->
|
||||
<!-- <if test="regionalVo.startTime != null">-->
|
||||
<!-- AND mcd.acquisition_time >= DATE_TRUNC( 'day', #{regionalVo.startTime} :: DATE )-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="regionalVo.endTime != null">-->
|
||||
<!-- AND mcd.acquisition_time <![CDATA[ <= ]]> DATE_TRUNC( 'day', #{regionalVo.endTime} :: DATE + INTERVAL '1 day' )-->
|
||||
<!-- </if>-->
|
||||
<!-- GROUP BY-->
|
||||
<!-- mp.point_region-->
|
||||
<!-- ) A ON A.point_region = sdd.dict_value-->
|
||||
<!-- WHERE-->
|
||||
<!-- sdd.status = '0'-->
|
||||
<!-- AND sdd.dict_type = 'activity_area'-->
|
||||
SELECT
|
||||
sdd.dict_label AS regionname,
|
||||
sdd.dict_value AS regioninfo,
|
||||
A.typename AS typename,
|
||||
A.monitoring_type AS typeinfo,
|
||||
COALESCE ( A.numberPeople, 0 ) AS loadBearingMax
|
||||
FROM
|
||||
sys_dict_data sdd
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
dmp.point_region,
|
||||
dmp.monitoring_type,
|
||||
sdd.dict_label AS typename,
|
||||
COUNT ( * ) AS numberPeople
|
||||
FROM
|
||||
dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data AS sdd ON dmp.monitoring_type = sdd.dict_value
|
||||
AND sdd.dict_type = 'monitoring_point_type'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
GROUP BY
|
||||
point_region,
|
||||
monitoring_type,
|
||||
sdd.dict_label
|
||||
) A ON A.point_region = sdd.dict_value
|
||||
WHERE
|
||||
sdd.status = '0'
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
</select>
|
||||
|
||||
<select id="regionalDataList" parameterType="RegionalVo" resultType="DklMonitoringPoints">
|
||||
select dmp.id, dmp.monitoring_type, dmp.point_name as pointName, dmp.point_region , dmp.duty_people as dutyPeople, dmp.duty_phone as dutyPhone, dmp.point_address as pointAddress , dmp.lng, dmp.lat, dmp.create_by, dmp.create_time,
|
||||
dmp.update_by, dmp.update_time, dmp.del_flag, dmp.load_bearing_max as loadBearingMax from dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data AS sdd ON dmp.monitoring_type = sdd.dict_value AND sdd.dict_type = 'monitoring_point_type'
|
||||
LEFT JOIN sys_dict_data AS sdd1 ON dmp.point_region = sdd1.dict_value AND sdd1.dict_type = 'activity_area'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
<if test="regionalVo.typename != null">
|
||||
AND sdd.dict_label = #{regionalVo.typename}
|
||||
</if>
|
||||
<if test="regionalVo.regionname != null">
|
||||
AND sdd1.dict_label = #{regionalVo.regionname}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="riskDataList" parameterType="RiskVo" resultType="RiskVo">
|
||||
SELECT
|
||||
mp.id,
|
||||
mp.point_name AS pointName,
|
||||
mp.load_bearing_max AS loadBearingMax,
|
||||
SUM( a.numberPeopleSum ) AS numberPeople,
|
||||
CAST( numberPeople / mp.load_bearing_max AS DECIMAL( 10, 3 ) )*100 AS capacityFactor,
|
||||
mp.monitoring_type AS monitoringType,
|
||||
mp.point_address AS pointAddress,
|
||||
(
|
||||
SELECT
|
||||
icon
|
||||
FROM
|
||||
dkl_warning_threshold
|
||||
WHERE
|
||||
CAST ( SUM ( a.numberPeopleSum ) / mp.load_bearing_max AS DECIMAL ( 10, 3 ) ) >= max_capacity
|
||||
AND CAST ( SUM ( a.numberPeopleSum ) / mp.load_bearing_max AS DECIMAL ( 10, 3 ) ) <= min_capacity
|
||||
AND del_flag = '0'
|
||||
) as icon
|
||||
FROM(
|
||||
SELECT
|
||||
mcd.camera_id,
|
||||
SUM( mcd.number_people ) AS numberPeopleSum
|
||||
FROM
|
||||
dkl_monitoring_camera_data mcd
|
||||
WHERE
|
||||
mcd.del_flag = '0'
|
||||
<if test="riskVo.startTime != null">
|
||||
AND mcd.acquisition_time >= DATE_TRUNC( 'day', #{riskVo.startTime} :: DATE )
|
||||
</if>
|
||||
<if test="riskVo.endTime != null">
|
||||
AND mcd.acquisition_time <![CDATA[ <= ]]> DATE_TRUNC( 'day', #{riskVo.endTime} :: DATE + INTERVAL '1 day' )
|
||||
</if>
|
||||
GROUP BY
|
||||
mcd.camera_id
|
||||
) a
|
||||
LEFT JOIN dkl_monitoring_camera AS mc ON mc."id" = a.camera_id
|
||||
LEFT JOIN dkl_monitoring_points AS mp ON mp."id" = mc.points_id
|
||||
WHERE
|
||||
mc.del_flag = '0'
|
||||
AND mp.del_flag = '0'
|
||||
GROUP BY mp.id
|
||||
</select>
|
||||
|
||||
<select id="homePointsStatistics" parameterType="RiskVo" resultType="RiskVo">
|
||||
SELECT
|
||||
dmp.point_region as pointRegion,
|
||||
sdd.dict_label AS regionname,
|
||||
count ( dmp.point_region ) AS numberPeople
|
||||
FROM
|
||||
dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = dmp.point_region
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
<if test="startTime != null and endTime != null ">
|
||||
AND dmp.create_time >= #{startTime}
|
||||
AND dmp.create_time <= #{endTime}
|
||||
</if>
|
||||
|
||||
GROUP BY
|
||||
dmp.point_region,
|
||||
sdd.dict_label
|
||||
</select>
|
||||
|
||||
<select id="homePointsStatisticsPeople" parameterType="RiskVo" resultType="RiskVo">
|
||||
SELECT
|
||||
dmp.point_region as pointRegion,
|
||||
sdd.dict_label as regionname,
|
||||
SUM ( dmp.load_bearing_max ) AS numberPeople
|
||||
FROM
|
||||
dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = dmp.point_region
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
<if test="startTime != null and endTime != null ">
|
||||
AND dmp.create_time >= #{startTime}
|
||||
AND dmp.create_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
dmp.point_region,
|
||||
sdd.dict_label
|
||||
</select>
|
||||
|
||||
<select id="checkPointsNameUnique" resultMap="DklMonitoringPointsResult">
|
||||
<include refid="selectDklMonitoringPointsVo"/>
|
||||
where dmp.point_name=#{pointName} and dmp.del_flag = '0' limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue