Explorar el Código

运维成本接口

lipenghui hace 1 semana
padre
commit
184df654cc
Se han modificado 11 ficheros con 286 adiciones y 88 borrados
  1. 43 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/inspect/order/IotInspectOrderController.java
  2. 3 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/inspect/order/vo/IotInspectOrderRespVO.java
  3. 2 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/maintain/vo/IotMaintainPageReqVO.java
  4. 94 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/DeptUtil.java
  5. 82 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotRepairController.java
  6. 13 87
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotReportDeviceController.java
  7. 14 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/vo/ReportCost.java
  8. 4 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/maintain/IotMaintainMapper.java
  9. 2 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainService.java
  10. 15 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainServiceImpl.java
  11. 14 0
      yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotMaintainMapper.xml

+ 43 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/inspect/order/IotInspectOrderController.java

@@ -26,6 +26,8 @@ import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderDetailService;
 import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
 import cn.iocoder.yudao.module.pms.service.inspect.IotInspectPlanService;
 import cn.iocoder.yudao.module.pms.service.inspect.IotInspectRouteService;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -69,6 +71,8 @@ public class IotInspectOrderController {
     private IotInspectOrderDetailService iotInspectOrderDetailService;
     @Autowired
     private IotInspectRouteService iotInspectRouteService;
+    @Autowired
+    private DeptApi deptApi;
 
     @PostMapping("/create")
     @Operation(summary = "创建巡检工单")
@@ -323,4 +327,43 @@ public class IotInspectOrderController {
         return success(deviceStatus);
     }
 
+
+    @GetMapping("/report/stat")
+    @Operation(summary = "获得巡检工单分页")
+    @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order:query')")
+    public CommonResult<PageResult<IotInspectOrderRespVO>> getIotInspectOrderPageReport(@Valid IotInspectOrderPageReqVO pageReqVO) {
+        PageResult<IotInspectOrderDO> pageResult = iotInspectOrderService.getIotInspectOrderPage(pageReqVO);
+        List<IotInspectOrderRespVO> collect = pageResult.getList().stream().map(e -> {
+            IotInspectOrderRespVO iotInspectOrderRespVO = new IotInspectOrderRespVO();
+            BeanUtils.copyProperties(e, iotInspectOrderRespVO);
+            List<IotInspectOrderDetailDO> details = iotInspectOrderDetailMapper.selectList("order_id", e.getId());
+            long exceptionCount = details.stream().filter(f -> Objects.nonNull(f.getIfNormal()) && !f.getIfNormal()).map(IotInspectOrderDetailDO::getDeviceId).distinct().count();
+            iotInspectOrderRespVO.setExceptionCount(exceptionCount);
+            //设置组织
+            DeptRespDTO dept = deptApi.getDept(e.getDeptId());
+            if (Objects.nonNull(dept)) {
+                if ("1".equals(dept.getType())) {
+                    iotInspectOrderRespVO.setCompany(dept.getName());
+                } else if ("2".equals(dept.getType())) {
+                    iotInspectOrderRespVO.setProject(dept.getName());
+                    DeptRespDTO dept1 = deptApi.getDept(dept.getParentId());
+                    if (Objects.nonNull(dept1)) {
+                        iotInspectOrderRespVO.setCompany(dept1.getName());
+                    }
+                } else if ("3".equals(dept.getName())) {
+                    iotInspectOrderRespVO.setDeptName(dept.getName());
+                    DeptRespDTO dept1 = deptApi.getDept(dept.getParentId());
+                    if (Objects.nonNull(dept1)) {
+                        iotInspectOrderRespVO.setProject(dept1.getName());
+                        DeptRespDTO dept2 = deptApi.getDept(dept1.getParentId());
+                        if (Objects.nonNull(dept2)) {
+                            iotInspectOrderRespVO.setCompany(dept2.getName());
+                        }
+                    }
+                }
+            }
+            return iotInspectOrderRespVO;
+        }).collect(Collectors.toList());
+        return success(new PageResult<>(collect, pageResult.getTotal()));
+    }
 }

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/inspect/order/vo/IotInspectOrderRespVO.java

@@ -57,5 +57,8 @@ public class IotInspectOrderRespVO {
 
     private List<IotInspectOrderController.OrderDetail> details;
 
+    private String company;
+    private String project;
+    private String deptName;
     private String reason;
 }

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/maintain/vo/IotMaintainPageReqVO.java

@@ -7,6 +7,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.Set;
 
 import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 
