|
@@ -34,11 +34,13 @@ import javax.annotation.security.PermitAll;
|
|
import javax.validation.constraints.*;
|
|
import javax.validation.constraints.*;
|
|
import javax.validation.*;
|
|
import javax.validation.*;
|
|
import javax.servlet.http.*;
|
|
import javax.servlet.http.*;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.sql.SQLException;
|
|
import java.sql.SQLException;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
@@ -79,7 +81,12 @@ public class IotOpeationFillController {
|
|
List< IotDeviceRunLogDO > logDO = new ArrayList<>();
|
|
List< IotDeviceRunLogDO > logDO = new ArrayList<>();
|
|
|
|
|
|
for (IotOpeationFillSaveReqVO fill:fillList) {
|
|
for (IotOpeationFillSaveReqVO fill:fillList) {
|
|
|
|
+ IotDeviceRunLogDO logDO1 = new IotDeviceRunLogDO();
|
|
|
|
+ logDO1.setDeviceId(fill.getDeviceId());
|
|
|
|
+ List<IotDeviceRunLogDO> logList = iotOpeationFillService.getDeivceFillInfo(logDO1);
|
|
|
|
+
|
|
IotDeviceRunLogDO deviceRunLogDO = new IotDeviceRunLogDO();
|
|
IotDeviceRunLogDO deviceRunLogDO = new IotDeviceRunLogDO();
|
|
|
|
+
|
|
deviceRunLogDO.setDeviceId(fill.getDeviceId());
|
|
deviceRunLogDO.setDeviceId(fill.getDeviceId());
|
|
deviceRunLogDO.setDeviceCode(fill.getDeviceCode());
|
|
deviceRunLogDO.setDeviceCode(fill.getDeviceCode());
|
|
deviceRunLogDO.setFillContent(fill.getFillContent());
|
|
deviceRunLogDO.setFillContent(fill.getFillContent());
|
|
@@ -87,6 +94,15 @@ public class IotOpeationFillController {
|
|
deviceRunLogDO.setDeptId(fill.getDeptId());
|
|
deviceRunLogDO.setDeptId(fill.getDeptId());
|
|
deviceRunLogDO.setCreateTime(LocalDateTime.now());
|
|
deviceRunLogDO.setCreateTime(LocalDateTime.now());
|
|
deviceRunLogDO.setPointName(fill.getPointName());
|
|
deviceRunLogDO.setPointName(fill.getPointName());
|
|
|
|
+ if(logList.size()>0){
|
|
|
|
+ BigDecimal num1 = logList.get(0).getTotalRunTime();
|
|
|
|
+ BigDecimal num2 = new BigDecimal(fill.getFillContent());
|
|
|
|
+ deviceRunLogDO.setTotalRunTime(num1.add(num2));
|
|
|
|
+ }else{
|
|
|
|
+ BigDecimal num2 = new BigDecimal(fill.getFillContent());
|
|
|
|
+ deviceRunLogDO.setTotalRunTime(num2);
|
|
|
|
+ }
|
|
|
|
+
|
|
logDO.add(deviceRunLogDO);
|
|
logDO.add(deviceRunLogDO);
|
|
}
|
|
}
|
|
iotOpeationFillService.updateFill(createReqVO.get(0));
|
|
iotOpeationFillService.updateFill(createReqVO.get(0));
|
|
@@ -137,7 +153,19 @@ public class IotOpeationFillController {
|
|
@Operation(summary = "获得运行记录填报分页")
|
|
@Operation(summary = "获得运行记录填报分页")
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-opeation-fill:query')")
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-opeation-fill:query')")
|
|
public CommonResult<PageResult<IotOpeationFillOrderDO>> getIotOpeationFillPage1(@Valid IotOpeationFillPageReqVO pageReqVO) {
|
|
public CommonResult<PageResult<IotOpeationFillOrderDO>> getIotOpeationFillPage1(@Valid IotOpeationFillPageReqVO pageReqVO) {
|
|
- PageResult<IotOpeationFillOrderDO> fillList = iotOpeationFillService.fillList1(pageReqVO);
|
|
|
|
|
|
+
|
|
|
|
+ List<IotOpeationFillDO> pdList = iotOpeationFillService.pdList();
|
|
|
|
+ List<String> nameList = pdList.stream().map(o -> o.getUserName()).collect(Collectors.toList());
|
|
|
|
+ List<Integer> idList = pdList.stream().map(o -> o.getUserId()).collect(Collectors.toList());
|
|
|
|
+ PageResult<IotOpeationFillOrderDO> fillList = new PageResult<>();
|
|
|
|
+ boolean exists = pdList.stream()
|
|
|
|
+ .anyMatch(rh -> rh.getUserId()==pageReqVO.getUserId());
|
|
|
|
+ if(!exists){
|
|
|
|
+ fillList = iotOpeationFillService.fillList2(pageReqVO,idList,nameList);
|
|
|
|
+ }else{
|
|
|
|
+ fillList = iotOpeationFillService.fillList1(pageReqVO);
|
|
|
|
+ }
|
|
|
|
+
|
|
return success(BeanUtils.toBean(fillList, IotOpeationFillOrderDO.class));
|
|
return success(BeanUtils.toBean(fillList, IotOpeationFillOrderDO.class));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,6 +209,7 @@ public class IotOpeationFillController {
|
|
for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
if(log.getPointName().equals(attrsDO.getName())){
|
|
if(log.getPointName().equals(attrsDO.getName())){
|
|
attrsDO.setFillContent(log.getFillContent());
|
|
attrsDO.setFillContent(log.getFillContent());
|
|
|
|
+ attrsDO.setTotalRunTime(log.getTotalRunTime());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|