bug修复

This commit is contained in:
guo 2024-01-20 17:44:00 +08:00
parent fbfb2b8ed6
commit cde5ab179c
7 changed files with 86 additions and 10 deletions

View File

@ -74,7 +74,7 @@ public class UDPServerHandler extends SimpleChannelInboundHandler<DatagramPacket
locationData.setCardno(cardno);
locationData.setPersonName(workerInfos.get(0).getWorkerName());
//算出洞口的距离
locationData.setInlX(Double.parseDouble(inlX) + 271);
locationData.setInlX(Double.parseDouble(inlX));
try {
locationData.setPY((double) RandomUtil.randomInt(locationTunnel.getYValueRandomRangeStart(), locationTunnel.getYValueRandomRangeEnd()));
} catch (Exception e) {

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.frontierprotectionnonet.controller;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetData;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetDataDto;
import com.zhgd.xmgl.modules.frontierprotectionnonet.service.IFrontierProtectionNoNetDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -126,14 +127,25 @@ public class FrontierProtectionNoNetDataController {
@GetMapping(value = "/queryById")
public Result<FrontierProtectionNoNetData> queryById(@RequestParam(name = "id", required = true) String id) {
Result<FrontierProtectionNoNetData> result = new Result<FrontierProtectionNoNetData>();
FrontierProtectionNoNetData frontierProtectionNoNetData = frontierProtectionNoNetDataService.getById(id);
if (frontierProtectionNoNetData == null) {
result.error500("未找到对应实体");
} else {
result.setResult(frontierProtectionNoNetData);
result.setSuccess(true);
}
return result;
}
FrontierProtectionNoNetData frontierProtectionNoNetData = frontierProtectionNoNetDataService.getById(id);
if (frontierProtectionNoNetData == null) {
result.error500("未找到对应实体");
} else {
result.setResult(frontierProtectionNoNetData);
result.setSuccess(true);
}
return result;
}
@ApiOperation(value = "艾礼安云平台设备状态信息订阅", notes = "报警主机在发生状态改变、报警时,主动向第三方平台上传相关信息,响应 \n" +
"0表示成功 \n" +
"1表示失败", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/alaDeviceSubscribe")
public Integer alaDeviceSubscribe(@RequestBody FrontierProtectionNoNetDataDto dto) {
return frontierProtectionNoNetDataService.alaDeviceSubscribe(dto);
}
}

View File

@ -0,0 +1,29 @@
package com.zhgd.xmgl.modules.frontierprotectionnonet.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@Data
public class FrontierProtectionNoNetDataDto {
@JsonProperty("deviceid")
private String deviceid;
@JsonProperty("devicename")
private String devicename;
@JsonProperty("type")
private String type;
@JsonProperty("address")
private String address;
@JsonProperty("alarm")
private String alarm;
@JsonProperty("state")
private String state;
@JsonProperty("zone")
private String zone;
@JsonProperty("zonename")
private String zonename;
@JsonProperty("time")
private String time;
@JsonProperty("number")
private String number;
}

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.frontierprotectionnonet.service;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetDataDto;
import java.util.HashMap;
import java.util.List;
@ -22,4 +23,6 @@ public interface IFrontierProtectionNoNetDataService extends IService<FrontierPr
void add(FrontierProtectionNoNetData frontierProtectionNoNetData);
void edit(FrontierProtectionNoNetData frontierProtectionNoNetData);
Integer alaDeviceSubscribe(FrontierProtectionNoNetDataDto dto);
}

View File

@ -1,8 +1,14 @@
package com.zhgd.xmgl.modules.frontierprotectionnonet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetData;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetDataDto;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetDev;
import com.zhgd.xmgl.modules.frontierprotectionnonet.mapper.FrontierProtectionNoNetDataMapper;
import com.zhgd.xmgl.modules.frontierprotectionnonet.mapper.FrontierProtectionNoNetDevMapper;
import com.zhgd.xmgl.modules.frontierprotectionnonet.service.IFrontierProtectionNoNetDataService;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -11,6 +17,7 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -29,6 +36,8 @@ import org.springframework.beans.factory.annotation.Autowired;
public class FrontierProtectionNoNetDataServiceImpl extends ServiceImpl<FrontierProtectionNoNetDataMapper, FrontierProtectionNoNetData> implements IFrontierProtectionNoNetDataService {
@Autowired
private FrontierProtectionNoNetDataMapper frontierProtectionNoNetDataMapper;
@Autowired
private FrontierProtectionNoNetDevMapper frontierProtectionNoNetDevMapper;
@Override
public IPage<FrontierProtectionNoNetData> queryPageList(HashMap<String, Object> paramMap) {
@ -66,4 +75,24 @@ public class FrontierProtectionNoNetDataServiceImpl extends ServiceImpl<Frontier
public void edit(FrontierProtectionNoNetData frontierProtectionNoNetData) {
baseMapper.updateById(frontierProtectionNoNetData);
}
@Override
public Integer alaDeviceSubscribe(FrontierProtectionNoNetDataDto dto) {
String deviceid = dto.getDeviceid();
FrontierProtectionNoNetDev dev = frontierProtectionNoNetDevMapper.selectOne(new LambdaQueryWrapper<FrontierProtectionNoNetDev>()
.eq(FrontierProtectionNoNetDev::getDevSn, deviceid));
if (dev == null) {
//throw new OpenAlertException("设备编号不正确");
return 1;
}
FrontierProtectionNoNetData data = new FrontierProtectionNoNetData();
data.setDevSn(deviceid);
data.setMonitorObject(null);
data.setAlarmTime(new Date(Long.parseLong(dto.getTime()) * 1000));
data.setDeviceStatus(Integer.valueOf(dto.getAlarm()));
data.setDetailStatus(dto.getState());
data.setProjectSn(dev.getProjectSn());
baseMapper.insert(data);
return 0;
}
}

View File

@ -109,4 +109,6 @@ public class LocationTunnel implements Serializable {
private String planarGraph;
@ApiModelProperty(value = "实时数据id")
private Long realtimeId;
@ApiModelProperty(value = "矫正人员图标x方向")
private Integer correctorIconXDirection;
}

View File

@ -298,6 +298,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/xmgl/workerAttendance/list").permitAll()
.antMatchers("/xmgl/workerInfo/selectPersonTypeAndEduStatistics").permitAll()
.antMatchers("/xmgl/taskProgressRt/queryById").permitAll()
.antMatchers("/xmgl/frontierProtectionNoNetData/alaDeviceSubscribe").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
.anyRequest().authenticated() // 剩下所有的验证都需要验证.
.and()