Commit f35806a1 authored by 李松's avatar 李松

添加大屏应急事件详情接口

parent 9a40f8af
......@@ -799,4 +799,54 @@ public class AlertCalledController extends BaseController {
return ResponseHelper.buildResponse(iAlertCalledService.getDetail(id));
}
/**
* 应急大屏使用
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/basicDetail/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取救援信息", notes = "根据id获取救援信息")
public ResponseModel<Object> getBasicDetail(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.getBasicDetail(id));
}
/**
* 应急大屏使用
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/dispatchRecord/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取调派信息", notes = "根据id获取调派信息")
public ResponseModel<Object> getDispatchRecord(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.getDispatchRecord(id));
}
/**
* 应急大屏使用
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/followRecords/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取回访信息", notes = "根据id获取回访信息")
public ResponseModel<Object> getFollowRecords(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.getFollowRecords(id));
}
/**
* 应急大屏使用
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/callRecords/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取通话记录信息", notes = "根据id获取通话记录信息")
public ResponseModel<Object> getCallRecords(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.getCallRecords(id));
}
}
......@@ -31,6 +31,7 @@ import com.yeejoin.amos.boot.module.elevator.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.elevator.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertCalledMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.elevator.api.service.IRescueStationService;
import com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -136,8 +137,28 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
@Autowired
IRescueStationService iRescueStationService;
@Autowired
DispatchTaskServiceImpl dispatchTaskServiceImpl;
@Autowired
DispatchPaperServiceImpl dispatchPaperServiceImpl;
@Autowired
@Value("classpath:/json/emergencyInformation.json")
private Resource emergencyInformation;
@Value("classpath:/json/emergencyBasic.json")
private Resource emergencyBasic;
@Value("classpath:/json/dispatchRecordFirst.json")
private Resource dispatchRecordFirst;
@Value("classpath:/json/dispatchRecordSecond.json")
private Resource dispatchRecordSecond;
@Value("classpath:/json/dispatchRecordPower.json")
private Resource dispatchRecordPower;
@Value("classpath:/json/rescueFollow.json")
private Resource rescueFollowJson;
@Value("classpath:/json/repairFollow.json")
private Resource repairFollowJson;
public AlertCalledServiceImpl(RedissonClient client){
......@@ -958,15 +979,221 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return alertCalledMapper.getCountNum(userName, startTime, endTime, groupCode);
}
public Object getDetail(Long id) {
public Object getCallRecords(Long id) {
HashMap<String, Object> map = new HashMap<>();
// 基本信息
Map<String, Object> keyInfo = getKeyInfo(id);
// map.put("keyinfo", keyInfo);
return keyInfo;
LambdaQueryWrapper<VoiceRecordFile> queryWrapper = new LambdaQueryWrapper<VoiceRecordFile>();
queryWrapper.eq(VoiceRecordFile::getAlertId, id).orderByDesc(VoiceRecordFile::getRecDate);
List<VoiceRecordFile> list = voiceRecordFileServiceImpl.list(queryWrapper);
List<VoiceRecordFileDto> dtoList = new ArrayList<VoiceRecordFileDto>(list.size());
list.stream().forEach(voiceRecord -> {
// 创建新的对象实例
VoiceRecordFileDto target = new VoiceRecordFileDto();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(voiceRecord, target);
dtoList.add(target);
});
map.put("dataList", dtoList);
return map;
}
public Object getFollowRecords(Long id) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap<String, Object> result = new HashMap<>();
ArrayList<Map<String, Object>> group = new ArrayList<>();
DispatchSaveFeedbackDto dispatchSaveFeedbackDto = dispatchPaperServiceImpl.getDispatchSaveFeedbackDtoByAlertId(id);
Map<String, Object> objectMap = Bean.BeantoMap(dispatchSaveFeedbackDto);
// 救援回访
HashMap<String, Object> rescueFollow = new HashMap<>();
List<FormValue> jsonData = getJsonData(rescueFollowJson);
jsonData.forEach(formValue -> {
Object o = objectMap.get(formValue.getKey());
if (!ObjectUtils.isEmpty(o)) {
formValue.setValue(o.toString());
}
});
rescueFollow.put("columns", 2);
rescueFollow.put("datas", jsonData);
rescueFollow.put("renderType", "basic");
rescueFollow.put("key", "rescueFollow");
rescueFollow.put("displayName", "救援回访");
group.add(rescueFollow);
// 维修反馈
HashMap<String, Object> repairFollow = new HashMap<>();
List<FormValue> repairJson = getJsonData(repairFollowJson);
repairJson.forEach(f -> {
Object o = objectMap.get(f.getKey());
if (!ObjectUtils.isEmpty(o)) {
f.setValue(o.toString());
if ("feedbackFinishTime".equals(f.getKey())) {
f.setValue(simpleDateFormat.format(dispatchSaveFeedbackDto.getFeedbackFinishTime()));
}
if ("fixResult".equals(f.getKey())) {
f.setValue(this.getBaseMapper().getDictName(dispatchSaveFeedbackDto.getFixResult()));
}
if ("errorResult".equals(f.getKey())) {
f.setValue(this.getBaseMapper().getDictName(dispatchSaveFeedbackDto.getErrorResult()));
}
}
});
repairFollow.put("columns", 2);
repairFollow.put("datas", repairJson);
repairFollow.put("renderType", "basic");
repairFollow.put("key", "repairFollow");
repairFollow.put("displayName", "维修反馈");
group.add(repairFollow);
result.put("subs", group);
return result;
}
public Object getDispatchRecord(Long id) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap<String, Object> result = new HashMap<>();
ArrayList<Map<String, Object>> group = new ArrayList<>();
String json;
try {
json = IOUtils.toString(dispatchRecordFirst.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Map> columns = parseArray(json, Map.class);
// 一级调派
// 获取根据警情获取电梯信息
Map<String, Object> map = elevatorServiceImpl.selectByAlertId(id);
if (ObjectUtils.isEmpty(map)) {
throw new BadRequest("设备未找到");
}
// 根据设备使用id 获取维保单位信息
HashMap<String, Object> first = new HashMap<>();
ArrayList<Map> firstDatas = new ArrayList<>();
HashMap<String, Object> firstData = new HashMap<>();
first.put("key", "firstLevelDispatch");
first.put("renderType", "table");
first.put("columns", columns);
first.put("displayName", "一级调派");
List<Map<String, Object>> list = elevatorServiceImpl.selectMtByAlertId(String.valueOf(map.get("sequenceNbr")));
// if (!ObjectUtils.isEmpty(list)) {
// firstData.put("companyName", ObjectUtils.isEmpty(list.get(0).get("unitName")) ? null : String.valueOf(list.get(0).get("unitName")));
// firstData.put("companyCode", ObjectUtils.isEmpty(list.get(0).get("useCode")) ? null : String.valueOf(list.get(0).get("useCode")));
// firstData.put("companyType", "维保单位");
// firstData.put("responseStatus", "已派遣");
// }
firstDatas.add(firstData);
first.put("datas", list);
// 二级调派
String secondJson;
try {
secondJson = IOUtils.toString(dispatchRecordSecond.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Map> secondColumns = parseArray(secondJson, Map.class);
// 获取根据警情获取电梯信息
Map<String, Object> map2 = elevatorServiceImpl.selectByAlertId(id);
String longitude = String.valueOf(map2.get("longitude"));
String latitude = String.valueOf(map2.get("latitude"));
// 根据经纬度和距离返回救援机构信息
HashMap<String, Object> second = new HashMap<>();
ArrayList<Map> secondDatas = new ArrayList<>();
second.put("key", "secondLevelDispatch");
second.put("renderType", "table");
second.put("columns", secondColumns);
second.put("displayName", "二级调派");
List<RescueStationDto> listByLatLonDistance = iRescueStationService.getListByLatLonDistance(latitude, longitude, 1000);
second.put("datas", listByLatLonDistance);
// 力量调派
String powerJson;
try {
powerJson = IOUtils.toString(dispatchRecordPower.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Map> powerColumns = parseArray(powerJson, Map.class);
LambdaQueryWrapper<DispatchTask> queryWrapper = new LambdaQueryWrapper<DispatchTask>();
queryWrapper.eq(DispatchTask::getAlertId, id);
HashMap<String, Object> power = new HashMap<>();
ArrayList<Map> powerDatas = new ArrayList<>();
power.put("key", "firstLevelDispatch");
power.put("renderType", "table");
power.put("columns", powerColumns);
power.put("displayName", "使用单位");
List<DispatchTask> powerList = dispatchTaskServiceImpl.list(queryWrapper);
if (!ObjectUtils.isEmpty(powerList)) {
powerList.forEach(p -> {
Map<String, Object> objectMap = Bean.BeantoMap(p);
if (!ObjectUtils.isEmpty(p.getDispatchTime())) {
objectMap.put("dispatchTime", simpleDateFormat.format(p.getDispatchTime()));
}
if (!ObjectUtils.isEmpty(p.getArriveTime())) {
objectMap.put("arriveTime", simpleDateFormat.format(p.getArriveTime()));
}
powerDatas.add(objectMap);
});
}
power.put("datas", powerDatas);
group.add(power);
group.add(first);
group.add(second);
result.put("subs", group);
return result;
}
public Object getBasicDetail(Long id) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
HashMap<String, Object> map = new HashMap<>();
List<FormValue> jsonData = getJsonData(emergencyBasic);
RescueProcessDto dto = rescueProcessServiceImpl.getProcessByAlertId(id);
Map<String, Object> objectMap = Bean.BeantoMap(dto);
jsonData.forEach(f -> {
Object o = objectMap.get(f.getKey());
if (!ObjectUtils.isEmpty(o)) {
f.setValue(o.toString());
}
// 派遣状态
if ("dispatchStatus".equals(f.getKey()) && Boolean.TRUE.equals(dto.getDispatchStatus())) {
f.setValue("已通知已派遣");
}
// 到达状态
if ("arriveStatus".equals(f.getKey()) && Boolean.TRUE.equals(dto.getArriveStatus())) {
f.setValue("已到达");
}
// 伤亡状态
if ("casualtiesStatus".equals(f.getKey()) && Boolean.TRUE.equals(dto.getCasualtiesStatus())) {
f.setValue("出现伤亡");
}
// 救援状态
if ("rescueStatus".equals(f.getKey()) && Boolean.TRUE.equals(dto.getRescueStatus())) {
f.setValue("救援成功");
}
// 是否超时
if ("isTimeout".equals(f.getKey())) {
if (Boolean.TRUE.equals(dto.getIsTimeout())) {
f.setValue("是");
} else {
f.setValue("否");
}
}
// 派遣时间
if ("dispatchTime".equals(f.getKey()) && !ObjectUtils.isEmpty(dto.getDispatchTime())) {
f.setValue(simpleDateFormat.format(dto.getDispatchTime()));
}
// 到达时间
if ("arriveTime".equals(f.getKey()) && !ObjectUtils.isEmpty(dto.getArriveTime())) {
f.setValue(simpleDateFormat.format(dto.getArriveTime()));
}
// 完成时间
if ("rescueTime".equals(f.getKey()) && !ObjectUtils.isEmpty(dto.getRescueTime())) {
f.setValue(simpleDateFormat.format(dto.getRescueTime()));
}
});
map.put("datas", jsonData);
map.put("columns", 2);
return map;
}
public Map<String, Object> getKeyInfo(Long id) {
public Object getDetail(Long id) {
HashMap<String, Object> keyinfoData = new HashMap<>();
// 基本信息
List<FormValue> jsonData = getJsonData(emergencyInformation);
......@@ -980,7 +1207,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
dynamicFormAlert.add(f);
});
// 使用单位信息
// 获取根据警情获取电梯信息
Map<String, Object> map = elevatorServiceImpl.selectByAlertId(id);
......
[
{
"dataIndex": "unitName",
"width": 150,
"align": "left",
"title": "维保单位",
"key": "AA6DE857-C788-494F-8F16-2ECFC7E34528"
},
{
"dataIndex": "address",
"width": 160,
"align": "left",
"title": "地址",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA"
},
{
"dataIndex": "userName1",
"width": 160,
"align": "left",
"title": "主要负责人",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA2"
},
{
"dataIndex": "phone1",
"width": 160,
"align": "left",
"title": "主要负责人电话",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA3"
}
]
\ No newline at end of file
[
{
"dataIndex": "orgType",
"width": 150,
"align": "left",
"title": "响应级别",
"key": "AA6DE857-C788-494F-8F16-2ECFC7E34528"
},
{
"dataIndex": "responseOrgName",
"width": 150,
"align": "left",
"title": "单位名称",
"key": "D1CB84A4-E037-446A-9469-65B76E381585"
},
{
"dataIndex": "responseUserName",
"width": 160,
"align": "left",
"title": "联系人",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA"
},
{
"dataIndex": "responseUserTel",
"width": 160,
"align": "left",
"title": "联系电话",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA1"
},
{
"dataIndex": "dispatchTime",
"width": 160,
"align": "left",
"title": "派遣时间",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA2"
},
{
"dataIndex": "arriveTime",
"width": 160,
"align": "left",
"title": "到达时间",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA3"
}
]
\ No newline at end of file
[
{
"dataIndex": "name",
"width": 150,
"align": "left",
"title": "名称",
"key": "AA6DE857-C788-494F-8F16-2ECFC7E34528"
},
{
"dataIndex": "address",
"width": 150,
"align": "left",
"title": "地址",
"key": "D1CB84A4-E037-446A-9469-65B76E381585"
},
{
"dataIndex": "distance",
"width": 160,
"align": "left",
"title": "距离",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA"
},
{
"dataIndex": "rescueLeader",
"width": 160,
"align": "left",
"title": "救援负责人",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA1"
},
{
"dataIndex": "rescueLeaderPhone",
"width": 160,
"align": "left",
"title": "电话",
"key": "611DAF3D-5B79-466C-BEF2-CC91580091FA2"
}
]
\ No newline at end of file
[
{
"key": "dispatchStatus",
"label": "派遣状态",
"type": "text"
},
{
"key": "dispatchUserName",
"label": "派遣人",
"type": "text"
},
{
"key": "dispatchTime",
"label": "派遣时间",
"type": "text"
},
{
"key": "arriveStatus",
"label": "到达状态",
"type": "text"
},
{
"key": "arriveTime",
"label": "到达时间",
"type": "text"
},
{
"key": "arriveUserName",
"label": "记录人",
"type": "text"
},
{
"key": "arriveFeedbackType",
"label": "反馈方式",
"type": "text"
},
{
"key": "casualtiesStatus",
"label": "伤亡状态",
"type": "text"
},
{
"key": "casualtiesInfo",
"label": "受伤人数",
"type": "text"
},
{
"key": "dieNum",
"label": "死亡人数",
"type": "text"
},
{
"key": "rescueStatus",
"label": "救援状态",
"type": "text"
},
{
"key": "rescueTime",
"label": "完成时间",
"type": "text"
},
{
"key": "rescueUserName",
"label": "记录人",
"type": "text"
},
{
"key": "rescueFeedbackType",
"label": "反馈方式",
"type": "text"
},
{
"key": "isTimeout",
"label": "是否超时",
"type": "text"
},
{
"key": "arriveUseTime",
"label": "救援时长",
"type": "text"
}
]
\ No newline at end of file
[
{
"key": "responseUserName",
"label": "维保响应人",
"type": "text"
},
{
"key": "responseUserTel",
"label": "响应电话",
"type": "text"
},
{
"key": "feedbackType",
"label": "反馈方式",
"type": "text"
},
{
"key": "fixResult",
"label": "维修结果",
"type": "text"
},
{
"key": "feedbackFinishTime",
"label": "维修完成时间",
"type": "text"
},
{
"key": "saveFeedbackUser",
"label": "维修回访人",
"type": "text"
},
{
"key": "errorResult",
"label": "故障原因",
"type": "text"
},
{
"key": "fixRemark",
"label": "备注",
"type": "text"
}
]
\ No newline at end of file
[
{
"key": "emergency",
"label": "救援人",
"type": "text"
},
{
"key": "emergencyCall",
"label": "救援电话",
"type": "text"
},
{
"key": "feedbackFinishTime",
"label": "回访时间",
"type": "text"
},
{
"key": "feedbackUname",
"label": "救援回访人",
"type": "text"
},
{
"key": "saveFeedbackResult",
"label": "回访结果",
"type": "text"
}
]
\ No newline at end of file
......@@ -10,6 +10,62 @@
"apiPath":"/elevator/alert-called/detail/{id}"
}
}
},
{
"key": "basic",
"displayName": "救援过程",
"renderType": "basic",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/elevator/alert-called/basicDetail/{id}"
}
}
},
{
"key": "dispatchRecord",
"displayName": "调派记录",
"renderType": "table",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/elevator/alert-called/dispatchRecord/{id}"
}
}
},
{
"key": "followRecords",
"displayName": "回访记录",
"renderType": "basic",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/elevator/alert-called/followRecords/{id}"
}
}
},
{
"key": "callRecords",
"displayName": "通话记录",
"renderType": "table",
"formSeq": "",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/elevator/alert-called/callRecords/{id}"
}
},
"visualParams": {
"rowKey": "record",
"showPage" : false,
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "recDate","width": 150,"align": "left","title": "通话时间","key": "AA6DE857-C788-494F-8F16-2ECFC7E34528"},
{"dataRenderingMode": "defaultText","dataIndex": "fileType","width": 160,"align": "left","title": "通话类型","key": "611DAF3D-5B79-466C-BEF2-CC91580091FA"},
{"dataRenderingMode": "defaultText","dataIndex": "tel","width": 150,"align": "left","title": "电话号码","key": "D1CB84A4-E037-446A-9469-65B76E381585"},
{"dataRenderingMode": "defaultText","dataIndex": "telTime","width": 180,"align": "left","title": "通话时长","key": "0BB7318F-5134-42B6-A835-FC86D68066C2"}
]
}
}
],
"content": {
......
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