|
@@ -17,6 +17,7 @@ import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
|
|
+import com.sckw.excel.utils.DateUtil;
|
|
|
import com.sckw.slope.detection.dao.mysql.*;
|
|
import com.sckw.slope.detection.dao.mysql.*;
|
|
|
import com.sckw.slope.detection.dao.tdengine.InsTablesMapper;
|
|
import com.sckw.slope.detection.dao.tdengine.InsTablesMapper;
|
|
|
import com.sckw.slope.detection.dao.tdengine.SlopeDataMapper;
|
|
import com.sckw.slope.detection.dao.tdengine.SlopeDataMapper;
|
|
@@ -26,10 +27,7 @@ import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
|
|
|
import com.sckw.slope.detection.model.dto.*;
|
|
import com.sckw.slope.detection.model.dto.*;
|
|
|
import com.sckw.slope.detection.model.param.DeviceAdd;
|
|
import com.sckw.slope.detection.model.param.DeviceAdd;
|
|
|
import com.sckw.slope.detection.model.param.DeviceQuery;
|
|
import com.sckw.slope.detection.model.param.DeviceQuery;
|
|
|
-import com.sckw.slope.detection.model.vo.DeviceOutputValueVO;
|
|
|
|
|
-import com.sckw.slope.detection.model.vo.DevicePartModelVo;
|
|
|
|
|
-import com.sckw.slope.detection.model.vo.DeviceVo;
|
|
|
|
|
-import com.sckw.slope.detection.model.vo.ProjectDeviceVO;
|
|
|
|
|
|
|
+import com.sckw.slope.detection.model.vo.*;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.http.HttpResponse;
|
|
import org.apache.http.HttpResponse;
|
|
@@ -93,6 +91,8 @@ public class DeviceService {
|
|
|
KwsDeviceReferenceMapper deviceReferenceMapper;
|
|
KwsDeviceReferenceMapper deviceReferenceMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public HttpResult dels(String ids) {
|
|
public HttpResult dels(String ids) {
|
|
|
List<Long> list = StringUtils.splitStrToList(ids, Long.class);
|
|
List<Long> list = StringUtils.splitStrToList(ids, Long.class);
|
|
@@ -210,30 +210,91 @@ public class DeviceService {
|
|
|
put("code", DictEnum.MODEL_PART.getCodeType());
|
|
put("code", DictEnum.MODEL_PART.getCodeType());
|
|
|
put("type", "1");
|
|
put("type", "1");
|
|
|
}});
|
|
}});
|
|
|
- //获取集成要素
|
|
|
|
|
- List<KwsDeviceIntegration> intergData = new ArrayList<>();
|
|
|
|
|
- intergData = deviceIntegrationMapper.selectListByParmsAndInterName(vo);
|
|
|
|
|
- if(!Objects.isNull(intergData)){
|
|
|
|
|
- vo.setIntegration(intergData);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //获取设备基准信息
|
|
|
|
|
+ HeaderData headerData = commonService.getHeaderData(response);
|
|
|
|
|
+ List<KwsDeviceReference> references = deviceReferenceMapper.selectList(new LambdaQueryWrapper<KwsDeviceReference>()
|
|
|
|
|
+ .eq(KwsDeviceReference::getDeviceId, id)
|
|
|
|
|
+ .eq(KwsDeviceReference::getMountainId, headerData.getMountainId())
|
|
|
|
|
+ .eq(KwsDeviceReference::getDelFlag, NumberConstant.ZERO)
|
|
|
|
|
+ );
|
|
|
//获取基础要数
|
|
//获取基础要数
|
|
|
List<DevicePartModelVo> partData = new ArrayList<>();
|
|
List<DevicePartModelVo> partData = new ArrayList<>();
|
|
|
partData = deviceModelPartMapper.selectByModelId(deviceModel.getId());
|
|
partData = deviceModelPartMapper.selectByModelId(deviceModel.getId());
|
|
|
if(!Objects.isNull(partData)){//首先在kws_device_model_part获取数据,然后到字典中查询
|
|
if(!Objects.isNull(partData)){//首先在kws_device_model_part获取数据,然后到字典中查询
|
|
|
-
|
|
|
|
|
for (DevicePartModelVo part : partData) {
|
|
for (DevicePartModelVo part : partData) {
|
|
|
for (SystemDict value : dictList.values()) {
|
|
for (SystemDict value : dictList.values()) {
|
|
|
if (part.getPartName().equals(value.getValue())) {
|
|
if (part.getPartName().equals(value.getValue())) {
|
|
|
part.setPartNameDesc(value.getLabel());
|
|
part.setPartNameDesc(value.getLabel());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ references.forEach(re -> {
|
|
|
|
|
+ if (part.getPartName().equals(re.getItem())) {
|
|
|
|
|
+ part.setPartBaseData(re.getOriginalValue().toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
vo.setPart(partData);
|
|
vo.setPart(partData);
|
|
|
- //vo.setIntegration(intergData);
|
|
|
|
|
}
|
|
}
|
|
|
- //获取设备基准信息
|
|
|
|
|
|
|
|
|
|
|
|
+ //获取集成要素
|
|
|
|
|
+ List<DeviceIntegrationVo> intergData = new ArrayList<>();
|
|
|
|
|
+ intergData = deviceIntegrationMapper.selectListByParmsAndInterName(vo);
|
|
|
|
|
+ if(!Objects.isNull(intergData)){
|
|
|
|
|
+ for (DeviceIntegrationVo inter : intergData) {
|
|
|
|
|
+ references.forEach(re -> {
|
|
|
|
|
+ if (inter.getIntegrationName().equals(re.getItem())) {
|
|
|
|
|
+ inter.setIntegrationBaseData(re.getOriginalValue().toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setIntegration(intergData);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //vo.setReference(references);
|
|
|
|
|
+ //获取td里面的要数数据
|
|
|
|
|
+ /*List<Map<String, DeviceOutputValueVO>> mapList = new ArrayList<>();
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(references)) {
|
|
|
|
|
+ vo.setReference(references);
|
|
|
|
|
+ references.forEach(re -> {
|
|
|
|
|
+ String snCode = device.getSnCode();
|
|
|
|
|
+ String item = re.getItem();
|
|
|
|
|
+ Date date = new Date();
|
|
|
|
|
+ BigDecimal decimal = new BigDecimal("0.00");
|
|
|
|
|
+ String dateStart = DateUtil.getLastWeekDateEndToString(6);
|
|
|
|
|
+ String dateEnd = LocalDateTime.now().toString();
|
|
|
|
|
+ List<SlopeData> selected = slopeDataMapper.selectLineList(snCode, item, dateStart,dateEnd);
|
|
|
|
|
+ List<Map<String, Object>> mapListXy = new ArrayList<>();
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(selected)) {
|
|
|
|
|
+ for (int i = 0; i < selected.size(); i++) {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ SlopeData currSlopeData = selected.get(i);
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm:ss");
|
|
|
|
|
+ String key = simpleDateFormat.format(currSlopeData.getTs());
|
|
|
|
|
+ SlopeData lastSlopeData = selected.get(i + 1);
|
|
|
|
|
+ Date localDateTime = currSlopeData.getTs();
|
|
|
|
|
+ long epochMilli1 = 0L;
|
|
|
|
|
+ String val2 = "0";
|
|
|
|
|
+ Date localDateTime1 = lastSlopeData.getTs();
|
|
|
|
|
+ if (lastSlopeData != null) {
|
|
|
|
|
+ epochMilli1 = localDateTime1.getTime();
|
|
|
|
|
+ val2 = lastSlopeData.getVal();
|
|
|
|
|
+ }
|
|
|
|
|
+ long epochMilli = localDateTime.getTime();
|
|
|
|
|
+ epochMilli1 = localDateTime1.getTime();
|
|
|
|
|
+ String val1 = currSlopeData.getVal();
|
|
|
|
|
+ long t = (epochMilli - epochMilli1) / (60 * 60 * 1000);
|
|
|
|
|
+ long val = Long.parseLong(val1) - Long.parseLong(val2);
|
|
|
|
|
+ decimal = BigDecimal.valueOf(val).divide((new BigDecimal(t).multiply(new BigDecimal(t))), 9, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ map.put(key, decimal);
|
|
|
|
|
+ mapListXy.add(map);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setMonitor(mapListXy);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
+ }*/
|
|
|
return HttpResult.ok(vo);
|
|
return HttpResult.ok(vo);
|
|
|
}
|
|
}
|
|
|
|
|
|