Commit 4a15ec8b authored by 李腾威's avatar 李腾威

修改 辅屏查询接口和导出接口

parent 03b272f6
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -43,8 +45,21 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
/**
* 根据查询条件返回警情记录
* @param alertCalledQueryDto
* @param workOrderNumber
* @return
*/
List<AlertCalledQueryDto> queryAlertListByQueryDto(@Param("alertCalledQueryDto") AlertCalledQueryDto alertCalledQueryDto);
Page<List<AlertCalledQueryDto>> queryAlertListByQueryDto(IPage<AlertCalledQueryDto> page,
String workOrderNumber,
String creator,
String emergency,
String emergencyTimeStart,
String emergencyTimeEnd,
String emergencyCall,
String deviceId,
String elevatorAddress,
String alertType,
String alertSource,
String alertStage,
String alertStatus,
String address);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import java.util.List;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
/**
* 警情接警填报记录接口类
......@@ -32,10 +34,22 @@ public interface IAlertCalledService {
/**
* 根据查询条件返回警情记录
* @param alertCalledQueryDto
* @param workOrderNumber
* @return
*/
List<AlertCalledQueryDto> queryAlertListByQueryDto(AlertCalledQueryDto alertCalledQueryDto);
Page<AlertCalledQueryDto> queryAlertListByQueryDto(IPage<AlertCalledQueryDto> page,
@Condition(Operator.like) String workOrderNumber,
@Condition(Operator.like) String creator,
@Condition(Operator.like) String emergency,
@Condition(Operator.lt) String emergencyTimeStart,
@Condition(Operator.gt) String emergencyTimeEnd,
@Condition(Operator.like) String emergencyCall,
@Condition(Operator.like) String deviceId,
@Condition(Operator.like) String elevatorAddress,
@Condition(Operator.eq) String alertType,
@Condition(Operator.eq) String alertSource,
@Condition(Operator.eq) String alertStage,
@Condition(Operator.eq) String alertStatus);
/**
* 更新警情阶段信息
......
......@@ -145,7 +145,7 @@
</if>
</select>
<select id="queryAlertListByQueryDto" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto">
<select id="queryAlertListByQueryDto" resultType="java.util.Map">
SELECT
a.work_order_number AS workOrderNumber,
a.rec_user_name AS creator,
......@@ -170,55 +170,52 @@
tz_alert_called a
LEFT JOIN tcb_elevator e ON e.rescue_code = a.device_id
WHERE 1=1
<if test="alertCalledQueryDto.workOrderNumber != null and alertCalledQueryDto.workOrderNumber != ''">
AND a.work_order_number like CONCAT(CONCAT('%',#{alertCalledQueryDto.workOrderNumber}),'%')
<if test="workOrderNumber != null and workOrderNumber != ''">
AND a.work_order_number like CONCAT(CONCAT('%',#{workOrderNumber}),'%')
</if>
<if test="alertCalledQueryDto.creator != null and alertCalledQueryDto.creator != ''">
AND a.rec_user_name like CONCAT(CONCAT('%',#{alertCalledQueryDto.creator}),'%')
<if test="creator != null and creator != ''">
AND a.rec_user_name like CONCAT(CONCAT('%',#{creator}),'%')
</if>
<if test="alertCalledQueryDto.emergency != null and alertCalledQueryDto.emergency != ''">
AND a.emergency_person like CONCAT(CONCAT('%',#{alertCalledQueryDto.emergency}),'%')
<if test="emergency != null and emergency != ''">
AND a.emergency_person like CONCAT(CONCAT('%',#{emergency}),'%')
</if>
<if test="alertCalledQueryDto.emergencyTimeStart != null ">
and #{alertCalledQueryDto.emergencyTimeStart} <![CDATA[ <= ]]> a.call_time
<if test="emergencyTimeStart != null ">
and #{emergencyTimeStart} <![CDATA[ <= ]]> a.call_time
</if>
<if test="alertCalledQueryDto.emergencyTimeEnd != null ">
and a.call_time <![CDATA[ <= ]]> #{alertCalledQueryDto.emergencyTimeEnd}
<if test="emergencyTimeEnd != null ">
and a.call_time <![CDATA[ <= ]]> #{emergencyTimeEnd}
</if>
<if test="alertCalledQueryDto.workOrderNumber != null and alertCalledQueryDto.workOrderNumber != ''">
<if test="workOrderNumber != null and workOrderNumber != ''">
and call_time <![CDATA[ <= ]]> #{endDate}
</if>
<if test="alertCalledQueryDto.emergencyCall != null and alertCalledQueryDto.emergencyCall != ''">
AND a.emergency_call like CONCAT(CONCAT('%',#{alertCalledQueryDto.emergencyCall}),'%')
<if test="emergencyCall != null and emergencyCall != ''">
AND a.emergency_call like CONCAT(CONCAT('%',#{emergencyCall}),'%')
</if>
<if test="alertCalledQueryDto.deviceId != null and alertCalledQueryDto.deviceId != ''">
AND a.device_id like CONCAT(CONCAT('%',#{alertCalledQueryDto.deviceId}),'%')
<if test="deviceId != null and deviceId != ''">
AND a.device_id like CONCAT(CONCAT('%',#{deviceId}),'%')
</if>
<if test="alertCalledQueryDto.elevatorAddress != null and alertCalledQueryDto.elevatorAddress != ''">
AND e.address like CONCAT(CONCAT('%',#{alertCalledQueryDto.elevatorAddress}),'%')
<if test="elevatorAddress != null and elevatorAddress != ''">
AND e.address like CONCAT(CONCAT('%',#{elevatorAddress}),'%')
</if>
<if test="alertCalledQueryDto.address != null and alertCalledQueryDto.address != ''">
AND a.region_code like CONCAT(CONCAT('%',#{alertCalledQueryDto.address}),'%')
<if test="address != null and address != ''">
AND a.region_code like CONCAT(CONCAT('%',#{address}),'%')
</if>
<if test="alertCalledQueryDto.alertType != null and alertCalledQueryDto.alertType != ''">
AND a.alarm_type_code = #{alertCalledQueryDto.alertType}
<if test="alertType != null and alertType != ''">
AND a.alarm_type_code = #{alertType}
</if>
<if test="alertCalledQueryDto.alertSource != null and alertCalledQueryDto.alertSource != ''">
AND a.alert_source_code = #{alertCalledQueryDto.alertSource}
<if test="alertSource != null and alertSource != ''">
AND a.alert_source_code = #{alertSource}
</if>
<if test="alertCalledQueryDto.alertStage != null and alertCalledQueryDto.alertStage != ''">
AND a.alert_stage_code = #{alertCalledQueryDto.alertStage}
<if test="alertStage != null and alertStage != ''">
AND a.alert_stage_code = #{alertStage}
</if>
<if test="alertCalledQueryDto.alertStatus != null and alertCalledQueryDto.alertStatus != ''">
AND a.alert_status = #{alertCalledQueryDto.alertStatus}
</if>
ORDER BY a.rec_date
<if test="alertCalledQueryDto.pageNum != null and alertCalledQueryDto.pageSize != ''">
limit #{alertCalledQueryDto.pageNum},#{alertCalledQueryDto.pageSize}
<if test="alertStatus != null and alertStatus != ''">
AND a.alert_status = #{alertStatus}
</if>
</select>
</mapper>
......
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -17,13 +16,9 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCallInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
......@@ -41,7 +36,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -53,7 +47,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -277,33 +270,85 @@ public class AlertCalledController extends BaseController {
queryWrapper.orderByDesc("call_time");
if(null != alertCalled.getCallTimeStart() && null != alertCalled.getCallTimeEnd()) {
queryWrapper.between("call_time", alertCalled.getCallTimeStart(),
alertCalled.getCallTimeEnd().getTime());
} else {
queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
}
if (alertCalled.getIsFatherAlert()) { // 0:接警;1:处警
queryWrapper.isNull("father_alert");
}
if(ValidationUtil.isEmpty(alertCalled.getType())) {
queryWrapper.eq("type",alertCalled.getType());
}
if(ValidationUtil.isEmpty(alertCalled.getAlarmType())) {
queryWrapper.eq("alarm_type",alertCalled.getAlarmType());
}
if(ValidationUtil.isEmpty(alertCalled.getAlertSource())) {
queryWrapper.eq("alert_source",alertCalled.getAlertSource());
}
return queryWrapper;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询警情事件记录", notes = "查询警情事件记录")
@PostMapping("/selectRecord")
public ResponseModel<Page<AlertCalledQueryDto>> queryAlertCalledByPager(@RequestBody AlertCalledQueryDto alertCalledQueryDto) {
List<AlertCalledQueryDto> list = iAlertCalledService.queryAlertListByQueryDto(alertCalledQueryDto);
@GetMapping("/selectRecord")
public ResponseModel<Page<AlertCalledQueryDto>> queryAlertCalledByPager(AlertCalledQueryDto alertCalledQueryDto,
@RequestParam(value = "pageNum") int pageNum,
@RequestParam(value = "pageSize") int pageSize) {
Page<AlertCalledQueryDto> page = new Page<AlertCalledQueryDto>();
page.setCurrent(pageNum);
page.setSize(pageSize);
Page<AlertCalledQueryDto> pageBean = iAlertCalledService.queryAlertListByQueryDto(
page,
alertCalledQueryDto.getWorkOrderNumber(),
alertCalledQueryDto.getCreator(),
alertCalledQueryDto.getEmergency(),
alertCalledQueryDto.getEmergencyTimeStart() == null ? null : DateUtils.date2LongStr(alertCalledQueryDto.getEmergencyTimeStart()),
alertCalledQueryDto.getEmergencyTimeEnd() == null ? null : DateUtils.date2LongStr(alertCalledQueryDto.getEmergencyTimeEnd()),
alertCalledQueryDto.getEmergencyCall(),
alertCalledQueryDto.getDeviceId(),
alertCalledQueryDto.getElevatorAddress(),
alertCalledQueryDto.getAlertType(),
alertCalledQueryDto.getAlertSource(),
alertCalledQueryDto.getAlertStage(),
alertCalledQueryDto.getAlertStatus());
Page<AlertCalledQueryDto> result = new Page<AlertCalledQueryDto>(alertCalledQueryDto.getPageNum(), alertCalledQueryDto.getPageSize());
long totle = list.size();
result.setRecords(list);
long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords());
result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出警情事件记录", notes = "导出警情事件记录")
@PostMapping("/exportSelectRecord")
public void exportAlertCalled(@RequestBody AlertCalledQueryDto alertCalledQueryDto, HttpServletResponse response) {
List<AlertCalledQueryDto> list = iAlertCalledService.queryAlertListByQueryDto(alertCalledQueryDto);
@GetMapping("/exportSelectRecord")
public void exportAlertCalled(AlertCalledQueryDto alertCalledQueryDto, HttpServletResponse response) {
Page<AlertCalledQueryDto> page = new Page<AlertCalledQueryDto>();
Page<AlertCalledQueryDto> pageBean = iAlertCalledService.queryAlertListByQueryDto(
page,
alertCalledQueryDto.getWorkOrderNumber(),
alertCalledQueryDto.getCreator(),
alertCalledQueryDto.getEmergency(),
alertCalledQueryDto.getEmergencyTimeStart() == null ? null : DateUtils.date2LongStr(alertCalledQueryDto.getEmergencyTimeStart()),
alertCalledQueryDto.getEmergencyTimeEnd() == null ? null : DateUtils.date2LongStr(alertCalledQueryDto.getEmergencyTimeEnd()),
alertCalledQueryDto.getEmergencyCall(),
alertCalledQueryDto.getDeviceId(),
alertCalledQueryDto.getElevatorAddress(),
alertCalledQueryDto.getAlertType(),
alertCalledQueryDto.getAlertSource(),
alertCalledQueryDto.getAlertStage(),
alertCalledQueryDto.getAlertStatus());
List<AlertCalledQueryDto> list = pageBean.getRecords();
String fileName = "警情事件记录" + System.currentTimeMillis();
ExcelUtil.createTemplate(response, fileName, "警情事件记录", list,
AlertCalledQueryDto.class, null, false);
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
......@@ -27,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
......@@ -148,9 +153,32 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
@Override
public List<AlertCalledQueryDto> queryAlertListByQueryDto(AlertCalledQueryDto alertCalledQueryDto) {
List<AlertCalledQueryDto> list = alertCalledMapper.queryAlertListByQueryDto(alertCalledQueryDto);
return list;
public Page<AlertCalledQueryDto> queryAlertListByQueryDto(IPage<AlertCalledQueryDto> page,
@Condition(Operator.like) String workOrderNumber,
@Condition(Operator.like) String creator,
@Condition(Operator.like) String emergency,
@Condition(Operator.gt) String emergencyTimeStart,
@Condition(Operator.lt) String emergencyTimeEnd,
@Condition(Operator.like) String emergencyCall,
@Condition(Operator.like) String deviceId,
@Condition(Operator.like) String elevatorAddress,
@Condition(Operator.eq) String alertType,
@Condition(Operator.eq) String alertSource,
@Condition(Operator.eq) String alertStage,
@Condition(Operator.eq) String alertStatus
) {
Page<List<AlertCalledQueryDto>>list = alertCalledMapper.queryAlertListByQueryDto(
page,workOrderNumber,creator,emergency,emergencyTimeStart,
emergencyTimeEnd,emergencyCall,deviceId,elevatorAddress,alertType,
alertSource,alertStage,alertStatus,null);
Page<AlertCalledQueryDto> page1 = new Page<>();
List<AlertCalledQueryDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()),AlertCalledQueryDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
page1.setRecords(resultDtoList);
return page1;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment