Lius
2025-03-27 b0f56573ea27a8798764314c72cf39e9eb0651dc
综合利用率图表接口
已添加15个文件
已修改26个文件
969 ■■■■■ 文件已修改
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/TeamEquipmentEfficiencyAnalyzeDto.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfoMonth.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMonthMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMonthMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMonthMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMonthMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoMonthService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoMonthService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoMonthServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoMonthServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/TeamEquEffVo.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/controller/MdcProductionController.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/vo/MdcProOptionsVo.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
@@ -593,6 +593,11 @@
    String DICT_EQUIPMENT_RATE_NORMAL = "equipment_rate_normal";
    /**
     * é…é€å°ç»„字典编号
     */
    String DICT_MDC_STAFF_TEAM = "mdc_staff_team";
    /**
     * åŠ ç­æ•°æ® è‡ªåŠ¨è®¡ç®—æ ‡è¯† 1(是) 2(否)
     */
    Integer AUTO_FLAG_Y = 1;
@@ -608,4 +613,6 @@
    String CLOSE_TYPE_0 = "0";
    String CLOSE_TYPE_1 = "1";
    String ORG_TYPE = "3";
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java
@@ -182,4 +182,8 @@
    /**选择系统类型*/
    private transient String systemValue;
    @Dict(dicCode = "mdc_staff_team")
    @ApiModelProperty(value = "配送小组")
    private String teamCode;
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -129,4 +129,6 @@
     * @return
     */
    MdcEquipmentDetailedDto findById(@Param("id") String id);
    List<MdcEquipment> findByProductionIds(@Param("mdcProductionIds") List<String> mdcProductionIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -296,4 +296,16 @@
        ORDER BY me.equipment_id
    </select>
    <select id="findByProductionIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
        SELECT
            t1.*
        FROM
            mdc_equipment t1
                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
        WHERE t2.production_id IN
        <foreach collection="mdcProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
            #{productionId}
        </foreach>
    </select>
</mapper>
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -216,4 +216,11 @@
     * @param productionId
     */
    void addNewEquipmentFromEam(MdcEquipment mdcEquipment, String productionId);
    /**
     * æ ¹æ®äº§çº¿id集合查询设备列表
     * @param mdcProductionIds
     * @return
     */
    List<MdcEquipment> findByProductionIds(List<String> mdcProductionIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1010,4 +1010,14 @@
        this.saveMdcEquipment(mdcEquipment, null, productionId);
    }
    /**
     * æ ¹æ®äº§çº¿id集合查询设备列表
     * @param mdcProductionIds
     * @return
     */
    @Override
    public List<MdcEquipment> findByProductionIds(List<String> mdcProductionIds) {
        return this.baseMapper.findByProductionIds(mdcProductionIds);
    }
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java
@@ -164,6 +164,7 @@
    public static final String STR_DATE = "yyyy-MM-dd";
    public static final String STRDATE = "yyyyMMdd";
    public static final String STR_YEAR_MONTH = "yyyy-MM";
    public static final String STRYEARMONTH = "yyyyMM";
    public static final String STR_DATE_TIME = "yyyy-MM-dd HH:mm:ss.SSS";
    public static final String STR_DATE_TIME_SMALL = "yyyy-MM-dd HH:mm:ss";
    public static final String STR_DATE_TIME_MIN = "yyyy-MM-dd HH:mm";
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEfficiencyReportController.java
@@ -13,9 +13,11 @@
import org.jeecg.modules.mdc.vo.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
/**
 * @author: LiuS
@@ -30,7 +32,6 @@
    @Resource
    private MdcEfficiencyReportService mdcEfficiencyReportService;
    @AutoLog(value = "设备效率报表-利用率列表查询")
    @ApiOperation(value = "设备效率报表-利用率列表查询", notes = "设备效率报表-利用率列表查询")
    @GetMapping("/efficiencyList")
    public Result efficiencyList(MdcEfficiencyReportQueryVo vo) {
@@ -40,7 +41,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-开动率列表查询")
    @ApiOperation(value = "设备效率报表-开动率列表查询", notes = "设备效率报表-开动率列表查询")
    @GetMapping("/efficiencyPOList")
    public Result efficiencyPOList(MdcEfficiencyReportQueryVo vo) {
@@ -50,7 +50,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-班次利用率列表查询")
    @ApiOperation(value = "设备效率报表-班次利用率列表查询", notes = "设备效率报表-班次利用率列表查询")
    @GetMapping("/efficiencyShiftList")
    public Result efficiencyShiftList(MdcEfficiencyReportShiftQueryVo vo) {
@@ -60,7 +59,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-统计分析列表")
    @ApiOperation(value = "设备效率报表-统计分析列表", notes = "设备效率报表-统计分析列表")
    @GetMapping("/dayStatisticalRate")
    public Result dayStatisticalRate(MdcEfficiencyReportQueryVo vo) {
@@ -70,7 +68,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-对比分析")
    @ApiOperation(value = "设备效率报表-对比分析", notes = "设备效率报表-对比分析")
    @GetMapping("/comparativeAnalysis")
    public Result comparativeAnalysis(ComparativeAnalysisQueryVo vo) {
@@ -80,7 +77,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-设备日利用率")
    @ApiOperation(value = "设备效率报表-设备日利用率", notes = "设备效率报表-设备日利用率")
    @GetMapping("/dayUtilizationRate")
    public Result dayUtilizationRate(DayUtilizationRateQueryVo vo) {
@@ -90,7 +86,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-设备日利用率对比")
    @ApiOperation(value = "设备效率报表-设备日利用率对比", notes = "设备效率报表-设备日利用率对比")
    @GetMapping("/dayUtilizationRateContrast")
    public Result dayUtilizationRateContrast(DayUtilizationRateContrastQueryVo vo) {
@@ -100,7 +95,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-利用率走势分析列表")
    @ApiOperation(value = "设备效率报表-利用率走势分析列表", notes = "设备效率报表-利用率走势分析列表")
    @GetMapping("/utilizationRateTrendAnalyze")
    public Result utilizationRateTrendAnalyze(DayUtilizationRateContrastQueryVo vo) {
@@ -110,7 +104,6 @@
        return Result.OK(result);
    }
    @AutoLog(value = "设备效率报表-利用率分段分析列表")
    @ApiOperation(value = "设备效率报表-利用率分段分析列表", notes = "设备效率报表-利用率分段分析列表")
    @GetMapping("/utilizationRateSectionAnalyze")
    public Result utilizationRateSectionAnalyze(DayUtilizationRateContrastQueryVo vo) {
@@ -120,4 +113,36 @@
        return Result.OK(result);
    }
//    @ApiOperation(value = "设备效率报表-综合利用率统计分析", notes = "设备效率报表-综合利用率统计分析")
//    @GetMapping("/comprehensiveRayeAnalyze")
//    public Result comprehensiveRayeAnalyze(DayUtilizationRateContrastQueryVo vo) {
//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        String userId = user.getId();
//        MdcUtilizationRateDto result = mdcEfficiencyReportService.comprehensiveRayeAnalyze(userId, vo);
//        return Result.OK(result);
//    }
//    @ApiOperation(value = "设备效率报表-班组综合利用率统计分析", notes = "设备效率报表-综合利用率统计分析")
//    @GetMapping("/teamComprehensiveRateAnalyze")
//    public Result teamComprehensiveRateAnalyze(DayUtilizationRateContrastQueryVo vo) {
//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        String userId = user.getId();
//        MdcUtilizationRateDto result = mdcEfficiencyReportService.teamComprehensiveRateAnalyze(userId, vo);
//        return Result.OK(result);Equipment utilization distribution of each team
//    }
//    @ApiOperation(value = "设备效率报表-配送小组维度各班组月设备利用分布", notes = "设备效率报表-配送小组维度各班组月设备利用分布")
//    @GetMapping("/teamEquipmentEfficiencyAnalyze")
//    public Result teamEquipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo) {
//        Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(teamEquEffVo);
//        return Result.OK(result);
//    }
    @ApiOperation(value = "设备效率报表-设备维度各班组月设备利用分布", notes = "设备效率报表-设备维度各班组月设备利用分布")
    @GetMapping("/equipmentEfficiencyAnalyze")
    public Result<?> equipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo) {
        Map<String, Object> result = mdcEfficiencyReportService.teamEquipmentEfficiencyAnalyze(teamEquEffVo);
        return Result.OK(result);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -13,7 +13,6 @@
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.mdc.model.MdcEquipmentTree;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
package org.jeecg.modules.mdc.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-03-25
 * @Description:
 */
@Data
public class MdcEquipmentStatisticalDto {
    /**
     * å¼€æœºæ—¶é•¿
     */
    private BigDecimal openLong = new BigDecimal("0");
    /**
     * å¾…机时长
     */
    private BigDecimal waitLong = new BigDecimal("0");
    /**
     * åŠ å·¥æ—¶é•¿
     */
    private BigDecimal processLong = new BigDecimal("0");
    /**
     * æŠ¥è­¦
     */
    private BigDecimal errorLong = new BigDecimal("0");
    /**
     * å…³æœºæ—¶é•¿
     */
    private BigDecimal closeLong = new BigDecimal("0");
    /**
     * æ€»æ—¶é•¿
     */
    private BigDecimal totalLong = new BigDecimal("0");
    /**
     * å¤©æ•°
     */
    private BigDecimal dayNum;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/TeamEquipmentEfficiencyAnalyzeDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
package org.jeecg.modules.mdc.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-03-26
 * @Description:
 */
@Data
public class TeamEquipmentEfficiencyAnalyzeDto {
    private String equipmentName;
    /**
     * åˆ©ç”¨çއ
     */
    private BigDecimal utilizationRate = BigDecimal.ZERO;
    /**
     * ç­æ¬¡åˆ©ç”¨çއ
     */
    private BigDecimal shiftUtilizationRate = BigDecimal.ZERO;
    /**
     * ä¿®æ­£åˆ©ç”¨çއ
     */
    private BigDecimal amendUtilizationRate = BigDecimal.ZERO;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,106 @@
package org.jeecg.modules.mdc.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @Description: æœˆè®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
@Data
@TableName("mdc_equipment_statistical_info_month")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "mdc_equipment_statistical_info_month对象", description = "月设备运行数据表")
public class MdcEquipmentStatisticalInfoMonth implements Serializable {
    /**
     * ä¸»é”®
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * è®¾å¤‡id
     */
    @Excel(name = "设备id", width = 15)
    @ApiModelProperty(value = "设备id")
    private String equipmentId;
    /**
     * æœ‰æ•ˆæœˆä»½
     */
    @Excel(name = "有效月份", width = 15)
    @ApiModelProperty(value = "有效月份")
    private String theMonth;
    /**
     * å¼€æœºæ—¶é•¿
     */
    @Excel(name = "开机时长", width = 15)
    @ApiModelProperty(value = "开机时长")
    private Integer openLong;
    /**
     * å…³æœºæ—¶é•¿
     */
    @Excel(name = "关机时长", width = 15)
    @ApiModelProperty(value = "关机时长")
    private Integer closeLong;
    /**
     * å¾…机时长
     */
    @Excel(name = "待机时长", width = 15)
    @ApiModelProperty(value = "待机时长")
    private Integer waitLong;
    /**
     * åŠ å·¥æ—¶é•¿
     */
    @Excel(name = "加工时长", width = 15)
    @ApiModelProperty(value = "加工时长")
    private Integer processLong;
    /**
     * æŠ¥è­¦æ—¶é•¿
     */
    @Excel(name = "报警时长", width = 15)
    @ApiModelProperty(value = "报警时长")
    private Integer errorLong;
    /**
     * åˆ©ç”¨çއ
     */
    @Excel(name = "利用率", width = 15)
    @ApiModelProperty(value = "利用率")
    private BigDecimal utilizationRate;
    /**
     * å¼€åŠ¨çŽ‡
     */
    @Excel(name = "开动率", width = 15)
    @ApiModelProperty(value = "开动率")
    private BigDecimal startRate;
    /**
     * å¼€æœºçއ
     */
    @Excel(name = "开机率", width = 15)
    @ApiModelProperty(value = "开机率")
    private BigDecimal openRate;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalShiftInfoMonth.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
package org.jeecg.modules.mdc.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @Description: æœˆç­æ¬¡è®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
@Data
@TableName("mdc_equipment_statistical_shift_info_month")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "mdc_equipment_statistical_shift_info_month对象", description = "月班次设备运行数据表")
public class MdcEquipmentStatisticalShiftInfoMonth implements Serializable {
    /**
     * ä¸»é”®
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * è®¾å¤‡id
     */
    @Excel(name = "设备id", width = 15)
    @ApiModelProperty(value = "设备id")
    private String equipmentId;
    /**
     * æœ‰æ•ˆæœˆä»½
     */
    @Excel(name = "有效月份", width = 15)
    @ApiModelProperty(value = "有效月份")
    private String theMonth;
    /**
     * å…³æœºæ—¶é•¿
     */
    @Excel(name = "关机时长", width = 15)
    @ApiModelProperty(value = "关机时长")
    private Integer closeLong;
    /**
     * å¼€æœºæ—¶é•¿
     */
    @Excel(name = "开机时长", width = 15)
    @ApiModelProperty(value = "开机时长")
    private Integer openLong;
    /**
     * æŠ¥è­¦æ—¶é•¿
     */
    @Excel(name = "报警时长", width = 15)
    @ApiModelProperty(value = "报警时长")
    private Integer errorLong;
    /**
     * å¾…机时长
     */
    @Excel(name = "待机时长", width = 15)
    @ApiModelProperty(value = "待机时长")
    private Integer waitLong;
    /**
     * åŠ å·¥æ—¶é•¿
     */
    @Excel(name = "加工时长", width = 15)
    @ApiModelProperty(value = "加工时长")
    private Integer processLong;
    /**
     * æœ‰æ•ˆæ—¶é•¿
     */
    @Excel(name = "有效时长", width = 15)
    @ApiModelProperty(value = "有效时长")
    private Integer totalLong;
    /**
     * åˆ©ç”¨çއ
     */
    @Excel(name = "利用率", width = 15)
    @ApiModelProperty(value = "利用率")
    private BigDecimal utilizationRate;
    /**
     * å¼€åŠ¨çŽ‡
     */
    @Excel(name = "开动率", width = 15)
    @ApiModelProperty(value = "开动率")
    private BigDecimal startRate;
    /**
     * å¼€æœºçއ
     */
    @Excel(name = "开机率", width = 15)
    @ApiModelProperty(value = "开机率")
    private BigDecimal openRate;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,147 @@
package org.jeecg.modules.mdc.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.util.ThrowableUtil;
import org.jeecg.modules.quartz.entity.QuartzJob;
import org.jeecg.modules.quartz.entity.SysQuartzLog;
import org.jeecg.modules.quartz.service.IQuartzJobService;
import org.jeecg.modules.quartz.service.ISysQuartzLogService;
import org.jeecg.modules.system.service.ISysAnnouncementService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * @Author: Lius
 * @CreateTime: 2025-03-24
 * @Description: ç»Ÿè®¡æœˆæ±‡æ€»æ•°æ®
 */
@Slf4j
public class CollectEquipmentDataMonthJob implements Job {
    /**
     * è‹¥å‚数变量名修改 QuartzJobController中也需对应修改  æ—¶é—´ï¼š yyyyMMdd ä¾‹ï¼š 20230414
     */
    private String parameter;
    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private ISysAnnouncementService sysAnnouncementService;
    @Resource
    private ISysQuartzLogService sysQuartzLogService;
    @Resource
    private IMdcEquipmentStatisticalInfoMonthService mdcEquipmentStatisticalInfoMonthService;
    @Resource
    private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
    @Resource
    private IMdcEquipmentStatisticalShiftInfoMonthService mdcEquipmentStatisticalShiftInfoMonthService;
    @Resource
    private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        SysQuartzLog quartzLog = new SysQuartzLog();
        quartzLog.setCreateTime(new Date());
        List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName());
        if (byJobClassName != null && !byJobClassName.isEmpty()) {
            quartzLog.setJobId(byJobClassName.get(0).getId());
        }
        quartzLog.setParams(this.parameter);
        log.info(String.format("统计月汇总数据 param: %s CollectEquipmentDataMonthJob start!  æ—¶é—´:" + DateUtils.getNow(), this.parameter));
        long startTime = System.currentTimeMillis();
        try {
            String date = "";
            if (StringUtils.isNotBlank(this.parameter)) {
                date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRYEARMONTH), DateUtils.STRYEARMONTH);
            } else {
                date = DateUtils.format(DateUtils.getNow(), DateUtils.STRYEARMONTH);
            }
            mdcEquipmentStatisticalInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalInfoMonth>().eq(MdcEquipmentStatisticalInfoMonth::getTheMonth, date));
            mdcEquipmentStatisticalShiftInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfoMonth>().eq(MdcEquipmentStatisticalShiftInfoMonth::getTheMonth, date));
            // step.1 èŽ·å–è®¾å¤‡åˆ—è¡¨
            List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list();
            List<MdcEquipmentStatisticalInfoMonth> mdcEquipmentStatisticalInfoMonthList = new ArrayList<>();
            List<MdcEquipmentStatisticalShiftInfoMonth> mdcEquipmentStatisticalShiftInfoMonthList = new ArrayList<>();
            if (mdcEquipmentList != null && !mdcEquipmentList.isEmpty()) {
                for (MdcEquipment mdcEquipment : mdcEquipmentList) {
                    // step.2 æ±‡æ€»24小时利用率数据
                    MdcEquipmentStatisticalDto mdcEquipmentStatisticalDto = mdcEquipmentStatisticalInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
                    MdcEquipmentStatisticalInfoMonth mdcEquipmentStatisticalInfoMonth = new MdcEquipmentStatisticalInfoMonth();
                    mdcEquipmentStatisticalInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcEquipmentStatisticalInfoMonth.setTheMonth(date);
                    mdcEquipmentStatisticalInfoMonth.setCloseLong(mdcEquipmentStatisticalDto.getCloseLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setErrorLong(mdcEquipmentStatisticalDto.getErrorLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setOpenLong(mdcEquipmentStatisticalDto.getOpenLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setProcessLong(mdcEquipmentStatisticalDto.getProcessLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setWaitLong(mdcEquipmentStatisticalDto.getWaitLong().intValue());
                    mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                    mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("86400").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                    mdcEquipmentStatisticalInfoMonthList.add(mdcEquipmentStatisticalInfoMonth);
                    // step.3 æ±‡æ€»ç­æ¬¡åˆ©ç”¨çŽ‡æ•°æ®
                    MdcEquipmentStatisticalDto mdcEquipmentShiftStatisticalDto = mdcEquipmentStatisticalShiftInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
                    MdcEquipmentStatisticalShiftInfoMonth mdcEquipmentShiftInfoMonth = new MdcEquipmentStatisticalShiftInfoMonth();
                    mdcEquipmentShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcEquipmentShiftInfoMonth.setTheMonth(date);
                    mdcEquipmentShiftInfoMonth.setCloseLong(mdcEquipmentShiftStatisticalDto.getCloseLong().intValue());
                    mdcEquipmentShiftInfoMonth.setTotalLong(mdcEquipmentShiftStatisticalDto.getTotalLong().intValue());
                    mdcEquipmentShiftInfoMonth.setOpenLong(mdcEquipmentShiftStatisticalDto.getOpenLong().intValue());
                    mdcEquipmentShiftInfoMonth.setErrorLong(mdcEquipmentShiftStatisticalDto.getErrorLong().intValue());
                    mdcEquipmentShiftInfoMonth.setWaitLong(mdcEquipmentShiftStatisticalDto.getWaitLong().intValue());
                    mdcEquipmentShiftInfoMonth.setProcessLong(mdcEquipmentShiftStatisticalDto.getProcessLong().intValue());
                    mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth);
                }
            }
            if (!mdcEquipmentStatisticalInfoMonthList.isEmpty()) {
                mdcEquipmentStatisticalInfoMonthService.saveBatch(mdcEquipmentStatisticalInfoMonthList);
            }
            if (!mdcEquipmentStatisticalShiftInfoMonthList.isEmpty()) {
                mdcEquipmentStatisticalShiftInfoMonthService.saveBatch(mdcEquipmentStatisticalShiftInfoMonthList);
            }
            quartzLog.setIsSuccess(0);
        } catch (Exception e) {
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
            // å‘送消息通知
            sysAnnouncementService.jobSendMessage("统计月汇总数据", quartzLog.getExceptionDetail());
        }
        long endTime = System.currentTimeMillis();
        quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
        sysQuartzLogService.save(quartzLog);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEfficiencyReportMapper.java
@@ -7,6 +7,7 @@
import org.jeecg.modules.mdc.vo.ComparativeAnalysisQueryVo;
import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo;
import org.jeecg.modules.mdc.vo.MdcEfficiencyReportShiftQueryVo;
import org.jeecg.modules.mdc.dto.TeamEquipmentEfficiencyAnalyzeDto;
import java.math.BigDecimal;
import java.util.List;
@@ -50,4 +51,6 @@
    List<MdcComAnaDto> comparativeAnalysis(@Param("vo") ComparativeAnalysisQueryVo vo);
    List<BigDecimal> getEfficiencyRate(@Param("equipmentId") String equipmentId, @Param("date") String date);
    List<TeamEquipmentEfficiencyAnalyzeDto> teamEquipmentEfficiencyAnalyze(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
/**
@@ -25,4 +26,6 @@
     * @return
     */
    Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMonthMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package org.jeecg.modules.mdc.mapper;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * @Description: æœˆè®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
public interface MdcEquipmentStatisticalInfoMonthMapper extends BaseMapper<MdcEquipmentStatisticalInfoMonth> {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo;
import java.math.BigDecimal;
@@ -21,4 +22,6 @@
    MdcEquipmentStatisticalShiftInfo getMaxStaticsData(@Param("equipmentId") String equipmentid);
    BigDecimal findSpindleRunDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMonthMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package org.jeecg.modules.mdc.mapper;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * @Description: æœˆç­æ¬¡è®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
public interface MdcEquipmentStatisticalShiftInfoMonthMapper extends BaseMapper<MdcEquipmentStatisticalShiftInfoMonth> {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -186,4 +186,24 @@
            equipment_id = #{ equipmentId } AND the_date &gt;= #{ date }
        ORDER BY the_date ASC
    </select>
    <select id="teamEquipmentEfficiencyAnalyze" resultType="org.jeecg.modules.mdc.dto.TeamEquipmentEfficiencyAnalyzeDto">
        SELECT
            t3.equipment_name,
            t1.utilization_rate AS utilizationRate,
            t2.utilization_rate AS shiftUtilizationRate
        FROM
            mdc_equipment_statistical_info_month t1
                LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month
                AND t1.equipment_id = t2.equipment_id
                LEFT JOIN mdc_equipment t3 ON t3.equipment_id = t1.equipment_id
        WHERE
            t1.equipment_id IN
            <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
          AND t1.the_month = #{month}
        ORDER BY
            t1.utilization_rate DESC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml
@@ -12,4 +12,18 @@
    <select id="selectProcessLong" resultType="java.lang.Integer">
        SELECT TOP 1 process_long FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate}
    </select>
    <select id="findByEquipmentAndMonth" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto">
        SELECT
            SUM(open_long) openLong,
            SUM(close_long) closeLong,
            SUM(wait_long) waitLong,
            SUM(process_long) processLong,
            SUM(error_long) errorLong,
            COUNT(*) dayNum
        FROM
            mdc_equipment_statistical_info
        WHERE
            equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%')
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMonthMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMonthMapper">
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml
@@ -17,4 +17,18 @@
            equipment_id = #{ equipmentId }
            AND the_date LIKE CONCAT(#{ validDate },'%')
    </select>
    <select id="findByEquipmentAndMonth" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto">
        SELECT
            SUM(open_long) openLong,
            SUM(close_long) closeLong,
            SUM(wait_long) waitLong,
            SUM(process_long) processLong,
            SUM(error_long) errorLong,
            SUM ( total_long ) totalLong
        FROM
            mdc_equipment_statistical_shift_info
        WHERE
            equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%')
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMonthMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalShiftInfoMonthMapper">
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoMonthService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package org.jeecg.modules.mdc.service;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * @Description: æœˆè®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
public interface IMdcEquipmentStatisticalInfoMonthService extends IService<MdcEquipmentStatisticalInfoMonth> {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
@@ -1,5 +1,6 @@
package org.jeecg.modules.mdc.service;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -26,4 +27,6 @@
     * @return
     */
    Integer selectProcessLong(String equipmentId, String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoMonthService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package org.jeecg.modules.mdc.service;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * @Description: æœˆç­æ¬¡è®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
public interface IMdcEquipmentStatisticalShiftInfoMonthService extends IService<MdcEquipmentStatisticalShiftInfoMonth> {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.mdc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo;
import java.math.BigDecimal;
@@ -28,4 +29,5 @@
     */
    BigDecimal findSpindleRunDuration(String equipmentId, String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/MdcEfficiencyReportService.java
@@ -6,6 +6,7 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
 * @author: LiuS
@@ -102,4 +103,6 @@
     * @return
     */
    List<BigDecimal> getEfficiencyRate(String equipmentId, String date);
    Map<String, Object> teamEquipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -448,7 +448,7 @@
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            result.setMdcEfficiencyList(listDtos);
        } else {
            List<String> equipmentIdList = mdcEquipmentService.listEquipmentId(vo);
            if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
                vo.setEquipmentIdList(equipmentIdList);
@@ -1736,6 +1736,33 @@
        return mdcEfficiencyReportMapper.getEfficiencyRate(equipmentId, date);
    }
    /**
     * ç­ç»„各设备综合利用率
     *
     * @param teamEquEffVo
     * @return
     */
    @Override
    public Map<String, Object> teamEquipmentEfficiencyAnalyze(TeamEquEffVo teamEquEffVo) {
        Map<String, Object> result = new HashMap<>();
        List<String> mdcProductionIds = new ArrayList<>();
        if (StringUtils.isEmpty(teamEquEffVo.getProductionIds())) {
            mdcProductionIds.add(teamEquEffVo.getProductionId());
        } else {
            mdcProductionIds.addAll(Arrays.asList(teamEquEffVo.getProductionIds().split(",")));
        }
        List<String> allProductionIds = mdcProductionService.findChildren(mdcProductionIds);
        List<MdcEquipment> equipmentList = mdcEquipmentService.findByProductionIds(allProductionIds);
        if (equipmentList != null && !equipmentList.isEmpty()) {
            List<String> equipmentIdList = equipmentList.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList());
            List<TeamEquipmentEfficiencyAnalyzeDto> dataList = mdcEfficiencyReportMapper.teamEquipmentEfficiencyAnalyze(equipmentIdList, teamEquEffVo.getMonth());
            result.put("dataList", dataList);
            List<String> equipmentNameList = dataList.stream().map(TeamEquipmentEfficiencyAnalyzeDto::getEquipmentName).collect(Collectors.toList());
            result.put("equipmentNameList", equipmentNameList);
        }
        return result;
    }
    private MdcUtilizationResultDto utilizationRate(String equipmentId, String equipmentName, String equipmentType, Date startTime, Date endTime, String date, List<MdcUtilizationRate> mdcUtilizationRateList) {
        MdcUtilizationResultDto dto = new MdcUtilizationResultDto();
        dto.setEquipmentId(equipmentId);
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoMonthServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package org.jeecg.modules.mdc.service.impl;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfoMonth;
import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMonthMapper;
import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoMonthService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * @Description: æœˆè®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
@Service
public class MdcEquipmentStatisticalInfoMonthServiceImpl extends ServiceImpl<MdcEquipmentStatisticalInfoMonthMapper, MdcEquipmentStatisticalInfoMonth> implements IMdcEquipmentStatisticalInfoMonthService {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.*;
import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper;
import org.jeecg.modules.mdc.service.*;
@@ -317,4 +318,9 @@
            return Integer.parseInt(new BigDecimal(processLong).divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP).toString());
        }
    }
    @Override
    public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) {
        return this.baseMapper.findByEquipmentAndMonth(equipmentId, date);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoMonthServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package org.jeecg.modules.mdc.service.impl;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfoMonth;
import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalShiftInfoMonthMapper;
import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalShiftInfoMonthService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * @Description: æœˆç­æ¬¡è®¾å¤‡è¿è¡Œæ•°æ®è¡¨
 * @Author: Lius
 * @Date: 2025-03-25
 * @Version: V1.0
 */
@Service
public class MdcEquipmentStatisticalShiftInfoMonthServiceImpl extends ServiceImpl<MdcEquipmentStatisticalShiftInfoMonthMapper, MdcEquipmentStatisticalShiftInfoMonth> implements IMdcEquipmentStatisticalShiftInfoMonthService {
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.Equipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentRepair;
import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection;
@@ -93,8 +94,13 @@
        }
    }
    @Override
    public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) {
        return this.baseMapper.findByEquipmentAndMonth(equipmentId, date);
    }
    @Transactional(readOnly = true)
    List<MdcEquipmentStatisticalShiftInfo> equipmentShiftStatisticalProcess(Equipment equipment, String dateTime) {
    public List<MdcEquipmentStatisticalShiftInfo> equipmentShiftStatisticalProcess(Equipment equipment, String dateTime) {
        Date initDate = null;
        //取最后的统计数据
        if (StringUtils.isBlank(dateTime)) {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/TeamEquEffVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package org.jeecg.modules.mdc.vo;
import lombok.Data;
/**
 * @Author: Lius
 * @CreateTime: 2025-03-27
 * @Description:
 */
@Data
public class TeamEquEffVo {
    /**
     * ä¸­å¿ƒ
     */
    private String productionId;
    /**
     * ç­ç»„ids
     */
    private String productionIds;
    /**
     * æœˆä»½
     */
    private String month;
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/controller/MdcProductionController.java
@@ -19,6 +19,7 @@
import org.jeecg.modules.system.model.MdcProductionTreeModel;
import org.jeecg.modules.system.model.ProductionIdModel;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.vo.MdcProOptionsVo;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -321,4 +322,36 @@
        return super.importExcel(request, response, MdcProduction.class);
    }
    @ApiOperation(value = "产线表-根据用户id获取MDC产线(中心)或班组下拉选项", notes = "产线表-根据用户id获取MDC产线(中心)或班组下拉选项")
    @GetMapping(value = "/loadProductionOptions")
    public Result<?> loadProductionOptions(String productionId) {
        Result<List<MdcProOptionsVo>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        try {
            List<MdcProOptionsVo> list = mdcProductionService.loadProductionOptions(userId, productionId);
            result.setSuccess(true);
            result.setResult(list);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
    @ApiOperation(value = "产线表-根据班组id获取配送组下拉选项", notes = "产线表-根据班组id获取配送组下拉选项")
    @GetMapping(value = "/loadTeamOptions")
    public Result<?> loadTeamOptions(@RequestParam(name = "productionId", required = true) String productionId) {
        Result<List<MdcProOptionsVo>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        try {
            List<MdcProOptionsVo> list = mdcProductionService.loadTeamOptions(userId, productionId);
            result.setSuccess(true);
            result.setResult(list);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -53,4 +53,10 @@
     * @return
     */
    List<MdcProduction> findAllProductionId(@Param("userId") String userId);
    List<String> findChildren(@Param("mdcProductionIds") List<String> mdcProductionIds);
    List<MdcProduction> loadProductionOptions(@Param("userId") String userId, @Param("productionId") String productionId);
    List<String> findTeamValue(@Param("userId") String userId, @Param("productionList") List<String> productionList);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -42,6 +42,7 @@
            t3.id = #{userId}
          AND t1.org_type = '3'
    </select>
    <select id="recursionChildrenByList" resultType="java.lang.String">
        WITH temp (id) AS (
            -- åˆå§‹æŸ¥è¯¢ï¼ŒèŽ·å–æŒ‡å®š id çš„记录
@@ -68,4 +69,59 @@
        FROM
            temp;
    </select>
    <select id="findChildren" resultType="java.lang.String">
        WITH temp ( id ) AS (
            SELECT
                id
            FROM
                mdc_production
            WHERE
                id IN
            <foreach collection="mdcProductionIds" item = "id" index = "index" open = "(" close = ")" separator = ",">
                #{id}
            </foreach>
            AND mdc_flag = '1' UNION ALL
            SELECT
                a.id
            FROM
                mdc_production a
                    INNER JOIN temp ON a.parent_id = temp.id
            WHERE
                a.mdc_flag = '1'
        ) SELECT
            *
        FROM
            temp
    </select>
    <select id="loadProductionOptions" resultType="org.jeecg.modules.system.entity.MdcProduction">
        SELECT
            t1.*
        FROM
            mdc_production t1
                LEFT JOIN mdc_user_production t2 ON t1.id = t2.pro_id
        WHERE
            t2.user_id = #{userId} AND t1.mdc_flag = '1'
        <choose>
            <when test="productionId != null and productionId != ''">
                AND t1.org_type = '3' AND t1.parent_id = #{productionId}
            </when>
            <otherwise>
                AND t1.org_type = '2'
            </otherwise>
        </choose>
    </select>
    <select id="findTeamValue" resultType="java.lang.String">
        SELECT DISTINCT
            t1.team_code deamCode
        FROM
            mdc_equipment t1
            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
        WHERE t2.production_id IN
        <foreach collection="productionList" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
            #{productionId}
        </foreach>
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -4,6 +4,7 @@
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.model.MdcProductionTreeModel;
import org.jeecg.modules.system.model.ProductionIdModel;
import org.jeecg.modules.system.vo.MdcProOptionsVo;
import java.util.List;
import java.util.Map;
@@ -141,4 +142,27 @@
     * æŸ¥è¯¢æ‰€æœ‰äº§çº¿ä¿¡æ¯ï¼Œå¹¶åˆ†èŠ‚ç‚¹è¿›è¡Œæ˜¾ç¤º
     */
    List<MdcProductionTreeModel> queryTreeListByMdc();
    /**
     * æŸ¥è¯¢å­èŠ‚ç‚¹
     * @param mdcProductionIds
     * @return
     */
    List<String> findChildren(List<String> mdcProductionIds);
    /**
     * æ ¹æ®ç”¨æˆ·id获取产线(中心)或班组下拉选项
     * @param userId
     * @param productionId
     * @return
     */
    List<MdcProOptionsVo> loadProductionOptions(String userId, String productionId);
    /**
     *
     * @param userId
     * @param productionId
     * @return
     */
    List<MdcProOptionsVo> loadTeamOptions(String userId, String productionId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -11,6 +11,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.FillRuleConstant;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.*;
@@ -21,8 +22,10 @@
import org.jeecg.modules.system.model.MdcProductionTreeModel;
import org.jeecg.modules.system.model.ProductionIdModel;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecg.modules.system.service.ISysParamsService;
import org.jeecg.modules.system.util.FindsProductionsChildrenUtil;
import org.jeecg.modules.system.vo.MdcProOptionsVo;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -51,6 +54,9 @@
    @Resource
    private ISysParamsService sysParamsService;
    @Resource
    private ISysDictService sysDictService;
    /**
     * queryTreeList å¯¹åº” queryTreeList æŸ¥è¯¢æ‰€æœ‰çš„产线数据,以树结构形式响应给前端
     */
@@ -521,6 +527,54 @@
        return FindsProductionsChildrenUtil.wrapTreeDataToTreeList(list);
    }
    @Override
    public List<String> findChildren(List<String> mdcProductionIds) {
        return this.baseMapper.findChildren(mdcProductionIds);
    }
    /**
     * æ ¹æ®ç”¨æˆ·id获取产线(中心)或班组下拉选项
     * @param userId
     * @param productionId
     * @return
     */
    @Override
    public List<MdcProOptionsVo> loadProductionOptions(String userId, String productionId) {
        List<MdcProOptionsVo> result = new ArrayList<>();
        List<MdcProduction> mdcProductionList = this.baseMapper.loadProductionOptions(userId, productionId);
        if (mdcProductionList != null && !mdcProductionList.isEmpty()) {
            for (MdcProduction mdcProduction : mdcProductionList) {
                MdcProOptionsVo vo = new MdcProOptionsVo().convert(mdcProduction);
                result.add(vo);
            }
        }
        return result;
    }
    @Override
    public List<MdcProOptionsVo> loadTeamOptions(String userId, String productionId) {
        List<MdcProOptionsVo> result = new ArrayList<>();
        List<String> productionList = this.findChildren(Arrays.asList(productionId.split(",")));
        if (productionList != null && !productionList.isEmpty()) {
            List<String> dictValues = this.baseMapper.findTeamValue(userId, productionList);
            if (dictValues != null && !dictValues.isEmpty()) {
                List<DictModel> dictModels = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MDC_STAFF_TEAM);
                if (dictModels != null && !dictModels.isEmpty()) {
                    for (DictModel dictModel : dictModels) {
                        if (dictValues.contains(dictModel.getValue())) {
                            MdcProOptionsVo vo = new MdcProOptionsVo();
                            vo.setKey(dictModel.getValue());
                            vo.setValue(dictModel.getValue());
                            vo.setTitle(dictModel.getText());
                            result.add(vo);
                        }
                    }
                }
            }
        }
        return result;
    }
    /**
     * æ‰“å¼€ çˆ¶èŠ‚ç‚¹ åŠ ä»¥ä¸Šçš„mdc标记
     * @param parentId
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/vo/MdcProOptionsVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package org.jeecg.modules.system.vo;
import lombok.Data;
import org.jeecg.modules.system.entity.MdcProduction;
/**
 * @Author: Lius
 * @CreateTime: 2025-03-27
 * @Description:
 */
@Data
public class MdcProOptionsVo {
    /**
     * id
     */
    private String key;
    /**
     * id
     */
    private String value;
    /**
     * åç§°
     */
    private String title;
    /**
     *
     *
     * @param mdcProduction
     * @return
     */
    public MdcProOptionsVo convert(MdcProduction mdcProduction) {
        this.key = mdcProduction.getId();
        this.value = mdcProduction.getId();
        this.title = mdcProduction.getProductionName();
        return this;
    }
}