@@ -89,4 +90,5 @@ public class IotMaintainPageReqVO extends PageParam {
      * 委外附件
      */
     private String outFile;
+    private Set<Long> deptIds;
 }

+ 94 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/DeptUtil.java

@@ -0,0 +1,94 @@
+package cn.iocoder.yudao.module.pms.controller.admin.stat;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@Component
+public class DeptUtil {
+    @Resource
+    private DeptApi deptApi;
+    @Resource
+    private DeptService deptService;
+
+    public String getCompanyCode(Long deptId) {
+        DeptRespDTO dept = deptApi.getDeptNoPermission(deptId);
+        String name = dept.getName();
+        String companyCode = "";
+        if (name.contains("瑞恒")) {
+            companyCode = "rh";
+        } else if (name.contains("瑞都")) {
+            companyCode = "rd";
+        } else if (name.contains("瑞鹰")) {
+            companyCode = "ry";
+        } else if (name.contains("科瑞石油技术")) {
+            companyCode = "jt";
+        } else {
+            Long parentId = dept.getParentId();
+            DeptRespDTO dept1 = deptApi.getDeptNoPermission(parentId);
+            String name1 = dept1.getName();
+            if (name1.contains("瑞恒")) {
+                companyCode = "rh";
+            } else if (name1.contains("瑞都")) {
+                companyCode = "rd";
+            } else if (name1.contains("瑞鹰")) {
+                companyCode = "ry";
+            } else if (name1.contains("科瑞石油技术")) {
+                companyCode = "jt";
+            } else {
+                DeptRespDTO dept2 = deptApi.getDeptNoPermission(dept1.getParentId());
+                String name2 = dept2.getName();
+                if (name2.contains("瑞恒")) {
+                    companyCode = "rh";
+                } else if (name2.contains("瑞都")) {
+                    companyCode = "rd";
+                } else if (name2.contains("瑞鹰")) {
+                    companyCode = "ry";
+                } else {
+                    DeptRespDTO dept3= deptApi.getDeptNoPermission(dept2.getParentId());
+                    String name3 = dept3.getName();
+                    if (name3.contains("瑞恒")) {
+                        companyCode = "rh";
+                    } else if (name3.contains("瑞都")) {
+                        companyCode = "rd";
+                    } else if (name3.contains("瑞鹰")) {
+                        companyCode = "ry";
+                    }
+                }
+            }
+        }
+        return companyCode;
+    }
+
+    public Set<Long> getDeptIds(String dept) {
+        Set<Long> ids = new HashSet<>();
+        List<DeptRespDTO> depts = new ArrayList<>();
+        if ("rd".equals(dept)) {
+            depts = deptApi.getDeptByName("四川瑞都");
+        } else if ("rh".equals(dept)) {
+            depts = deptApi.getDeptByName("瑞恒兴域");
+        } else if ("ry".equals(dept)) {
+            depts = deptApi.getDeptByName("瑞鹰国际");
+        } else if ("jt".equals(dept)) {
+            depts = deptApi.getDeptByName("科瑞石油技术");
+        } else {
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            DeptRespDTO dto = deptApi.getDept(loginUserDeptId);
+            depts = deptApi.getDeptByName(dto.getName());
+        }
+        if (CollUtil.isNotEmpty(depts)) {
+            Long deptId = depts.get(0).getId();
+            if (Objects.nonNull(depts.get(0).getId())) {
+                ids = deptService.getChildDeptIdListFromCache(depts.get(0).getId());
+                ids.add(deptId);
+            }
+        }
+        return  ids;
+    }
+}

+ 82 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotRepairController.java

