|
|
@@ -27,9 +27,7 @@ import com.sckw.slope.detection.model.dos.mysql.*;
|
|
|
import com.sckw.slope.detection.model.dos.tdengine.InsTables;
|
|
|
import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
|
|
|
import com.sckw.slope.detection.model.dto.*;
|
|
|
-import com.sckw.slope.detection.model.param.DeviceAdd;
|
|
|
-import com.sckw.slope.detection.model.param.DeviceQuery;
|
|
|
-import com.sckw.slope.detection.model.param.DeviceReferenceAdd;
|
|
|
+import com.sckw.slope.detection.model.param.*;
|
|
|
import com.sckw.slope.detection.model.vo.*;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -182,7 +180,7 @@ public class DeviceService {
|
|
|
.last("LIMIT 1")
|
|
|
.orderByDesc(KwsDeviceReference::getId)
|
|
|
);
|
|
|
- if(!Objects.isNull(deviceHas)){
|
|
|
+ if (!Objects.isNull(deviceHas)) {
|
|
|
vo.setChangeBy(deviceHas.getCreateBy());
|
|
|
vo.setChangeTime(deviceHas.getCreateTime());
|
|
|
}
|
|
|
@@ -287,19 +285,19 @@ public class DeviceService {
|
|
|
}
|
|
|
}
|
|
|
references.forEach(re -> {
|
|
|
- if (part.getPartName().equals(re.getItem())) {
|
|
|
- SlopeData slopeData = slopeDataMapper.selectListByLine(snCode, re.getItem());//获取到当前测量值
|
|
|
- part.setPartBaseData(re.getOriginalValue().toString());
|
|
|
- part.setPartCurrentBaseData(re.getCurrentValue().toString());
|
|
|
- if(!Objects.isNull(slopeData)){
|
|
|
- part.setCurrentData(slopeData.getVal());
|
|
|
- }
|
|
|
- part.setOffset(re.getOffset().toString());
|
|
|
+ if (part.getPartName().equals(re.getItem())) {
|
|
|
+ SlopeData slopeData = slopeDataMapper.selectListByLine(snCode, re.getItem());//获取到当前测量值
|
|
|
+ part.setPartBaseData(re.getOriginalValue().toString());
|
|
|
+ part.setPartCurrentBaseData(re.getCurrentValue().toString());
|
|
|
+ if (!Objects.isNull(slopeData)) {
|
|
|
+ part.setCurrentData(slopeData.getVal());
|
|
|
}
|
|
|
+ part.setOffset(re.getOffset().toString());
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
//获取字典
|
|
|
- Map<String, SystemDict> deviceType= commonService.getDictList(null, new HashMap<>() {{
|
|
|
+ Map<String, SystemDict> deviceType = commonService.getDictList(null, new HashMap<>() {{
|
|
|
put("code", DictEnum.DEVICE_TYPE.getCodeType());
|
|
|
put("type", "1");
|
|
|
}});
|
|
|
@@ -313,7 +311,7 @@ public class DeviceService {
|
|
|
.eq(KwsProjectDevice::getDeviceId, vo.getId())
|
|
|
.eq(KwsProjectDevice::getDelFlag, NumberConstant.ZERO)
|
|
|
);
|
|
|
- if(!Objects.isNull(projectDevice)){
|
|
|
+ if (!Objects.isNull(projectDevice)) {
|
|
|
vo.setProjectId(projectDevice.getProjectId().toString());
|
|
|
}
|
|
|
vo.setPart(partData);
|
|
|
@@ -493,7 +491,7 @@ public class DeviceService {
|
|
|
put("code", DictEnum.MODEL_PART.getCodeType());
|
|
|
put("type", "1");
|
|
|
}});
|
|
|
- String itemName = dictList == null ? item : (dictList.get(item)==null?item:dictList.get(item).getLabel());
|
|
|
+ String itemName = dictList == null ? item : (dictList.get(item) == null ? item : dictList.get(item).getLabel());
|
|
|
BigDecimal originalValue = re.getOriginalValue();
|
|
|
BigDecimal currentValue = re.getCurrentValue();
|
|
|
BigDecimal offset = re.getOffset();
|
|
|
@@ -514,7 +512,7 @@ public class DeviceService {
|
|
|
try {
|
|
|
slopeData = slopeDataMapper.selectListByLine(snCode, item);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("select tdengine devices error :{}",e.getMessage(),e);
|
|
|
+ log.error("select tdengine devices error :{}", e.getMessage(), e);
|
|
|
}
|
|
|
String val = slopeData == null ? null : slopeData.getVal();
|
|
|
//存在经度纬度海拔等要素 要进行公式计算
|
|
|
@@ -534,7 +532,7 @@ public class DeviceService {
|
|
|
try {
|
|
|
selected = slopeDataMapper.selectListByLine(kwsDevice.getSnCode(), DictItemEnum.LATITUDE_Y.getValue());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("select tdengine devices error :{}",e.getMessage(),e);
|
|
|
+ log.error("select tdengine devices error :{}", e.getMessage(), e);
|
|
|
}
|
|
|
double angleInRadians = Math.toRadians(selected == null ? 0L : Double.parseDouble(selected.getVal()));
|
|
|
double cosValue = Math.cos(angleInRadians);
|
|
|
@@ -688,13 +686,13 @@ public class DeviceService {
|
|
|
//BigDecimal offset = value.subtract(reference.getValue());
|
|
|
kwsDeviceReference.setOriginalValue(reference.getOriginalValue());//原始基准不变
|
|
|
//调整经纬度
|
|
|
- if(type.equals(String.valueOf(NumberConstant.ONE))){
|
|
|
+ if (type.equals(String.valueOf(NumberConstant.ONE))) {
|
|
|
BigDecimal offset = commonService.computeOffset(value.toString(), obj.get("item").toString(), reference);
|
|
|
kwsDeviceReference.setOffset(offset);//当前位置-上一次的位置的距离的距离
|
|
|
kwsDeviceReference.setCurrentValue(value);
|
|
|
kwsDeviceReference.setValue(reference.getCurrentValue());
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
BigDecimal currentValue = commonService.getValueByOffset(value.toString(), obj.get("item").toString(), reference);
|
|
|
kwsDeviceReference.setValue(reference.getCurrentValue());
|
|
|
kwsDeviceReference.setOffset(value);
|
|
|
@@ -741,4 +739,24 @@ public class DeviceService {
|
|
|
jsonObject.put("integrationItem", integrationItem);
|
|
|
return HttpResult.ok(jsonObject);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询设备型号数据
|
|
|
+ *
|
|
|
+ * @param query
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public HttpResult findProjectAndModelAndDeviceList(ProjectAndModelAndDeviceQuery query, HttpServletRequest request) {
|
|
|
+ List<KwsDeviceModel> kwsDeviceModels = deviceModelMapper.selectList(new LambdaQueryWrapper<KwsDeviceModel>()
|
|
|
+ .eq(KwsDeviceModel::getDelFlag, NumberConstant.ZERO)
|
|
|
+ .eq(KwsDeviceModel::getStatus, NumberConstant.ZERO)
|
|
|
+ );
|
|
|
+ return HttpResult.ok(kwsDeviceModels);
|
|
|
+ }
|
|
|
+
|
|
|
+ public HttpResult findDeviceListByModelType(String modelType, HttpServletRequest request) {
|
|
|
+ List<Map<String, String>> map = deviceMapper.selectListByModelType(modelType);
|
|
|
+ return HttpResult.ok(map);
|
|
|
+ }
|
|
|
}
|