Commit d35a8ef4 authored by 李腾威's avatar 李腾威

日常管理-相似电梯查询,警情填报保存完善

parent 268687cd
......@@ -91,4 +91,39 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "组织机构")
private String orgCode;
@ApiModelProperty(value = "使用单位")
private String useUnit;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "接警时间开始---用于列表过滤")
private Date callTimeStart ;
@ApiModelProperty(value = "接警时间结束---用于列表过滤")
private Date callTimeEnd ;
@ApiModelProperty(value = "是否处警")
private Boolean isFatherAlert = false;
@ApiModelProperty(value = "所属省")
private String province;
@ApiModelProperty(value = "所属地市")
private String city;
@ApiModelProperty(value = "所属区县")
private String district;
@ApiModelProperty(value = "所属区域代码")
private String regionCode;
@ApiModelProperty(value = "使用场所分类")
private String useSiteCategory;
@ApiModelProperty(value = "电梯使用状态")
private Integer useStatus;
@ApiModelProperty(value = "警情地址")
private String alertAddress;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -24,7 +23,7 @@ public class AlertCalledObjsDto extends BaseDto{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情基本信息")
private AlertCalled alertCalled;
private AlertCalledDto alertCalledDto;
@ApiModelProperty(value = "动态表单值")
private List<AlertFormValue> alertFormValue;
......
......@@ -162,6 +162,17 @@ public class AlertCalled extends BaseEntity {
@TableField("org_code")
private String orgCode;
@TableField("city")
@ApiModelProperty(value = "所属地市")
private String city;
@TableField("district")
@ApiModelProperty(value = "所属区县")
private String district;
@TableField("region_code")
@ApiModelProperty(value = "所属区域代码")
private String regionCode;
@TableField(exist=false)
@ApiModelProperty(value = "使用单位")
......@@ -184,4 +195,6 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "是否处警")
private Boolean isFatherAlert = false;
}
......@@ -197,4 +197,8 @@ public class AlertCalledVo extends BaseEntity {
@ApiModelProperty(value = "电梯使用状态")
private Integer useStatus;
@ApiModelProperty(value = "警情地址")
private String alertAddress;
}
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
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.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
......@@ -16,6 +17,7 @@ import com.yeejoin.amos.boot.module.tzs.api.vo.AlertCalledVo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
......@@ -64,9 +66,9 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<AlertCalled> save(@RequestBody AlertCalledObjsDto alertCalledObjsDto) {
public ResponseModel<AlertCalledDto> save(@RequestBody AlertCalledObjsDto alertCalledObjsDto) {
if (ValidationUtil.isEmpty(alertCalledObjsDto)
|| ValidationUtil.isEmpty(alertCalledObjsDto.getAlertCalled())){
|| ValidationUtil.isEmpty(alertCalledObjsDto.getAlertCalledDto())){
throw new BadRequest("参数校验失败.");
}
ReginParams reginParams =
......@@ -78,7 +80,7 @@ public class AlertCalledController extends BaseController {
// alertCalled.setOrgCode(String.valueOf(code));
// alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto =iAlertCalledService.createAlertCalled(alertCalledObjsDto);
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalled());
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalledDto());
}
......@@ -128,7 +130,8 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET",value = "警情接警填报记录分页查询", notes = "警情接警填报记录分页查询")
public ResponseModel<IPage<AlertCalledVo>> queryForPage(String pageNum, String pageSize,String sort, AlertCalled alertCalled) {
public ResponseModel<IPage<AlertCalledVo>> queryForPage(String pageNum, String pageSize,String sort, AlertCalledDto alertCalledDto) {
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledDto,AlertCalled.class);
Page<AlertCalled> pageBean;
IPage<AlertCalled> page;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
......@@ -142,6 +145,7 @@ public class AlertCalledController extends BaseController {
}
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
IPage<AlertCalledVo> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageVo(page);
calledVoIPage.getRecords().stream().forEach(e->e.setAlertAddress(e.getCity()+e.getDistrict()));
return ResponseHelper.buildResponse(calledVoIPage);
}
......
......@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.tzs.api.vo.AlertCalledVo;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -84,7 +85,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
formValue.add(value);
}
}
AlertCalledVo alertCalledVo = AlertBeanDtoVoUtils.convertAlertCalledToVo(alertCalled);
AlertCalledDto alertCalledDto = BeanDtoVoUtils.convert(alertCalled,AlertCalledDto.class);
AlertCalledVo alertCalledVo = AlertBeanDtoVoUtils.convertAlertCalledDtoToVo(alertCalledDto);
QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
elevatorQueryWrapper.eq("rescue_code", Integer.parseInt(alertCalled.getDeviceId()));
elevatorQueryWrapper.eq("register_code", alertCalled.getRegistrationCode());
......@@ -121,7 +123,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
try {
// 警情基本信息
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledObjsDto.getAlertCalledDto(),AlertCalled.class);
alertCalled.setCallTime(new Date());
......@@ -139,7 +141,15 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// 填充警情主键
alertFormValuelist.stream().forEach(alertFormValue -> {
alertFormValue.setAlertCalledId(alertCalled.getSequenceNbr());
alertFormValue.setAlertTypeCode(alertCalled.getAlarmTypeCode());
if(AlertStageEnums.GZWX.toString().equals(alertCalled.getAlarmTypeCode()) ){
alertFormValue.setAlertTypeCode(AlertStageEnums.GZWX.getCode());
}
if(AlertStageEnums.TSZX.toString().equals(alertCalled.getAlarmTypeCode()) ) {
alertFormValue.setAlertTypeCode(AlertStageEnums.TSZX.getCode());
}
if(AlertStageEnums.KRJY.toString().equals(alertCalled.getAlarmTypeCode()) ) {
alertFormValue.setAlertTypeCode(AlertStageEnums.KRJY.getCode());
}
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
......@@ -171,7 +181,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
});
// 保存动态表单数据
iAlertFormValueService.saveBatch(alertFormValuelist);
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto.setAlertCalledDto(BeanDtoVoUtils.convert(alertCalled,AlertCalledDto.class));
alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
//保存处置记录-接警
......
......@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.ESAlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESAlertCalledRepository;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -146,7 +147,7 @@ public class ESAlertCalledService {
return result;
}
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
AlertCalled alertCalled = BeanDtoVoUtils.convert(alertCalledVo.getAlertCalledDto(),AlertCalled.class);
if (ValidationUtil.isEmpty(alertCalled))
{
return result;
......
package com.yeejoin.amos.boot.module.tzs.biz.utils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.vo.AlertCalledVo;
import org.springframework.beans.BeanUtils;
......@@ -20,6 +21,30 @@ public class AlertBeanDtoVoUtils {
* @param source 实体类
* @return Vo类
*/
public static AlertCalledVo convertAlertCalledDtoToVo( AlertCalledDto source) {
// 判断source是否为空
if (source == null) {
return null;
}
try {
// 创建新的对象实例
AlertCalledVo target = new AlertCalledVo();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 将警情记录实体类转换为Vo
*
* @param source 实体类
* @return Vo类
*/
public static AlertCalledVo convertAlertCalledToVo( AlertCalled source) {
// 判断source是否为空
if (source == null) {
......@@ -38,6 +63,8 @@ public class AlertBeanDtoVoUtils {
}
}
/**
* 将AlertCalled转换为IPage<AlertCalledVo>
*
......
spring.application.name=TZS
spring.application.name=TZS_LITW
server.servlet.context-path=/tzs
server.port=10000
spring.profiles.active=dev
......
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