@@ -0,0 +1,82 @@
+package cn.iocoder.yudao.module.pms.controller.admin.stat;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
+import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
+import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.ReportCost;
+import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.maintain.IotMaintainMapper;
+import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainService;
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
+import com.google.common.collect.ImmutableMap;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.security.PermitAll;
+import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.Objects;
+import java.util.Set;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "报表维修接口")
+@RestController
+@RequestMapping("/rq/report/repair")
+@Validated
+@PermitAll
+@AllArgsConstructor
+public class IotRepairController {
+
+    private final IotMaintainMapper iotMaintainMapper;
+    private final DeptUtil deptUtil;
+    private final DeptService deptService;
+    private final IotMaintainService iotMaintainService;
+
+    @GetMapping("/fee")
+    public CommonResult<ImmutableMap<String, BigDecimal>> getRepairFee(@Valid IotMaintainPageReqVO pageReqVO) {
+        Set<Long> ids;
+        if (Objects.isNull(pageReqVO.getDeptId())){
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            String companyCode = deptUtil.getCompanyCode(loginUserDeptId);
+            ids = deptUtil.getDeptIds(companyCode);
+        } else {
+            ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
+            ids.add(pageReqVO.getDeptId());
+        }
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        PageResult<IotMaintainDO> iotMaintainDOPageResult = iotMaintainMapper.selectPage(pageReqVO, ids);
+        BigDecimal totalFee = iotMaintainDOPageResult.getList().stream()
+                .map(IotMaintainDO::getMaintainFee)
+                .map(fee -> Objects.isNull(fee) ? BigDecimal.ZERO : fee)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal outFee = iotMaintainDOPageResult.getList().stream().filter(e -> "out".equals(e.getType()))
+                .map(IotMaintainDO::getMaintainFee)
+                .map(fee -> Objects.isNull(fee) ? BigDecimal.ZERO : fee)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        return CommonResult.success(ImmutableMap.of("repair", totalFee, "out", outFee));
+    }
+
+
+    @GetMapping("/page")
+    public CommonResult<PageResult<ReportCost>> getOrderFeePage(@Valid IotMaintainPageReqVO pageReqVO) {
+        Set<Long> ids;
+        if (Objects.isNull(pageReqVO.getDeptId())){
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            String companyCode = deptUtil.getCompanyCode(loginUserDeptId);
+            ids = deptUtil.getDeptIds(companyCode);
+        } else {
+            ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
+            ids.add(pageReqVO.getDeptId());
+        }
+        pageReqVO.setDeptIds(ids);
+        PageResult<ReportCost> page = iotMaintainService.getReportCost(pageReqVO);
+        return success(page);
+    }
+}

+ 13 - 87
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotReportDeviceController.java

@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
 
-@Tag(name = "报表接口")
+@Tag(name = "报表设备接口")
 @RestController
 @RequestMapping("/rq/report")
 @Validated
