新火炬后端单体项目初始化代码
Lius
9 天以前 368e938e3ced045d6b8499cdaed7d61a84180a1c
删除原MDC设备车间管理代码
已修改18个文件
已删除20个文件
4575 ■■■■ 文件已修改
src/main/java/org/jeecg/modules/base/mapper/FactoryMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/mapper/xml/FactoryMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/service/IFactoryService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/service/impl/FactoryServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java 278 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/controller/MdcProductionController.java 357 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyDto.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyResultDto.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentFaultInfoMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/MdcProductionEquipmentMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/MdcProductionMapper.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/MdcUserProductionMapper.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentFaultInfoMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProductionEquipmentMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProductionMapper.xml 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcUserProductionMapper.xml 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/rule/OrgCodeProRule.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentFaultInfoService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/IMdcProductionService.java 195 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/IMdcUserProductionService.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java 506 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java 782 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentFaultInfoServiceImpl.java 380 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 126 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcProductionEquipmentServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcProductionServiceImpl.java 649 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mdc/service/impl/MdcUserProductionServiceImpl.java 152 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/system/controller/SysUserController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/mapper/FactoryMapper.java
@@ -20,4 +20,9 @@
     */
    @Select("SELECT * FROM base_factory where del_flag ='0' AND parent_id = #{parentId,jdbcType=VARCHAR}")
    List<Factory> queryFacByPid(@Param("parentId") String parentId);
    /**
     * é€’归查询所有子节点
     */
    List<String> recursionChildren(@Param("factoryId") String factoryId);
}
src/main/java/org/jeecg/modules/base/mapper/xml/FactoryMapper.xml
@@ -2,4 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.base.mapper.FactoryMapper">
    <select id="recursionChildren" resultType="java.lang.String">
        WITH temp ( id ) AS (
            SELECT
                id
            FROM
                base_factory
            WHERE
                id = #{ factoryId } UNION ALL
            SELECT
                a.id
            FROM
                base_factory a
                    INNER JOIN temp ON a.parent_id = temp.id
        ) SELECT
            *
        FROM
            temp
    </select>
</mapper>
src/main/java/org/jeecg/modules/base/service/IFactoryService.java
@@ -43,4 +43,6 @@
     * èŽ·å–ä¸‹çº§äº§çº¿
     */
    List<Factory> queryFacByPid(String pid);
    List<String> recursionChildren(String factoryId);
}
src/main/java/org/jeecg/modules/base/service/impl/FactoryServiceImpl.java
@@ -168,6 +168,14 @@
    }
    /**
     * é€’归查询所有子节点id
     */
    @Override
    public List<String> recursionChildren(String factoryId) {
        return this.baseMapper.recursionChildren(factoryId);
    }
    /**
     * æ‰“å¼€ çˆ¶èŠ‚ç‚¹ åŠ ä»¥ä¸Šçš„mdc标记
     * @param parentId
     */
src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
@@ -112,40 +112,40 @@
        return Result.OK(result);
    }
    @ApiOperation(value = "设备效率报表-综合利用率统计分析", notes = "设备效率报表-综合利用率统计分析")
    @GetMapping("/comprehensiveRateAnalyze")
    public Result<?> comprehensiveRateAnalyze(EquEffVo vo) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        Map<String, Object> result = mdcEfficiencyReportService.comprehensiveRateAnalyze(userId, vo);
        return Result.OK(result);
    }
    @ApiOperation(value = "设备效率报表-班组综合利用率统计分析", notes = "设备效率报表-综合利用率统计分析")
    @GetMapping("/teamEfficiencyAnalyzeByMonth")
    public Result<?> teamEfficiencyAnalyzeByMonth(EquEffVo equEffVo) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        Map<String, Object> result = mdcEfficiencyReportService.teamEfficiencyAnalyzeByMonth(userId, equEffVo);
        return Result.OK(result);
    }
    @ApiOperation(value = "设备效率报表-配送小组维度各班组月设备利用分布", notes = "设备效率报表-配送小组维度各班组月设备利用分布")
    @GetMapping("/teamEquipmentEfficiencyAnalyze")
    public Result<?> teamEquipmentEfficiencyAnalyze(EquEffVo equEffVo) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(userId, equEffVo);
        return Result.OK(result);
    }
    @ApiOperation(value = "设备效率报表-设备维度各班组月设备利用分布", notes = "设备效率报表-设备维度各班组月设备利用分布")
    @GetMapping("/equipmentEfficiencyAnalyze")
    public Result<?> equipmentEfficiencyAnalyze(EquEffVo equEffVo) {
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        Map<String, Object> result = mdcEfficiencyReportService.equipmentEfficiencyAnalyze(userId, equEffVo);
        return Result.OK(result);
    }
//    @ApiOperation(value = "设备效率报表-综合利用率统计分析", notes = "设备效率报表-综合利用率统计分析")
//    @GetMapping("/comprehensiveRateAnalyze")
//    public Result<?> comprehensiveRateAnalyze(EquEffVo vo) {
//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        String userId = user.getId();
//        Map<String, Object> result = mdcEfficiencyReportService.comprehensiveRateAnalyze(userId, vo);
//        return Result.OK(result);
//    }
//
//    @ApiOperation(value = "设备效率报表-班组综合利用率统计分析", notes = "设备效率报表-综合利用率统计分析")
//    @GetMapping("/teamEfficiencyAnalyzeByMonth")
//    public Result<?> teamEfficiencyAnalyzeByMonth(EquEffVo equEffVo) {
//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        String userId = user.getId();
//        Map<String, Object> result = mdcEfficiencyReportService.teamEfficiencyAnalyzeByMonth(userId, equEffVo);
//        return Result.OK(result);
//    }
//
//    @ApiOperation(value = "设备效率报表-配送小组维度各班组月设备利用分布", notes = "设备效率报表-配送小组维度各班组月设备利用分布")
//    @GetMapping("/teamEquipmentEfficiencyAnalyze")
//    public Result<?> teamEquipmentEfficiencyAnalyze(EquEffVo equEffVo) {
//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        String userId = user.getId();
//        Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(userId, equEffVo);
//        return Result.OK(result);
//    }
//
//    @ApiOperation(value = "设备效率报表-设备维度各班组月设备利用分布", notes = "设备效率报表-设备维度各班组月设备利用分布")
//    @GetMapping("/equipmentEfficiencyAnalyze")
//    public Result<?> equipmentEfficiencyAnalyze(EquEffVo equEffVo) {
//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        String userId = user.getId();
//        Map<String, Object> result = mdcEfficiencyReportService.equipmentEfficiencyAnalyze(userId, equEffVo);
//        return Result.OK(result);
//    }
}
src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -208,34 +208,34 @@
        return Result.OK("批量移除成功!");
    }
    /**
     * æ‰¹é‡ç§»é™¤äº§çº¿å’Œè®¾å¤‡å…³ç³»
     */
    @AutoLog(value = "设备产线表-批量移除产线和设备关系")
    @ApiOperation(value = "设备产线表-批量移除产线和设备关系", notes = "设备产线表-批量移除产线和设备关系")
    @PostMapping(value = "/removeEquipmentsForProduction")
    public Result<?> removeEquipmentsForProduction(@RequestParam(name = "productionId", required = true) String productionId,
                                                   @RequestParam(name = "equipmentIds", required = true) String equipmentIds) {
        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentIds)) {
            List<String> equipmentIdList = Arrays.asList(equipmentIds.split(","));
            mdcEquipmentService.removeEquipmentsForProduction(productionId, equipmentIdList);
        }
        return Result.OK("批量移除成功!");
    }
//    /**
//     * æ‰¹é‡ç§»é™¤äº§çº¿å’Œè®¾å¤‡å…³ç³»
//     */
//    @AutoLog(value = "设备产线表-批量移除产线和设备关系")
//    @ApiOperation(value = "设备产线表-批量移除产线和设备关系", notes = "设备产线表-批量移除产线和设备关系")
//    @PostMapping(value = "/removeEquipmentsForProduction")
//    public Result<?> removeEquipmentsForProduction(@RequestParam(name = "productionId", required = true) String productionId,
//                                                   @RequestParam(name = "equipmentIds", required = true) String equipmentIds) {
//        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentIds)) {
//            List<String> equipmentIdList = Arrays.asList(equipmentIds.split(","));
//            mdcEquipmentService.removeEquipmentsForProduction(productionId, equipmentIdList);
//        }
//        return Result.OK("批量移除成功!");
//    }
    /**
     * ç§»é™¤äº§çº¿å’Œè®¾å¤‡å…³ç³»
     */
    @AutoLog(value = "设备产线表-移除产线和设备关系")
    @ApiOperation(value = "设备产线表-移除产线和设备关系", notes = "设备产线表-移除产线和设备关系")
    @PostMapping(value = "/removeEquipmentForProduction")
    public Result<?> removeEquipmentForProduction(@RequestParam(name = "productionId", required = true) String productionId,
                                                  @RequestParam(name = "equipmentId", required = true) String equipmentId) {
        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentId)) {
            mdcEquipmentService.removeEquipmentForProduction(productionId, equipmentId);
        }
        return Result.OK("移除成功!");
    }
