人员定位信息、大屏室外环境监测api
This commit is contained in:
parent
efe541588c
commit
50e640a758
|
|
@ -31,7 +31,7 @@ public class TbDevAttributeController extends BaseController {
|
|||
/**
|
||||
* 通过主键查询单条数据
|
||||
*/
|
||||
@GetMapping("{/id}")
|
||||
@GetMapping("/{id}")
|
||||
public TbDevAttribute getById(@PathVariable Long id) {
|
||||
return tbDevAttributeService.selectByPrimaryKey(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.base.mapper;
|
||||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.screen.vo.PeoplePositionVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
|
@ -59,5 +60,10 @@ public interface TbPeopleMapper {
|
|||
*/
|
||||
TbPeople queryByName(TbPeople tbPeople);
|
||||
|
||||
/**
|
||||
* 根据工程ID查询人员定位信息
|
||||
*/
|
||||
List<PeoplePositionVo> queryPeoplePositionByProId(@Param("proId") Integer proId);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.base.service;
|
|||
|
||||
import com.bonus.base.domain.TbPeople;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.screen.vo.PeoplePositionVo;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -75,4 +76,6 @@ public interface TbPeopleService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult importTbPeople(MultipartFile file);
|
||||
|
||||
List<PeoplePositionVo> queryPeoplePositionByProId(Integer proId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.bonus.common.core.utils.encryption.Sm4Utils;
|
|||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.screen.vo.PeoplePositionVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
|
@ -362,6 +363,11 @@ public class TbPeopleServiceImpl implements TbPeopleService {
|
|||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PeoplePositionVo> queryPeoplePositionByProId(Integer proId) {
|
||||
return tbPeopleDao.queryPeoplePositionByProId(proId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取Excel表格数据,做非空判断
|
||||
* @param sheet
|
||||
|
|
|
|||
|
|
@ -100,7 +100,11 @@ public class DataCenterController extends BaseController {
|
|||
*/
|
||||
@PostMapping("/uploadZnshData")
|
||||
public AjaxResult uploadZnshData(@RequestBody String obj){
|
||||
|
||||
return service.uploadZnshData(obj);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadSafetyHatData")
|
||||
public AjaxResult uploadSafetyHatData(@RequestBody String obj){
|
||||
return service.uploadSafetyHatData(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.data.entity;
|
||||
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
|
@ -8,13 +9,14 @@ import java.time.LocalDateTime;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.oracle.jrockit.jfr.ContentType.Timestamp;
|
||||
//import static com.oracle.jrockit.jfr.ContentType.Timestamp;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
* 设备检测属性值
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class DevAttributeVo {
|
||||
|
||||
private String id;
|
||||
|
|
@ -64,4 +66,14 @@ public class DevAttributeVo {
|
|||
this.jcTime = formattedDate;
|
||||
this.mergerId = mergerId;
|
||||
}
|
||||
|
||||
public DevAttributeVo(String devId,String devName,String devType, String jcName, String jcValue, String isWarn, String jcTime) {
|
||||
this.devId = devId;
|
||||
this.devName = devName;
|
||||
this.devType = devType;
|
||||
this.jcName = jcName;
|
||||
this.jcValue = jcValue;
|
||||
this.isWarn = isWarn;
|
||||
this.jcTime = jcTime;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.bonus.data.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.data.entity
|
||||
* @CreateTime: 2024-09-23 17:41
|
||||
* @Description: 安全帽监测数据
|
||||
*/
|
||||
@Data
|
||||
public class SafetyHatVo {
|
||||
|
||||
private String id;
|
||||
|
||||
// 设备编码
|
||||
private String deviceCode;
|
||||
|
||||
// 经度
|
||||
private String lon;
|
||||
|
||||
// 纬度
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 海拔高度
|
||||
*/
|
||||
private String altitude;
|
||||
|
||||
|
||||
/**
|
||||
* 端设备出厂标识
|
||||
*/
|
||||
private String nodeId;
|
||||
/**
|
||||
* 平台注册端设备主键
|
||||
*/
|
||||
private String deviceId;
|
||||
/**
|
||||
* 设备模型
|
||||
*/
|
||||
private String model;
|
||||
/**
|
||||
* 服务 ID
|
||||
*/
|
||||
private String serviceId;
|
||||
/**
|
||||
* 数据监测时间
|
||||
*/
|
||||
private String dataTime;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -7,6 +7,9 @@ import com.bonus.data.entity.WarnConfigVo;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author 黑子
|
||||
* 数据中心 接口层
|
||||
|
|
@ -75,6 +78,18 @@ public interface DataCenterMapper {
|
|||
*/
|
||||
void insertRecordData(DevAttributeVo vo);
|
||||
|
||||
/**
|
||||
* 查询室外感知设备最新的各项监测数据
|
||||
* @param devId 设备id
|
||||
*/
|
||||
List<DevAttributeVo> getDevAttributeLatestInfoById(@Param("devId") Integer devId);
|
||||
|
||||
/**
|
||||
* 查询室外感知设备历史各项10条记录
|
||||
* @param devId 设备id
|
||||
*/
|
||||
List<DevAttributeVo> getDevAttributeRecordByDevId(@Param("devId") Integer devId);
|
||||
|
||||
/**
|
||||
* 更新设备采集数据值
|
||||
* @param devId
|
||||
|
|
|
|||
|
|
@ -30,6 +30,13 @@ public interface DataCenterService {
|
|||
*/
|
||||
AjaxResult uploadCjData(String obj);
|
||||
|
||||
/**
|
||||
* 安全帽监测--数据采集
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
AjaxResult uploadSafetyHatData(String obj);
|
||||
|
||||
/**
|
||||
* 室外环境检测-数据采集
|
||||
* @param obj
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
log.info("设备数据数据-->{}",obj);
|
||||
List<DevInfoVo> list = jsonObject.getList("list",DevInfoVo.class);
|
||||
if(ObjectUtils.isNotEmpty(edgeId)){
|
||||
String bdId=mapper.getDevBdData(edgeId.toString());
|
||||
String bdId = mapper.getDevBdData(edgeId.toString());
|
||||
if(StringUtils.isNotEmpty(bdId)){
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
list.forEach(vo->{
|
||||
|
|
@ -51,9 +51,9 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
vo.setDeviceType(devType.toString());
|
||||
}
|
||||
int nums = mapper.getDevInfoNum(vo);
|
||||
if(nums>0){
|
||||
if (nums > 0) {
|
||||
//是否更新
|
||||
int num=mapper.updateDevInfo(vo);
|
||||
int num = mapper.updateDevInfo(vo);
|
||||
if(num<1){
|
||||
msg.set("存在数据更新失败!");
|
||||
}
|
||||
|
|
@ -129,6 +129,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
mapper.updateDevData(devId,json);
|
||||
}else{
|
||||
log.info("设备未注册------>{}",vo.getDeviceId());
|
||||
msg.set("设备未注册!");
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -141,8 +142,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
|
||||
@Override
|
||||
public AjaxResult uploadCjData(String obj) {
|
||||
|
||||
AtomicReference<String> msg= new AtomicReference<>("数据上传成功!");
|
||||
int code = 1;
|
||||
try{
|
||||
JSONObject jsonObject = JSONObject.parseObject(obj);
|
||||
log.info("沉降数据-->{}",obj);
|
||||
|
|
@ -157,37 +157,94 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
ObjectMapper objectMapper=new ObjectMapper();
|
||||
List<DevAttributeVo> attributeVos=new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
list.forEach(vo->{
|
||||
//先找到系统设备id
|
||||
DeviceVo deviceVo=mapper.getDevInfoId(vo.getDeviceId(),bdId);
|
||||
if(ObjectUtils.isNotEmpty(deviceVo) && StringUtils.isNotEmpty(deviceVo.getDevId())){
|
||||
String json="";
|
||||
for (CjDataVo vo : list) {//先找到系统设备id
|
||||
DeviceVo deviceVo = mapper.getDevInfoId(vo.getDeviceId(), bdId);
|
||||
if (ObjectUtils.isNotEmpty(deviceVo) && StringUtils.isNotEmpty(deviceVo.getDevId())) {
|
||||
String json = "";
|
||||
try {
|
||||
json = objectMapper.writeValueAsString(vo);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String devId= deviceVo.getDevId();
|
||||
log.info("设备注册系统id---->{}",devId);
|
||||
String devId = deviceVo.getDevId();
|
||||
log.info("设备注册系统id---->{}", devId);
|
||||
// WarnConfigVo config=mapper.getDevWarnConfig(devId);
|
||||
String mergerId= UuidUtils.generateUuid().toUpperCase().replaceAll("-","");
|
||||
String mergerId = UuidUtils.generateUuid().toUpperCase().replaceAll("-", "");
|
||||
attributeVos.clear();
|
||||
DevAttributeVo devAttributeVo=new DevAttributeVo(devId,json,deviceVo.getDevName(),deviceVo.getDevType(),"测量值",vo.getSubsideData(),"mm","subside_data","0",vo.getDataTime(),mergerId);
|
||||
DevAttributeVo devAttributeVo = new DevAttributeVo(devId, json, deviceVo.getDevName(), deviceVo.getDevType(), "测量值", vo.getSubsideData(), "mm", "subside_data", "0", vo.getDataTime(), mergerId);
|
||||
attributeVos.add(devAttributeVo);
|
||||
DevAttributeVo devAttributeVo2=new DevAttributeVo(devId,json,deviceVo.getDevName(),deviceVo.getDevType(),"变化值",vo.getRealSubsideData(),"mm","real_subside_data","0",vo.getDataTime(),mergerId);
|
||||
DevAttributeVo devAttributeVo2 = new DevAttributeVo(devId, json, deviceVo.getDevName(), deviceVo.getDevType(), "变化值", vo.getRealSubsideData(), "mm", "real_subside_data", "0", vo.getDataTime(), mergerId);
|
||||
attributeVos.add(devAttributeVo2);
|
||||
DevAttributeVo devAttributeVo3=new DevAttributeVo(devId,json,deviceVo.getDevName(),deviceVo.getDevType(),"累加值",vo.getAccSubsideData(),"mm","acc_subside_data","0",vo.getDataTime(),mergerId);
|
||||
DevAttributeVo devAttributeVo3 = new DevAttributeVo(devId, json, deviceVo.getDevName(), deviceVo.getDevType(), "累加值", vo.getAccSubsideData(), "mm", "acc_subside_data", "0", vo.getDataTime(), mergerId);
|
||||
attributeVos.add(devAttributeVo3);
|
||||
DevAttributeVo devAttributeVo4=new DevAttributeVo(devId,json,deviceVo.getDevName(),deviceVo.getDevType(),"基础沉降",vo.getSettlementFoundation(),"mm","settlement_foundation","0",vo.getDataTime(),mergerId);
|
||||
DevAttributeVo devAttributeVo4 = new DevAttributeVo(devId, json, deviceVo.getDevName(), deviceVo.getDevType(), "基础沉降", vo.getSettlementFoundation(), "mm", "settlement_foundation", "0", vo.getDataTime(), mergerId);
|
||||
attributeVos.add(devAttributeVo4);
|
||||
//更新/新增设备检测信息及记录
|
||||
insertOrAddDevAttribute(attributeVos);
|
||||
//更新设备采集数据json
|
||||
mapper.updateDevData(devId, json);
|
||||
} else {
|
||||
log.info("设备未注册------>{}", vo.getDeviceId());
|
||||
code = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return code == 1 ? AjaxResult.success("设备上传成功") : AjaxResult.error("设备未注册");
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全帽监测--数据采集
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult uploadSafetyHatData(String obj) {
|
||||
AtomicReference<String> msg= new AtomicReference<>("数据上传成功!");
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(obj);
|
||||
log.info("安全帽感知设备数据-->{}",obj);
|
||||
List<SafetyHatVo> list = jsonObject.getList("list",SafetyHatVo.class);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<DevAttributeVo> safetyHatVos = new ArrayList<>();
|
||||
Object edgeId = jsonObject.get("edgeId");
|
||||
String bdId;
|
||||
if (ObjectUtils.isNotEmpty(edgeId)){
|
||||
bdId = edgeId.toString();
|
||||
} else {
|
||||
bdId = "99999";
|
||||
}
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
list.forEach(vo->{
|
||||
//先找到系统设备id
|
||||
DeviceVo deviceVo = mapper.getDevInfoId(vo.getDeviceId(),bdId);
|
||||
if(ObjectUtils.isNotEmpty(deviceVo) && StringUtils.isNotEmpty(deviceVo.getDevId())){
|
||||
String json;
|
||||
try {
|
||||
json = objectMapper.writeValueAsString(vo);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String devId = deviceVo.getDevId();
|
||||
log.info("设备注册系统id---->{}",devId);
|
||||
WarnConfigVo config = mapper.getDevWarnConfig(devId);
|
||||
String mergerId= UuidUtils.generateUuid().toUpperCase().replaceAll("-","");
|
||||
safetyHatVos.clear();
|
||||
DevAttributeVo devAttributeVo = new DevAttributeVo(devId,json,deviceVo.getDevName(),deviceVo.getDevType(),"经度",vo.getLon(),"%度","hat_lon","0",vo.getDataTime(),mergerId);
|
||||
safetyHatVos.add(devAttributeVo);
|
||||
DevAttributeVo devAttributeVo2 = new DevAttributeVo(devId,json,deviceVo.getDevName(),deviceVo.getDevType(),"纬度",vo.getLat(),"/度","hat_lat","0",vo.getDataTime(),mergerId);
|
||||
safetyHatVos.add(devAttributeVo2);
|
||||
//更新/新增设备检测信息及记录
|
||||
insertOrAddDevAttribute(safetyHatVos);
|
||||
mapper.updateDevData(devId,json);
|
||||
}else{
|
||||
log.info("设备未注册------>{}",vo.getDeviceId());
|
||||
msg.set("设备未注册!");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
|
@ -258,6 +315,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
mapper.updateDevData(devId,json);
|
||||
}else{
|
||||
log.info("设备未注册------>{}",vo.getDeviceId());
|
||||
msg.set("设备未注册!");
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -314,6 +372,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
mapper.updateDevData(devId,json);
|
||||
}else{
|
||||
log.info("设备未注册------>{}",vo.getDeviceId());
|
||||
msg.set("设备未注册!");
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -365,6 +424,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
mapper.updateDevData(devId,json);
|
||||
}else{
|
||||
log.info("设备未注册------>{}",vo.getDeviceId());
|
||||
msg.set("设备未注册!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -435,6 +495,7 @@ public class DataCenterServiceImpl implements DataCenterService{
|
|||
mapper.updateDevData(devId,json);
|
||||
}else{
|
||||
log.info("设备未注册------>{}",vo.getDeviceId());
|
||||
msg.set("设备未注册!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.bonus.screen.controller;
|
||||
|
||||
import com.bonus.base.service.TbPeopleService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.screen.service.impl.ProjectDetailsViewServiceImpl;
|
||||
import com.bonus.screen.service.impl.ProjectViewServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.screen.controller
|
||||
* @CreateTime: 2024-09-24 10:35
|
||||
* @Description: 大屏详情页内容
|
||||
*/
|
||||
@RequestMapping("/screen/info")
|
||||
@RestController
|
||||
public class ProjectDetailsViewController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TbPeopleService tbPeopleService;
|
||||
|
||||
@Autowired
|
||||
private ProjectDetailsViewServiceImpl projectDetailsViewService;
|
||||
|
||||
@GetMapping("/queryPeoplePositionByProject")
|
||||
public AjaxResult queryPeoplePositionByProject(Integer proId) {
|
||||
return AjaxResult.success(tbPeopleService.queryPeoplePositionByProId(proId));
|
||||
}
|
||||
|
||||
@GetMapping("/getDevAttributeLatestInfoById")
|
||||
public AjaxResult getDevAttributeLatestInfoById(Integer devId) {
|
||||
return AjaxResult.success(projectDetailsViewService.getDevAttributeLatestInfoById(devId));
|
||||
}
|
||||
|
||||
@GetMapping("/getDevAttributeRecordById")
|
||||
public AjaxResult getDevAttributeRecordByDevId(Integer devId) {
|
||||
return AjaxResult.success(projectDetailsViewService.getDevAttributeRecordByDevId(devId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.bonus.screen.service.impl;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.data.entity.DevAttributeVo;
|
||||
import com.bonus.data.mapper.DataCenterMapper;
|
||||
import com.bonus.data.service.DataCenterService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.screen.service.impl
|
||||
* @CreateTime: 2024-09-24 11:33
|
||||
* @Description: 工程详情服务
|
||||
*/
|
||||
@Service
|
||||
public class ProjectDetailsViewServiceImpl {
|
||||
|
||||
@Autowired
|
||||
private DataCenterMapper dataCenterMapper;
|
||||
|
||||
|
||||
public AjaxResult getDevAttributeLatestInfoById(Integer proId) {
|
||||
return AjaxResult.success(dataCenterMapper.getDevAttributeLatestInfoById(proId));
|
||||
}
|
||||
|
||||
public AjaxResult getDevAttributeRecordByDevId(Integer devId) {
|
||||
List<DevAttributeVo> records = dataCenterMapper.getDevAttributeRecordByDevId(devId);
|
||||
if (records.isEmpty()) {
|
||||
return AjaxResult.error("暂无数据");
|
||||
}
|
||||
Map<String, List<DevAttributeVo>> listMap = records.stream().collect(Collectors.groupingBy(DevAttributeVo::getJcName));
|
||||
return AjaxResult.success(listMap);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.screen.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.screen.vo
|
||||
* @CreateTime: 2024-09-24 11:14
|
||||
* @Description: 边代设备环境监测信息vo
|
||||
*/
|
||||
@Data
|
||||
public class BdDeviceDataRecordVo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer devId;
|
||||
|
||||
private String devName;
|
||||
|
||||
// 环境监测数据
|
||||
private Map<String,List<Object>> data;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bonus.screen.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.screen.vo
|
||||
* @CreateTime: 2024-09-24 10:27
|
||||
* @Description: 人员定位vo
|
||||
*/
|
||||
@Data
|
||||
public class PeoplePositionVo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 人员名称
|
||||
*/
|
||||
private String relName;
|
||||
|
||||
private String idCard;
|
||||
|
||||
private Integer devId;
|
||||
|
||||
private String devName;
|
||||
|
||||
private String devCode;
|
||||
|
||||
private String lon;
|
||||
|
||||
private String lat;
|
||||
|
||||
private Integer proId;
|
||||
|
||||
private String proName;
|
||||
|
||||
}
|
||||
|
|
@ -128,5 +128,28 @@
|
|||
update tb_people set del_flag = '1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="queryPeoplePositionByProId" resultType="com.bonus.screen.vo.PeoplePositionVo">
|
||||
SELECT
|
||||
tp.id_card,
|
||||
tp.rel_name,
|
||||
tp.dev_id,
|
||||
tp.team_id AS teamId,
|
||||
tt.team_name,
|
||||
tt.pro_id,
|
||||
project.pro_name,
|
||||
device.dev_code,
|
||||
MAX(CASE WHEN tda.jc_name = '经度' THEN tda.jc_value END) AS lon,
|
||||
MAX(CASE WHEN tda.jc_name = '纬度' THEN tda.jc_value END) AS lat
|
||||
|
||||
FROM
|
||||
tb_people tp
|
||||
LEFT JOIN tb_team tt ON tt.id = tp.team_id AND tt.del_flag = 0
|
||||
LEFT JOIN tb_project project ON project.id = tt.pro_id AND project.del_flag = 0
|
||||
LEFT JOIN tb_device device ON tp.dev_id = device.id AND device.del_flag = 0
|
||||
LEFT JOIN tb_dev_attribute tda ON tda.dev_id = tp.dev_id AND tda.del_flag = 0
|
||||
|
||||
WHERE tp.del_flag = 0 AND project.id = #{proId}
|
||||
GROUP BY tp.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -87,11 +87,12 @@
|
|||
left join tb_warn_config twc on td.config_id=twc.id and twc.del_flag=0
|
||||
where td.id=#{devId} and td.del_flag=0
|
||||
</select>
|
||||
|
||||
<select id="getDevBdData" resultType="java.lang.String">
|
||||
select bdr.id
|
||||
from tb_bd_device_record bdr
|
||||
LEFT JOIN tb_bd_record tbr on tbr.id=bdr.record_id
|
||||
where tbr.audit_status=1 and bdr.dev_code=#{edgeId}
|
||||
LEFT JOIN tb_bd_record tbr on tbr.id = bdr.record_id
|
||||
where tbr.audit_status = 1 and bdr.dev_code = #{edgeId}
|
||||
</select>
|
||||
<select id="getDevTypeId" resultType="java.lang.Integer">
|
||||
select dict_code
|
||||
|
|
@ -100,4 +101,35 @@
|
|||
and status=0
|
||||
and dict_value LIKE CONCAT("%",#{relType},',',"%")
|
||||
</select>
|
||||
|
||||
<select id="getDevAttributeLatestInfoById" resultType="com.bonus.data.entity.DevAttributeVo">
|
||||
select
|
||||
tddr.dev_id,tddr.dev_name,tddr.dev_type,tddr.attribute_name as jcName,tddr.attribute_val as jcValue,
|
||||
tddr.is_warn,tddr.create_time as jcTime
|
||||
from tb_dev_data_record tddr
|
||||
where tddr.dev_id = #{devId}
|
||||
and tddr.merger_id = (
|
||||
select merger_id
|
||||
from tb_dev_data_record
|
||||
where dev_id = #{devId}
|
||||
order by create_time desc limit 1
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getDevAttributeRecordByDevId" resultType="com.bonus.data.entity.DevAttributeVo">
|
||||
SELECT
|
||||
tddr.dev_id,tddr.dev_name,tddr.dev_type,tddr.attribute_name as jcName,tddr.attribute_val as jcValue,
|
||||
tddr.is_warn,tddr.create_time as jcTime
|
||||
FROM tb_dev_data_record AS tddr
|
||||
WHERE tddr.dev_id = #{devId}
|
||||
AND tddr.attribute_name IN ('温度', '湿度', '风速','噪声','pm25','pm10')
|
||||
AND (
|
||||
SELECT COUNT(*)
|
||||
FROM tb_dev_data_record AS sub
|
||||
WHERE sub.dev_id = tddr.dev_id
|
||||
AND sub.attribute_name = tddr.attribute_name
|
||||
AND sub.create_time >= tddr.create_time
|
||||
) <= 10
|
||||
ORDER BY tddr.attribute_name, tddr.create_time DESC;
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue