From 34b1bf63a8af561c51fa40eb5c8b34c93f7b92d4 Mon Sep 17 00:00:00 2001 From: Angel <1050374295@qq.com> Date: Fri, 2 Feb 2024 10:55:35 +0800 Subject: [PATCH] DDDDD --- .../controller/MetaAlarmInfoController.java | 40 +++++++- .../MetaImpUserModelInfoController.java | 14 +-- .../database/domain/DAO/AlarmInfoDAO.java | 0 .../database/domain/MetaImpUserModelInfo.java | 2 + .../ruoyi/database/domain/dto/DeviceDTO.java | 17 ++++ .../ruoyi/database/domain/vo/alarmInfoVO.java | 98 +++++++++++++++++++ .../database/mapper/MetaAlarmInfoMapper.java | 8 ++ .../service/MetaAlarmInfoService.java | 4 + .../impl/MetaAlarmInfoServiceImpl.java | 6 ++ 9 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 gather-app/src/main/java/com/ruoyi/database/domain/DAO/AlarmInfoDAO.java create mode 100644 gather-app/src/main/java/com/ruoyi/database/domain/dto/DeviceDTO.java create mode 100644 gather-app/src/main/java/com/ruoyi/database/domain/vo/alarmInfoVO.java diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java b/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java index 0f694b9..41198bf 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/MetaAlarmInfoController.java @@ -1,11 +1,13 @@ package com.ruoyi.database.controller; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.StringKit; import com.ruoyi.database.domain.MetaAlarmInfo; +import com.ruoyi.database.domain.vo.alarmInfoVO; import com.ruoyi.database.service.MetaAlarmInfoService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -16,6 +18,8 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.annotations.Param; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -66,6 +70,38 @@ public class MetaAlarmInfoController extends BaseController { return getDataTable(list); } + @GetMapping("/search") + @ApiOperation("根据条件查询接警信息") + public AjaxResult searchAlarmInfo(alarmInfoVO alarmInfoVO) throws Exception { + + QueryWrapper queryWrapper = new QueryWrapper<>(); + + // 判断条件是否为空,不为空则加入查询条件 + if (StringUtils.isNotBlank(alarmInfoVO.getPoliceReceiverName())) { + queryWrapper.eq("police_receiver_name", alarmInfoVO.getPoliceReceiverName()); + } + + if (StringUtils.isNotBlank(alarmInfoVO.getInformantName())) { + queryWrapper.eq("informant_name", alarmInfoVO.getInformantName()); + } + + if (StringUtils.isNotBlank(alarmInfoVO.getAlarmResponseUnit())) { + queryWrapper.like("alarm_response_unit", alarmInfoVO.getAlarmResponseUnit()); + } + + if (StringUtils.isNotBlank(alarmInfoVO.getInformantPhone())) { + queryWrapper.eq("informant_phone", alarmInfoVO.getInformantPhone()); + } + // 添加日期范 + // 围查询 + if (alarmInfoVO.getStartDate() != null && alarmInfoVO.getEndDate() != null) { + queryWrapper.between("informant_time", alarmInfoVO.getStartDate(), alarmInfoVO.getEndDate()); + } + + List resultList = metaAlarmInfoService.list(queryWrapper); + return AjaxResult.success(resultList); + } + @GetMapping("/time") @ApiOperation("根据时间查询接警信息") public TableDataInfo timeList(MetaAlarmInfo metaAlarmInfo) throws Exception { @@ -76,17 +112,19 @@ public class MetaAlarmInfoController extends BaseController { calendar.setTime(parse); calendar.add(Calendar.DAY_OF_MONTH, 1); + SimpleDateFormat outputSdf = new SimpleDateFormat("yyyyMMddHHmmss"); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String resultDateString = outputSdf.format(calendar.getTime()); String format = outputSdf.format(parse); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.between("alarm_response_time", format, resultDateString); int count = metaAlarmInfoService.count(queryWrapper); + PageUtils.startPage(); List list = metaAlarmInfoService.list(queryWrapper); List alarmInfos = new ArrayList<>(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (MetaAlarmInfo metaAlarmInfo1 : list) { String informantTime = metaAlarmInfo1.getInformantTime(); Date parse1 = outputSdf.parse(informantTime); diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/MetaImpUserModelInfoController.java b/gather-app/src/main/java/com/ruoyi/database/controller/MetaImpUserModelInfoController.java index f0ed601..08a9109 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/MetaImpUserModelInfoController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/MetaImpUserModelInfoController.java @@ -1,12 +1,10 @@ package com.ruoyi.database.controller; -import cn.hutool.db.handler.StringHandler; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.bean.BeanUtils; -import com.ruoyi.database.domain.DisposalInfo; import com.ruoyi.database.domain.MetaImpUserModelInfo; import com.ruoyi.database.domain.TransitHuntersUserModelRecord; import com.ruoyi.database.domain.vo.ImpUserModelVO; @@ -16,8 +14,6 @@ import com.ruoyi.database.service.TransitHuntersUserModelRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.SmartInitializingSingleton; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -115,7 +111,7 @@ public class MetaImpUserModelInfoController extends BaseController { LocalDateTime now = LocalDateTime.now(); LocalDateTime minusDay = now.minusDays(1); QueryWrapper metaImpUserModelInfoQueryWrapper = new QueryWrapper<>(); -// metaImpUserModelInfoQueryWrapper.groupBy("data_type"); + //metaImpUserModelInfoQueryWrapper.groupBy("data_type"); metaImpUserModelInfoQueryWrapper.in("sign_police_code", strings); metaImpUserModelInfoQueryWrapper.between("warning_time", formatter.format(minusDay), formatter.format(now)); List list = metaImpUserModelInfoService.list(metaImpUserModelInfoQueryWrapper); @@ -163,6 +159,13 @@ public class MetaImpUserModelInfoController extends BaseController { if (metaImpUserModelInfo.getKey5()!=null && metaImpUserModelInfo.getValue5()!=null){ map.put(metaImpUserModelInfo.getKey5(), metaImpUserModelInfo.getValue5()); } + if (metaImpUserModelInfo.getKey1()!=null && metaImpUserModelInfo.getValue1()!=null){ + map.put(metaImpUserModelInfo.getKey1(), metaImpUserModelInfo.getValue1()); + } + if (metaImpUserModelInfo.getActivityMessage()!=null){ + metaImpUserModelInfo.setKey17("活动信息"); + map.put(metaImpUserModelInfo.getKey17(), metaImpUserModelInfo.getActivityMessage()); + } metaImpUserModelInfoVO.setKV(map); } if (Objects.equals(metaImpUserModelInfo.getDataType(), "100086")) { @@ -215,7 +218,6 @@ public class MetaImpUserModelInfoController extends BaseController { metaImpUserModelInfoVO.setKV(map); } metaImpUserModelInfoVOS.add(metaImpUserModelInfoVO); - } for (TransitHuntersUserModelRecord transitHuntersUserModelRecord : list1) { diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/DAO/AlarmInfoDAO.java b/gather-app/src/main/java/com/ruoyi/database/domain/DAO/AlarmInfoDAO.java new file mode 100644 index 0000000..e69de29 diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/MetaImpUserModelInfo.java b/gather-app/src/main/java/com/ruoyi/database/domain/MetaImpUserModelInfo.java index 8f664e4..188d4ff 100644 --- a/gather-app/src/main/java/com/ruoyi/database/domain/MetaImpUserModelInfo.java +++ b/gather-app/src/main/java/com/ruoyi/database/domain/MetaImpUserModelInfo.java @@ -136,5 +136,7 @@ public class MetaImpUserModelInfo extends BaseEntity { private String key16; private String value16; + @TableField(exist = false) + private String key17; } \ No newline at end of file diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/dto/DeviceDTO.java b/gather-app/src/main/java/com/ruoyi/database/domain/dto/DeviceDTO.java new file mode 100644 index 0000000..c1d61fe --- /dev/null +++ b/gather-app/src/main/java/com/ruoyi/database/domain/dto/DeviceDTO.java @@ -0,0 +1,17 @@ +package com.ruoyi.database.domain.dto; + +import com.ruoyi.database.domain.DevopsDeviceInfo; + +public class DeviceDTO extends DevopsDeviceInfo { + private String concatenatedAddress; + + // getters and setters for the new field + public String getConcatenatedAddress() { + return concatenatedAddress; + } + + public void setConcatenatedAddress(String concatenatedAddress) { + this.concatenatedAddress = concatenatedAddress; + } + +} diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/vo/alarmInfoVO.java b/gather-app/src/main/java/com/ruoyi/database/domain/vo/alarmInfoVO.java new file mode 100644 index 0000000..2fca2a4 --- /dev/null +++ b/gather-app/src/main/java/com/ruoyi/database/domain/vo/alarmInfoVO.java @@ -0,0 +1,98 @@ +package com.ruoyi.database.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class alarmInfoVO{ + + /** + * 警情编码 + */ + @ApiModelProperty("警情编码") + @Excel(name = "警情编码") + private String alarmCode; + + /** + * 接警人姓名 + */ + @ApiModelProperty("接警人姓名") + @Excel(name = "接警人姓名") + private String policeReceiverName; + + /** + * 接警单位 + */ + @ApiModelProperty("接警单位") + @Excel(name = "接警单位") + private String alarmResponseUnit; + + /** + * 接警时间 + */ + @ApiModelProperty("接警时间") + @Excel(name = "接警时间") + private String alarmResponseTime; + + /** + * 报警内容 + */ + @ApiModelProperty("报警内容") + @Excel(name = "报警内容") + private String alarmResponseContent; + + /** + * 报警类型名称 + */ + @ApiModelProperty("报警类型名称") + @Excel(name = "报警类型名称") + private String alarmResponseTypeName; + + /** + * 报警人姓名 + */ + @ApiModelProperty("报警人姓名") + @Excel(name = "报警人姓名") + private String informantName; + + /** + * 报警人联系方式 + */ + @ApiModelProperty("报警人联系方式") + @Excel(name = "报警人联系方式") + private String informantPhone; + + /** + * 报警时间 + */ + @ApiModelProperty("报警时间") + @Excel(name = "报警时间") + private String informantTime; + + /** + * 接警事发地址 + */ + @ApiModelProperty("接警事发地址") + @Excel(name = "接警事发地址") + private String alarmAddress; + + /** + * 经度 + */ + @ApiModelProperty("经度") + @Excel(name = "经度") + private Double longitude; + + /** + * 纬度 + */ + @ApiModelProperty("纬度") + @Excel(name = "纬度") + private Double latitude; + + + private String startDate; + + private String endDate; +} diff --git a/gather-app/src/main/java/com/ruoyi/database/mapper/MetaAlarmInfoMapper.java b/gather-app/src/main/java/com/ruoyi/database/mapper/MetaAlarmInfoMapper.java index b888a7f..4c727e7 100644 --- a/gather-app/src/main/java/com/ruoyi/database/mapper/MetaAlarmInfoMapper.java +++ b/gather-app/src/main/java/com/ruoyi/database/mapper/MetaAlarmInfoMapper.java @@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.business.domain.vo.MetaAlarmInfoAndHandleAlarmVo; import com.ruoyi.business.domain.vo.MetaAlarmInfoVo; import com.ruoyi.database.domain.MetaAlarmInfo; +import com.ruoyi.database.domain.vo.alarmInfoVO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; @@ -91,4 +93,10 @@ public interface MetaAlarmInfoMapper extends BaseMapper { " ORDER BY informant_time DESC LIMIT 100) a") public List listAlarmAndHandleAlarm(); + @Select("SELECT * FROM meta_alarm_info " + + "WHERE police_receiver_name LIKE #{policeReceiverName} " + + "AND informant_name LIKE #{informantName} " + + "AND alarm_response_unit LIKE #{alarmResponseUnit} " + + "AND informant_phone LIKE #{informantPhone}") + List searchAlarmIxnfo(@Param("policeReceiverName") String policeReceiverName, @Param("informantName") String informantName, @Param("alarmResponseUnit") String alarmResponseUnit, @Param("informantPhone") String informantPhone); } diff --git a/gather-app/src/main/java/com/ruoyi/database/service/MetaAlarmInfoService.java b/gather-app/src/main/java/com/ruoyi/database/service/MetaAlarmInfoService.java index 405baaa..0c51865 100644 --- a/gather-app/src/main/java/com/ruoyi/database/service/MetaAlarmInfoService.java +++ b/gather-app/src/main/java/com/ruoyi/database/service/MetaAlarmInfoService.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.business.domain.vo.MetaAlarmInfoAndHandleAlarmVo; import com.ruoyi.business.domain.vo.MetaAlarmInfoVo; import com.ruoyi.database.domain.MetaAlarmInfo; +import com.ruoyi.database.domain.vo.alarmInfoVO; +import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -36,4 +38,6 @@ public interface MetaAlarmInfoService extends IService { public List selectTop3AlarmInfo(); public List listAlarmAndHandleAlarm(); + List searchAlarmIxnfo(@Param("policeReceiverName") String policeReceiverName, @Param("informantName") String informantName, @Param("alarmResponseUnit") String alarmResponseUnit, @Param("informantPhone") String informantPhone); + } diff --git a/gather-app/src/main/java/com/ruoyi/database/service/impl/MetaAlarmInfoServiceImpl.java b/gather-app/src/main/java/com/ruoyi/database/service/impl/MetaAlarmInfoServiceImpl.java index 9609f0c..4836406 100644 --- a/gather-app/src/main/java/com/ruoyi/database/service/impl/MetaAlarmInfoServiceImpl.java +++ b/gather-app/src/main/java/com/ruoyi/database/service/impl/MetaAlarmInfoServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.business.domain.vo.MetaAlarmInfoAndHandleAlarmVo; import com.ruoyi.business.domain.vo.MetaAlarmInfoVo; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.database.domain.MetaAlarmInfo; +import com.ruoyi.database.domain.vo.alarmInfoVO; import com.ruoyi.database.mapper.MetaAlarmInfoMapper; import com.ruoyi.database.service.MetaAlarmInfoService; import lombok.RequiredArgsConstructor; @@ -69,4 +70,9 @@ public class MetaAlarmInfoServiceImpl extends ServiceImpl listAlarmAndHandleAlarm() { return alarmInfoMapper.listAlarmAndHandleAlarm(); } + + @Override + public List searchAlarmIxnfo(String policeReceiverName, String informantName, String alarmResponseUnit, String informantPhone) { + return alarmInfoMapper.searchAlarmIxnfo(policeReceiverName, informantName, alarmResponseUnit, informantPhone); + } }