//    /**
//     * ç§»é™¤äº§çº¿å’Œè®¾å¤‡å…³ç³»
//     */
//    @AutoLog(value = "设备产线表-移除产线和设备关系")
//    @ApiOperation(value = "设备产线表-移除产线和设备关系", notes = "设备产线表-移除产线和设备关系")
//    @PostMapping(value = "/removeEquipmentForProduction")
//    public Result<?> removeEquipmentForProduction(@RequestParam(name = "productionId", required = true) String productionId,
//                                                  @RequestParam(name = "equipmentId", required = true) String equipmentId) {
//        if (StringUtils.isNotBlank(productionId) && StringUtils.isNotBlank(equipmentId)) {
//            mdcEquipmentService.removeEquipmentForProduction(productionId, equipmentId);
//        }
//        return Result.OK("移除成功!");
//    }
    /**
     * æ·»åŠ 
@@ -589,18 +589,18 @@
    }
    @AutoLog(value = "设备表-通过车间ids获取设备树")
    @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树")
    @GetMapping(value = "/loadTreeListByProductionIds")
    public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
//    @AutoLog(value = "设备表-通过车间ids获取设备树")
//    @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树")
//    @GetMapping(value = "/loadTreeListByProductionIds")
//    public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) {
//        Result<List<MdcEquipmentTree>> result = new Result<>();
//        try {
//            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids);
//            result.setSuccess(true);
//            result.setResult(mdcEquipmentTreeList);
//        } catch (Exception e) {
//            log.error(e.getMessage(), e);
//        }
//        return result;
//    }
}
src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/controller/MdcProductionController.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyDto.java
@@ -55,17 +55,5 @@
     * å…³æœºæ—¶é•¿
     */
    private BigDecimal closeLong;
    /**
     * æ•…障时长
     */
    private BigDecimal faultLong;
    /**
     * æ•…障率
     */
    private BigDecimal faultRate;
    /**
     * è¿è¡Œæ—¶é•¿(去除故障时间)
     */
    private BigDecimal removeFaultRunLong;
}
src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyResultDto.java
@@ -42,24 +42,24 @@
     * å…³æœºæ—¶é•¿
     */
    private BigDecimal closeLong = BigDecimal.ZERO;
    /**
     * æ•…障时长
     */
    private BigDecimal faultLong = BigDecimal.ZERO;
    /**
     * æ•…障率
     */
    private BigDecimal faultRate = BigDecimal.ZERO;
    /**
     * è¿è¡Œæ—¶é•¿(去除故障时间)
     */
    private BigDecimal removeFaultRunLong = BigDecimal.ZERO;
//    /**
//     * æ•…障时长
//     */
//    private BigDecimal faultLong = BigDecimal.ZERO;
//    /**
//     * æ•…障率
//     */
//    private BigDecimal faultRate = BigDecimal.ZERO;
//    /**
//     * è¿è¡Œæ—¶é•¿(去除故障时间)
//     */
//    private BigDecimal removeFaultRunLong = BigDecimal.ZERO;
    /**
     * é¢œè‰²
     */
    private String color;
    public MdcEfficiencyResultDto(String theDate, BigDecimal processLong, BigDecimal utilizationRate, BigDecimal startRate, BigDecimal openRate, BigDecimal openLong, BigDecimal waitLong, BigDecimal closeLong, BigDecimal faultLong, BigDecimal faultRate, BigDecimal removeFaultRunLong) {
    public MdcEfficiencyResultDto(String theDate, BigDecimal processLong, BigDecimal utilizationRate, BigDecimal startRate, BigDecimal openRate, BigDecimal openLong, BigDecimal waitLong, BigDecimal closeLong) {
        this.theDate = theDate;
        this.processLong = processLong;
        this.utilizationRate = utilizationRate;
@@ -68,9 +68,9 @@
        this.openLong = openLong;
        this.waitLong = waitLong;
        this.closeLong = closeLong;
        this.faultLong = faultLong;
        this.faultRate = faultRate;
        this.removeFaultRunLong = removeFaultRunLong;
//        this.faultLong = faultLong;
//        this.faultRate = faultRate;
//        this.removeFaultRunLong = removeFaultRunLong;
    }
    public MdcEfficiencyResultDto() {
src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentFaultInfoMapper.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -143,7 +143,7 @@
    List<String> getEquIdsByProIds(@Param("proIds") List<String> proIds);
    List<MdcEquipment> getEquipmentList(@Param("allProductionIds") List<String> allProductionIds);
    List<MdcEquipment> getEquipmentList(@Param("allFactoryIds") List<String> allFactoryIds);
    List<MdcEquipment> queryByFactoryId(@Param("factoryId") String factoryId);
src/main/java/org/jeecg/modules/mdc/mapper/MdcProductionEquipmentMapper.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/MdcProductionMapper.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/MdcUserProductionMapper.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -18,14 +18,10 @@
            t1.open_long / 86400 openRate,
            t1.open_long openLong,
            t1.wait_long waitLong,
            t1.close_long closeLong,
            COALESCE(t3.fault_long, 0) faultLong,
            COALESCE(t3.fault_rate, 0) faultRate,
            COALESCE(t3.remove_fault_run_long, 0) removeFaultRunLong
            t1.close_long closeLong
        FROM
            mdc_equipment t2
            LEFT JOIN mdc_equipment_statistical_info t1 ON t1.equipment_id = t2.equipment_id
            LEFT JOIN mdc_equipment_fault_info t3 ON t2.equipment_id = t3.equipment_id AND t1.the_date = t3.the_date
        WHERE
            t1.the_date &lt;= #{ vo.endTime }
            AND t1.the_date &gt;= #{ vo.startTime }
@@ -69,14 +65,10 @@
            t1.open_long / 86400 openRate,
            t1.open_long openLong,
            t1.wait_long waitLong,
            t1.close_long closeLong,
            COALESCE(t3.fault_long, 0) faultLong,
            COALESCE(t3.fault_rate, 0) faultRate,
            COALESCE(t3.remove_fault_run_long, 0) removeFaultRunLong
            t1.close_long closeLong
        FROM
            mdc_equipment t2
            LEFT JOIN mdc_equipment_statistical_info t1 ON t1.equipment_id = t2.equipment_id
            LEFT JOIN mdc_equipment_fault_info t3 ON t2.equipment_id = t3.equipment_id AND t1.the_date = t3.the_date
        WHERE
            t1.the_date &lt;= #{ vo.endTime }
            AND t1.the_date &gt;= #{ vo.startTime }
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentFaultInfoMapper.xml
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -95,10 +95,10 @@
        me.*
        FROM
        mdc_equipment me
        LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
        LEFT JOIN base_equipment_factory mpe ON me.id = mpe.equipment_id
        WHERE
        mpe.production_id IN
        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
        mpe.factory_id IN
        <foreach collection="allFactoryIds" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
@@ -181,14 +181,14 @@
        SELECT
            mp.id,
            mp.parent_id,
            mp.production_name,
            mp.org_type,
            mp.factory_name AS productionName,
            mp.factory_category AS orgtype,
            me.equipment_id,
            me.equipment_name,
            me.equipment_type
        FROM
            mdc_production_equipment mpe
            LEFT JOIN mdc_production mp ON mpe.production_id = mp.id
            base_equipment_factory mpe
            LEFT JOIN base_factory mp ON mpe.factory_id = mp.id
            LEFT JOIN mdc_equipment me ON me.id = mpe.equipment_id
        <where>
            me.equipment_id IN
@@ -196,7 +196,7 @@
                #{id}
            </foreach>
        </where>
        ORDER BY mp.production_order
        ORDER BY mp.sorter
    </select>
    <!--根据大屏车间id查询设备列表-->
@@ -221,8 +221,8 @@
            t1.*
        FROM
            mdc_equipment t1
            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
            LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
            LEFT JOIN base_equipment_factory t2 ON t1.id = t2.equipment_id
            LEFT JOIN base_factory t3 ON t2.factory_id = t3.id
        <where>
            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
@@ -260,8 +260,8 @@
            t1.*
        FROM
            mdc_equipment t1
            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
            LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
            LEFT JOIN base_equipment_factory t2 ON t1.id = t2.equipment_id
            LEFT JOIN base_factory t3 ON t2.production_id = t3.id
        <where>
            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProductionEquipmentMapper.xml
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProductionMapper.xml
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcUserProductionMapper.xml
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/rule/OrgCodeProRule.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentFaultInfoService.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -88,15 +88,15 @@
     */
    void removeEquipmentsForDepart(String departId, List<String> equipmentIdList);
    /**
     * ç§»é™¤è®¾å¤‡å’Œäº§çº¿å…³ç³»
     */
    void removeEquipmentForProduction(String productionId, String equipmentId);
//    /**
//     * ç§»é™¤è®¾å¤‡å’Œäº§çº¿å…³ç³»
//     */
//    void removeEquipmentForProduction(String productionId, String equipmentId);
    /**
     * æ‰¹é‡ç§»é™¤äº§çº¿å’Œè®¾å¤‡å…³ç³»
     */
    void removeEquipmentsForProduction(String productionId, List<String> equipmentIdList);
//    /**
//     * æ‰¹é‡ç§»é™¤äº§çº¿å’Œè®¾å¤‡å…³ç³»
//     */
//    void removeEquipmentsForProduction(String productionId, List<String> equipmentIdList);
    /**
     * åŠ è½½éƒ¨é—¨è®¾å¤‡æ ‘
@@ -192,13 +192,13 @@
     */
    List<MdcEquipment> exportXlsList(MdcEquipmentVo mdcEquipment);
    /**
     * é€šè¿‡è½¦é—´ids获取设备树
     *
     * @param ids
     * @return
     */
    List<MdcEquipmentTree> loadTreeListByProductionIds(String ids);
//    /**
//     * é€šè¿‡è½¦é—´ids获取设备树
//     *
//     * @param ids
//     * @return
//     */
//    List<MdcEquipmentTree> loadTreeListByProductionIds(String ids);
    /**
     * æŸ¥è¯¢å•表数据
src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/IMdcProductionService.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/IMdcUserProductionService.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
@@ -105,11 +105,11 @@
     */
    List<BigDecimal> getEfficiencyRate(String equipmentId, String date);
    Map<String, Object> equipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo);
    Map<String, Object> teamEquipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo);
    Map<String, Object> teamEfficiencyAnalyzeByMonth(String userId, EquEffVo equEffVo);
    Map<String, Object> comprehensiveRateAnalyze(String userId, EquEffVo vo);
