高支模bug修复
This commit is contained in:
parent
81e70f8078
commit
00bd41f195
@ -34,10 +34,10 @@ public class TcpNettyHandler extends SimpleChannelInboundHandler<Object> {
|
||||
|
||||
//字符串判断
|
||||
String str = getString(bytes);
|
||||
str = str.trim();
|
||||
log.info("channelRead0 str >>> \r\n {} ", str);
|
||||
if (StringUtils.startsWith(str, HighFormworkSupport.TCP_DATA_PREFIX) && StringUtils.endsWith(str, HighFormworkSupport.TCP_DATA_END)) {
|
||||
//接收高支模数据保存到mysql中
|
||||
str = str.trim();
|
||||
try {
|
||||
highFormworkSupportService.saveTcpData(str);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -102,61 +102,29 @@ public class HighFormworkSupportService {
|
||||
String[] one = onePair.split(":");
|
||||
dataMap.put(one[0], StringUtils.substringAfter(onePair, one[0] + ":"));
|
||||
}
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HHmmss");
|
||||
|
||||
log.info("saveTcpData() >>> \r\n {}", dataMap);
|
||||
// LambdaQueryWrapper<HighFormworkSupportDevice> deviceLambdaQueryWrapper = new LambdaQueryWrapper<HighFormworkSupportDevice>()
|
||||
// .eq(HighFormworkSupportDevice::getDevBh, dataMap.get(HighFormworkSupport.DEV_BH))
|
||||
// .eq(HighFormworkSupportDevice::getTrBh, dataMap.get(HighFormworkSupport.TR_BH));
|
||||
if (dataMap.keySet().stream().anyMatch(HighFormworkSupport.GPS_DEV_J::equals)) {
|
||||
log.info("saveTcpData() >>> \r\n {}", "高支模设备-工程信息");
|
||||
// HighFormworkSupportDevice highFormworkSupportDevice = new HighFormworkSupportDevice();
|
||||
// highFormworkSupportDevice.setDevType(dataMap.get(HighFormworkSupport.DEV_TYPE));
|
||||
// highFormworkSupportDevice.setDevBh(dataMap.get(HighFormworkSupport.DEV_BH));
|
||||
// highFormworkSupportDevice.setGpsDevJ(Double.valueOf(dataMap.get(HighFormworkSupport.GPS_DEV_J)));
|
||||
// highFormworkSupportDevice.setGpsDevW(Double.valueOf(dataMap.get(HighFormworkSupport.GPS_DEV_W)));
|
||||
// highFormworkSupportDevice.setTrBh(dataMap.get(HighFormworkSupport.TR_BH));
|
||||
// HighFormworkSupportDevice device = highFormworkSupportDeviceMapper.selectOne(deviceLambdaQueryWrapper);
|
||||
// //高支模设备-工程信息
|
||||
// if (device == null) {
|
||||
// highFormworkSupportDeviceMapper.insert(highFormworkSupportDevice);
|
||||
// } else {
|
||||
// highFormworkSupportDeviceMapper.update(highFormworkSupportDevice, deviceLambdaQueryWrapper);
|
||||
// highFormworkSupportDevice.setId(device.getId());
|
||||
// }
|
||||
//
|
||||
// HighFormworkSupportUpload upload = new HighFormworkSupportUpload();
|
||||
// upload.setHighFormworkSupportDeviceId(highFormworkSupportDevice.getId());
|
||||
// upload.setScBh(dataMap.get(HighFormworkSupport.SC_BH));
|
||||
// upload.setCdAl(Integer.valueOf(dataMap.get(HighFormworkSupport.CD_AL)));
|
||||
// upload.setJcT(Integer.valueOf(dataMap.get(HighFormworkSupport.JC_T)));
|
||||
// upload.setScT(Integer.valueOf(dataMap.get(HighFormworkSupport.SC_T)));
|
||||
// upload.setTime(sdf.parse(dataMap.get(HighFormworkSupport.TIME)));
|
||||
// upload.setDevSn(dataMap.get(HighFormworkSupport.DEV_TYPE));
|
||||
// highFormworkSupportUploadMapper.insert(upload);
|
||||
} else if (dataMap.keySet().stream().anyMatch(HighFormworkSupport.GZ_CS::equals)) {
|
||||
log.info("saveTcpData() >>> \r\n {}", "高支模测点信息");
|
||||
saveAlarmThreshold(dataMap);
|
||||
//saveAlarmThreshold(dataMap);
|
||||
} else if (dataMap.keySet().stream().anyMatch(s -> s.contains(HighFormworkSupport.GZ_CJ))) {
|
||||
log.info("saveTcpData() >>> \r\n {}", "高支模设备采集数据");
|
||||
pickData(dataMap);
|
||||
} else if (dataMap.keySet().stream().anyMatch(HighFormworkSupport.GZ_GZT::equals)) {
|
||||
log.info("saveTcpData() >>> \r\n {}", "高支模结束信息");
|
||||
//高支模结束信息
|
||||
// Integer uploadIdByInfo = highFormworkSupportDeviceMapper.getUploadIdByInfo(dataMap);
|
||||
// HighFormworkSupportUpload upload = new HighFormworkSupportUpload();
|
||||
// upload.setJsT(sdf.parse(dataMap.get(HighFormworkSupport.JS_T)));
|
||||
// upload.setGzGzt(Integer.valueOf(dataMap.get(HighFormworkSupport.GZ_GZT)));
|
||||
// upload.setId(uploadIdByInfo);
|
||||
// highFormworkSupportUploadMapper.updateById(upload);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveAlarmThreshold(HashMap<String, String> dataMap) {
|
||||
String measurePointNumber = dataMap.get(HighFormworkSupport.DEV_BH);
|
||||
String sn = dataMap.get(HighFormworkSupport.DEV_SN);
|
||||
HighFormworkMeasurePoint point = highFormworkMeasurePointMapper.selectOne(new LambdaQueryWrapper<HighFormworkMeasurePoint>()
|
||||
.eq(HighFormworkMeasurePoint::getMeasurePointNumber, dataMap.get(HighFormworkSupport.DEV_BH))
|
||||
.eq(HighFormworkMeasurePoint::getAcquisitionInstrumentNumber, dataMap.get(HighFormworkSupport.DEV_SN)));
|
||||
.eq(HighFormworkMeasurePoint::getMeasurePointNumber, measurePointNumber)
|
||||
.eq(HighFormworkMeasurePoint::getAcquisitionInstrumentNumber, sn));
|
||||
if (point == null) {
|
||||
log.info("测点不存在:测量点编号:{} 采集仪编号:{}", measurePointNumber, sn);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -221,7 +189,9 @@ public class HighFormworkSupportService {
|
||||
List<String> list = Stream.of(no, no2, no3).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
//保存设备
|
||||
Map<String, String> noMap = list.stream().collect(Collectors.toMap(x -> x, x -> x));
|
||||
if (noMap.size() != existDevices.size() || existDevices.stream().allMatch(noMap::containsKey)) {
|
||||
if (noMap.size() != existDevices.size() || !existDevices.stream().allMatch(key -> {
|
||||
return noMap.containsKey(key.getDeviceSn());
|
||||
})) {
|
||||
highFormworkMeasureDeviceMapper.delete(new LambdaQueryWrapper<HighFormworkMeasureDevice>().eq(HighFormworkMeasureDevice::getMeasurePointId, point.getId()));
|
||||
for (String nu : list) {
|
||||
HighFormworkMeasureDevice d = new HighFormworkMeasureDevice();
|
||||
@ -234,7 +204,7 @@ public class HighFormworkSupportService {
|
||||
}
|
||||
}
|
||||
|
||||
HighFormworkMeasureCurrentData currentData = getHighFormworkMeasureCurrentData(dataMap, no, no2, no3, point);
|
||||
HighFormworkMeasureCurrentData currentData = getAndSaveHighFormworkMeasureCurrentData(dataMap, no, no2, no3, point);
|
||||
|
||||
//插入报警/预警数据
|
||||
addAlarmData(point, currentData);
|
||||
@ -243,17 +213,22 @@ public class HighFormworkSupportService {
|
||||
|
||||
private Integer getDeviceTypeByNo(String no) {
|
||||
String noType = no.substring(no.length() - 1);
|
||||
if (noType.equals("L")) {
|
||||
//类型:1立杆轴力2水平位移3模板沉降4立杆倾斜5地基沉降
|
||||
if (noType.equals("F")) {
|
||||
return 1;
|
||||
} else if (noType.equals("F")) {
|
||||
} else if (noType.equals("H")) {
|
||||
return 2;
|
||||
} else if (noType.equals("V")) {
|
||||
return 3;
|
||||
} else if (noType.equals("L")) {
|
||||
return 4;
|
||||
} else if (noType.equals("D")) {
|
||||
return 5;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private HighFormworkMeasureCurrentData getHighFormworkMeasureCurrentData(HashMap<String, String> dataMap, String no, String no2, String no3, HighFormworkMeasurePoint point) {
|
||||
private HighFormworkMeasureCurrentData getAndSaveHighFormworkMeasureCurrentData(HashMap<String, String> dataMap, String no, String no2, String no3, HighFormworkMeasurePoint point) {
|
||||
//测点编号后缀为测点类型识别:F-立杆轴力(单位为牛)、H-水平位移(单位为mm)、V-模板沉降(单位为mm)、L-立杆倾斜(单位为°)、D-地基沉降;,例如测点 0001L表示测点类型为立杆倾斜;
|
||||
HighFormworkMeasureCurrentData currentData = new HighFormworkMeasureCurrentData();
|
||||
currentData.setMeasurePointNumber(point.getMeasurePointNumber());
|
||||
@ -281,7 +256,7 @@ public class HighFormworkSupportService {
|
||||
if (StringUtils.isNotBlank(no)) {
|
||||
String noType = no.substring(no.length() - 1);
|
||||
if (noType.equals("F")) {
|
||||
currentData.setPoleAxialForce(String.valueOf(Double.parseDouble(dataMap.get(gzDs2)) / 1000));
|
||||
currentData.setPoleAxialForce(String.valueOf(Double.parseDouble(dataMap.get(gzDs2))));
|
||||
}
|
||||
if (noType.equals("H")) {
|
||||
currentData.setHorizontalDisplacement(dataMap.get(gzDs2));
|
||||
@ -333,52 +308,53 @@ public class HighFormworkSupportService {
|
||||
Integer type = threshold.getType();
|
||||
Double alarmValue = StringUtils.isNotBlank(threshold.getAlarmValue()) ? Double.valueOf(threshold.getAlarmValue()) : null;
|
||||
Double warningValue = StringUtils.isNotBlank(threshold.getWarningValue()) ? Double.valueOf(threshold.getWarningValue()) : null;
|
||||
//类型:1立杆轴力2水平位移3模板沉降4立杆倾斜5地基沉降
|
||||
if (type == 1) {
|
||||
Double electricPower = StringUtils.isNotBlank(currentData.getElectricPower()) ? Double.valueOf(currentData.getElectricPower()) : null;
|
||||
if (electricPower != null && alarmValue != null && alarmValue < electricPower) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getPoleAxialForce()) ? Double.valueOf(currentData.getPoleAxialForce()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, electricPower, 1, 1);
|
||||
insertHighFormworkAlarmData(point, subside, 1, 1);
|
||||
isAlarm = true;
|
||||
} else if (electricPower != null && warningValue != null && warningValue < electricPower) {
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, electricPower, 1, 2);
|
||||
insertHighFormworkAlarmData(point, subside, 1, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 2) {
|
||||
Double x = StringUtils.isNotBlank(currentData.getAngleXAxis()) ? Double.valueOf(currentData.getAngleXAxis()) : null;
|
||||
if (x != null && alarmValue != null && alarmValue < x) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getHorizontalDisplacement()) ? Double.valueOf(currentData.getHorizontalDisplacement()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, x, 2, 1);
|
||||
insertHighFormworkAlarmData(point, subside, 2, 1);
|
||||
isAlarm = true;
|
||||
} else if (x != null && warningValue != null && warningValue < x) {
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, x, 2, 2);
|
||||
insertHighFormworkAlarmData(point, subside, 2, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 3) {
|
||||
Double angleYAxis = StringUtils.isNotBlank(currentData.getAngleYAxis()) ? Double.valueOf(currentData.getAngleYAxis()) : null;
|
||||
if (angleYAxis != null && alarmValue != null && alarmValue < angleYAxis) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getFormworkSettlement()) ? Double.valueOf(currentData.getFormworkSettlement()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, angleYAxis, 3, 1);
|
||||
insertHighFormworkAlarmData(point, subside, 3, 1);
|
||||
isAlarm = true;
|
||||
} else if (angleYAxis != null && warningValue != null && warningValue < angleYAxis) {
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, angleYAxis, 3, 2);
|
||||
insertHighFormworkAlarmData(point, subside, 3, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 4) {
|
||||
Double pressure = StringUtils.isNotBlank(currentData.getPressure()) ? Double.valueOf(currentData.getPressure()) : null;
|
||||
if (pressure != null && alarmValue != null && alarmValue < pressure) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getPoleTilt()) ? Double.valueOf(currentData.getPoleTilt()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, pressure, 4, 1);
|
||||
insertHighFormworkAlarmData(point, subside, 4, 1);
|
||||
isAlarm = true;
|
||||
} else if (pressure != null && warningValue != null && warningValue < pressure) {
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, pressure, 4, 2);
|
||||
insertHighFormworkAlarmData(point, subside, 4, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 5) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getSubside()) ? Double.valueOf(currentData.getSubside()) : null;
|
||||
Double subside = StringUtils.isNotBlank(currentData.getFoundationSettlement()) ? Double.valueOf(currentData.getFoundationSettlement()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, subside, 5, 1);
|
||||
@ -388,61 +364,6 @@ public class HighFormworkSupportService {
|
||||
insertHighFormworkAlarmData(point, subside, 5, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 6) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getPoleAxialForce()) ? Double.valueOf(currentData.getPoleAxialForce()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, subside, 6, 1);
|
||||
isAlarm = true;
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, subside, 6, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 7) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getHorizontalDisplacement()) ? Double.valueOf(currentData.getHorizontalDisplacement()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, subside, 7, 1);
|
||||
isAlarm = true;
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, subside, 7, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 8) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getFormworkSettlement()) ? Double.valueOf(currentData.getFormworkSettlement()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, subside, 8, 1);
|
||||
isAlarm = true;
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, subside, 8, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 9) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getPoleTilt()) ? Double.valueOf(currentData.getPoleTilt()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, subside, 9, 1);
|
||||
isAlarm = true;
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, subside, 9, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
} else if (type == 10) {
|
||||
Double subside = StringUtils.isNotBlank(currentData.getFoundationSettlement()) ? Double.valueOf(currentData.getFoundationSettlement()) : null;
|
||||
if (subside != null && alarmValue != null && alarmValue < subside) {
|
||||
//报警
|
||||
insertHighFormworkAlarmData(point, subside, 10, 1);
|
||||
isAlarm = true;
|
||||
} else if (subside != null && warningValue != null && warningValue < subside) {
|
||||
//预警
|
||||
insertHighFormworkAlarmData(point, subside, 10, 2);
|
||||
isWarn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,11 +31,7 @@ public class HighFormworkAlarmData implements Serializable {
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 类型 ,1电量(%),2 X轴(°),3 Y轴(°),4压力(kN),5沉降(mm),6.立杆轴力7.水平位移8.模板沉降9.立杆倾斜10.地基沉降
|
||||
*/
|
||||
@Excel(name = "类型 ,1电量(%),2 X轴(°),3 Y轴(°),4压力(kN),5沉降(mm),6.立杆轴力7.水平位移8.模板沉降9.立杆倾斜10.地基沉降", width = 15)
|
||||
@ApiModelProperty(value = "类型 ,1电量(%),2 X轴(°),3 Y轴(°),4压力(kN),5沉降(mm),6.立杆轴力7.水平位移8.模板沉降9.立杆倾斜10.地基沉降")
|
||||
@ApiModelProperty(value = "类型:1立杆轴力2水平位移3模板沉降4立杆倾斜5地基沉降")
|
||||
private java.lang.Integer type;
|
||||
/**
|
||||
* 监测点ID
|
||||
|
||||
@ -22,7 +22,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@ApiModel(value="HighFormworkMeasureDevice实体类",description="HighFormworkMeasureDevice")
|
||||
public class HighFormworkMeasureDevice implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="id")
|
||||
@ -44,8 +44,6 @@ public class HighFormworkMeasureDevice implements Serializable {
|
||||
@Excel(name = "设备名称", width = 15)
|
||||
@ApiModelProperty(value="设备名称")
|
||||
private java.lang.String deviceName ;
|
||||
/**设备类型,1倾角,2压力,3沉降*/
|
||||
@Excel(name = "设备类型,1倾角,2压力,3沉降", width = 15)
|
||||
@ApiModelProperty(value="设备类型,1倾角,2压力,3沉降")
|
||||
@ApiModelProperty(value = "类型:1立杆轴力2水平位移3模板沉降4立杆倾斜5地基沉降")
|
||||
private java.lang.Integer deviceType ;
|
||||
}
|
||||
|
||||
@ -36,8 +36,7 @@ public class HighFormworkMeasurePointThreshold implements Serializable {
|
||||
@ApiModelProperty(value = "监测点ID")
|
||||
|
||||
private java.lang.Long measurePointId;
|
||||
@Excel(name = "类型 ,1电量(%),2 X轴(°),3 Y轴(°),4压力(kN),5沉降(mm),6.立杆轴力7.水平位移8.模板沉降9.立杆倾斜10.地基沉降", width = 15)
|
||||
@ApiModelProperty(value = "类型 ,1电量(%),2 X轴(°),3 Y轴(°),4压力(kN),5沉降(mm),6.立杆轴力7.水平位移8.模板沉降9.立杆倾斜10.地基沉降")
|
||||
@ApiModelProperty(value = "类型:1立杆轴力2水平位移3模板沉降4立杆倾斜5地基沉降")
|
||||
private java.lang.Integer type;
|
||||
/**
|
||||
* 预警值
|
||||
|
||||
@ -26,6 +26,8 @@ import org.apache.commons.lang.time.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -35,7 +37,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Log4j
|
||||
@Component
|
||||
@RestController
|
||||
@RequestMapping("xmgl/task")
|
||||
public class ProjectTask {
|
||||
@Resource
|
||||
private VerificationCodeMapper verificationCodeMapper;
|
||||
@ -146,6 +149,7 @@ public class ProjectTask {
|
||||
*/
|
||||
@SchedulerLock(name = "getMonthAttendanceStatistics", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
|
||||
@Scheduled(cron = "0 0 3 * * ?")
|
||||
@RequestMapping("getMonthAttendanceStatistics")
|
||||
public void getMonthAttendanceStatistics() {
|
||||
try {
|
||||
SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user