Commit 17c2abe2 authored by changhong's avatar changhong

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/UseUnitController.java
parents 1db29ada d35a8ef4
......@@ -19,6 +19,7 @@ public class ExcelDto {
private String type;
public ExcelDto(String fileName, String sheetName, String classUrl, String type) {
super();
this.fileName = fileName;
this.sheetName = sheetName;
this.classUrl = classUrl;
......@@ -31,6 +32,10 @@ public class ExcelDto {
this.type = type;
}
public ExcelDto() {
}
public String getFileName() {
return StringUtils.isEmpty(fileName) ? DateUtils.convertDateToString(new Date(), "yyyyMMddHHmmss") : fileName;
}
......
......@@ -122,4 +122,12 @@ public interface EquipFeignClient {
**/
@RequestMapping(value = "/car/getCarDetailById/{id}", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getCarDetailById(@PathVariable Long id);
/**
* 获取消防建筑树
*
* @return
*/
@RequestMapping(value = "/building/BuildingtreeAndEquip", method = RequestMethod.GET)
ResponseModel<Object> getBuildingTreeAndEquip();
}
......@@ -4,7 +4,10 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
......@@ -23,6 +26,7 @@ public interface IotFeignClient {
ResponseModel<Map<String, Object>> getDynamicFlightInfo(@PathVariable String flightNo);
@RequestMapping(value = "/v1/iot/DynamicFlightInfo/list", method = RequestMethod.GET)
ResponseModel<List<Map<String, Object>>> findImgByFileCategory();
}
......@@ -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.vo.AlertCalledVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -21,14 +21,14 @@ public class AlertCalledFormDto extends BaseDto{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情基本信息")
private AlertCalled alertCalled;
private AlertCalledVo alertCalledVo;
@ApiModelProperty(value = "动态表单值")
private List<FormValue> dynamicFormAlert;
public AlertCalledFormDto(AlertCalled alertCalled, List<FormValue> formValue) {
this.alertCalled = alertCalled;
public AlertCalledFormDto(AlertCalledVo alertCalledVo, List<FormValue> formValue) {
this.alertCalledVo = alertCalledVo;
this.dynamicFormAlert = formValue;
}
}
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;
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* 装备服务feign
*
* @author Dell
*/
@FeignClient(name = "AMOS-EQUIPMANAGE", path = "equip")
//@FeignClient(name = "AMOS-AUTOSYS", url = "http://172.16.10.66:8085", path = "fireAutoSys")
public interface EquipFeignService {
/**
* 获取消防建筑树
*
* @return
*/
@RequestMapping(value = "/building/BuildingtreeAndEquip", method = RequestMethod.GET)
ResponseModel<Object> getBuildingTreeAndEquip();
}
//package com.yeejoin.amos.boot.module.tzs.api.service;
//
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
//
///**
// * 装备服务feign
// *
// * @author Dell
// */
//@FeignClient(name = "AMOS-EQUIPMANAGE", path = "equip")
////@FeignClient(name = "AMOS-AUTOSYS", url = "http://172.16.10.66:8085", path = "fireAutoSys")
//public interface EquipFeignService {
//
// /**
// * 获取消防建筑树
// *
// * @return
// */
// @RequestMapping(value = "/building/BuildingtreeAndEquip", method = RequestMethod.GET)
// ResponseModel<Object> getBuildingTreeAndEquip();
//}
package com.yeejoin.amos.boot.module.tzs.api.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 警情接警填报记录
*
* @author litw
* @date 2021-08-03
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_alert_called")
@ApiModel(value = "AlertCalledVo", description = "AlertCalledVo")
public class AlertCalledVo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 警情状态 (0 未结案 1 结案)
*/
@ApiModelProperty("警情状态")
private Boolean alertStatus;
/**
* 警情来源类型
*/
@ApiModelProperty("警情来源类型")
private String alertSource;
/**
* 警情来源类型Code
*/
@ApiModelProperty("警情来源类型Code")
private String alertSourceCode;
/**
* 接警时间
*/
@ApiModelProperty("接警时间")
private Date callTime;
/**
* 报警人电话
*/
@ApiModelProperty("报警人电话")
private String emergencyCall;
/**
* 报警人名称,默认为先生或女士
*/
@ApiModelProperty("报警人名称,默认为先生或女士")
private String emergencyPerson;
/**
* 联系人姓名
*/
@ApiModelProperty("联系人姓名")
private String contactUser;
/**
* 联系人电话
*/
@ApiModelProperty("联系人电话")
private String contactPhone;
/**
* 设备分类,字典表数据
*/
@ApiModelProperty("设备分类")
private String equipmentClassification;
/**
* 报警类型
*/
@ApiModelProperty("报警类型")
private String type;
/**
* 警情类别
*/
@ApiModelProperty("警情类别")
private String alarmType;
/**
* 通话记录信息id
*/
@ApiModelProperty("通话记录信息id")
private Integer callRecordId;
/**
* 警情阶段
*/
@ApiModelProperty("警情阶段")
private String alertStage;
/**
* 父警情id
*/
@ApiModelProperty("父警情id")
private Long fatherAlert;
/**
* 设备识别码
*/
@ApiModelProperty("设备识别码")
private String deviceId;
/**
* 注册编码
*/
@ApiModelProperty("注册编码")
private String registrationCode;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 设备分类code
*/
@ApiModelProperty("设备分类code")
private String equipmentClassificationCode;
/**
* 报警类型code
*/
@ApiModelProperty("报警类型code")
private String typeCode;
/**
* 警情类别code
*/
@ApiModelProperty("警情类别code")
private String alarmTypeCode;
/**
* 警情阶段code
*/
@ApiModelProperty("警情阶段code")
private String alertStageCode;
/**
* 组织机构
*/
@ApiModelProperty("组织机构")
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;
}
......@@ -8,12 +8,16 @@ 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;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
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;
......@@ -62,21 +66,21 @@ 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 =
JSONObject.parseObject(null != redisUtils.get(buildKey(getToken())) ?
redisUtils.get(buildKey(getToken())).toString() : null, ReginParams.class);
//获取当前登录人公司
Integer code= reginParams.getCompany().getCompanyOrgCode();
AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
alertCalled.setOrgCode(String.valueOf(code));
alertCalledObjsDto.setAlertCalled(alertCalled);
// Integer code= reginParams.getCompany().getCompanyOrgCode();
// AlertCalled alertCalled = alertCalledObjsDto.getAlertCalled();
// alertCalled.setOrgCode(String.valueOf(code));
// alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto =iAlertCalledService.createAlertCalled(alertCalledObjsDto);
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalled());
return ResponseHelper.buildResponse(alertCalledObjsDto.getAlertCalledDto());
}
......@@ -126,7 +130,8 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/list")
@ApiOperation(httpMethod = "GET",value = "警情接警填报记录分页查询", notes = "警情接警填报记录分页查询")
public ResponseModel<IPage<AlertCalled>> 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<>();
......@@ -139,7 +144,9 @@ public class AlertCalledController extends BaseController {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return ResponseHelper.buildResponse(page);
IPage<AlertCalledVo> calledVoIPage = AlertBeanDtoVoUtils.alertCalledIPageVo(page);
calledVoIPage.getRecords().stream().forEach(e->e.setAlertAddress(e.getCity()+e.getDistrict()));
return ResponseHelper.buildResponse(calledVoIPage);
}
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
......
......@@ -16,13 +16,19 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
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.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 电梯Api
......@@ -152,6 +158,51 @@ public class ElevatorController extends BaseController {
return ResponseHelper.buildResponse(elevatorVoIPage);
}
/**
* 相似电梯模糊查询
*
* @param elevatorDto 查询参数
* @return 返回结果
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/page/similar", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "相似电梯模糊查询", notes = "相似电梯模糊查询")
public ResponseModel<List<ElevatorVo>> similar(ElevatorDto elevatorDto) {
Elevator elevator = BeanDtoVoUtils.convert(elevatorDto, Elevator.class);
QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
Class<? extends Elevator> aClass = elevator.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(elevator);
if (o != null) {
String name = NameUtils.camel2Underline(field.getName());
if ("rescue_code".equalsIgnoreCase(name)) {
Integer fileValue = (Integer) o;
elevatorQueryWrapper.like(name, fileValue);
} else if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name)) {
String fileValue = (String) o;
elevatorQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) o;
elevatorQueryWrapper.like(name, fileValue);
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
});
List<Elevator> elevators = iElevatorService.list(elevatorQueryWrapper);
List<ElevatorVo> elevatorVos = new ArrayList<>();
for (Elevator elevato:elevators
) {
ElevatorVo elevatorVo = BeanDtoVoUtils.convertElevatorToVo(elevato,false);
elevatorVos.add(elevatorVo);
}
return ResponseHelper.buildResponse(elevatorVos);
}
/**
* 分页查询电梯信息
*
......
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -12,11 +11,17 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.FormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.RepairConsult;
import com.yeejoin.amos.boot.module.tzs.api.entity.Template;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -53,23 +58,12 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
private ESAlertCalledService eSAlertCalledService;
@Autowired
private RepairConsultServiceImpl repairConsultService;
private ElevatorServiceImpl iElevatorService;
/**
* 分页查询
*/
public Page<AlertCalledDto> queryForAlertCalledPage(Page<AlertCalledDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<AlertCalledDto> queryForAlertCalledList() {
return this.queryForList("" , false);
}
@Autowired
private RepairConsultServiceImpl repairConsultService;
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
@Override
......@@ -91,7 +85,23 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
formValue.add(value);
}
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalled, formValue);
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());
Elevator elevator = iElevatorService.getOne(elevatorQueryWrapper);
if(null != elevator) {
alertCalledVo.setAddress(elevator.getAddress());
alertCalledVo.setProvince(elevator.getProvince());
alertCalledVo.setCity(elevator.getCity());
alertCalledVo.setDistrict(elevator.getDistrict());
alertCalledVo.setUseStatus(elevator.getUseStatus());
alertCalledVo.setUseSiteCategory(elevator.getUseSiteCategory());
alertCalledVo.setUseUnit(elevator.getUseUnit());
alertCalledVo.setRegionCode(elevator.getRegionCode());
}
AlertCalledFormDto alertCalledFormVo = new AlertCalledFormDto(alertCalledVo, formValue);
redisUtils.set(RedisKey.ALERTCALLED_ID+id, JSON.toJSON(alertCalledFormVo),time);
return alertCalledFormVo;
......@@ -113,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());
......@@ -131,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);
......@@ -151,11 +169,19 @@ 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);
alertCalledObjsDto.setAlertCalled(alertCalled);
alertCalledObjsDto.setAlertCalledDto(BeanDtoVoUtils.convert(alertCalled,AlertCalledDto.class));
alertCalledObjsDto.setAlertFormValue(alertFormValuelist);
//保存处置记录-接警
......@@ -175,7 +201,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return alertCalledObjsDto;
} catch (Exception e) {
e.printStackTrace();
logger.error("报送失败",e);
throw new RuntimeException("报送失败,系统异常!");
}
}
......
......@@ -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;
import org.springframework.stereotype.Component;
/**
* @author fengwang
* @date 2021-08-05.
*/
@Component
public class AlertBeanDtoVoUtils {
/**
* 将警情记录实体类转换为Vo
*
* @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) {
return null;
}
try {
// 创建新的对象实例
AlertCalledVo target = new AlertCalledVo();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
// 返回新对象
return target;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 将AlertCalled转换为IPage<AlertCalledVo>
*
* @param page 原分页对象
* @return 转换后的Vo
*/
public static IPage<AlertCalledVo> alertCalledIPageVo(IPage<AlertCalled> page) {
return page.convert(item -> {
try {
return convertAlertCalledToVo(item);
} catch (Exception e) {
return null;
}
});
}
}
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