@@ -58,6 +58,7 @@ public class IotReportDeviceController {
     private final DeptApi deptApi;
     private final IotDeviceMapper iotDeviceMapper;
     private final IotProductClassifyMapper iotProductClassifyMapper;
+    private final DeptUtil deptUtil;
     @Autowired
     private DeptService deptService;
     @Autowired
@@ -65,10 +66,11 @@ public class IotReportDeviceController {
     @Resource
     private SupplierService supplierService;
 
-    public IotReportDeviceController(DeptApi deptApi, IotDeviceMapper iotDeviceMapper, IotProductClassifyMapper iotProductClassifyMapper) {
+    public IotReportDeviceController(DeptApi deptApi, IotDeviceMapper iotDeviceMapper, IotProductClassifyMapper iotProductClassifyMapper, DeptUtil deptUtil) {
         this.deptApi = deptApi;
         this.iotDeviceMapper = iotDeviceMapper;
         this.iotProductClassifyMapper = iotProductClassifyMapper;
+        this.deptUtil = deptUtil;
     }
 
     @Operation(summary = "类别统计")
@@ -78,10 +80,10 @@ public class IotReportDeviceController {
         String companyCode;
         if (Objects.isNull(iotDevicePageReqVO.getDeptId())){
             Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
-            companyCode = getCompanyCode(loginUserDeptId);
-            ids = getDeptIds(companyCode);
+            companyCode = deptUtil.getCompanyCode(loginUserDeptId);
+            ids = deptUtil.getDeptIds(companyCode);
         } else {
-            companyCode = getCompanyCode(iotDevicePageReqVO.getDeptId());
+            companyCode = deptUtil.getCompanyCode(iotDevicePageReqVO.getDeptId());
             ids = deptService.getChildDeptIdListFromCache(iotDevicePageReqVO.getDeptId());
             ids.add(iotDevicePageReqVO.getDeptId());
         }
@@ -132,8 +134,8 @@ public class IotReportDeviceController {
         Set<Long> ids;
         if (Objects.isNull(iotDevicePageReqVO.getDeptId())){
             Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
-            String companyCode = getCompanyCode(loginUserDeptId);
-            ids = getDeptIds(companyCode);
+            String companyCode = deptUtil.getCompanyCode(loginUserDeptId);
+            ids = deptUtil.getDeptIds(companyCode);
         } else {
             ids = deptService.getChildDeptIdListFromCache(iotDevicePageReqVO.getDeptId());
             ids.add(iotDevicePageReqVO.getDeptId());
@@ -149,8 +151,8 @@ public class IotReportDeviceController {
         Set<Long> ids;
         if (Objects.isNull(iotDevicePageReqVO.getDeptId())){
             Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
-            String companyCode = getCompanyCode(loginUserDeptId);
-            ids = getDeptIds(companyCode);
+            String companyCode = deptUtil.getCompanyCode(loginUserDeptId);
+            ids = deptUtil.getDeptIds(companyCode);
         } else {
             ids = deptService.getChildDeptIdListFromCache(iotDevicePageReqVO.getDeptId());
             ids.add(iotDevicePageReqVO.getDeptId());
@@ -179,8 +181,8 @@ public class IotReportDeviceController {
         Set<Long> ids;
         if (Objects.isNull(pageReqVO.getDeptId())){
             Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
-            String companyCode = getCompanyCode(loginUserDeptId);
-            ids = getDeptIds(companyCode);
+            String companyCode = deptUtil.getCompanyCode(loginUserDeptId);
+            ids = deptUtil.getDeptIds(companyCode);
         } else {
             ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
             ids.add(pageReqVO.getDeptId());
@@ -227,80 +229,4 @@ public class IotReportDeviceController {
         return success(new PageResult<>(iotDeviceRespVOS, pageResult.getTotal()));
     }
 
-
-
-    private String getCompanyCode(Long deptId) {
-        DeptRespDTO dept = deptApi.getDeptNoPermission(deptId);
-        String name = dept.getName();
-        String companyCode = "";
-        if (name.contains("瑞恒")) {
-            companyCode = "rh";
-        } else if (name.contains("瑞都")) {
-            companyCode = "rd";
-        } else if (name.contains("瑞鹰")) {
-            companyCode = "ry";
-        } else if (name.contains("科瑞石油技术")) {
-            companyCode = "jt";
-        } else {
-            Long parentId = dept.getParentId();
-            DeptRespDTO dept1 = deptApi.getDeptNoPermission(parentId);
-            String name1 = dept1.getName();
-            if (name1.contains("瑞恒")) {
-                companyCode = "rh";
-            } else if (name1.contains("瑞都")) {
-                companyCode = "rd";
-            } else if (name1.contains("瑞鹰")) {
-                companyCode = "ry";
-            } else if (name1.contains("科瑞石油技术")) {
-                companyCode = "jt";
-            } else {
-                DeptRespDTO dept2 = deptApi.getDeptNoPermission(dept1.getParentId());
-                String name2 = dept2.getName();
-                if (name2.contains("瑞恒")) {
-                    companyCode = "rh";
-                } else if (name2.contains("瑞都")) {
-                    companyCode = "rd";
-                } else if (name2.contains("瑞鹰")) {
-                    companyCode = "ry";
-                } else {
-                    DeptRespDTO dept3= deptApi.getDeptNoPermission(dept2.getParentId());
-                    String name3 = dept3.getName();
-                    if (name3.contains("瑞恒")) {
-                        companyCode = "rh";
-                    } else if (name3.contains("瑞都")) {
-                        companyCode = "rd";
-                    } else if (name3.contains("瑞鹰")) {
-                        companyCode = "ry";
-                    }
-                }
-            }
-        }
-        return companyCode;
-    }
-
-    public Set<Long> getDeptIds(String dept) {
-        Set<Long> ids = new HashSet<>();
-        List<DeptRespDTO> depts = new ArrayList<>();
-        if ("rd".equals(dept)) {
-            depts = deptApi.getDeptByName("四川瑞都");
-        } else if ("rh".equals(dept)) {
-            depts = deptApi.getDeptByName("瑞恒兴域");
-        } else if ("ry".equals(dept)) {
-            depts = deptApi.getDeptByName("瑞鹰国际");
-        } else if ("jt".equals(dept)) {
-            depts = deptApi.getDeptByName("科瑞石油技术");
-        } else {
-            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
-            DeptRespDTO dto = deptApi.getDept(loginUserDeptId);
-            depts = deptApi.getDeptByName(dto.getName());
-        }
-        if (CollUtil.isNotEmpty(depts)) {
-            Long deptId = depts.get(0).getId();
-            if (Objects.nonNull(depts.get(0).getId())) {
-                ids = deptService.getChildDeptIdListFromCache(depts.get(0).getId());
-                ids.add(deptId);
-            }
-        }
-        return  ids;
-    }
 }

+ 14 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/vo/ReportCost.java

@@ -0,0 +1,14 @@
+package cn.iocoder.yudao.module.pms.controller.admin.stat.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ReportCost {
+    private String date;
+    private String type;
+    private String deviceCode;
+    private String deviceName;
+    private BigDecimal cost;
+}

+ 4 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/maintain/IotMaintainMapper.java

@@ -3,10 +3,13 @@ package cn.iocoder.yudao.module.pms.dal.mysql.maintain;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.pms.controller.admin.inspect.item.vo.IotInspectItemPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.iotmainworkorder.vo.IotMainWorkOrderPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
+import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.ReportCost;
 import cn.iocoder.yudao.module.pms.dal.dataobject.failure.IotFailureReportDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectItemDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorder.IotMainWorkOrderDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.material.IotMaintainMaterialDO;
@@ -27,7 +30,7 @@ import java.util.Set;
  */
 @Mapper
 public interface IotMaintainMapper extends BaseMapperX<IotMaintainDO> {
-
+    IPage<ReportCost> getCost(IPage<IotMaintainPageReqVO> page, @Param("reqVO")  IotMaintainPageReqVO reqVO);
     default PageResult<IotMaintainDO> selectPage(IotMaintainPageReqVO reqVO, Collection<Long> ids) {
         return selectPage(reqVO, new LambdaQueryWrapperX<IotMaintainDO>()
                 .likeIfPresent(IotMaintainDO::getFailureCode, reqVO.getFailureCode())

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainService.java

@@ -13,6 +13,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainSaveVO;
 import cn.iocoder.yudao.module.pms.controller.admin.stat.IotStaticController;
 import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
+import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.ReportCost;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.material.IotMaintainMaterialDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.oa.IotOaPersonDO;
@@ -24,6 +25,7 @@ import cn.iocoder.yudao.module.pms.oa.CallBackOaVo;
  * @author phli
  */
 public interface IotMaintainService {
+    PageResult<ReportCost> getReportCost(IotMaintainPageReqVO reqVO);
     void methodDeal(IotMaintainController.MaintainMethod method);
     void oaDeal(CallBackOaVo callBackOaVo);
     List<IotOaPersonDO> getMaintainPerson(String id);

+ 15 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainServiceImpl.java

@@ -11,16 +11,19 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
 import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
 import cn.iocoder.yudao.module.pms.controller.admin.failure.vo.IotFailureReportProcessVO;
+import cn.iocoder.yudao.module.pms.controller.admin.inspect.item.vo.IotInspectItemPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.IotMaintainController;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.bom.vo.IotMaintainBomSaveReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainSaveReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainSaveVO;
 import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
+import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.ReportCost;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotProductClassifyDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.failure.IotFailureReportDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.information.IotInformationDbDO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectItemDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotlockstock.IotLockStockDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.iotoutbound.IotOutboundDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.maintain.IotMaintainBomDO;
@@ -641,4 +644,16 @@ public class IotMaintainServiceImpl implements IotMaintainService {
         List<IotOaPersonDO> result = companyUsers.stream().filter(e -> "0".equals(e.getStatus()) || "1".equals(e.getStatus()) || "2".equals(e.getStatus()) || "3".equals(e.getStatus())).collect(Collectors.toList());
         return result;
     }
+
+
+    @Override
+    public PageResult<ReportCost> getReportCost(IotMaintainPageReqVO pageReqVO) {
+        IPage<ReportCost> page = iotMaintainMapper.getCost(
+                new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO);
+        if (CollUtil.isNotEmpty(page.getRecords())) {
+            return new PageResult<>(page.getRecords(), page.getTotal());
+        }
+
+        return new PageResult<>(page.getRecords(), page.getTotal());
+    }
 }

+ 14 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotMaintainMapper.xml

@@ -51,4 +51,18 @@
             </if>
         </where>
     </select>
+
+
+    <select id="getCost" parameterType="cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO"
+            resultType="cn.iocoder.yudao.module.pms.controller.admin.stat.vo.ReportCost">
+        select CAST(create_time AS CHAR) as date, '维修'as type, device_code as deviceCode, device_name as deviceName, maintain_fee as cost from rq_iot_maintain a
+        <where>
+            <if test="reqVO.createTime[0] != null">
+                AND a.create_time &gt;= #{reqVO.createTime[0]}
+            </if>
+            <if test="reqVO.createTime.length > 1 and reqVO.createTime[1] != null">
+                AND a.create_time &lt;= #{reqVO.createTime[1]}
+            </if>
+        </where>
+    </select>
 </mapper>