|
@@ -1,13 +1,17 @@
|
|
|
package cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill;
|
|
|
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmodel.vo.IotModelPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.IotModelTemplateAttrsRespVO;
|
|
|
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.IotOpeationFillSaveReqVO;
|
|
|
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.dal.dataobject.IotDeviceDO;
|
|
|
+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.iotmodeltemplateattrs.IotModelTemplateAttrsDO;
|
|
|
+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.service.iotopeationfill.IotOpeationFillService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -18,10 +22,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
|
+import javax.annotation.security.PermitAll;
|
|
|
import javax.validation.constraints.*;
|
|
|
import javax.validation.*;
|
|
|
import javax.servlet.http.*;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
|
|
@@ -53,6 +59,27 @@ public class IotOpeationFillController {
|
|
|
return success(iotOpeationFillService.createIotOpeationFill(createReqVO));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/insertLog")
|
|
|
+ @Operation(summary = "创建运行记录填写信息")
|
|
|
+ public CommonResult<Integer> insertLog(@Valid @RequestBody List<IotOpeationFillSaveReqVO>createReqVO) {
|
|
|
+ List<IotOpeationFillSaveReqVO> fillList = createReqVO;
|
|
|
+ List< IotDeviceRunLogDO > logDO = new ArrayList<>();
|
|
|
+
|
|
|
+ for (IotOpeationFillSaveReqVO fill:fillList) {
|
|
|
+ IotDeviceRunLogDO deviceRunLogDO = new IotDeviceRunLogDO();
|
|
|
+ deviceRunLogDO.setDeviceId(fill.getDeviceId());
|
|
|
+ deviceRunLogDO.setDeviceCode(fill.getDeviceCode());
|
|
|
+ deviceRunLogDO.setFillContent(fill.getFillContent());
|
|
|
+ deviceRunLogDO.setPointCode(fill.getModelAttr());
|
|
|
+ deviceRunLogDO.setDeptId(fill.getDeptId());
|
|
|
+ deviceRunLogDO.setCreateTime(LocalDateTime.now());
|
|
|
+ deviceRunLogDO.setPointName(fill.getPointName());
|
|
|
+ logDO.add(deviceRunLogDO);
|
|
|
+ }
|
|
|
+ iotOpeationFillService.updateFill(createReqVO.get(0));
|
|
|
+ return success(iotOpeationFillService.insertLog(logDO));
|
|
|
+ }
|
|
|
+
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新运行记录填报")
|
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-opeation-fill:update')")
|
|
@@ -82,9 +109,47 @@ public class IotOpeationFillController {
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得运行记录填报分页")
|
|
|
@PreAuthorize("@ss.hasPermission('rq:iot-opeation-fill:query')")
|
|
|
- public CommonResult<List<IotDeviceRespVO>> getIotOpeationFillPage(@Valid IotDevicePageReqVO pageReqVO) {
|
|
|
- List<IotDeviceDO> pageResult = iotOpeationFillService.getFillDevices(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, IotDeviceRespVO.class));
|
|
|
+ public CommonResult<List<IotOpeationFillDO>> getIotOpeationFillPage(@Valid IotOpeationFillPageReqVO pageReqVO) {
|
|
|
+ List<IotOpeationFillDO> fillList = iotOpeationFillService.fillList(pageReqVO);
|
|
|
+ List<IotOpeationFillDO> pageResult = iotOpeationFillService.getFillDevices(pageReqVO);
|
|
|
+ if(fillList.size()==0){
|
|
|
+ for (IotOpeationFillDO re:pageResult) {
|
|
|
+ re.setDeviceId(re.getId());
|
|
|
+ }
|
|
|
+ iotOpeationFillService.insertFill(pageResult);
|
|
|
+ }
|
|
|
+ fillList = iotOpeationFillService.fillList(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(fillList, IotOpeationFillDO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getAttrs")
|
|
|
+ @PermitAll
|
|
|
+ @Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
|
+ @Parameter(name = "deviceCategoryName", description = "名称", required = true, example = "1024")
|
|
|
+ public CommonResult<List<IotModelTemplateAttrsDO>> getModelAttrs(@Valid IotModelTemplateAttrsRespVO vo) {
|
|
|
+ List<IotModelTemplateAttrsDO> list = iotOpeationFillService.getAttrsById(vo );
|
|
|
+ IotDeviceRunLogDO logDO1 = new IotDeviceRunLogDO();
|
|
|
+ logDO1.setDeviceId(vo.getDeviceId());
|
|
|
+ List<IotDeviceRunLogDO> logList = iotOpeationFillService.getDeivceFillInfo(logDO1);
|
|
|
+ if(logList.size()>0){
|
|
|
+ for (IotDeviceRunLogDO log:logList) {
|
|
|
+ for (IotModelTemplateAttrsDO attrsDO:list) {
|
|
|
+ if(log.getPointName().equals(attrsDO.getName())){
|
|
|
+ attrsDO.setFillContent(log.getFillContent());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success(BeanUtils.toBean(list,IotModelTemplateAttrsDO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getDeivceFillInfo")
|
|
|
+ @PermitAll
|
|
|
+ @Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
|
+ @Parameter(name = "deviceCategoryName", description = "名称", required = true, example = "1024")
|
|
|
+ public CommonResult<List<IotDeviceRunLogDO>> getDeivceFillInfo(@Valid IotDeviceRunLogDO vo) {
|
|
|
+ List<IotDeviceRunLogDO> list = iotOpeationFillService.getDeivceFillInfo(vo);
|
|
|
+ return success(BeanUtils.toBean(list,IotDeviceRunLogDO.class));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|