Commit 9565f4c1 authored by tangwei's avatar tangwei

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

parents bfe029df eab6b464
......@@ -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;
......
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 派遣单更新DTO
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="DispatchPaperUpdateDto", description="派遣单更新DTO")
public class DispatchPaperUpdateDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "派遣单Id")
private Long pageId;
@ApiModelProperty(value = "派遣任务单Id")
private Long taskId;
@ApiModelProperty(value = "派遣单位Id")
private Long orgId;
@ApiModelProperty(value = "派遣单位类型code")
private String orgTypeCode;
@ApiModelProperty(value = "派遣单位社会信用代码")
private String orgCreditCode;
@ApiModelProperty(value = "派遣时间")
private Date dispatchTime;
public DispatchPaperUpdateDto() {
}
}
......@@ -90,4 +90,10 @@ public class ESAlertCalledDto extends BaseDto {
@ApiModelProperty(value = "求援人电话")
private String emergencyCall;
/**
* 响应级别
*/
@ApiModelProperty(value = "响应级别")
private String responseLevel;
}
......@@ -194,4 +194,10 @@ public class ElevatorDto extends BaseDto {
@ApiModelProperty(value = "原始表id(来自历史数据库)")
private String originalId;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
}
......@@ -66,4 +66,13 @@ public class RescueStationDto extends BaseDto {
@ApiModelProperty(value = "经纬度")
private String longitudeLatitude;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "距离")
private String distance;
}
......@@ -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;
}
......@@ -195,4 +195,9 @@ public class Elevator extends BaseEntity {
@ApiModelProperty(value = "原始表id(来自历史数据库)")
private String originalId;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
}
......@@ -73,4 +73,10 @@ public class RescueStation extends BaseEntity {
@ApiModelProperty(value = "经纬度")
private String longitudeLatitude;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import java.util.List;
/**
* Mapper 接口
*
......@@ -10,5 +13,12 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
* @date 2021-06-01
*/
public interface RescueStationMapper extends BaseMapper<RescueStation> {
/**
* 根据经纬度和距离反馈救援机构列表
* @param lat
* @param lon
* @param distance 单位为千米
* @return
*/
List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/**
* 派遣单接口类
......@@ -16,10 +17,11 @@ public interface IDispatchPaperService {
Object selectDispatchPaperDtoByAlertId(Long alertId);
/**
* 根据警情id 及 警情类别 创建 派遣单
* 根据警情id 及 警情类别 派遣人 创建 派遣单
* @param alertId
* @param alertCode
* @param sendUser
* @return
*/
DispatchPaper createDispatchPaper(Long alertId, String alertCode);
DispatchPaper createDispatchPaper(Long alertId, String alertCode, AgencyUserModel sendUser);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
/**
* 派遣任务接口类
......@@ -12,7 +13,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto;
public interface IDispatchTaskService {
Boolean createDispatchTask(DispatchTaskDto dispatchTaskDto);
Boolean createDispatchTask(DispatchTaskDto dispatchTaskDto, AgencyUserModel sendUser);
DispatchTaskDto getTaskInfo(String orgTypeCode, Long alertId);
}
......@@ -10,5 +10,10 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
* @date 2021-06-01
*/
public interface IElevatorService extends IService<Elevator> {
/**
* 根据警情返回电梯信息
* @param alertId
* @return
*/
Elevator selectByAlertId(Long alertId);
}
package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import java.util.List;
/**
* 服务类
*
......@@ -11,4 +14,13 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
*/
public interface IRescueStationService extends IService<RescueStation> {
/**
* 根据经纬度和距离反馈救援机构列表
* @param lat
* @param lon
* @param distance 单位为千米
* @return
*/
List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance);
}
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;
@ApiModelProperty(value = "响应级别")
private String responseLevel;
}
<?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.yeejoin.amos.boot.module.tzs.api.mapper.RescueStationMapper">
<select id="getListByLatLonDistance" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto">
select * from (
select tcb_rescue_station.sequence_nbr,
tcb_rescue_station.name,
tcb_rescue_station.address,
tcb_rescue_station.rescue_leader_id,
tcb_rescue_station.rescue_leader,
tcb_rescue_station.rescue_leader_phone,
(
ACOS(
SIN(
(#{lat} * 3.1415) / 180
) * SIN(
(
tcb_rescue_station.latitude * PI()
) / 180
) + COS(
(#{lat} * 3.1415) / 180
) * COS(
(
tcb_rescue_station.latitude * PI()
) / 180
) * COS(
(#{lon} * 3.1415) / 180 - (
tcb_rescue_station.longitude * PI()
) / 180
)
) * 6371
) AS distance
from tcb_rescue_station
) t
where t.distance
<![CDATA[ <= ]]>
#{distance}
</select>
</mapper>
......@@ -161,9 +161,14 @@ public class AircraftController extends BaseController {
@GetMapping(value = "/getAircraftNum")
@ApiOperation(httpMethod = "GET", value = "获取24小时内的航班号", notes = "获取24小时内的航班号")
public ResponseModel<List<Map<String, Object>>> getAircraftNum() {
List<Map<String, Object>> list= new ArrayList<>();
ResponseModel<List<Map<String, Object>>> dataModel= iotFeignClient.findImgByFileCategory();
return ResponseHelper.buildResponse(dataModel!=null?dataModel.getResult():null);
List<Map<String, Object>> list= new ArrayList<>();
Map<String, Object> map=new HashedMap();
Map<String, Object> map1=new HashedMap();
map.put("id", "1");map.put("name", "测试");
map1.put("id", "12");map1.put("name", "测试2");
list.add(map1);
list.add(map);
return ResponseHelper.buildResponse(list);
}
/**
......@@ -176,7 +181,9 @@ public class AircraftController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "通过航班号,查询最新的航班信息", notes = "通过航班号,查询最新的航班信息")
public ResponseModel<Map<String, Object>> getAircraftDetails(@PathVariable String num) {
Map<String, Object> map1=new HashedMap();
Map<String, Object> map1=new HashedMap();
ResponseModel<Map<String, Object>> dataModel= iotFeignClient.getDynamicFlightInfo(num);
if(dataModel!=null) {
Map<String, Object> map= dataModel.getResult();
......
......@@ -44,7 +44,7 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
@Autowired
AircraftMapper aircraftMapper;
AircraftMapper aircraftMapper;
/**
* <pre>
* 保存
......
......@@ -8,12 +8,20 @@ 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.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
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.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
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;
......@@ -34,6 +42,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
/**
......@@ -53,7 +64,10 @@ public class AlertCalledController extends BaseController {
AlertCalledServiceImpl iAlertCalledService;
@Autowired
private ESAlertCalledService eSAlertCalledService;
@Autowired
DispatchPaperServiceImpl dispatchPaperServiceImpl;
@Autowired
AlertFormValueServiceImpl iAlertFormValueService;
/**
* 新增警情接警填报记录
*
......@@ -62,21 +76,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());
}
......@@ -99,7 +113,12 @@ public class AlertCalledController extends BaseController {
@RequestBody ESAlertCalledRequestDto alertCalledVo,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) throws Exception {
return ResponseHelper.buildResponse(eSAlertCalledService.queryByKeys(alertCalledVo, current, size));
Page<ESAlertCalledDto> esAlertCalledDtoPage = eSAlertCalledService.queryByKeys(alertCalledVo, current, size);
esAlertCalledDtoPage.getRecords().stream().forEach(e->{
getResponseLevel(alertCalledVo.getSequenceNbr(),null,e);
});
return ResponseHelper.buildResponse(esAlertCalledDtoPage);
}
......@@ -126,7 +145,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 +159,12 @@ 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()));
calledVoIPage.getRecords().stream().forEach(e->{
getResponseLevel(alertCalled.getSequenceNbr(),e,null);
});
return ResponseHelper.buildResponse(calledVoIPage);
}
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
......@@ -196,4 +221,27 @@ public class AlertCalledController extends BaseController {
});
return queryWrapper;
}
void getResponseLevel(Long alertId,AlertCalledVo alertCalledVo,ESAlertCalledDto esAlertCalledDto) {
QueryWrapper<DispatchPaper> dispatchPaperQueryWrapper = new QueryWrapper<>();
dispatchPaperQueryWrapper.eq("alert_id",alertId);
DispatchPaper dispatchPaper = dispatchPaperServiceImpl.getOne(dispatchPaperQueryWrapper);
if(null != dispatchPaper) {
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", dispatchPaper.getSendUserId()).eq("alert_type_code",dispatchPaper.getAlertType());
// 派遣单动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
// map 存取数据
Map<String,String> dynamicParms = new HashMap<String,String>();
list.stream().forEach(paperFormValue -> {
dynamicParms.put("field_code","field_value");
});
String responseLevel = dynamicParms.get("response_level");
if(null != alertCalledVo) {
alertCalledVo.setResponseLevel(responseLevel);
} else {
esAlertCalledDto.setResponseLevel(responseLevel);
}
}
}
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
......@@ -17,6 +23,8 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchTaskDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getToken;
/**
* 派遣任务
*
......@@ -31,18 +39,8 @@ public class DispatchTaskController extends BaseController {
@Autowired
DispatchTaskServiceImpl dispatchTaskServiceImpl;
/**
* 新增派遣任务
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增派遣任务", notes = "新增派遣任务")
public ResponseModel<Boolean> save(@RequestBody DispatchTaskDto model) {
Boolean flag = dispatchTaskServiceImpl.createDispatchTask(model);
return ResponseHelper.buildResponse(flag);
}
@Autowired
RedisUtils redisUtils;
/**
* 根据派遣单位类型和警情id 获取任务模板
......@@ -51,13 +49,30 @@ public class DispatchTaskController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{orgTypeCode}/{alertId}")
@GetMapping(value = "/{orgTypeCode}/alert/{alertId}")
@ApiOperation(httpMethod = "GET",value = "根据派遣单位类型和警情id 获取任务信息", notes = "根据派遣单位类型和警情id 获取任务信息")
public ResponseModel<DispatchTaskDto> selectOne(@PathVariable String orgTypeCode, @PathVariable Long alertId) {
return ResponseHelper.buildResponse(dispatchTaskServiceImpl.getTaskInfo(orgTypeCode,alertId));
}
/**
* 新增派遣任务
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增派遣任务", notes = "新增派遣任务")
public ResponseModel<Boolean> save(@RequestBody DispatchTaskDto model) {
ReginParams reginParams =
JSONObject.parseObject(null != redisUtils.get(buildKey(getToken())) ?
redisUtils.get(buildKey(getToken())).toString() : null, ReginParams.class);
Boolean flag = dispatchTaskServiceImpl.createDispatchTask(model,reginParams.getUserModel());
return ResponseHelper.buildResponse(flag);
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
......@@ -71,32 +86,17 @@ public class DispatchTaskController extends BaseController {
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "派遣任务分页查询", notes = "派遣任务分页查询")
public ResponseModel<Page<DispatchTaskDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<DispatchTaskDto> page = new Page<DispatchTaskDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(dispatchTaskServiceImpl.queryForDispatchTaskPage(page));
}
/**
* 列表全部数据查询
* 根据警情id 查找力量调派信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "派遣任务列表全部数据查询", notes = "派遣任务列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<DispatchTaskDto>> selectForList() {
return ResponseHelper.buildResponse(dispatchTaskServiceImpl.queryForDispatchTaskList());
@ApiOperation(httpMethod = "GET",value = "根据警情id 查找力量调派信息", notes = "根据警情id 查找力量调派信息")
@GetMapping(value = "/list/alert/{alertId}")
public ResponseModel<List<DispatchTask>> selectForListByAlertId(@PathVariable Long alertId) {
QueryWrapper<DispatchTask> queryWrapper = new QueryWrapper<DispatchTask>();
queryWrapper.eq("alert_id", alertId);
List<DispatchTask> list = dispatchTaskServiceImpl.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
}
......@@ -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);
}
/**
* 分页查询电梯信息
*
......
......@@ -5,10 +5,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
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.api.entity.UseUnit;
import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitNameVo;
import com.yeejoin.amos.boot.module.tzs.api.vo.MaintenanceUnitVo;
import com.yeejoin.amos.boot.module.tzs.api.vo.UseUnitVo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -18,7 +24,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -40,6 +48,9 @@ public class MaintenanceUnitController extends BaseController {
@Autowired
IMaintenanceUnitService iMaintenanceUnitService;
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
/**
* 新增维保单位
*
......@@ -221,5 +232,27 @@ public class MaintenanceUnitController extends BaseController {
MaintenanceUnitNameVo.class);
return ResponseHelper.buildResponse(maintenanceUnitVoIPage);
}
/**
* 根据警情id 查找设备维保单位信息
* @param alertId
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/alert/{alertId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据警情id 查找设备维保单位信息", notes = "根据警情id 查找设备维保单位信息")
public ResponseModel<MaintenanceUnitVo> selectByAlertId(@PathVariable Long alertId) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
if (ValidationUtil.isEmpty(elevator))
throw new BadRequest("设备未找到");
// 根据设备使用单位id 获取使用单位信息
MaintenanceUnit maintenanceUnit = iMaintenanceUnitService.getById(elevator.getMaintainUnitId());
if (ValidationUtil.isEmpty(maintenanceUnit))
throw new BadRequest("维保单位未找到");
MaintenanceUnitVo maintenanceUnitVo = BeanDtoVoUtils.convert(maintenanceUnit, MaintenanceUnitVo.class);
return ResponseHelper.buildResponse(maintenanceUnitVo);
}
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.api.dto.RepairConsultDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RepairConsult;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.RepairConsultServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.RepairConsultDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
/**
* 警情填报业务数据项
......@@ -103,14 +112,17 @@ public class RepairConsultController extends BaseController {
}
/**
* 列表全部数据查询
*
* 根据警情id 查找处置过程日志
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "警情填报业务数据项列表全部数据查询", notes = "警情填报业务数据项列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<RepairConsultDto>> selectForList() {
return ResponseHelper.buildResponse(repairConsultServiceImpl.queryForRepairConsultList());
@ApiOperation(httpMethod = "GET",value = "根据警情id 查找处置过程日志", notes = "根据警情id 查找处置过程日志")
@GetMapping(value = "/list/alert/{alertId}")
public ResponseModel<List<RepairConsult>> selectForListByAlertId(@PathVariable Long alertId) {
QueryWrapper<RepairConsult> queryWrapper = new QueryWrapper<RepairConsult>();
queryWrapper.eq("parent_id", alertId).orderByDesc("rec_date");
List<RepairConsult> list = repairConsultServiceImpl.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
}
......@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import com.yeejoin.amos.boot.module.tzs.api.vo.RescueStationVo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -43,6 +45,9 @@ public class RescueStationController extends BaseController {
@Autowired
IRescueStationService iRescueStationService;
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
/**
* 新增救援站
*
......@@ -213,5 +218,25 @@ public class RescueStationController extends BaseController {
IPage<RescueStationVo> rescueStationVoIPage = BeanDtoVoUtils.iPageVoStream(page, RescueStationVo.class);
return ResponseHelper.buildResponse(rescueStationVoIPage);
}
/**
* 根据警情id和距离返回救援机构信息
* @param alertId
* @param distance
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/alert/{alertId}/distance/{distance}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据警情id和距离返回救援机构信息", notes = "根据警情id和距离返回救援机构信息")
public ResponseModel<Object> selectByAlertIdDistance(@PathVariable Long alertId, @PathVariable Integer distance) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
String longitude = elevator.getLongitude();
String latitude = elevator.getLatitude();
// 根据经纬度和距离返回救援机构信息
return ResponseHelper.buildResponse(iRescueStationService.getListByLatLonDistance(latitude,longitude,distance));
}
}
......@@ -7,10 +7,11 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.UseUnit;
//import com.yeejoin.amos.boot.module.tzs.api.service.EquipFeignService;
import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService;
import com.yeejoin.amos.boot.module.tzs.api.vo.UseUnitVo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -20,7 +21,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -48,6 +51,9 @@ public class UseUnitController extends BaseController {
@Autowired
AmosFeignService amosFeignService;
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
/**
* 新增使用单位
*
......@@ -186,5 +192,24 @@ public class UseUnitController extends BaseController {
page = iUseUnitService.page(pageBean, useUnitQueryWrapper);
return ResponseHelper.buildResponse(page);
}
/**
* 根据警情id 查找设备使用单位信息
* @param alertId
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/alert/{alertId}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据警情id 查找设备使用单位信息", notes = "根据警情id 查找设备使用单位信息")
public ResponseModel<UseUnitVo> selectByAlertId(@PathVariable Long alertId) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
// 根据设备使用单位id 获取使用单位信息
UseUnit useUnit = iUseUnitService.getById(elevator.getUseUnitId());
if (ValidationUtil.isEmpty(useUnit))
throw new BadRequest("使用单位未找到");
UseUnitVo useUnitVo = BeanDtoVoUtils.convert(useUnit, UseUnitVo.class);
return ResponseHelper.buildResponse(useUnitVo);
}
}
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.VoiceRecordFileServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
/**
* 通话记录附件
......@@ -103,14 +112,17 @@ public class VoiceRecordFileController extends BaseController {
}
/**
* 列表全部数据查询
*
* 根据警情id 查找通话记录信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "通话记录附件列表全部数据查询", notes = "通话记录附件列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<VoiceRecordFileDto>> selectForList() {
return ResponseHelper.buildResponse(voiceRecordFileServiceImpl.queryForVoiceRecordFileList());
@ApiOperation(httpMethod = "GET",value = "根据警情id 查找通话记录信息", notes = "根据警情id 查找通话记录信息")
@GetMapping(value = "/list/alert/{alertId}")
public ResponseModel<List<VoiceRecordFile>> selectForListByAlertId(@PathVariable Long alertId) {
QueryWrapper<VoiceRecordFile> queryWrapper = new QueryWrapper<VoiceRecordFile>();
queryWrapper.eq("alert_id", alertId).orderByDesc("rec_date");
List<VoiceRecordFile> list = voiceRecordFileServiceImpl.list(queryWrapper);
return ResponseHelper.buildResponse(list);
}
}
......@@ -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;
/**
* 分页查询
*/
public Page<AlertCalledDto> queryForAlertCalledPage(Page<AlertCalledDto> page) {
return this.queryForPage(page, null, false);
}
private ElevatorServiceImpl iElevatorService;
/**
* 列表查询 示例
*/
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("报送失败,系统异常!");
}
}
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertFormInitDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DispatchPaperFormDto;
......@@ -10,6 +13,7 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.tzs.api.mapper.DispatchPaperMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IDispatchPaperService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -19,6 +23,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getToken;
/**
* 派遣单服务实现类
*
......@@ -104,7 +110,7 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
}
@Override
public DispatchPaper createDispatchPaper(Long alertId, String alertCode) {
public DispatchPaper createDispatchPaper(Long alertId, String alertCode, AgencyUserModel sendUser) {
// 创建基本信息
DispatchPaper dispatchPaper = new DispatchPaper();
......@@ -113,6 +119,17 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
dispatchPaper.setDispatchTime(new Date());
dispatchPaper.setIsDelete(false);
// 完成状态 派遣状态 派遣人
DispatchPaperEnums finishStatus = DispatchPaperEnums.getEnum("notFinish");
dispatchPaper.setPaperStatus(finishStatus.getValue());
dispatchPaper.setPaperStatusCode(finishStatus.getCode());
DispatchPaperEnums dispatchStatus = DispatchPaperEnums.getEnum("receivedAlert");
dispatchPaper.setProcessStatus(dispatchStatus.getValue());
dispatchPaper.setProcessStatusCode(dispatchStatus.getCode());
dispatchPaper.setSendUserId(sendUser.getUserId());
dispatchPaper.setSendUserName(sendUser.getUserName());
this.save(dispatchPaper);
......
......@@ -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.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.mapper.ElevatorMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
* 服务实现类
......@@ -15,4 +20,26 @@ import org.springframework.stereotype.Service;
@Service
public class ElevatorServiceImpl extends ServiceImpl<ElevatorMapper, Elevator> implements IElevatorService {
@Autowired
AlertCalledServiceImpl alertCalledServiceImpl;
@Override
public Elevator selectByAlertId(Long alertId) {
AlertCalledDto alertCalledDto = alertCalledServiceImpl.queryBySeq(alertId);
if (ValidationUtil.isEmpty(alertCalledDto)
|| ValidationUtil.isEmpty(alertCalledDto.getDeviceId()))
throw new BadRequest("警情不存在或者设备编码不存在");
// 设备类型 和 编码 确定设备的使用单位或者维保单位
String equipmentClassificationCode = alertCalledDto.getEquipmentClassificationCode();
String deviceId = alertCalledDto.getDeviceId();
// 目前只有电梯类型
QueryWrapper<Elevator> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("rescue_code", deviceId);
Elevator elevator = this.getOne(queryWrapper);
if (ValidationUtil.isEmpty(elevator))
throw new BadRequest("设备未找到");
return elevator;
}
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tzs.api.dto.RescueStationDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import com.yeejoin.amos.boot.module.tzs.api.mapper.RescueStationMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 服务实现类
*
......@@ -15,4 +19,11 @@ import org.springframework.stereotype.Service;
@Service
public class RescueStationServiceImpl extends ServiceImpl<RescueStationMapper, RescueStation> implements IRescueStationService {
@Autowired
RescueStationMapper rescueStationMapper;
@Override
public List<RescueStationDto> getListByLatLonDistance(String lat, String lon, Integer distance) {
return rescueStationMapper.getListByLatLonDistance(lat,lon,distance);
}
}
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;
}
});
}
}
......@@ -18,6 +18,7 @@ spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
## unit(h)
alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=0
spring.redis.host=172.16.10.85
......
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