|
@@ -1,5 +1,6 @@
|
|
package cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill;
|
|
package cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill;
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
|
@@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.Iot
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillSaveReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.DeviceVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.DeviceVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDevicePageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.vo.IotDeviceRespVO;
|
|
@@ -22,10 +24,14 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModel
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotThingsModelDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotThingsModelDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO;
|
|
|
|
+
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.YfDeviceDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.yanfan.YfDeviceDO;
|
|
|
|
+
|
|
import cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant;
|
|
import cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant;
|
|
import cn.iocoder.yudao.module.pms.service.IDeviceService;
|
|
import cn.iocoder.yudao.module.pms.service.IDeviceService;
|
|
import cn.iocoder.yudao.module.pms.service.iotopeationfill.IotOpeationFillService;
|
|
import cn.iocoder.yudao.module.pms.service.iotopeationfill.IotOpeationFillService;
|
|
|
|
+
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotrhdailyreport.IotRhDailyReportService;
|
|
import cn.iocoder.yudao.module.pms.service.yanfan.YfDeviceService;
|
|
import cn.iocoder.yudao.module.pms.service.yanfan.YfDeviceService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import com.aliyun.tea.utils.StringUtils;
|
|
import com.aliyun.tea.utils.StringUtils;
|
|
@@ -79,6 +85,8 @@ public class IotOpeationFillController {
|
|
private YfDeviceService yfDeviceService;
|
|
private YfDeviceService yfDeviceService;
|
|
@Resource
|
|
@Resource
|
|
private DeptService deptService;
|
|
private DeptService deptService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IotRhDailyReportService iotRhDailyReportService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建运行记录填报")
|
|
@Operation(summary = "创建运行记录填报")
|
|
@@ -127,6 +135,11 @@ public class IotOpeationFillController {
|
|
deviceRunLogDO.setCreateTime(LocalDateTime.of(fill.getCreateTime(),localTime));
|
|
deviceRunLogDO.setCreateTime(LocalDateTime.of(fill.getCreateTime(),localTime));
|
|
deviceRunLogDO.setPointName(fill.getPointName());
|
|
deviceRunLogDO.setPointName(fill.getPointName());
|
|
deviceRunLogDO.setTotalRunTime(fill.getTotalRunTime());
|
|
deviceRunLogDO.setTotalRunTime(fill.getTotalRunTime());
|
|
|
|
+ if(fill.getIsSum()==0){
|
|
|
|
+ deviceRunLogDO.setIsSum(0);
|
|
|
|
+ }else{
|
|
|
|
+ deviceRunLogDO.setIsSum(1);
|
|
|
|
+ }
|
|
|
|
|
|
logDO.add(deviceRunLogDO);
|
|
logDO.add(deviceRunLogDO);
|
|
}
|
|
}
|
|
@@ -178,7 +191,53 @@ public class IotOpeationFillController {
|
|
iotOpeationFillService.updateFillOrder2(deviceRunLogDO);
|
|
iotOpeationFillService.updateFillOrder2(deviceRunLogDO);
|
|
}
|
|
}
|
|
|
|
|
|
- return success(iotOpeationFillService.insertLog(logDO));
|
|
|
|
|
|
+ for (IotDeviceRunLogDO log:logDO) {
|
|
|
|
+ //根据设备编码,属性名称和时间查询run_log表
|
|
|
|
+ //有数据则更新,无数据则插入
|
|
|
|
+ IotDeviceRunLogDO fillData = iotOpeationFillService.reportData(log);
|
|
|
|
+ if(fillData == null){
|
|
|
|
+ iotOpeationFillService.insertLog1(log);
|
|
|
|
+ }else{
|
|
|
|
+ if(log.getIsSum() == 0){
|
|
|
|
+ iotOpeationFillService.updateLog(log);
|
|
|
|
+ }else{
|
|
|
|
+ iotOpeationFillService.updateSumLog(log);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ IotDeviceRunLogDO runDo = logDO.get(0);
|
|
|
|
+
|
|
|
|
+ IotOpeationFillDO reportDO = new IotOpeationFillDO();
|
|
|
|
+ reportDO.setDeviceId(runDo.getDeviceId());
|
|
|
|
+ reportDO.setCreateTime(runDo.getCreateTime());
|
|
|
|
+ IotOpeationFillDO fillDO1 = iotOpeationFillService.isReport(reportDO);
|
|
|
|
+
|
|
|
|
+ //虚拟设备插入日报
|
|
|
|
+ if(fillDO1.getIsReport()==1){
|
|
|
|
+
|
|
|
|
+ IotRhDailyReportSaveReqVO saveReqVO = new IotRhDailyReportSaveReqVO();
|
|
|
|
+ Map<String, Object> stringObjectMap = BeanUtil.beanToMap(saveReqVO);
|
|
|
|
+
|
|
|
|
+ for (IotDeviceRunLogDO logDO1:logDO) {
|
|
|
|
+
|
|
|
|
+ IotDeviceRunLogDO descDO = iotOpeationFillService.getDesc(logDO1);
|
|
|
|
+
|
|
|
|
+ if(descDO!=null){
|
|
|
|
+ stringObjectMap.forEach((k,v)->{
|
|
|
|
+ if(k.equals(descDO.getPointName())){
|
|
|
|
+ stringObjectMap.put(k,logDO1.getFillContent());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ IotRhDailyReportSaveReqVO saveReqVO1 = BeanUtil.mapToBean(stringObjectMap,IotRhDailyReportSaveReqVO.class,false);
|
|
|
|
+ saveReqVO1.setDeptId(fillDO1.getDeptId());
|
|
|
|
+ saveReqVO1.setFillOrderCreateTime(fillList.get(0).getCreateTime().atStartOfDay());
|
|
|
|
+ iotRhDailyReportService.createIotRhDailyReport(saveReqVO1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return success(1);
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|
|
@@ -234,9 +293,6 @@ public class IotOpeationFillController {
|
|
*/
|
|
*/
|
|
fillList = iotOpeationFillService.fillListByUserId(pageReqVO);
|
|
fillList = iotOpeationFillService.fillListByUserId(pageReqVO);
|
|
|
|
|
|
- if (CollUtil.isEmpty(fillList)) {
|
|
|
|
- throw new ServiceException(ErrorCodeConstant.IOT_OPEATION_FILL_NOT_EXISTS1);
|
|
|
|
- }
|
|
|
|
return success(BeanUtils.toBean(fillList, IotOpeationFillDO.class));
|
|
return success(BeanUtils.toBean(fillList, IotOpeationFillDO.class));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -289,6 +345,7 @@ public class IotOpeationFillController {
|
|
*/
|
|
*/
|
|
for (IotOpeationFillOrderDO orderDO : fillList.getList()) {
|
|
for (IotOpeationFillOrderDO orderDO : fillList.getList()) {
|
|
fill.setOrderId(orderDO.getId());
|
|
fill.setOrderId(orderDO.getId());
|
|
|
|
+ fill.setDeptId(orderDO.getDeptId());
|
|
List<IotOpeationFillDO> dList = iotOpeationFillService.fillListByDeptId(fill);
|
|
List<IotOpeationFillDO> dList = iotOpeationFillService.fillListByDeptId(fill);
|
|
IotOpeationFillDO devList = iotOpeationFillService.devListByOrderId(fill);
|
|
IotOpeationFillDO devList = iotOpeationFillService.devListByOrderId(fill);
|
|
if(dList.size()>0){
|
|
if(dList.size()>0){
|
|
@@ -361,63 +418,198 @@ public class IotOpeationFillController {
|
|
@Parameter(name = "deviceCategoryName", description = "名称", required = true, example = "1024")
|
|
@Parameter(name = "deviceCategoryName", description = "名称", required = true, example = "1024")
|
|
public CommonResult<List<IotModelTemplateAttrsDO1>> getModelAttrs(@Valid IotModelTemplateAttrsRespVO vo) throws SQLException{
|
|
public CommonResult<List<IotModelTemplateAttrsDO1>> getModelAttrs(@Valid IotModelTemplateAttrsRespVO vo) throws SQLException{
|
|
|
|
|
|
|
|
+ //判断是否为虚拟设备
|
|
|
|
+ //如果是走原来逻辑
|
|
|
|
+ //不是走虚拟设备逻辑
|
|
|
|
+ IotOpeationFillDO fillDO = new IotOpeationFillDO();
|
|
|
|
+ fillDO.setDeviceId(vo.getDeviceId());
|
|
|
|
+ fillDO.setCreateTime(vo.getCreateTime().atStartOfDay());
|
|
|
|
+ IotOpeationFillDO fillDO1 = iotOpeationFillService.isReport(fillDO);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<IotModelTemplateAttrsDO1> resut = new ArrayList<>();
|
|
List<IotModelTemplateAttrsDO> list = iotOpeationFillService.getAttrsById(vo );
|
|
List<IotModelTemplateAttrsDO> list = iotOpeationFillService.getAttrsById(vo );
|
|
|
|
|
|
|
|
+ if(fillDO1.getIsReport()==1){
|
|
|
|
+
|
|
|
|
+ IotOpeationFillDO fillDO2 = iotOpeationFillService.orderDO(fillDO);
|
|
|
|
|
|
- List<YfDeviceDO> allDevice = yfDeviceService.getAllDevice();
|
|
|
|
|
|
+ List<IotOpeationFillDO> reportList = new ArrayList<>();
|
|
|
|
+ List<IotOpeationFillDO> reportList1 = new ArrayList<>();
|
|
|
|
|
|
|
|
+ if(fillDO2!=null){
|
|
|
|
+ reportList = iotOpeationFillService.reportList(fillDO2);
|
|
|
|
+ reportList1 = iotOpeationFillService.reportList1(fillDO2);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- LocalTime localTime = LocalTime.of(0,0,0);
|
|
|
|
- LocalTime localTime1 = LocalTime.of(23,59,59);
|
|
|
|
|
|
+ for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
|
|
|
|
- LocalDateTime start = LocalDateTime.of(vo.getCreateTime(),localTime);
|
|
|
|
- LocalDateTime end = LocalDateTime.of(vo.getCreateTime(),localTime1);
|
|
|
|
|
|
|
|
- Timestamp startTime = Timestamp.valueOf(start);
|
|
|
|
- Timestamp endTime = Timestamp.valueOf(end);
|
|
|
|
|
|
+ //根据日报取值设备赋值
|
|
|
|
+ if(reportList.size()>0){
|
|
|
|
|
|
|
|
+ List<IotOpeationFillDO> cxLixt = reportList.stream().filter(e->e.getOrgName().equals(attrsDO.getName())).collect(Collectors.toList());
|
|
|
|
+ //虚拟设备取值
|
|
|
|
+ List<IotOpeationFillDO> cxLixt1 = reportList1.stream().filter(e->e.getOrgName().equals(attrsDO.getName())).collect(Collectors.toList());
|
|
|
|
|
|
- List<YfDeviceDO> existList = allDevice.stream().filter(e->e.getStatus()==3).collect(Collectors.toList());
|
|
|
|
- boolean exists1 = existList.stream().anyMatch(yfDeviceDO->yfDeviceDO.getSerialNumber().equals(vo.getDeviceCode()));
|
|
|
|
|
|
+ if(cxLixt.size()>0){
|
|
|
|
+ // 使用Map按orgName分组存储累加结果
|
|
|
|
+ Map<String, String> orgNameToFillContent = new HashMap<>();
|
|
|
|
|
|
- IotDeviceRunLogDO logDO1 = new IotDeviceRunLogDO();
|
|
|
|
- logDO1.setDeviceId(vo.getDeviceId());
|
|
|
|
- LocalTime local = LocalTime.of(12, 0);
|
|
|
|
- logDO1.setCreateTime(LocalDateTime.of(vo.getCreateTime(),local));
|
|
|
|
|
|
+ for (IotOpeationFillDO reportData : cxLixt) {
|
|
|
|
+ IotDeviceRunLogDO report = new IotDeviceRunLogDO();
|
|
|
|
+ report.setDeviceId(reportData.getDeviceId());
|
|
|
|
+ report.setPointName(reportData.getOrgName());
|
|
|
|
+ report.setCreateTime(reportData.getCreateTime());
|
|
|
|
|
|
- if(exists1){
|
|
|
|
- for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
|
|
|
|
+ IotDeviceRunLogDO reportCx = iotOpeationFillService.reportData(report);
|
|
|
|
|
|
- DeviceVO dv= new DeviceVO();
|
|
|
|
- dv.setDeviceName(vo.getDeviceCode().toLowerCase());
|
|
|
|
- dv.setColName(attrsDO.getModelAttr());
|
|
|
|
- dv.setTs(startTime);
|
|
|
|
- dv.setTs1(endTime);
|
|
|
|
-
|
|
|
|
- DeviceVO deviceVO = iDeviceService.getYesInfo(dv);
|
|
|
|
-
|
|
|
|
- if(!StringUtils.isEmpty(deviceVO) && !deviceVO.getEarliestData().equals("0.0")){
|
|
|
|
- attrsDO.setFillContent(
|
|
|
|
- String.valueOf(Double.parseDouble(deviceVO.getLatestData())-Double.parseDouble(deviceVO.getEarliestData())));
|
|
|
|
- attrsDO.setTotalRunTime(BigDecimal.valueOf(Double.parseDouble(deviceVO.getLatestData())));
|
|
|
|
- /**
|
|
|
|
- * 设置为数采
|
|
|
|
- */
|
|
|
|
- attrsDO.setIsCollection(1);
|
|
|
|
- }else{
|
|
|
|
|
|
+ String currentContent = "";
|
|
|
|
+ if(reportCx==null){
|
|
|
|
+ attrsDO.setFillContent("");
|
|
|
|
+ }else{
|
|
|
|
+ currentContent = reportCx.getFillContent() != null ? reportCx.getFillContent() : "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 获取当前orgName
|
|
|
|
+ String orgName = reportData.getOrgName();
|
|
|
|
+
|
|
|
|
+ // 累加相同orgName的内容
|
|
|
|
+ if (orgNameToFillContent.containsKey(orgName)) {
|
|
|
|
+ String existingContent = orgNameToFillContent.get(orgName);
|
|
|
|
+
|
|
|
|
+ double existingValue = safeParseInt(existingContent);
|
|
|
|
+ double currentValue = safeParseInt(currentContent);
|
|
|
|
+
|
|
|
|
+ if((existingValue + currentValue)==0){
|
|
|
|
+ orgNameToFillContent.put(orgName, "");
|
|
|
|
+ }else{
|
|
|
|
+ orgNameToFillContent.put(orgName, String.valueOf(existingValue + currentValue));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ orgNameToFillContent.put(orgName, currentContent);
|
|
|
|
+ }
|
|
|
|
+ attrsDO.setFillContent(orgNameToFillContent.get(reportData.getOrgName()));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(cxLixt1.size()>0){
|
|
|
|
+ for (IotOpeationFillDO reportData : cxLixt1) {
|
|
|
|
+ IotDeviceRunLogDO report = new IotDeviceRunLogDO();
|
|
|
|
+ report.setDeviceId(reportData.getDeviceId());
|
|
|
|
+ report.setPointName(reportData.getOrgName());
|
|
|
|
+ report.setCreateTime(reportData.getCreateTime());
|
|
|
|
+ IotDeviceRunLogDO reportCx = iotOpeationFillService.reportData(report);
|
|
|
|
+
|
|
|
|
+ String currentContent = "";
|
|
|
|
+ if(reportCx!=null){
|
|
|
|
+ currentContent = reportCx.getFillContent() != null ? reportCx.getFillContent() : "";
|
|
|
|
+ attrsDO.setFillContent(currentContent);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ attrsDO.setIsCollection(0);
|
|
|
|
+ attrsDO.setIsSum(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<YfDeviceDO> allDevice = yfDeviceService.getAllDevice();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ LocalTime localTime = LocalTime.of(0,0,0);
|
|
|
|
+ LocalTime localTime1 = LocalTime.of(23,59,59);
|
|
|
|
+
|
|
|
|
+ LocalDateTime start = LocalDateTime.of(vo.getCreateTime(),localTime);
|
|
|
|
+ LocalDateTime end = LocalDateTime.of(vo.getCreateTime(),localTime1);
|
|
|
|
+
|
|
|
|
+ Timestamp startTime = Timestamp.valueOf(start);
|
|
|
|
+ Timestamp endTime = Timestamp.valueOf(end);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<YfDeviceDO> existList = allDevice.stream().filter(e->e.getStatus()==3).collect(Collectors.toList());
|
|
|
|
+ boolean exists1 = existList.stream().anyMatch(yfDeviceDO->yfDeviceDO.getSerialNumber().equals(vo.getDeviceCode()));
|
|
|
|
+
|
|
|
|
+ IotDeviceRunLogDO logDO1 = new IotDeviceRunLogDO();
|
|
|
|
+ logDO1.setDeviceId(vo.getDeviceId());
|
|
|
|
+ LocalTime local = LocalTime.of(12, 0);
|
|
|
|
+ logDO1.setCreateTime(LocalDateTime.of(vo.getCreateTime(),local));
|
|
|
|
+
|
|
|
|
+ if(exists1){
|
|
|
|
+ for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
|
|
+
|
|
|
|
+ DeviceVO dv= new DeviceVO();
|
|
|
|
+ dv.setDeviceName(vo.getDeviceCode().toLowerCase());
|
|
|
|
+ dv.setColName(attrsDO.getModelAttr());
|
|
|
|
+ dv.setTs(startTime);
|
|
|
|
+ dv.setTs1(endTime);
|
|
|
|
+
|
|
|
|
+ DeviceVO deviceVO = iDeviceService.getYesInfo(dv);
|
|
|
|
+
|
|
|
|
+ if(!StringUtils.isEmpty(deviceVO) && !deviceVO.getEarliestData().equals("0.0")){
|
|
|
|
+ attrsDO.setFillContent(
|
|
|
|
+ String.valueOf(Double.parseDouble(deviceVO.getLatestData())-Double.parseDouble(deviceVO.getEarliestData())));
|
|
|
|
+ attrsDO.setTotalRunTime(BigDecimal.valueOf(Double.parseDouble(deviceVO.getLatestData())));
|
|
|
|
+ /**
|
|
|
|
+ * 设置为数采
|
|
|
|
+ */
|
|
|
|
+ attrsDO.setIsCollection(1);
|
|
|
|
+ }else{
|
|
|
|
+ logDO1.setPointName(attrsDO.getName());
|
|
|
|
+ IotDeviceRunLogDO logInfo = iotOpeationFillService.getLogInfo(logDO1);
|
|
|
|
+ IotDeviceRunLogDO maxLog = iotOpeationFillService.getMaxFillInfo(logDO1);
|
|
|
|
+ if(!StringUtils.isEmpty(logInfo)){
|
|
|
|
+
|
|
|
|
+ attrsDO.setFillContent(logInfo.getFillContent());
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isEmpty(maxLog)){
|
|
|
|
+ attrsDO.setTotalRunTime(BigDecimal.valueOf(0));
|
|
|
|
+ }else{
|
|
|
|
+ attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 设置为非数采
|
|
|
|
+ */
|
|
|
|
+ attrsDO.setIsCollection(0);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ attrsDO.setFillContent("");
|
|
|
|
+ if(StringUtils.isEmpty(maxLog)){
|
|
|
|
+ attrsDO.setTotalRunTime(BigDecimal.valueOf(0));
|
|
|
|
+ }else{
|
|
|
|
+ attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 设置为非数采
|
|
|
|
+ */
|
|
|
|
+ attrsDO.setIsCollection(0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+
|
|
|
|
+ for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
logDO1.setPointName(attrsDO.getName());
|
|
logDO1.setPointName(attrsDO.getName());
|
|
IotDeviceRunLogDO logInfo = iotOpeationFillService.getLogInfo(logDO1);
|
|
IotDeviceRunLogDO logInfo = iotOpeationFillService.getLogInfo(logDO1);
|
|
IotDeviceRunLogDO maxLog = iotOpeationFillService.getMaxFillInfo(logDO1);
|
|
IotDeviceRunLogDO maxLog = iotOpeationFillService.getMaxFillInfo(logDO1);
|
|
if(!StringUtils.isEmpty(logInfo)){
|
|
if(!StringUtils.isEmpty(logInfo)){
|
|
|
|
|
|
attrsDO.setFillContent(logInfo.getFillContent());
|
|
attrsDO.setFillContent(logInfo.getFillContent());
|
|
|
|
+ attrsDO.setTotalRunTime(logInfo.getTotalRunTime());
|
|
|
|
|
|
- if(StringUtils.isEmpty(maxLog)){
|
|
|
|
- attrsDO.setTotalRunTime(BigDecimal.valueOf(0));
|
|
|
|
- }else{
|
|
|
|
- attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
- }
|
|
|
|
/**
|
|
/**
|
|
* 设置为非数采
|
|
* 设置为非数采
|
|
*/
|
|
*/
|
|
@@ -431,52 +623,23 @@ public class IotOpeationFillController {
|
|
}else{
|
|
}else{
|
|
attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置为非数采
|
|
* 设置为非数采
|
|
*/
|
|
*/
|
|
attrsDO.setIsCollection(0);
|
|
attrsDO.setIsCollection(0);
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
|
|
|
|
- for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
|
|
- logDO1.setPointName(attrsDO.getName());
|
|
|
|
- IotDeviceRunLogDO logInfo = iotOpeationFillService.getLogInfo(logDO1);
|
|
|
|
- IotDeviceRunLogDO maxLog = iotOpeationFillService.getMaxFillInfo(logDO1);
|
|
|
|
- if(!StringUtils.isEmpty(logInfo)){
|
|
|
|
-
|
|
|
|
- attrsDO.setFillContent(logInfo.getFillContent());
|
|
|
|
- attrsDO.setTotalRunTime(logInfo.getTotalRunTime());
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 设置为非数采
|
|
|
|
- */
|
|
|
|
- attrsDO.setIsCollection(0);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }else{
|
|
|
|
- attrsDO.setFillContent("");
|
|
|
|
- if(StringUtils.isEmpty(maxLog)){
|
|
|
|
- attrsDO.setTotalRunTime(BigDecimal.valueOf(0));
|
|
|
|
- }else{
|
|
|
|
- attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 设置为非数采
|
|
|
|
- */
|
|
|
|
- attrsDO.setIsCollection(0);
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
- List<IotModelTemplateAttrsDO1> resut = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
+ }
|
|
List<IotModelTemplateAttrsDO> sumList = list.stream().filter(e->e.getIsSum()==1).collect(Collectors.toList());
|
|
List<IotModelTemplateAttrsDO> sumList = list.stream().filter(e->e.getIsSum()==1).collect(Collectors.toList());
|
|
List<IotModelTemplateAttrsDO> nonSumList = list.stream().filter(e->e.getIsSum()==0).collect(Collectors.toList());
|
|
List<IotModelTemplateAttrsDO> nonSumList = list.stream().filter(e->e.getIsSum()==0).collect(Collectors.toList());
|
|
|
|
|
|
@@ -487,9 +650,23 @@ public class IotOpeationFillController {
|
|
|
|
|
|
resut.add(sum);
|
|
resut.add(sum);
|
|
|
|
|
|
|
|
+
|
|
return success(BeanUtils.toBean(resut,IotModelTemplateAttrsDO1.class));
|
|
return success(BeanUtils.toBean(resut,IotModelTemplateAttrsDO1.class));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 工具方法:将字符串转换为整数,空字符串视为0
|
|
|
|
+ private double safeParseInt(String str) {
|
|
|
|
+ if (str == null || str.trim().isEmpty()) {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ return Integer.parseInt(str);
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ // 如果字符串不是有效的整数格式,也返回0或根据实际需求处理
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@GetMapping("/getDeivceFillInfo")
|
|
@GetMapping("/getDeivceFillInfo")
|
|
@PermitAll
|
|
@PermitAll
|
|
@Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
@Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
@@ -512,4 +689,5 @@ public class IotOpeationFillController {
|
|
BeanUtils.toBean(list, IotOpeationFillRespVO.class));
|
|
BeanUtils.toBean(list, IotOpeationFillRespVO.class));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|