//    Map<String, Object> equipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo);
//
//    Map<String, Object> teamEquipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo);
//
//    Map<String, Object> teamEfficiencyAnalyzeByMonth(String userId, EquEffVo equEffVo);
//
//    Map<String, Object> comprehensiveRateAnalyze(String userId, EquEffVo vo);
}
src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -1,10 +1,13 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import liquibase.pro.packaged.I;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.base.entity.Factory;
import org.jeecg.modules.base.service.IFactoryService;
import org.jeecg.modules.mdc.dto.*;
import org.jeecg.modules.mdc.entity.*;
import org.jeecg.modules.mdc.mapper.MdcEfficiencyReportMapper;
@@ -46,7 +49,10 @@
    private ISysDepartService sysDepartService;
    @Resource
    private IMdcProductionService mdcProductionService;
    private IFactoryService factoryService;
//    @Resource
//    private IMdcProductionService mdcProductionService;
    @Resource
    private IMdcShiftSubService mdcShiftSubService;
@@ -192,12 +198,12 @@
                    mdcEfficiencyResultDto.setWaitLong(mdcEfficiencyResultDto.getWaitLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setCloseLong(mdcEfficiencyResultDto.getCloseLong());
                    mdcEfficiencyResultDto.setCloseLong(mdcEfficiencyResultDto.getCloseLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setFaultLong(mdcEfficiencyResultDto.getFaultLong());
                    mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setFaultRate(mdcEfficiencyResultDto.getFaultRate());
                    mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(dates.size()), 4, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong());
                    mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
//                    mdcEfficiencyResultDto1.setFaultLong(mdcEfficiencyResultDto.getFaultLong());
//                    mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
//                    mdcEfficiencyResultDto1.setFaultRate(mdcEfficiencyResultDto.getFaultRate());
//                    mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(dates.size()), 4, RoundingMode.HALF_UP));
//                    mdcEfficiencyResultDto1.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong());
//                    mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    long rate = mdcEfficiencyResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -214,7 +220,7 @@
                // äº§çº¿å±‚级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // æŸ¥è¯¢æ‰€æœ‰äº§çº¿ä¿¡æ¯
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().ne(Factory::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(Factory::getSorter));
                for (MdcEquProDto mdcEquProDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
@@ -233,31 +239,31 @@
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                    Factory baseFactory = factoryList.stream().filter(factory -> factory.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (baseFactory != null) {
                        switch (baseFactory.getFactoryCategory()) {
                            case "1":
                                mdcEfficiencyListDto.setLevel1(mdcProduction.getProductionName());
                                mdcEfficiencyListDto.setLevel1(baseFactory.getFactoryName());
                                break;
                            case "2":
                                mdcEfficiencyListDto.setLevel2(mdcProduction.getProductionName());
                                mdcEfficiencyListDto.setLevel2(baseFactory.getFactoryName());
                                break;
                            case "3":
                                mdcEfficiencyListDto.setLevel3(mdcProduction.getProductionName());
                                mdcEfficiencyListDto.setLevel3(baseFactory.getFactoryName());
                                break;
                            default:
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                        if (StringUtils.isNotEmpty(baseFactory.getParentId())) {
                            factoryList.stream().filter(factory -> factory.getId().equals(baseFactory.getParentId())).findAny().ifPresent(factory1 -> {
                                switch (factory1.getFactoryCategory()) {
                                    case "1":
                                        mdcEfficiencyListDto.setLevel1(production1.getProductionName());
                                        mdcEfficiencyListDto.setLevel1(factory1.getFactoryName());
                                        break;
                                    case "2":
                                        mdcEfficiencyListDto.setLevel2(production1.getProductionName());
                                        mdcEfficiencyListDto.setLevel2(factory1.getFactoryName());
                                        break;
                                    case "3":
                                        mdcEfficiencyListDto.setLevel3(production1.getProductionName());
                                        mdcEfficiencyListDto.setLevel3(factory1.getFactoryName());
                                        break;
                                    default:
                                }
@@ -286,12 +292,12 @@
                    mdcEfficiencyResultDto.setWaitLong(mdcEfficiencyResultDto.getWaitLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setCloseLong(mdcEfficiencyResultDto.getCloseLong());
                    mdcEfficiencyResultDto.setCloseLong(mdcEfficiencyResultDto.getCloseLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setFaultLong(mdcEfficiencyResultDto.getFaultLong());
                    mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setFaultRate(mdcEfficiencyResultDto.getFaultRate());
                    mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(dates.size()), 4, RoundingMode.HALF_UP));
                    mdcEfficiencyResultDto1.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong());
                    mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
//                    mdcEfficiencyResultDto1.setFaultLong(mdcEfficiencyResultDto.getFaultLong());
//                    mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
//                    mdcEfficiencyResultDto1.setFaultRate(mdcEfficiencyResultDto.getFaultRate());
//                    mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(dates.size()), 4, RoundingMode.HALF_UP));
//                    mdcEfficiencyResultDto1.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong());
//                    mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(dates.size()), 0, RoundingMode.HALF_UP));
                    long rate = mdcEfficiencyResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -357,10 +363,7 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
@@ -403,10 +406,7 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
@@ -574,7 +574,7 @@
                // äº§çº¿å±‚级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // æŸ¥è¯¢æ‰€æœ‰äº§çº¿ä¿¡æ¯
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().ne(Factory::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(Factory::getSorter));
                for (MdcEquProDto mdcEquProDto : equipmentList) {
                    MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto();
@@ -593,31 +593,31 @@
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                    Factory baseFactory = factoryList.stream().filter(factory -> factory.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (baseFactory != null) {
                        switch (baseFactory.getFactoryCategory()) {
                            case "1":
                                mdcEfficiencyListDto.setLevel1(mdcProduction.getProductionName());
                                mdcEfficiencyListDto.setLevel1(baseFactory.getFactoryName());
                                break;
                            case "2":
                                mdcEfficiencyListDto.setLevel2(mdcProduction.getProductionName());
                                mdcEfficiencyListDto.setLevel2(baseFactory.getFactoryName());
                                break;
                            case "3":
                                mdcEfficiencyListDto.setLevel3(mdcProduction.getProductionName());
                                mdcEfficiencyListDto.setLevel3(baseFactory.getFactoryName());
                                break;
                            default:
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                        if (StringUtils.isNotEmpty(baseFactory.getParentId())) {
                            factoryList.stream().filter(factory -> factory.getId().equals(baseFactory.getParentId())).findAny().ifPresent(factory1 -> {
                                switch (factory1.getFactoryCategory()) {
                                    case "1":
                                        mdcEfficiencyListDto.setLevel1(production1.getProductionName());
                                        mdcEfficiencyListDto.setLevel1(factory1.getFactoryName());
                                        break;
                                    case "2":
                                        mdcEfficiencyListDto.setLevel2(production1.getProductionName());
                                        mdcEfficiencyListDto.setLevel2(factory1.getFactoryName());
                                        break;
                                    case "3":
                                        mdcEfficiencyListDto.setLevel3(production1.getProductionName());
                                        mdcEfficiencyListDto.setLevel3(factory1.getFactoryName());
                                        break;
                                    default:
                                }
@@ -710,10 +710,7 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
@@ -723,9 +720,9 @@
            mdcEfficiencyResultDto.setWaitLong(mdcEfficiencyResultDto.getWaitLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setOpenLong(mdcEfficiencyResultDto.getOpenLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setProcessLong(mdcEfficiencyResultDto.getProcessLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
//            mdcEfficiencyResultDto.setFaultLong(mdcEfficiencyResultDto.getFaultLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
//            mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
//            mdcEfficiencyResultDto.setRemoveFaultRunLong(mdcEfficiencyResultDto.getRemoveFaultRunLong().divide(new BigDecimal(mdcEfficiencyList.size()), 0, RoundingMode.HALF_UP));
            long rate = mdcEfficiencyResultDto.getStartRate().multiply(new BigDecimal("100")).longValue();
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -760,16 +757,13 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setOpenRate(mdcEfficiencyResultDto.getOpenRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setStartRate(mdcEfficiencyResultDto.getStartRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
            mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
//            mdcEfficiencyResultDto.setFaultRate(mdcEfficiencyResultDto.getFaultRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
            long rate = mdcEfficiencyResultDto.getStartRate().multiply(new BigDecimal("100")).longValue();
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -955,7 +949,7 @@
                // äº§çº¿å±‚级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // æŸ¥è¯¢æ‰€æœ‰äº§çº¿ä¿¡æ¯
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().ne(Factory::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(Factory::getSorter));
                // ç­æ¬¡åç§°æ˜¾ç¤ºå¤„理
                String shiftSubName = "";
@@ -996,31 +990,31 @@
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                    Factory baseFactory = factoryList.stream().filter(factory -> factory.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (baseFactory != null) {
                        switch (baseFactory.getFactoryCategory()) {
                            case "1":
                                mdcEfficiencyShiftListDto.setLevel1(mdcProduction.getProductionName());
                                mdcEfficiencyShiftListDto.setLevel1(baseFactory.getFactoryName());
                                break;
                            case "2":
                                mdcEfficiencyShiftListDto.setLevel2(mdcProduction.getProductionName());
                                mdcEfficiencyShiftListDto.setLevel2(baseFactory.getFactoryName());
                                break;
                            case "3":
                                mdcEfficiencyShiftListDto.setLevel3(mdcProduction.getProductionName());
                                mdcEfficiencyShiftListDto.setLevel3(baseFactory.getFactoryName());
                                break;
                            default:
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                        if (StringUtils.isNotEmpty(baseFactory.getParentId())) {
                            factoryList.stream().filter(factory -> factory.getId().equals(baseFactory.getParentId())).findAny().ifPresent(factory1 -> {
                                switch (factory1.getFactoryCategory()) {
                                    case "1":
                                        mdcEfficiencyShiftListDto.setLevel1(production1.getProductionName());
                                        mdcEfficiencyShiftListDto.setLevel1(factory1.getFactoryName());
                                        break;
                                    case "2":
                                        mdcEfficiencyShiftListDto.setLevel2(production1.getProductionName());
                                        mdcEfficiencyShiftListDto.setLevel2(factory1.getFactoryName());
                                        break;
                                    case "3":
                                        mdcEfficiencyShiftListDto.setLevel3(production1.getProductionName());
                                        mdcEfficiencyShiftListDto.setLevel3(factory1.getFactoryName());
                                        break;
                                    default:
                                }
@@ -1767,316 +1761,316 @@
        return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date);
    }
    /**
     * ç­ç»„各设备综合利用率
     *
     * @param equEffVo
     * @return
     */
    @Override
    public Map<String, Object> equipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo) {
        Map<String, Object> result = new HashMap<>();
        List<String> mdcProductionIds = new ArrayList<>();
        if (StringUtils.isBlank(equEffVo.getProductionIds())) {
            mdcProductionIds.add(equEffVo.getProductionId());
        } else {
            mdcProductionIds.addAll(Arrays.asList(equEffVo.getProductionIds().split(",")));
        }
        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
        //数据权限过滤
        allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
        List<MdcEquipment> equipmentList = mdcEquipmentService.findByProductionIds(allProductionIds);
        if (equipmentList != null && !equipmentList.isEmpty()) {
            List<String> equipmentIdList = equipmentList.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList());
            List<EquipmentEfficiencyAnalyzeDto> dataList = mdcEfficiencyReportMapper.equipmentEfficiencyAnalyze(equipmentIdList, equEffVo.getMonth());
            result.put("dataList", dataList);
            List<String> equipmentNameList = dataList.stream().map(EquipmentEfficiencyAnalyzeDto::getEquipmentId).collect(Collectors.toList());
            result.put("equipmentNameList", equipmentNameList);
        }
        return result;
    }
    @Override
    public Map<String, Object> teamEquipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo) {
        Map<String, Object> result = new HashMap<>();
        // 1. å¤„理生产ID
        List<String> mdcProductionIds = StringUtils.isBlank(equEffVo.getProductionIds())
                ? Collections.singletonList(equEffVo.getProductionId())
                : Arrays.asList(equEffVo.getProductionIds().split(","));
        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
        if (allProductionIds.isEmpty()) {
            return result; // æå‰è¿”回空结果
        }
        //数据权限过滤
        allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
        // 2. èŽ·å–è®¾å¤‡åˆ—è¡¨
        List<MdcEquipment> equipmentList = StringUtils.isNotBlank(equEffVo.getTeamCodes())
                ? mdcEquipmentService.findByProIdsAndTeamCode(allProductionIds, Arrays.asList(equEffVo.getTeamCodes().split(",")))
                : mdcEquipmentService.findByProductionIds(allProductionIds);
        if (equipmentList.isEmpty()) {
            return result;
        }
        // 3. æ•°æ®å¤„理
        List<String> equipmentIdList = equipmentList.stream()
                .map(MdcEquipment::getEquipmentId)
                .collect(Collectors.toList());
        List<TeamEquEffDto> dataList = mdcEfficiencyReportMapper
                .teamEquipmentEfficiencyAnalyze(equipmentIdList, equEffVo.getMonth());
        if (dataList.isEmpty()) {
            return result;
        }
        // 4. åˆ†ç»„计算平均值
        Map<String, TeamEquEffDto> grouped = dataList.stream()
                .collect(Collectors.groupingBy(
                        TeamEquEffDto::getTeamCode,
                        Collectors.collectingAndThen(
                                Collectors.toList(),
                                this::calculateAverages // æå–计算方法
                        )));
        // 5. å­—典转换
        Map<String, String> dictMap = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MDC_STAFF_TEAM)
                .stream()
                .collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
        List<TeamEquEffDto> resultList = grouped.entrySet().stream()
                .map(entry -> buildResultDto(entry, dictMap))// æå–构建方法
                .sorted(Comparator.comparing(TeamEquEffDto::getUtilizationRate).reversed())
                .collect(Collectors.toList());
        result.put("dataList", resultList);
        result.put("teamCodeList", resultList.stream()
                .map(TeamEquEffDto::getTeamCode)
                .collect(Collectors.toList()));
        return result;
    }
    @Override
    public Map<String, Object> teamEfficiencyAnalyzeByMonth(String userId, EquEffVo equEffVo) {
        Map<String, Object> result = new HashMap<>();
        // 1. æ—¥æœŸå¤„理
        LocalDate now = LocalDate.now();
        Date start = DateUtils.toDate(now.plusMonths(-6).toString(), DateUtils.STR_DATE);
        Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE);
        List<String> monthBetween = DateUtils.getMonthBetween(start, end);
        List<String> dateList = monthBetween.stream()
                .map(date -> date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月")
                .collect(Collectors.toList());
        result.put("dateList", dateList);
        // 2. èŽ·å–äº§çº¿æ•°æ®
        List<MdcProduction> mdcProductions = mdcProductionService.findMdcPros(userId, equEffVo.getProductionId());
        // 3. åˆå§‹åŒ–结果集
        List<TeamEquEffMonthDto> utilizationRateList = new ArrayList<>();
        List<TeamEquEffMonthDto> shiftUtilizationRateList = new ArrayList<>();
        List<TeamEquEffMonthDto> amendUtilizationRateList = new ArrayList<>();
        // 4. å¤„理每个产线
        mdcProductions.forEach(mdcProduction -> {
            // 4.1 èŽ·å–ä¸‹çº§äº§çº¿å¹¶è¿‡æ»¤
            List<String> allProductionIds = mdcProductionService.recursionChildren(mdcProduction.getId());
            // æ•°æ®æƒé™è¿‡æ»¤
            allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
            // 4.2 èŽ·å–è®¾å¤‡åˆ—è¡¨
            List<MdcEquipment> equipmentList = mdcEquipmentService.findByProductionIds(allProductionIds);
            if (equipmentList == null || equipmentList.isEmpty()) {
                return;
            }
            //提取id集合
            List<String> equipmentIdList = equipmentList.stream()
                    .map(MdcEquipment::getEquipmentId)
                    .collect(Collectors.toList());
            TeamEquEffMonthDto urDto = new TeamEquEffMonthDto();
            TeamEquEffMonthDto surDto = new TeamEquEffMonthDto();
            TeamEquEffMonthDto aurDto = new TeamEquEffMonthDto();
            urDto.setProductionName(mdcProduction.getProductionName());
            surDto.setProductionName(mdcProduction.getProductionName());
            aurDto.setProductionName(mdcProduction.getProductionName());
            List<TeamEquEffMonthChildDto> urDataList = new ArrayList<>();
            List<TeamEquEffMonthChildDto> surDataList = new ArrayList<>();
            List<TeamEquEffMonthChildDto> aurDataList = new ArrayList<>();
            monthBetween.forEach(date -> {
                TeamEquEffMonthChildDto urCDto = new TeamEquEffMonthChildDto();
                TeamEquEffMonthChildDto surCDto = new TeamEquEffMonthChildDto();
                TeamEquEffMonthChildDto aurCDto = new TeamEquEffMonthChildDto();
                String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
                urCDto.setMonth(month);
                surCDto.setMonth(month);
                aurCDto.setMonth(month);
                List<TeamEquEffDto> dataList = mdcEfficiencyReportMapper.teamEquipmentEfficiencyAnalyze(equipmentIdList, date.replaceAll("-", ""));
                if (dataList != null && !dataList.isEmpty()) {
                    // è®¡ç®—平均值
                    BigDecimal ur = dataList.stream()
                            .map(TeamEquEffDto::getUtilizationRate)
                            .reduce(BigDecimal.ZERO, BigDecimal::add)
                            .divide(BigDecimal.valueOf(dataList.size()), 2, RoundingMode.HALF_UP);
                    //利用率
                    urCDto.setUtilizationRate(ur);
                    //班次利用率
                    BigDecimal sur = dataList.stream()
                            .map(TeamEquEffDto::getShiftUtilizationRate)
                            .reduce(BigDecimal.ZERO, BigDecimal::add)
                            .divide(BigDecimal.valueOf(dataList.size()), 2, RoundingMode.HALF_UP);
                    surCDto.setUtilizationRate(sur);
                    //去除故障24小时利用率
                    BigDecimal aur = dataList.stream()
                            .map(TeamEquEffDto::getAmendUtilizationRate)
                            .reduce(BigDecimal.ZERO, BigDecimal::add)
                            .divide(BigDecimal.valueOf(dataList.size()), 2, RoundingMode.HALF_UP);
                    aurCDto.setUtilizationRate(aur);
                }
                urDataList.add(urCDto);
                surDataList.add(surCDto);
                aurDataList.add(aurCDto);
            });
            urDto.setDataList(urDataList);
            surDto.setDataList(surDataList);
            aurDto.setDataList(aurDataList);
            utilizationRateList.add(urDto);
            shiftUtilizationRateList.add(surDto);
            amendUtilizationRateList.add(aurDto);
        });
        result.put("utilizationRateList", utilizationRateList);
        result.put("shiftUtilizationRateList", shiftUtilizationRateList);
        result.put("amendUtilizationRateList", amendUtilizationRateList);
        return result;
    }
    @Override
    public Map<String, Object> comprehensiveRateAnalyze(String userId, EquEffVo vo) {
        Map<String, Object> result = new HashMap<>();
        // 1. æ—¥æœŸå¤„理
        LocalDate now = LocalDate.now();
        Date start = DateUtils.toDate(now.plusMonths(-12).toString(), DateUtils.STR_DATE);
        Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE);
        List<String> monthBetween = DateUtils.getMonthBetween(start, end);
        List<String> dateList = monthBetween.stream()
                .map(date -> date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月")
                .collect(Collectors.toList());
        result.put("dateList", dateList);
        // 1. å¤„理生产ID
        List<String> mdcProductionIds = StringUtils.isBlank(vo.getProductionIds())
                ? Collections.singletonList(vo.getProductionId())
                : Arrays.asList(vo.getProductionIds().split(","));
        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
        if (allProductionIds.isEmpty()) {
            return result; // æå‰è¿”回空结果
        }
        //数据权限过滤
        allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
        // 2. èŽ·å–è®¾å¤‡åˆ—è¡¨
        List<MdcEquipment> equipmentList = StringUtils.isNotBlank(vo.getEquipmentType())
                ? mdcEquipmentService.findByProIdsAndType(allProductionIds, Arrays.asList(vo.getEquipmentType().split(",")))
                : mdcEquipmentService.findByProductionIds(allProductionIds);
        if (equipmentList.isEmpty()) {
            return result;
        }
        // 3. æ•°æ®å¤„理
        List<String> equipmentIdList = equipmentList.stream()
                .map(MdcEquipment::getEquipmentId)
                .collect(Collectors.toList());
        String startStr = monthBetween.get(0).replaceAll("-", "");
        String endStr = monthBetween.get(monthBetween.size() - 1).replaceAll("-", "");
        List<ComRateDto> comRateDtoList = mdcEfficiencyReportMapper.comprehensiveRateAnalyze(equipmentIdList, startStr, endStr);
        if (comRateDtoList.isEmpty()) {
            return result; // æå‰è¿”回空结果
        }
        List<ComRateDto> dataList = new ArrayList<>();
        Map<String, ComRateDto> map = comRateDtoList.stream().collect(Collectors.toMap(ComRateDto::getTheMonth, comRateDto -> comRateDto));
        monthBetween.forEach(date -> {
            String d = date.replaceAll("-", "");
            String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
            if (map.containsKey(d)) {
                ComRateDto comRateDto = map.get(d);
                comRateDto.setTheMonth(month);
                comRateDto.setUtilizationRate(comRateDto.getUtilizationRate().setScale(2, RoundingMode.HALF_UP));
                comRateDto.setShiftUtilizationRate(comRateDto.getShiftUtilizationRate() != null ? comRateDto.getShiftUtilizationRate().setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                comRateDto.setAmendUtilizationRate(comRateDto.getAmendUtilizationRate().setScale(2, RoundingMode.HALF_UP));
                comRateDto.setProcessLong(comRateDto.getProcessLong().divide(new BigDecimal("3600"), 2, RoundingMode.HALF_UP));
                dataList.add(comRateDto);
            } else {
                ComRateDto comRateDto = new ComRateDto();
                comRateDto.setTheMonth(month);
                dataList.add(comRateDto);
            }
        });
        result.put("dataList", dataList);
        if (StringUtils.isNotBlank(vo.getShiftId())) {
            List<MdcShiftSub> shiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftId, vo.getShiftId()));
            if (shiftSubList == null || shiftSubList.isEmpty()) {
                return result;
            }
            List<String> shiftSubNameList = shiftSubList.stream().map(MdcShiftSub::getShiftSubName).collect(Collectors.toList());
            result.put("shiftSubList", shiftSubNameList);
            List<ComShiftRateDto> comShiftRateDtoList = mdcEfficiencyReportMapper.comprehensiveShiftRateAnalyze(equipmentIdList, startStr, endStr, vo.getShiftId());
            Map<String, List<ComShiftRateDto>> groupMap;
            if (comShiftRateDtoList != null && !comShiftRateDtoList.isEmpty()) {
                groupMap = comShiftRateDtoList.stream().collect(Collectors.groupingBy(ComShiftRateDto::getShiftSub));
            } else {
                groupMap = new HashMap<>();
            }
            List<ComShiftDto> shiftDataList = new ArrayList<>();
            shiftSubList.forEach(mdcShiftSub -> {
                ComShiftDto comShiftDto = new ComShiftDto();
                comShiftDto.setShiftSubName(mdcShiftSub.getShiftSubName());
                if (groupMap.containsKey(mdcShiftSub.getId())) {
                    List<ComShiftRateDto> csrd = groupMap.get(mdcShiftSub.getId());
                    Map<String, ComShiftRateDto> collect = csrd.stream().collect(Collectors.toMap(ComShiftRateDto::getTheMonth, comShiftRateDto -> comShiftRateDto));
                    List<ComShiftChildDto> comShiftChildDtoList = new ArrayList<>();
                    monthBetween.forEach(date -> {
                        String d = date.replaceAll("-", "");
                        String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
                        if (collect.containsKey(d)) {
                            ComShiftRateDto comShiftRateDto = collect.get(d);
                            ComShiftChildDto comShiftChildDto = new ComShiftChildDto();
                            comShiftChildDto.setMonth(month);
                            comShiftChildDto.setUtilizationRate(comShiftRateDto.getUtilizationRate().setScale(2, RoundingMode.HALF_UP));
                            comShiftChildDtoList.add(comShiftChildDto);
                        } else {
                            ComShiftChildDto comShiftChildDto = new ComShiftChildDto();
                            comShiftChildDto.setMonth(month);
                            comShiftChildDtoList.add(comShiftChildDto);
                        }
                    });
                    comShiftDto.setDataList(comShiftChildDtoList);
                } else {
                    List<ComShiftChildDto> comShiftChildDtoList = new ArrayList<>();
                    monthBetween.forEach(date -> {
                        String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
                        ComShiftChildDto comShiftChildDto = new ComShiftChildDto();
                        comShiftChildDto.setMonth(month);
                        comShiftChildDtoList.add(comShiftChildDto);
                    });
                    comShiftDto.setDataList(comShiftChildDtoList);
                }
                shiftDataList.add(comShiftDto);
            });
            result.put("shiftDataList", shiftDataList);
        }
        return result;
    }
//    /**
//     * ç­ç»„各设备综合利用率
//     *
//     * @param equEffVo
//     * @return
//     */
//    @Override
//    public Map<String, Object> equipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo) {
//        Map<String, Object> result = new HashMap<>();
//        List<String> mdcProductionIds = new ArrayList<>();
//        if (StringUtils.isBlank(equEffVo.getProductionIds())) {
//            mdcProductionIds.add(equEffVo.getProductionId());
//        } else {
//            mdcProductionIds.addAll(Arrays.asList(equEffVo.getProductionIds().split(",")));
//        }
//        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
//        //数据权限过滤
//        allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
//        List<MdcEquipment> equipmentList = mdcEquipmentService.findByProductionIds(allProductionIds);
//        if (equipmentList != null && !equipmentList.isEmpty()) {
//            List<String> equipmentIdList = equipmentList.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList());
//            List<EquipmentEfficiencyAnalyzeDto> dataList = mdcEfficiencyReportMapper.equipmentEfficiencyAnalyze(equipmentIdList, equEffVo.getMonth());
//            result.put("dataList", dataList);
//            List<String> equipmentNameList = dataList.stream().map(EquipmentEfficiencyAnalyzeDto::getEquipmentId).collect(Collectors.toList());
//            result.put("equipmentNameList", equipmentNameList);
//        }
//        return result;
//    }
//
//    @Override
//    public Map<String, Object> teamEquipmentEfficiencyAnalyze(String userId, EquEffVo equEffVo) {
//        Map<String, Object> result = new HashMap<>();
//        // 1. å¤„理生产ID
//        List<String> mdcProductionIds = StringUtils.isBlank(equEffVo.getProductionIds())
//                ? Collections.singletonList(equEffVo.getProductionId())
//                : Arrays.asList(equEffVo.getProductionIds().split(","));
//
//        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
//        if (allProductionIds.isEmpty()) {
//            return result; // æå‰è¿”回空结果
//        }
//        //数据权限过滤
//        allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
//        // 2. èŽ·å–è®¾å¤‡åˆ—è¡¨
//        List<MdcEquipment> equipmentList = StringUtils.isNotBlank(equEffVo.getTeamCodes())
//                ? mdcEquipmentService.findByProIdsAndTeamCode(allProductionIds, Arrays.asList(equEffVo.getTeamCodes().split(",")))
//                : mdcEquipmentService.findByProductionIds(allProductionIds);
//
//        if (equipmentList.isEmpty()) {
//            return result;
//        }
//
//        // 3. æ•°æ®å¤„理
//        List<String> equipmentIdList = equipmentList.stream()
//                .map(MdcEquipment::getEquipmentId)
//                .collect(Collectors.toList());
//
//        List<TeamEquEffDto> dataList = mdcEfficiencyReportMapper
//                .teamEquipmentEfficiencyAnalyze(equipmentIdList, equEffVo.getMonth());
//
//        if (dataList.isEmpty()) {
//            return result;
//        }
//
//        // 4. åˆ†ç»„计算平均值
//        Map<String, TeamEquEffDto> grouped = dataList.stream()
//                .collect(Collectors.groupingBy(
//                        TeamEquEffDto::getTeamCode,
//                        Collectors.collectingAndThen(
//                                Collectors.toList(),
//                                this::calculateAverages // æå–计算方法
//                        )));
//
//        // 5. å­—典转换
//        Map<String, String> dictMap = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MDC_STAFF_TEAM)
//                .stream()
//                .collect(Collectors.toMap(DictModel::getValue, DictModel::getText));
//
//        List<TeamEquEffDto> resultList = grouped.entrySet().stream()
//                .map(entry -> buildResultDto(entry, dictMap))// æå–构建方法
//                .sorted(Comparator.comparing(TeamEquEffDto::getUtilizationRate).reversed())
//                .collect(Collectors.toList());
//
//        result.put("dataList", resultList);
//        result.put("teamCodeList", resultList.stream()
//                .map(TeamEquEffDto::getTeamCode)
//                .collect(Collectors.toList()));
//
//        return result;
//
//    }
//
//    @Override
//    public Map<String, Object> teamEfficiencyAnalyzeByMonth(String userId, EquEffVo equEffVo) {
//        Map<String, Object> result = new HashMap<>();
//
//        // 1. æ—¥æœŸå¤„理
//        LocalDate now = LocalDate.now();
//        Date start = DateUtils.toDate(now.plusMonths(-6).toString(), DateUtils.STR_DATE);
//        Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE);
//
//        List<String> monthBetween = DateUtils.getMonthBetween(start, end);
//        List<String> dateList = monthBetween.stream()
//                .map(date -> date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月")
//                .collect(Collectors.toList());
//        result.put("dateList", dateList);
//
//        // 2. èŽ·å–äº§çº¿æ•°æ®
//        List<MdcProduction> mdcProductions = mdcProductionService.findMdcPros(userId, equEffVo.getProductionId());
//
//        // 3. åˆå§‹åŒ–结果集
//        List<TeamEquEffMonthDto> utilizationRateList = new ArrayList<>();
//        List<TeamEquEffMonthDto> shiftUtilizationRateList = new ArrayList<>();
//        List<TeamEquEffMonthDto> amendUtilizationRateList = new ArrayList<>();
//
//        // 4. å¤„理每个产线
//        mdcProductions.forEach(mdcProduction -> {
//            // 4.1 èŽ·å–ä¸‹çº§äº§çº¿å¹¶è¿‡æ»¤
//            List<String> allProductionIds = mdcProductionService.recursionChildren(mdcProduction.getId());
//            // æ•°æ®æƒé™è¿‡æ»¤
//            allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
//            // 4.2 èŽ·å–è®¾å¤‡åˆ—è¡¨
//            List<MdcEquipment> equipmentList = mdcEquipmentService.findByProductionIds(allProductionIds);
//            if (equipmentList == null || equipmentList.isEmpty()) {
//                return;
//            }
//            //提取id集合
//            List<String> equipmentIdList = equipmentList.stream()
//                    .map(MdcEquipment::getEquipmentId)
//                    .collect(Collectors.toList());
//
//            TeamEquEffMonthDto urDto = new TeamEquEffMonthDto();
//            TeamEquEffMonthDto surDto = new TeamEquEffMonthDto();
//            TeamEquEffMonthDto aurDto = new TeamEquEffMonthDto();
//            urDto.setProductionName(mdcProduction.getProductionName());
//            surDto.setProductionName(mdcProduction.getProductionName());
//            aurDto.setProductionName(mdcProduction.getProductionName());
//            List<TeamEquEffMonthChildDto> urDataList = new ArrayList<>();
//            List<TeamEquEffMonthChildDto> surDataList = new ArrayList<>();
//            List<TeamEquEffMonthChildDto> aurDataList = new ArrayList<>();
//
//            monthBetween.forEach(date -> {
//                TeamEquEffMonthChildDto urCDto = new TeamEquEffMonthChildDto();
//                TeamEquEffMonthChildDto surCDto = new TeamEquEffMonthChildDto();
//                TeamEquEffMonthChildDto aurCDto = new TeamEquEffMonthChildDto();
//                String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
//                urCDto.setMonth(month);
//                surCDto.setMonth(month);
//                aurCDto.setMonth(month);
//                List<TeamEquEffDto> dataList = mdcEfficiencyReportMapper.teamEquipmentEfficiencyAnalyze(equipmentIdList, date.replaceAll("-", ""));
//                if (dataList != null && !dataList.isEmpty()) {
//                    // è®¡ç®—平均值
//                    BigDecimal ur = dataList.stream()
//                            .map(TeamEquEffDto::getUtilizationRate)
//                            .reduce(BigDecimal.ZERO, BigDecimal::add)
//                            .divide(BigDecimal.valueOf(dataList.size()), 2, RoundingMode.HALF_UP);
//                    //利用率
//                    urCDto.setUtilizationRate(ur);
//                    //班次利用率
//                    BigDecimal sur = dataList.stream()
//                            .map(TeamEquEffDto::getShiftUtilizationRate)
//                            .reduce(BigDecimal.ZERO, BigDecimal::add)
//                            .divide(BigDecimal.valueOf(dataList.size()), 2, RoundingMode.HALF_UP);
//                    surCDto.setUtilizationRate(sur);
//                    //去除故障24小时利用率
//                    BigDecimal aur = dataList.stream()
//                            .map(TeamEquEffDto::getAmendUtilizationRate)
//                            .reduce(BigDecimal.ZERO, BigDecimal::add)
//                            .divide(BigDecimal.valueOf(dataList.size()), 2, RoundingMode.HALF_UP);
//                    aurCDto.setUtilizationRate(aur);
//                }
//                urDataList.add(urCDto);
//                surDataList.add(surCDto);
//                aurDataList.add(aurCDto);
//            });
//            urDto.setDataList(urDataList);
//            surDto.setDataList(surDataList);
//            aurDto.setDataList(aurDataList);
//            utilizationRateList.add(urDto);
//            shiftUtilizationRateList.add(surDto);
//            amendUtilizationRateList.add(aurDto);
//        });
//        result.put("utilizationRateList", utilizationRateList);
//        result.put("shiftUtilizationRateList", shiftUtilizationRateList);
//        result.put("amendUtilizationRateList", amendUtilizationRateList);
//        return result;
//    }
//
//    @Override
//    public Map<String, Object> comprehensiveRateAnalyze(String userId, EquEffVo vo) {
//        Map<String, Object> result = new HashMap<>();
//        // 1. æ—¥æœŸå¤„理
//        LocalDate now = LocalDate.now();
//        Date start = DateUtils.toDate(now.plusMonths(-12).toString(), DateUtils.STR_DATE);
//        Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE);
//
//        List<String> monthBetween = DateUtils.getMonthBetween(start, end);
//        List<String> dateList = monthBetween.stream()
//                .map(date -> date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月")
//                .collect(Collectors.toList());
//        result.put("dateList", dateList);
//
//        // 1. å¤„理生产ID
//        List<String> mdcProductionIds = StringUtils.isBlank(vo.getProductionIds())
//                ? Collections.singletonList(vo.getProductionId())
//                : Arrays.asList(vo.getProductionIds().split(","));
//
//        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
//        if (allProductionIds.isEmpty()) {
//            return result; // æå‰è¿”回空结果
//        }
//        //数据权限过滤
//        allProductionIds = mdcProductionService.findProIdsByUId(userId, allProductionIds);
//        // 2. èŽ·å–è®¾å¤‡åˆ—è¡¨
//        List<MdcEquipment> equipmentList = StringUtils.isNotBlank(vo.getEquipmentType())
//                ? mdcEquipmentService.findByProIdsAndType(allProductionIds, Arrays.asList(vo.getEquipmentType().split(",")))
//                : mdcEquipmentService.findByProductionIds(allProductionIds);
//
//        if (equipmentList.isEmpty()) {
//            return result;
//        }
//
//        // 3. æ•°æ®å¤„理
//        List<String> equipmentIdList = equipmentList.stream()
//                .map(MdcEquipment::getEquipmentId)
//                .collect(Collectors.toList());
//        String startStr = monthBetween.get(0).replaceAll("-", "");
//        String endStr = monthBetween.get(monthBetween.size() - 1).replaceAll("-", "");
//        List<ComRateDto> comRateDtoList = mdcEfficiencyReportMapper.comprehensiveRateAnalyze(equipmentIdList, startStr, endStr);
//        if (comRateDtoList.isEmpty()) {
//            return result; // æå‰è¿”回空结果
//        }
//        List<ComRateDto> dataList = new ArrayList<>();
//        Map<String, ComRateDto> map = comRateDtoList.stream().collect(Collectors.toMap(ComRateDto::getTheMonth, comRateDto -> comRateDto));
//        monthBetween.forEach(date -> {
//            String d = date.replaceAll("-", "");
//            String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
//            if (map.containsKey(d)) {
//                ComRateDto comRateDto = map.get(d);
//                comRateDto.setTheMonth(month);
//                comRateDto.setUtilizationRate(comRateDto.getUtilizationRate().setScale(2, RoundingMode.HALF_UP));
//                comRateDto.setShiftUtilizationRate(comRateDto.getShiftUtilizationRate() != null ? comRateDto.getShiftUtilizationRate().setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
//                comRateDto.setAmendUtilizationRate(comRateDto.getAmendUtilizationRate().setScale(2, RoundingMode.HALF_UP));
//                comRateDto.setProcessLong(comRateDto.getProcessLong().divide(new BigDecimal("3600"), 2, RoundingMode.HALF_UP));
//                dataList.add(comRateDto);
//            } else {
//                ComRateDto comRateDto = new ComRateDto();
//                comRateDto.setTheMonth(month);
//                dataList.add(comRateDto);
//            }
//        });
//        result.put("dataList", dataList);
//
//        if (StringUtils.isNotBlank(vo.getShiftId())) {
//            List<MdcShiftSub> shiftSubList = mdcShiftSubService.list(new LambdaQueryWrapper<MdcShiftSub>().eq(MdcShiftSub::getShiftId, vo.getShiftId()));
//            if (shiftSubList == null || shiftSubList.isEmpty()) {
//                return result;
//            }
//            List<String> shiftSubNameList = shiftSubList.stream().map(MdcShiftSub::getShiftSubName).collect(Collectors.toList());
//            result.put("shiftSubList", shiftSubNameList);
//
//            List<ComShiftRateDto> comShiftRateDtoList = mdcEfficiencyReportMapper.comprehensiveShiftRateAnalyze(equipmentIdList, startStr, endStr, vo.getShiftId());
//            Map<String, List<ComShiftRateDto>> groupMap;
//            if (comShiftRateDtoList != null && !comShiftRateDtoList.isEmpty()) {
//                groupMap = comShiftRateDtoList.stream().collect(Collectors.groupingBy(ComShiftRateDto::getShiftSub));
//            } else {
//                groupMap = new HashMap<>();
//            }
//            List<ComShiftDto> shiftDataList = new ArrayList<>();
//            shiftSubList.forEach(mdcShiftSub -> {
//                ComShiftDto comShiftDto = new ComShiftDto();
//                comShiftDto.setShiftSubName(mdcShiftSub.getShiftSubName());
//                if (groupMap.containsKey(mdcShiftSub.getId())) {
//                    List<ComShiftRateDto> csrd = groupMap.get(mdcShiftSub.getId());
//                    Map<String, ComShiftRateDto> collect = csrd.stream().collect(Collectors.toMap(ComShiftRateDto::getTheMonth, comShiftRateDto -> comShiftRateDto));
//                    List<ComShiftChildDto> comShiftChildDtoList = new ArrayList<>();
//                    monthBetween.forEach(date -> {
//                        String d = date.replaceAll("-", "");
//                        String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
//                        if (collect.containsKey(d)) {
//                            ComShiftRateDto comShiftRateDto = collect.get(d);
//                            ComShiftChildDto comShiftChildDto = new ComShiftChildDto();
//                            comShiftChildDto.setMonth(month);
//                            comShiftChildDto.setUtilizationRate(comShiftRateDto.getUtilizationRate().setScale(2, RoundingMode.HALF_UP));
//                            comShiftChildDtoList.add(comShiftChildDto);
//                        } else {
//                            ComShiftChildDto comShiftChildDto = new ComShiftChildDto();
//                            comShiftChildDto.setMonth(month);
//                            comShiftChildDtoList.add(comShiftChildDto);
//                        }
//                    });
//                    comShiftDto.setDataList(comShiftChildDtoList);
//                } else {
//                    List<ComShiftChildDto> comShiftChildDtoList = new ArrayList<>();
//                    monthBetween.forEach(date -> {
//                        String month = date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
//                        ComShiftChildDto comShiftChildDto = new ComShiftChildDto();
//                        comShiftChildDto.setMonth(month);
//                        comShiftChildDtoList.add(comShiftChildDto);
//                    });
//                    comShiftDto.setDataList(comShiftChildDtoList);
//                }
//                shiftDataList.add(comShiftDto);
//            });
//
//            result.put("shiftDataList", shiftDataList);
//        }
//
//        return result;
//    }
    // æå–的平均值计算方法
    private TeamEquEffDto calculateAverages(List<TeamEquEffDto> items) {
@@ -2170,9 +2164,9 @@
                    mdcEfficiencyResultDto.setOpenLong(efficiencyDto.getOpenLong());
                    mdcEfficiencyResultDto.setWaitLong(efficiencyDto.getWaitLong());
                    mdcEfficiencyResultDto.setCloseLong(efficiencyDto.getCloseLong());
                    mdcEfficiencyResultDto.setFaultLong(efficiencyDto.getFaultLong());
                    mdcEfficiencyResultDto.setFaultRate(efficiencyDto.getFaultRate());
                    mdcEfficiencyResultDto.setRemoveFaultRunLong(efficiencyDto.getRemoveFaultRunLong());
//                    mdcEfficiencyResultDto.setFaultLong(efficiencyDto.getFaultLong());
//                    mdcEfficiencyResultDto.setFaultRate(efficiencyDto.getFaultRate());
//                    mdcEfficiencyResultDto.setRemoveFaultRunLong(efficiencyDto.getRemoveFaultRunLong());
                    long rate = efficiencyDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -2190,9 +2184,9 @@
            mdcEfficiencyResultDto.setOpenLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setWaitLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setCloseLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setFaultLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setFaultRate(new BigDecimal("0"));
            mdcEfficiencyResultDto.setRemoveFaultRunLong(new BigDecimal("0"));
//            mdcEfficiencyResultDto.setFaultLong(new BigDecimal("0"));
//            mdcEfficiencyResultDto.setFaultRate(new BigDecimal("0"));
//            mdcEfficiencyResultDto.setRemoveFaultRunLong(new BigDecimal("0"));
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) {
                    mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor());
@@ -2208,9 +2202,9 @@
            mdcEfficiencyResultDto.setOpenLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setWaitLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setCloseLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setFaultLong(new BigDecimal("0"));
            mdcEfficiencyResultDto.setFaultRate(new BigDecimal("0"));
            mdcEfficiencyResultDto.setRemoveFaultRunLong(new BigDecimal("0"));
//            mdcEfficiencyResultDto.setFaultLong(new BigDecimal("0"));
//            mdcEfficiencyResultDto.setFaultRate(new BigDecimal("0"));
//            mdcEfficiencyResultDto.setRemoveFaultRunLong(new BigDecimal("0"));
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) {
                    mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor());
@@ -2224,9 +2218,9 @@
        efficiencyResultDto.setOpenLong(efficiencyResultDto.getOpenLong().add(mdcEfficiencyResultDto.getOpenLong()));
        efficiencyResultDto.setWaitLong(efficiencyResultDto.getWaitLong().add(mdcEfficiencyResultDto.getWaitLong()));
        efficiencyResultDto.setCloseLong(efficiencyResultDto.getCloseLong().add(mdcEfficiencyResultDto.getCloseLong()));
        efficiencyResultDto.setFaultLong(efficiencyResultDto.getFaultLong().add(mdcEfficiencyResultDto.getFaultLong()));
        efficiencyResultDto.setFaultRate(efficiencyResultDto.getFaultRate().add(mdcEfficiencyResultDto.getFaultRate()));
        efficiencyResultDto.setRemoveFaultRunLong(efficiencyResultDto.getRemoveFaultRunLong().add(mdcEfficiencyResultDto.getRemoveFaultRunLong()));
//        efficiencyResultDto.setFaultLong(efficiencyResultDto.getFaultLong().add(mdcEfficiencyResultDto.getFaultLong()));
//        efficiencyResultDto.setFaultRate(efficiencyResultDto.getFaultRate().add(mdcEfficiencyResultDto.getFaultRate()));
//        efficiencyResultDto.setRemoveFaultRunLong(efficiencyResultDto.getRemoveFaultRunLong().add(mdcEfficiencyResultDto.getRemoveFaultRunLong()));
        return mdcEfficiencyResultDto;
    }
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentFaultInfoServiceImpl.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -59,15 +59,9 @@
    @Resource
    private MdcEquipmentDepartMapper mdcEquipmentDepartMapper;
    @Resource
    private MdcProductionEquipmentMapper mdcProductionEquipmentMapper;
    @Resource
    private ISysUserDepartService sysUserDepartService;
    @Resource
    private IMdcUserProductionService mdcUserProductionService;
    @Resource
    private ISysDepartService sysDepartService;
    @Resource
    private IMdcProductionService mdcProductionService;
    @Resource
    private IEquipmentWorkLineService equipmentWorkLineService;
    @Resource
@@ -222,15 +216,15 @@
        mdcEquipmentDepartMapper.delete(new LambdaQueryWrapper<MdcEquipmentDepart>().eq(MdcEquipmentDepart::getDepId, departId).in(MdcEquipmentDepart::getEquipmentId, equipmentIdList));
    }
    @Override
    public void removeEquipmentForProduction(String productionId, String equipmentId) {
        mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).eq(MdcProductionEquipment::getEquipmentId, equipmentId));
    }
//    @Override
//    public void removeEquipmentForProduction(String productionId, String equipmentId) {
//        mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).eq(MdcProductionEquipment::getEquipmentId, equipmentId));
//    }
    @Override
    public void removeEquipmentsForProduction(String productionId, List<String> equipmentIdList) {
        mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).in(MdcProductionEquipment::getEquipmentId, equipmentIdList));
    }
//    @Override
//    public void removeEquipmentsForProduction(String productionId, List<String> equipmentIdList) {
//        mdcProductionEquipmentMapper.delete(new LambdaQueryWrapper<MdcProductionEquipment>().eq(MdcProductionEquipment::getProductionId, productionId).in(MdcProductionEquipment::getEquipmentId, equipmentIdList));
//    }
    @Override
    public List<MdcEquipmentTree> loadTreeListByDepart(String userId) {
@@ -703,22 +697,22 @@
        return this.baseMapper.selectPage(page, queryWrapper);
    }
    /**
     * æ ¹æ®çˆ¶çº§id递归查询所有下级id集合
     */
    private List<String> findAllProductions(String key) {
        List<String> productions = new ArrayList<>();
        List<MdcProduction> mdcProductions = mdcProductionService.queryProdByPid(key);
        if (mdcProductions != null && !mdcProductions.isEmpty()) {
            List<String> ids = mdcProductions.stream().map(MdcProduction::getId).collect(Collectors.toList());
            productions.addAll(ids);
            for (MdcProduction mdcProduction : mdcProductions) {
                List<String> allProductions = findAllProductions(mdcProduction.getId());
                productions.addAll(allProductions);
            }
        }
        return productions;
    }
//    /**
//     * æ ¹æ®çˆ¶çº§id递归查询所有下级id集合
//     */
//    private List<String> findAllProductions(String key) {
//        List<String> productions = new ArrayList<>();
//        List<MdcProduction> mdcProductions = mdcProductionService.queryProdByPid(key);
//        if (mdcProductions != null && !mdcProductions.isEmpty()) {
//            List<String> ids = mdcProductions.stream().map(MdcProduction::getId).collect(Collectors.toList());
//            productions.addAll(ids);
//            for (MdcProduction mdcProduction : mdcProductions) {
//                List<String> allProductions = findAllProductions(mdcProduction.getId());
//                productions.addAll(allProductions);
//            }
//        }
//        return productions;
//    }
    /**
     * äº§çº¿è®¾å¤‡æ ‘填充设备数据
@@ -843,7 +837,7 @@
    public IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req) {
        if (StringUtils.isNotBlank(mdcEquipment.getProductionName())) {
            // é€’归查询所有子节点
            List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName());
            List<String> productionIds = factoryService.recursionChildren(mdcEquipment.getProductionName());
            mdcEquipment.setProductionIds(productionIds);
        }
        return this.baseMapper.pageList(page, mdcEquipment);
@@ -919,38 +913,38 @@
    public List<MdcEquipment> exportXlsList(MdcEquipmentVo mdcEquipment) {
        if (StringUtils.isNotBlank(mdcEquipment.getProductionName())) {
            // é€’归查询所有子节点
            List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName());
            List<String> productionIds = factoryService.recursionChildren(mdcEquipment.getProductionName());
            mdcEquipment.setProductionIds(productionIds);
        }
        return this.baseMapper.exportXlsList(mdcEquipment);
    }
    /**
     * é€šè¿‡è½¦é—´ids获取设备树
     *
     * @param ids
     * @return
     */
    @Override
    public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) {
        List<String> productionIds = Arrays.asList(ids.split(","));
        //获取所有产线数据
        List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
        List<String> allProductionIds = new ArrayList<>();
        //找到所有产线id的上级id
        if (!productionIds.isEmpty()) {
            for (String productionId : productionIds) {
                this.getAllProductionIds(productionList, productionId, allProductionIds);
            }
        }
        //过滤产线数据
        List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
        //组装产线设备树
        List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
        //填充设备数据
        FillEquipmentByProduction(treeList);
        return treeList;
    }
//    /**
//     * é€šè¿‡è½¦é—´ids获取设备树
//     *
//     * @param ids
//     * @return
//     */
//    @Override
//    public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) {
//        List<String> productionIds = Arrays.asList(ids.split(","));
//        //获取所有产线数据
//        List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
//        List<String> allProductionIds = new ArrayList<>();
//        //找到所有产线id的上级id
//        if (!productionIds.isEmpty()) {
//            for (String productionId : productionIds) {
//                this.getAllProductionIds(productionList, productionId, allProductionIds);
//            }
//        }
//        //过滤产线数据
//        List<MdcProduction> list = productionList.stream().filter((MdcProduction mdcProduction) -> allProductionIds.contains(mdcProduction.getId())).collect(Collectors.toList());
//        //组装产线设备树
//        List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
//        //填充设备数据
//        FillEquipmentByProduction(treeList);
//        return treeList;
//    }
    /**
     * æŸ¥è¯¢å•表数据
@@ -1061,21 +1055,21 @@
            return this.baseMapper.selectList(new LambdaQueryWrapper<MdcEquipment>().in(MdcEquipment::getEquipmentId, Arrays.asList(user.getEquipmentIds().split(StringPool.COMMA))));
        }
        //获取所有产线数据
        List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
        List<Factory> factoryList = factoryService.list(new LambdaQueryWrapper<Factory>().eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(Factory::getSorter));
        //根据用户id获取拥有的产线信息集合
        List<String> productionIds = mdcUserProductionService.queryProductionIdsByUserId(userId);
        List<String> allProductionIds = new ArrayList<>();
        List<String> factoryIds = userFactoryService.queryFactoryIdsByUserId(userId);
        List<String> allFactoryIds = new ArrayList<>();
        //找到所有产线id的上级id
        if (productionIds != null && !productionIds.isEmpty()) {
            for (String productionId : productionIds) {
                this.getAllProductionIds(productionList, productionId, allProductionIds);
        if (factoryIds != null && !factoryIds.isEmpty()) {
            for (String factoryId : factoryIds) {
                this.getAllFactoryIds(factoryList, factoryId, allFactoryIds);
            }
        }
        //根据产线集合查找所有设备id
        if (allProductionIds.isEmpty()) {
        if (allFactoryIds.isEmpty()) {
            return null;
        }
        List<MdcEquipment> equipmentIds = this.baseMapper.getEquipmentList(allProductionIds);
        List<MdcEquipment> equipmentIds = this.baseMapper.getEquipmentList(allFactoryIds);
        return equipmentIds;
    }
src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -37,8 +37,8 @@
    @Resource
    private IMdcSystemParametersService mdcSystemParametersService;
    @Resource
    private IMdcEquipmentFaultInfoService mdcEquipmentFaultInfoService;
//    @Resource
//    private IMdcEquipmentFaultInfoService mdcEquipmentFaultInfoService;
    /**
     * è®¡ç®—设备单日运行数据
@@ -68,7 +68,7 @@
        if (!result.isEmpty()) {
            this.saveBatch(result);
        }
        mdcEquipmentFaultInfoService.runningAllEquFaultStatistical(dateTime);
//        mdcEquipmentFaultInfoService.runningAllEquFaultStatistical(dateTime);
    }
    private List<MdcEquipmentStatisticalInfo> equipmentStatisticalProcess(Equipment equipment, String dateTime) {
src/main/java/org/jeecg/modules/mdc/service/impl/MdcProductionEquipmentServiceImpl.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/impl/MdcProductionServiceImpl.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/mdc/service/impl/MdcUserProductionServiceImpl.java
ÎļþÒÑɾ³ý
src/main/java/org/jeecg/modules/system/controller/SysUserController.java
@@ -12,7 +12,6 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import liquibase.pro.packaged.I;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
@@ -31,8 +30,6 @@
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.base.service.IUserFactoryService;
import org.jeecg.modules.base.service.IUserGroupService;
import org.jeecg.modules.mdc.model.ProductionIdModel;
import org.jeecg.modules.mdc.service.IMdcUserProductionService;
import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.model.DepartIdModel;
import org.jeecg.modules.base.model.FactoryIdModel;
@@ -108,8 +105,8 @@
    @Resource
    private IUserFactoryService userFactoryService;
    @Resource
    private IMdcUserProductionService userProductionService;
//    @Resource
//    private IMdcUserProductionService userProductionService;
    @Resource
    private IUserGroupService userGroupService;
src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
@@ -7,7 +7,6 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CacheConstant;
@@ -24,8 +23,6 @@
import org.jeecg.modules.base.entity.UserFactory;
import org.jeecg.modules.base.mapper.UserFactoryMapper;
import org.jeecg.modules.base.service.BaseCommonService;
import org.jeecg.modules.mdc.entity.MdcUserProduction;
import org.jeecg.modules.mdc.mapper.MdcUserProductionMapper;
import org.jeecg.modules.system.entity.*;
import org.jeecg.modules.system.mapper.*;
import org.jeecg.modules.system.model.SysUserSysDepartModel;
@@ -85,8 +82,8 @@
    SysRoleIndexMapper sysRoleIndexMapper;
    @Resource
    UserFactoryMapper userFactoryMapper;
    @Resource
    MdcUserProductionMapper mdcUserProductionMapper;
//    @Resource
//    MdcUserProductionMapper mdcUserProductionMapper;
    @Resource
    private ISysDictService sysDictService;