浏览代码

报表接口

lipenghui 1 周之前
父节点
当前提交
8a9a90525b

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

@@ -134,6 +134,22 @@ public class IotInspectOrderDetailController {
         ImmutableMap<String, ? extends Serializable> map2 = ImmutableMap.of("name", "异常", "value", exception);
         return success(ImmutableList.of(map,map1,map2));
     }
+
+    @GetMapping("/report/status")
+    @Operation(summary = "获得报表的异常点数量")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('rq:iot-inspect-item:query')")
+    public CommonResult<ImmutableMap<String, ? extends Serializable>> getIotInspectItemStatusReport(IotCountDataDO vo) {
+        Set<Long> ids = new HashSet<>();
+        if (Objects.nonNull(vo.getDeptId())) {
+            ids = deptService.getChildDeptIdListFromCache(vo.getDeptId());
+            ids.add(vo.getDeptId());
+        }
+        Long exceptionReport = iotInspectOrderDetailService.selectExceptionReport(vo, ids);
+        ImmutableMap<String, ? extends Serializable> map2 = ImmutableMap.of("name", "异常", "value", exceptionReport);
+        return success(map2);
+    }
+
     @GetMapping("/item")
     public CommonResult<PageResult<IotInspectOrderDetailRespVO>> getItemStatus(IotInspectOrderDetailPageReqVO pageReqVO){
 

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

@@ -1,14 +0,0 @@
-package cn.iocoder.yudao.module.pms.controller.admin.stat;
-
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@Tag(name = "报表接口")
-@RestController
-@RequestMapping("/rq/report")
-@Validated
-public class IotReportController {
-
-}

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

@@ -0,0 +1,306 @@
+package cn.iocoder.yudao.module.pms.controller.admin.stat;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+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.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.IotProductClassifyDO;
+import cn.iocoder.yudao.module.pms.dal.mysql.IotDeviceMapper;
+import cn.iocoder.yudao.module.pms.dal.mysql.IotProductClassifyMapper;
+import cn.iocoder.yudao.module.pms.service.IotProductClassifyService;
+import cn.iocoder.yudao.module.pms.util.IotDeviceConvert;
+import cn.iocoder.yudao.module.supplier.dal.dataobject.product.SupplierDO;
+import cn.iocoder.yudao.module.supplier.service.product.SupplierService;
+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.dal.dataobject.dept.DeptDO;
+import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
+import cn.iocoder.yudao.module.system.service.dept.DeptService;
+import cn.iocoder.yudao.module.system.service.dict.DictDataService;
+import com.google.common.collect.ImmutableList;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.annotation.security.PermitAll;
+import javax.validation.Valid;
+import java.util.*;
+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 = "报表接口")
+@RestController
+@RequestMapping("/rq/report")
+@Validated
+@PermitAll
+public class IotReportDeviceController {
+    private static final ImmutableList<String> jt = ImmutableList.<String>builder()
+            .add("电驱增压机", "柴驱增压机", "液驱增压机", "电驱空压机", "柴驱空压机") // 第一批5个
+            .add("提纯撬", "空气处理撬", "膜组", "注水泵", "绞车") // 第二批5个
+            .add("井架", "底座", "发动机", "泥浆泵", "连油主车") // 第三批5个
+            .build();
+    private static final ImmutableList<String> rh = ImmutableList.<String>builder()
+            .add("电驱增压机", "柴驱增压机", "液驱增压机", "电驱空压机", "柴驱空压机") // 第一批5个
+            .add("提纯撬", "空气处理撬", "膜组", "注水泵").build();
+    private static final ImmutableList<String> ry = ImmutableList.<String>builder()
+            .add("井架", "底座", "发动机", "泥浆泵","绞车").build();
+    private static final ImmutableList<String> rd = ImmutableList.<String>builder()
+            .add("连油主车","混砂车","仪表车","小车").build();
+    private final DeptApi deptApi;
+    private final IotDeviceMapper iotDeviceMapper;
+    private final IotProductClassifyMapper iotProductClassifyMapper;
+    @Autowired
+    private DeptService deptService;
+    @Autowired
+    private IotProductClassifyService iotProductClassifyService;
+    @Resource
+    private SupplierService supplierService;
+
+    public IotReportDeviceController(DeptApi deptApi, IotDeviceMapper iotDeviceMapper, IotProductClassifyMapper iotProductClassifyMapper) {
+        this.deptApi = deptApi;
+        this.iotDeviceMapper = iotDeviceMapper;
+        this.iotProductClassifyMapper = iotProductClassifyMapper;
+    }
+
+    @Operation(summary = "类别统计")
+    @GetMapping("/device/type")
+    public CommonResult<List<Map<String, Object>>> getDeviceTypeStat(@Valid IotDevicePageReqVO iotDevicePageReqVO) {
+        Set<Long> ids;
+        String companyCode;
+        if (Objects.isNull(iotDevicePageReqVO.getDeptId())){
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            companyCode = getCompanyCode(loginUserDeptId);
+            ids = getDeptIds(companyCode);
+        } else {
+            companyCode = getCompanyCode(iotDevicePageReqVO.getDeptId());
+            ids = deptService.getChildDeptIdListFromCache(iotDevicePageReqVO.getDeptId());
+            ids.add(iotDevicePageReqVO.getDeptId());
+        }
+        IotDevicePageReqVO pageReqVO = new IotDevicePageReqVO();
+        pageReqVO.setDeptIds(new ArrayList<>(ids));
+        List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList(pageReqVO);
+        LinkedList<Map<String, Object>> results = new LinkedList<>();
+        List<Map.Entry<Long, Long>> collect = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getAssetClass, Collectors.counting())).entrySet().stream().sorted(Map.Entry.<Long, Long>comparingByValue().reversed()).collect(Collectors.toList());
+        collect.forEach(e->{
+            IotProductClassifyDO iotProductClassifyDO = iotProductClassifyMapper.selectById(e.getKey());
+            if ("jt".equals(companyCode)) {
+                if (jt.contains(iotProductClassifyDO.getName())){
+                    Map<String, Object> map = new HashMap<>(4);
+                    map.put("category", iotProductClassifyDO.getName());
+                    map.put("value", e.getValue());
+                    results.add(map);
+                }
+            } else if ("rh".equals(companyCode)) {
+                if (rh.contains(iotProductClassifyDO.getName())){
+                    Map<String, Object> map = new HashMap<>(4);
+                    map.put("category", iotProductClassifyDO.getName());
+                    map.put("value", e.getValue());
+                    results.add(map);
+                }
+            } else if ("ry".equals(companyCode)) {
+                if (ry.contains(iotProductClassifyDO.getName())){
+                    Map<String, Object> map = new HashMap<>(4);
+                    map.put("category", iotProductClassifyDO.getName());
+                    map.put("value", e.getValue());
+                    results.add(map);
+                }
+            } else if ("rd".equals(companyCode)) {
+                if (rd.contains(iotProductClassifyDO.getName())||iotProductClassifyDO.getName().contains("压裂泵车")){
+                    Map<String, Object> map = new HashMap<>(4);
+                    map.put("category", iotProductClassifyDO.getName());
+                    map.put("value", e.getValue());
+                    results.add(map);
+                }
+            }
+        });
+        return CommonResult.success(results);
+    }
+
+
+    @Operation(summary = "获取设备数量")
+    @GetMapping("/device/count")
+    public CommonResult<Long> getDeviceCount(@Valid IotDevicePageReqVO iotDevicePageReqVO) {
+        Set<Long> ids;
+        if (Objects.isNull(iotDevicePageReqVO.getDeptId())){
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            String companyCode = getCompanyCode(loginUserDeptId);
+            ids = getDeptIds(companyCode);
+        } else {
+            ids = deptService.getChildDeptIdListFromCache(iotDevicePageReqVO.getDeptId());
+            ids.add(iotDevicePageReqVO.getDeptId());
+        }
+        Long l = iotDeviceMapper.selectCountByParam(ids,iotDevicePageReqVO);
+        return CommonResult.success(l);
+    }
+
+    @Resource
+    private DictDataService dictDataService;
+    @GetMapping("/device/status")
+    public CommonResult<List<Map<String, Object>>> getDeviceStatusStat(@Valid IotDevicePageReqVO iotDevicePageReqVO) {
+        Set<Long> ids;
+        if (Objects.isNull(iotDevicePageReqVO.getDeptId())){
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            String companyCode = getCompanyCode(loginUserDeptId);
+            ids = getDeptIds(companyCode);
+        } else {
+            ids = deptService.getChildDeptIdListFromCache(iotDevicePageReqVO.getDeptId());
+            ids.add(iotDevicePageReqVO.getDeptId());
+        }
+        IotDevicePageReqVO pageReqVO = new IotDevicePageReqVO();
+        pageReqVO.setDeptIds(new ArrayList<>(ids));
+        List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectList(pageReqVO);
+        Map<String, Long> order = iotDeviceDOS.stream().collect(Collectors.groupingBy(IotDeviceDO::getDeviceStatus, Collectors.counting()));
+        List<Map<String, Object>> results = new ArrayList<>();
+        List<DictDataDO> pmsDeviceStatus = dictDataService.getDictDataListByDictType("pms_device_status");
+        order.forEach((k,v)->{
+            pmsDeviceStatus.stream().filter(e -> e.getValue().equals(k)).findFirst().ifPresent(e -> {
+                Map<String, Object> resultMap = new HashMap<>();
+                resultMap.put("name", e.getLabel());
+                resultMap.put("value", v);
+                results.add(resultMap);
+            });
+        });
+        return CommonResult.success(results);
+    }
+
+    @GetMapping("/device/page")
+    @Operation(summary = "获得设备报表分页")
+    @PreAuthorize("@ss.hasPermission('rq:iot-device:query')")
+    public CommonResult<PageResult<IotDeviceRespVO>> getIotDevicePage(@Valid IotDevicePageReqVO pageReqVO) {
+        Set<Long> ids;
+        if (Objects.isNull(pageReqVO.getDeptId())){
+            Long loginUserDeptId = SecurityFrameworkUtils.getLoginUserDeptId();
+            String companyCode = getCompanyCode(loginUserDeptId);
+            ids = getDeptIds(companyCode);
+        } else {
+            ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
+            ids.add(pageReqVO.getDeptId());
+        }
+        PageResult<IotDeviceDO> pageResult = iotDeviceMapper.selectPageReport(pageReqVO, ids);
+        if (CollUtil.isEmpty(pageResult.getList())) {
+            return success(new PageResult<>(pageResult.getTotal()));
+        }
+        Map<Long, DeptDO> deptMap = deptService.getDeptMap(
+                convertList(pageResult.getList(), IotDeviceDO::getDeptId));
+        List<IotDeviceRespVO> iotDeviceRespVOS = IotDeviceConvert.INSTANCE.convertList(pageResult.getList(), deptMap);
+        iotDeviceRespVOS.forEach(e ->{
+            if (Objects.nonNull(e.getAssetClass())) {
+                IotProductClassifyDO iotProductClassify = iotProductClassifyService.getIotProductClassify(e.getAssetClass());
+                e.setAssetClassName(Objects.nonNull(iotProductClassify)?iotProductClassify.getName():"");
+            }
+            SupplierDO supplierDO = supplierService.get(e.getManufacturerId());
+            if (Objects.nonNull(supplierDO)) {
+                e.setManufacturer(supplierDO.getName());
+            }
+            DeptRespDTO dept = deptApi.getDept(e.getDeptId());
+            if (Objects.nonNull(dept)) {
+                if ("1".equals(dept.getType())) {
+                    e.setCompany(dept.getName());
+                } else if ("2".equals(dept.getType())) {
+                    e.setProject(dept.getName());
+                    DeptRespDTO dept1 = deptApi.getDept(dept.getParentId());
+                    if (Objects.nonNull(dept1)) {
+                        e.setCompany(dept1.getName());
+                    }
+                } else if ("3".equals(dept.getName())) {
+                    e.setDeptName(dept.getName());
+                    DeptRespDTO dept1 = deptApi.getDept(dept.getParentId());
+                    if (Objects.nonNull(dept1)) {
+                        e.setProject(dept1.getName());
+                        DeptRespDTO dept2 = deptApi.getDept(dept1.getParentId());
+                        if (Objects.nonNull(dept2)) {
+                            e.setCompany(dept2.getName());
+                        }
+                    }
+                }
+            }
+        });
+        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;
+    }
+}

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/stat/IotStaticController.java

