Commit 197716b4 authored by 李松's avatar 李松

添加大屏应急处置详情-基本信息接口

parent f3834b4a
package com.yeejoin.amos.boot.module.elevator.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -567,7 +568,7 @@ public class AlertCalledController extends BaseController {
/**
* 冻结工单-维修
*
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -603,7 +604,7 @@ public class AlertCalledController extends BaseController {
/**
* 工单结案-投诉
*
*
* @return
*/
@ResubmitCheck
......@@ -785,6 +786,17 @@ public class AlertCalledController extends BaseController {
/**
* 应急大屏使用
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/detail/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取详细信息", notes = "根据id获取详细信息")
public ResponseModel<Object> getDetail(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.getDetail(id));
}
}
......@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.elevator.api.service.IAlertCalledService;
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;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.text.StrBuilder;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.LogManager;
......@@ -44,12 +45,16 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
......@@ -58,6 +63,8 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
/**
* 警情接警填报记录服务实现类
*
......@@ -127,6 +134,12 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
private RAtomicLong rAtomicLong;
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
@Value("classpath:/json/emergencyInformation.json")
private Resource emergencyInformation;
public AlertCalledServiceImpl(RedissonClient client){
this.redissonClient = client;
rAtomicLong = redissonClient.getAtomicLong("AUTO_INCR_LONG");
......@@ -944,4 +957,98 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
return alertCalledMapper.getCountNum(userName, startTime, endTime, groupCode);
}
public Object getDetail(Long id) {
HashMap<String, Object> map = new HashMap<>();
// 基本信息
Map<String, Object> keyInfo = getKeyInfo(id);
// map.put("keyinfo", keyInfo);
return keyInfo;
}
public Map<String, Object> getKeyInfo(Long id) {
HashMap<String, Object> keyinfoData = new HashMap<>();
// 基本信息
List<FormValue> jsonData = getJsonData(emergencyInformation);
AlertCalledFormDto alertCalledFormVo = getAlertCalledFormDto(id);
Map<String, Object> objectMap = Bean.BeantoMap(alertCalledFormVo.getAlertCalledDto());
List<FormValue> dynamicFormAlert = alertCalledFormVo.getDynamicFormAlert();
jsonData.forEach(f -> {
Object o = objectMap.get(f.getKey());
if (!ObjectUtils.isEmpty(o)) {
f.setValue(o.toString());
}
dynamicFormAlert.add(f);
});
// 使用单位信息
// 获取根据警情获取电梯信息
Map<String, Object> map = elevatorServiceImpl.selectByAlertId(id);
// 根据设备id 获取使用单位信息
Map<String, Object> useUnitMap = elevatorServiceImpl.selectUseUnitByAlertId(String.valueOf(map.get("sequenceNbr")));
if (!ObjectUtils.isEmpty(useUnitMap)) {
jsonData.forEach(f -> {
// 单位名称
if ("useUnitName".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("useUnitName")) ? null : String.valueOf(useUnitMap.get("useUnitName")));
}
// 单位电话
// if ("principalPhone".equals(f.getKey())){
//
// }
// 单位地址
if ("unitAddress".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("address")) ? null : String.valueOf(useUnitMap.get("address")));
}
// 安全管理员
if ("securityAdministrator".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("manager")) ? null : String.valueOf(useUnitMap.get("manager")));
}
// 安全管理员电话
if ("securityAdministratorPhone".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("managerPhone")) ? null : String.valueOf(useUnitMap.get("managerPhone")));
}
});
}
// 处置记录
LambdaQueryWrapper<RepairConsult> queryWrapper = new LambdaQueryWrapper<RepairConsult>();
queryWrapper.eq(RepairConsult::getParentId, id).orderByDesc(RepairConsult::getRecDate);
List<RepairConsult> list = repairConsultServiceImpl.list(queryWrapper);
HashMap<String, Object> datas = new HashMap<>();
ArrayList<Map<String, Object>> records = new ArrayList<>();
list.forEach(r -> {
HashMap<String, Object> data = new HashMap<>();
data.put("label", r.getAlertStatus());
data.put("operatingTime", r.getRecDate());
data.put("operater", r.getDescription());
records.add(data);
});
// 监管码
HashMap<String, Object> qrcode = new HashMap<>();
if (!ObjectUtils.isEmpty(alertCalledFormVo.getAlertCalledDto())) {
qrcode.put("value", alertCalledFormVo.getAlertCalledDto().getRegistrationCode());
}
// 96333码
HashMap<String, Object> qrcode2 = new HashMap<>();
if (!ObjectUtils.isEmpty(alertCalledFormVo.getAlertCalledDto())) {
qrcode2.put("value", alertCalledFormVo.getAlertCalledDto().getDeviceId());
}
datas.put("datas", records);
keyinfoData.put("keyParams", dynamicFormAlert);
keyinfoData.put("infoRecords", datas);
keyinfoData.put("qrcode", qrcode);
keyinfoData.put("qrcode2", qrcode2);
return keyinfoData;
}
private List<FormValue> getJsonData(Resource resource) {
String json;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
return parseArray(json, FormValue.class);
}
}
\ No newline at end of file
[
{
"key": "emergencyPerson",
"label": "救援人姓名",
"type": "text"
},
{
"key": "callTime",
"label": "接警时间",
"type": "text"
},
{
"key": "contactPhone",
"label": "联系人电话",
"type": "text"
},
{
"key": "useSiteCategory",
"label": "使用场所分类",
"type": "text"
},
{
"key": "deviceId",
"label": "电梯识别码",
"type": "text"
},
{
"key": "useStatus",
"label": "使用情况",
"type": "text"
},
{
"key": "address",
"label": "地址",
"type": "text"
},
{
"key": "useUnitName",
"label": "单位名称",
"type": "text"
},
{
"key": "principalPhone",
"label": "单位电话",
"type": "text"
},
{
"key": "unitAddress",
"label": "单位地址",
"type": "text"
},
{
"key": "securityAdministrator",
"label": "电梯安全管理员",
"type": "text"
},
{
"key": "securityAdministratorPhone",
"label": "电梯安全管理员电话",
"type": "text"
}
]
\ No newline at end of file
......@@ -38,7 +38,9 @@ public class DPSubController {
public ResponseModel<JSONObject> commonQuery(@PathVariable String template, @RequestBody Map<String, Object> param) {
if (template.equals("company")) {
Assert.notNull(param.get("useUnitCode"), "企业统一信用代码不能为空");
} else if (template.equals("equip")) {
} else if (template.equals("emergency")){
Assert.notNull(param.get("id"), "id不能为空");
}else if(template.equals("equip")) {
param.put("record", param.get("SEQUENCE_NBR"));
param.put("equList", param.get("EQU_LIST_CODE"));
Assert.notNull(param.get("record"), "设备ID不能为空");
......
{
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/elevator/alert-called/detail/{id}"
}
}
}
],
"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