|
@@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodel.IotModelDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodel.IotModelDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO1;
|
|
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;
|
|
@@ -83,14 +84,41 @@ public class IotOpeationFillController {
|
|
@Operation(summary = "创建运行记录填写信息")
|
|
@Operation(summary = "创建运行记录填写信息")
|
|
public CommonResult<Integer> insertLog(@Valid @RequestBody List<IotOpeationFillSaveReqVO>createReqVO) {
|
|
public CommonResult<Integer> insertLog(@Valid @RequestBody List<IotOpeationFillSaveReqVO>createReqVO) {
|
|
List<IotOpeationFillSaveReqVO> fillList = createReqVO;
|
|
List<IotOpeationFillSaveReqVO> fillList = createReqVO;
|
|
|
|
+
|
|
|
|
+ String fillContent = null;
|
|
|
|
+ for (IotOpeationFillSaveReqVO dayilyRun:fillList) {
|
|
|
|
+ if(dayilyRun.getPointName().equals("当日运转时间")){
|
|
|
|
+ fillContent = dayilyRun.getFillContent();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (IotOpeationFillSaveReqVO totalRun:fillList) {
|
|
|
|
+ if(totalRun.getPointName().equals("累计运转时间")||totalRun.getPointName().equals("累计运行时间")){
|
|
|
|
+ double total = Double.parseDouble(fillContent);
|
|
|
|
+ totalRun.setTotalRunTime(BigDecimal.valueOf(total).add(totalRun.getTotalRunTime()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fillContent = null;
|
|
|
|
+ for (IotOpeationFillSaveReqVO dayilyGas:fillList) {
|
|
|
|
+ if(dayilyGas.getPointName().equals("当日注气量")){
|
|
|
|
+ fillContent = dayilyGas.getFillContent();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (IotOpeationFillSaveReqVO totalGas:fillList) {
|
|
|
|
+ if(totalGas.getPointName().equals("累计注气量")){
|
|
|
|
+ double total = Double.parseDouble(fillContent);
|
|
|
|
+ totalGas.setTotalRunTime(BigDecimal.valueOf(total).add(totalGas.getTotalRunTime()));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
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());
|
|
|
|
|
|
+
|
|
LocalTime localTime = LocalTime.of(0,0);
|
|
LocalTime localTime = LocalTime.of(0,0);
|
|
- logDO1.setCreateTime(LocalDateTime.of(fill.getCreateTime(),localTime));
|
|
|
|
- List<IotDeviceRunLogDO> logList = iotOpeationFillService.getDeivceFillInfo(logDO1);
|
|
|
|
|
|
|
|
IotDeviceRunLogDO deviceRunLogDO = new IotDeviceRunLogDO();
|
|
IotDeviceRunLogDO deviceRunLogDO = new IotDeviceRunLogDO();
|
|
|
|
|
|
@@ -101,23 +129,7 @@ public class IotOpeationFillController {
|
|
deviceRunLogDO.setDeptId(fill.getDeptId());
|
|
deviceRunLogDO.setDeptId(fill.getDeptId());
|
|
deviceRunLogDO.setCreateTime(LocalDateTime.of(fill.getCreateTime(),localTime));
|
|
deviceRunLogDO.setCreateTime(LocalDateTime.of(fill.getCreateTime(),localTime));
|
|
deviceRunLogDO.setPointName(fill.getPointName());
|
|
deviceRunLogDO.setPointName(fill.getPointName());
|
|
- if(logList.size()>0){
|
|
|
|
- if(createReqVO.get(0).getIsCollection()==1){
|
|
|
|
- deviceRunLogDO.setTotalRunTime(createReqVO.get(0).getTotalRunTime());
|
|
|
|
- }else{
|
|
|
|
- BigDecimal num1 = logList.get(0).getTotalRunTime();
|
|
|
|
- BigDecimal num2 = new BigDecimal(fill.getFillContent());
|
|
|
|
- deviceRunLogDO.setTotalRunTime(num1.add(num2));
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- if(createReqVO.get(0).getIsCollection()==1){
|
|
|
|
- deviceRunLogDO.setTotalRunTime(createReqVO.get(0).getTotalRunTime());
|
|
|
|
- }else{
|
|
|
|
- BigDecimal num2 = new BigDecimal(fill.getFillContent());
|
|
|
|
- deviceRunLogDO.setTotalRunTime(num2);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ deviceRunLogDO.setTotalRunTime(fill.getTotalRunTime());
|
|
|
|
|
|
logDO.add(deviceRunLogDO);
|
|
logDO.add(deviceRunLogDO);
|
|
}
|
|
}
|
|
@@ -132,6 +144,7 @@ public class IotOpeationFillController {
|
|
IotOpeationFillRespVO respVO = new IotOpeationFillRespVO();
|
|
IotOpeationFillRespVO respVO = new IotOpeationFillRespVO();
|
|
respVO.setUserId(createReqVO.get(0).getUserId());
|
|
respVO.setUserId(createReqVO.get(0).getUserId());
|
|
respVO.setCreateTime(createReqVO.get(0).getCreateTime());
|
|
respVO.setCreateTime(createReqVO.get(0).getCreateTime());
|
|
|
|
+ respVO.setOrderId(createReqVO.get(0).getId());
|
|
List<IotOpeationFillRespVO> fillList1 = iotOpeationFillService.getFillList(respVO);
|
|
List<IotOpeationFillRespVO> fillList1 = iotOpeationFillService.getFillList(respVO);
|
|
|
|
|
|
boolean result = fillList1.stream().allMatch(e->e.getIsFill()==1);
|
|
boolean result = fillList1.stream().allMatch(e->e.getIsFill()==1);
|
|
@@ -244,7 +257,7 @@ public class IotOpeationFillController {
|
|
@PermitAll
|
|
@PermitAll
|
|
@Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
@Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
@Parameter(name = "deviceCategoryName", description = "名称", required = true, example = "1024")
|
|
@Parameter(name = "deviceCategoryName", description = "名称", required = true, example = "1024")
|
|
- public CommonResult<List<IotModelTemplateAttrsDO>> getModelAttrs(@Valid IotModelTemplateAttrsRespVO vo) throws SQLException{
|
|
|
|
|
|
+ public CommonResult<List<IotModelTemplateAttrsDO1>> getModelAttrs(@Valid IotModelTemplateAttrsRespVO vo) throws SQLException{
|
|
|
|
|
|
List<IotModelTemplateAttrsDO> list = iotOpeationFillService.getAttrsById(vo );
|
|
List<IotModelTemplateAttrsDO> list = iotOpeationFillService.getAttrsById(vo );
|
|
|
|
|
|
@@ -272,9 +285,6 @@ public class IotOpeationFillController {
|
|
LocalTime local = LocalTime.of(12, 0);
|
|
LocalTime local = LocalTime.of(12, 0);
|
|
logDO1.setCreateTime(LocalDateTime.of(vo.getCreateTime(),local));
|
|
logDO1.setCreateTime(LocalDateTime.of(vo.getCreateTime(),local));
|
|
|
|
|
|
- List<IotDeviceRunLogDO> logList = iotOpeationFillService.getDeivceFillInfo(logDO1);
|
|
|
|
- List<IotDeviceRunLogDO> maxLog = iotOpeationFillService.getMaxFillInfo(logDO1);
|
|
|
|
-
|
|
|
|
if(exists){
|
|
if(exists){
|
|
for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
|
|
|
|
@@ -295,20 +305,31 @@ public class IotOpeationFillController {
|
|
*/
|
|
*/
|
|
attrsDO.setIsCollection(1);
|
|
attrsDO.setIsCollection(1);
|
|
}else{
|
|
}else{
|
|
- if(logList.size()>0){
|
|
|
|
- for (IotDeviceRunLogDO log:logList) {
|
|
|
|
- if(log.getPointName().equals(attrsDO.getName())){
|
|
|
|
- attrsDO.setFillContent(log.getFillContent());
|
|
|
|
- attrsDO.setTotalRunTime(log.getTotalRunTime());
|
|
|
|
- /**
|
|
|
|
- * 设置为非数采
|
|
|
|
- */
|
|
|
|
- attrsDO.setIsCollection(0);
|
|
|
|
- }
|
|
|
|
|
|
+ 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{
|
|
}else{
|
|
attrsDO.setFillContent("0.0");
|
|
attrsDO.setFillContent("0.0");
|
|
- attrsDO.setTotalRunTime(maxLog.get(0).getTotalRunTime());
|
|
|
|
|
|
+ if(StringUtils.isEmpty(maxLog)){
|
|
|
|
+ attrsDO.setTotalRunTime(BigDecimal.valueOf(0));
|
|
|
|
+ }else{
|
|
|
|
+ attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 设置为非数采
|
|
* 设置为非数采
|
|
*/
|
|
*/
|
|
@@ -319,23 +340,28 @@ public class IotOpeationFillController {
|
|
}else{
|
|
}else{
|
|
|
|
|
|
for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
- if(logList.size()>0){
|
|
|
|
-
|
|
|
|
- for (IotDeviceRunLogDO log:logList) {
|
|
|
|
- if(log.getPointName().equals(attrsDO.getName())){
|
|
|
|
- attrsDO.setFillContent(log.getFillContent());
|
|
|
|
- attrsDO.setTotalRunTime(log.getTotalRunTime());
|
|
|
|
- /**
|
|
|
|
- * 设置为非数采
|
|
|
|
- */
|
|
|
|
- attrsDO.setIsCollection(0);
|
|
|
|
- }
|
|
|
|
|
|
+ logDO1.setPointName(attrsDO.getName());
|
|
|
|
+ IotDeviceRunLogDO logInfo = iotOpeationFillService.getLogInfo(logDO1);
|
|
|
|
+ IotDeviceRunLogDO maxLog = iotOpeationFillService.getMaxFillInfo(logDO1);
|
|
|
|
+ if(!StringUtils.isEmpty(logInfo)){
|
|
|
|
+
|
|
|
|
+ attrsDO.setFillContent(logInfo.getFillContent());
|
|
|
|
+ attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 设置为非数采
|
|
|
|
+ */
|
|
|
|
+ attrsDO.setIsCollection(0);
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
}else{
|
|
}else{
|
|
attrsDO.setFillContent("0.0");
|
|
attrsDO.setFillContent("0.0");
|
|
- attrsDO.setTotalRunTime(maxLog.get(0).getTotalRunTime());
|
|
|
|
|
|
+ if(StringUtils.isEmpty(maxLog)){
|
|
|
|
+ attrsDO.setTotalRunTime(BigDecimal.valueOf(0));
|
|
|
|
+ }else{
|
|
|
|
+ attrsDO.setTotalRunTime(maxLog.getTotalRunTime());
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置为非数采
|
|
* 设置为非数采
|
|
*/
|
|
*/
|
|
@@ -348,7 +374,18 @@ public class IotOpeationFillController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- return success(BeanUtils.toBean(list,IotModelTemplateAttrsDO.class));
|
|
|
|
|
|
+ List<IotModelTemplateAttrsDO1> resut = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ 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());
|
|
|
|
+
|
|
|
|
+ IotModelTemplateAttrsDO1 sum = new IotModelTemplateAttrsDO1();
|
|
|
|
+ sum.setSumList(sumList);
|
|
|
|
+ sum.setNonSumList(nonSumList);
|
|
|
|
+
|
|
|
|
+ resut.add(sum);
|
|
|
|
+
|
|
|
|
+ return success(BeanUtils.toBean(resut,IotModelTemplateAttrsDO1.class));
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/getDeivceFillInfo")
|
|
@GetMapping("/getDeivceFillInfo")
|