@@ -457,7 +457,7 @@ public class IotStaticController {
         }
     }
 
-    private Set<Long> getDeptIds(String dept) {
+    public Set<Long> getDeptIds(String dept) {
         Set<Long> ids = new HashSet<>();
         List<DeptRespDTO> depts = new ArrayList<>();
         if ("rd".equals(dept)) {

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

@@ -239,4 +239,6 @@ public class IotDeviceRespVO {
     @Schema(description = "油服设备编码")
     private String yfDeviceCode;
     private String carOnline;
+    private String company;
+    private String project;
 }

+ 40 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/IotDeviceMapper.java

@@ -67,6 +67,42 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
 //                .orderByAsc(IotDeviceDO::getSortColumn));
     }
 
+    default PageResult<IotDeviceDO> selectPageReport(IotDevicePageReqVO reqVO, Collection<Long> deptIds) {
+//        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceDO>()
+        return selectPage(reqVO, new LambdaQueryWrapperX<IotDeviceDO>()
+                .likeIfPresent(IotDeviceDO::getYfDeviceCode, reqVO.getYfDeviceCode())
+                .likeIfPresent(IotDeviceDO::getDeviceCode, reqVO.getDeviceCode())
+                .likeIfPresent(IotDeviceDO::getDeviceName, reqVO.getDeviceName())
+                .eqIfPresent(IotDeviceDO::getBrand, reqVO.getBrand())
+                .eqIfPresent(IotDeviceDO::getModel, reqVO.getModel())
+                .likeIfPresent(IotDeviceDO::getBrandName, reqVO.getBrandName())
+                //.eqIfPresent(IotDeviceDO::getOrgId, reqVO.getOrgId())
+                .inIfPresent(IotDeviceDO::getDeptId, deptIds)
+                .eqIfPresent(IotDeviceDO::getDeviceStatus, reqVO.getDeviceStatus())
+                .eqIfPresent(IotDeviceDO::getAssetProperty, reqVO.getAssetProperty())
+                .eqIfPresent(IotDeviceDO::getPicUrl, reqVO.getPicUrl())
+                .eqIfPresent(IotDeviceDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotDeviceDO::getManufacturerId, reqVO.getManufacturerId())
+                .eqIfPresent(IotDeviceDO::getSupplierId, reqVO.getSupplierId())
+                .eqIfPresent(IotDeviceDO::getNameplate, reqVO.getNameplate())
+                .eqIfPresent(IotDeviceDO::getExpires, reqVO.getExpires())
+                .eqIfPresent(IotDeviceDO::getPlPrice, reqVO.getPlPrice())
+                .eqIfPresent(IotDeviceDO::getPlYear, reqVO.getPlYear())
+                .betweenIfPresent(IotDeviceDO::getPlStartDate, reqVO.getPlStartDate())
+                .eqIfPresent(IotDeviceDO::getPlMonthed, reqVO.getPlMonthed())
+                .eqIfPresent(IotDeviceDO::getPlAmounted, reqVO.getPlAmounted())
+                .eqIfPresent(IotDeviceDO::getRemainAmount, reqVO.getRemainAmount())
+                .eqIfPresent(IotDeviceDO::getInfoId, reqVO.getInfoId())
+                .eqIfPresent(IotDeviceDO::getInfoType, reqVO.getInfoType())
+                .eqIfPresent(IotDeviceDO::getAssetClass, reqVO.getAssetClass())
+                .likeIfPresent(IotDeviceDO::getInfoName, reqVO.getInfoName())
+                .eqIfPresent(IotDeviceDO::getInfoRemark, reqVO.getInfoRemark())
+                .eqIfPresent(IotDeviceDO::getInfoUrl, reqVO.getInfoUrl())
+                .eqIfPresent(IotDeviceDO::getTemplateJson, reqVO.getTemplateJson())
+                .eqIfPresent(IotDeviceDO::getBomSyncStatus, reqVO.getBomSyncStatus()));
+//                .orderByAsc(IotDeviceDO::getSortColumn));
+    }
+
     default PageResult<IotDeviceDO> selectPageApp(IotDevicePageReqVO reqVO, Collection<Long> deptIds, SortablePageParam sortablePageParam) {
         LambdaQueryWrapper<IotDeviceDO> wrapper = new LambdaQueryWrapper<>();
         wrapper.like(StringUtils.isNotBlank(reqVO.getCommonParam()), IotDeviceDO::getDeviceName, reqVO.getCommonParam())
@@ -247,6 +283,10 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
         return selectCount(new LambdaQueryWrapperX<IotDeviceDO>()
                 .inIfPresent(IotDeviceDO::getDeptId, ids));
     }
+    default Long selectCountByParam(Set<Long> ids, IotDevicePageReqVO iotDevicePageReqVO) {
+        return selectCount(new LambdaQueryWrapperX<IotDeviceDO>()
+                .inIfPresent(IotDeviceDO::getDeptId, ids).likeIfPresent(IotDeviceDO::getDeviceCode, iotDevicePageReqVO.getDeviceCode()).likeIfPresent(IotDeviceDO::getDeviceName, iotDevicePageReqVO.getDeviceName()));
+    }
     /* default PageResult<IotDeviceDO> deviceAssociateBomPage(IotDevicePageReqVO reqVO, Collection<Long> deptIds) {
         MPJLambdaWrapperX<IotDeviceDO> query = new MPJLambdaWrapperX<IotDeviceDO>();
         query.innerJoin(IotBomDO.class, IotBomDO::getDeviceCategoryId, IotDeviceDO::getAssetClass)

+ 10 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/inspect/IotInspectOrderDetailMapper.java

@@ -53,6 +53,16 @@ public interface IotInspectOrderDetailMapper extends BaseMapperX<IotInspectOrder
         );
     }
 
+    default Long selectExceptionReport(IotCountDataDO vo, Set<Long> ids) {
+        return selectCount(new LambdaQueryWrapperX<IotInspectOrderDetailDO>()
+                        .betweenIfPresent(IotInspectOrderDetailDO::getCreateTime, vo.getCreateTime())
+//                .inIfPresent(IotInspectOrderDetailDO::getOrderId, orderIds)
+                        .inIfPresent(IotInspectOrderDetailDO::getDeptId, ids)
+                .eq(IotInspectOrderDetailDO::getIfNormal, false)
+                        .orderByDesc(IotInspectOrderDetailDO::getId)
+        );
+    }
+
     default PageResult<IotInspectOrderDetailDO> selectItemPage(IotInspectOrderDetailPageReqVO reqVO, Set<Long> ids, Set<Long> deviceIds, Set<Long> orderIds) {
         return selectPage(reqVO, new LambdaQueryWrapperX<IotInspectOrderDetailDO>()
                 .eq(IotInspectOrderDetailDO::getIfNormal, reqVO.getIfNormal())

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/inspect/IotInspectOrderDetailService.java

@@ -18,6 +18,7 @@ import java.util.Set;
  * @author 芋道源码
  */
 public interface IotInspectOrderDetailService {
+    Long selectExceptionReport(IotCountDataDO vo, Set<Long> ids);
     List<IotInspectOrderDetailDO> getListStat(IotCountDataDO vo, Set<Long> ids);
 
     PageResult<IotInspectDeviceVo> getDeviceStatus(IotInspectOrderDetailPageReqVO pageReqVO);

+ 4 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/inspect/IotInspectOrderDetailServiceImpl.java

@@ -96,7 +96,10 @@ public class IotInspectOrderDetailServiceImpl implements IotInspectOrderDetailSe
     public List<IotInspectOrderDetailDO> getListStat(IotCountDataDO vo, Set<Long> ids) {
         return iotInspectOrderDetailMapper.selectListStat(vo, ids);
     }
-
+    @Override
+    public Long selectExceptionReport(IotCountDataDO vo, Set<Long> ids) {
+        return iotInspectOrderDetailMapper.selectExceptionReport(vo, ids);
+    }
     @Override
     public PageResult<IotInspectDeviceVo> getDeviceStatus(IotInspectOrderDetailPageReqVO pageReqVO) {
         IPage<IotInspectDeviceVo> page;

+ 1 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/dto/DeptRespDTO.java

@@ -48,4 +48,5 @@ public class DeptRespDTO {
      */
     private Integer status;
 
+    private String type;
 }