Lius
2025-06-20 2473cd2814fd7c8fa1d132704dd9ab190f43f3ff
同步涉密网功能
已添加24个文件
已修改39个文件
1814 ■■■■■ 文件已修改
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | 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/EquipmentMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcAlarmInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/controller/DtBoardController.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/mapper/DtBoardMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/mapper/xml/DtBoardMapper.xml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/service/IDtBoardService.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/service/impl/DtBoardServiceImpl.java 382 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquAlarm.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquAndon.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquDowntimeInfo.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquOeeMonth.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquOperation.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquRepair.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquRunInfo.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquStatus.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquUtilRate.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquUtilRateMonth.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyDto.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyResultDto.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/AndonOrder.java 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebsocketPushEquStatusJob.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/AndonOrderMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentAlarmMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcAlarmInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentAlarmMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcAlarmInfoMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentAlarmService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentAlarmServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcAlarmInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/AndonOrderWebSocketVo.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java
@@ -598,6 +598,11 @@
    String DICT_MDC_STAFF_TEAM = "mdc_staff_team";
    /**
     * é©±åŠ¨å‚æ•°å•ä½å­—å…¸ç¼–å·
     */
    String DICT_EQUIPMENT_RUN_UNIT = "equipment_run_unit";
    /**
     * åŠ ç­æ•°æ® è‡ªåŠ¨è®¡ç®—æ ‡è¯† 1(是) 2(否)
     */
    Integer AUTO_FLAG_Y = 1;
@@ -612,8 +617,11 @@
     */
    String CLOSE_TYPE_0 = "0";
    String CLOSE_TYPE_1 = "1";
    String ORG_TYPE = "3";
    /**
     * äº§çº¿ç±»åž‹ 1一级部门 2子部门 3子部门
     */
    String ORG_TYPE_2 = "2";
    String ORG_TYPE_3 = "3";
    Integer SHIFT_TYPE_1 = 1;
    Integer SHIFT_TYPE_2 = 2;
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java
@@ -7,6 +7,8 @@
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.mdc.entity.Equipment;
import java.util.List;
/**
 * @Description: é‡‡é›†è®¾å¤‡è¡¨
 * @Author: liuS
@@ -30,4 +32,8 @@
    @Insert(" SELECT * INTO ${tableName} FROM ${lastTableName} WHERE CollectTime < '${date}' ")
    void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date);
    List<Equipment> listByProds(@Param("proIds") List<String> proIds);
    Equipment findByEquId(@Param("equipmentId") String equipmentId);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -141,5 +141,7 @@
    List<MdcEquipment> findByProIdsAndType(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("typeList") List<String> typeList);
    List<String> getEquIdsByProIds(@Param("proIds") List<String> proIds);
    List<MdcEquipment> getEquipmentList(@Param("allProductionIds") List<String> allProductionIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml
@@ -1,5 +1,23 @@
<?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.EquipmentMapper">
    <select id="listByProds" resultType="org.jeecg.modules.mdc.entity.Equipment">
        SELECT
        t1.*
        FROM
        Equipment t1
        LEFT JOIN mdc_equipment t2 ON t1.EquipmentID = t2.equipment_id
        LEFT JOIN mdc_production_equipment t3 ON t2.id = t3.equipment_id
        <where>
            t3.production_id IN
            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </where>
    </select>
    <select id="findByEquId" resultType="org.jeecg.modules.mdc.entity.Equipment">
        SELECT TOP 1 * FROM Equipment WHERE EquipmentID = #{equipmentId}
    </select>
</mapper>
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -372,4 +372,18 @@
        </foreach>
    </select>
    <select id="getEquIdsByProIds" resultType="java.lang.String">
        SELECT
        t1.equipment_id
        FROM
        mdc_equipment t1
        LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
        <where>
            t2.production_id IN
            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </where>
    </select>
</mapper>
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.entity.Equipment;
import java.util.List;
/**
 * @Description: é‡‡é›†è®¾å¤‡è¡¨
 * @Author: liuS
@@ -48,4 +50,8 @@
     * @param day
     */
    void insertNoTableData(String backupTableName, String tableName, String day);
    List<Equipment> listByProds(List<String> proIds);
    Equipment findByEquId(String equipmentId);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcAlarmInfoService.java
@@ -11,4 +11,6 @@
 */
public interface IMdcAlarmInfoService extends IService<MdcAlarmInfo> {
    MdcAlarmInfo findAlarmContent(String alarmNo, String equipmentId);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -240,6 +240,8 @@
     */
    List<MdcEquipment> findByProIdsAndType(List<String> allProductionIds, List<String> typeList);
    List<String> getEquIdsByProIds(List<String> proIds);
    /**
     * æ ¹æ®ç”¨æˆ·æŸ¥è¯¢è®¾å¤‡åˆ—表信息
     * @return
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java
@@ -6,6 +6,8 @@
import org.jeecg.modules.mdc.service.IEquipmentService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @Description: é‡‡é›†è®¾å¤‡è¡¨
 * @Author: liuS
@@ -39,4 +41,14 @@
    public void insertNoTableData(String backupTableName, String tableName, String day) {
        this.baseMapper.insertNoTableData(backupTableName, tableName, day);
    }
    @Override
    public List<Equipment> listByProds(List<String> proIds) {
        return this.baseMapper.listByProds(proIds);
    }
    @Override
    public Equipment findByEquId(String equipmentId) {
        return this.baseMapper.findByEquId(equipmentId);
    }
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1070,4 +1070,9 @@
        return equipmentIds;
    }
    @Override
    public List<String> getEquIdsByProIds(List<String> proIds) {
        return this.baseMapper.getEquIdsByProIds(proIds);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/controller/DtBoardController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,103 @@
package org.jeecg.modules.board.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.board.service.IDtBoardService;
import org.jeecg.modules.board.vo.*;
import org.jeecg.modules.system.entity.MdcProduction;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-30
 * @Description: æ•°å­—孪生看板接口
 */
@Slf4j
@Api(tags = "数字孪生看板")
@RestController
@RequestMapping("/board/dtBoard")
public class DtBoardController {
    @Resource
    private IDtBoardService dtBoardService;
    @ApiOperation(value = "数字孪生看板-获取车间分组", notes = "数字孪生看板-获取车间分组")
    @GetMapping("/productionList")
    public Result<?> productionList() {
        List<MdcProduction> result = dtBoardService.productionList();
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备月度利用率", notes = "数字孪生看板-设备月度利用率")
    @GetMapping("/equipmentMonthUtilizationRate")
    public Result<?> equipmentMonthUtilizationRate(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquUtilRateMonth> result = dtBoardService.equipmentMonthUtilizationRate(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备利用率", notes = "数字孪生看板-设备利用率")
    @GetMapping("/equipmentUtilizationRate")
    public Result<?> equipmentUtilizationRate(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquUtilRate> result = dtBoardService.equipmentUtilizationRate(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-月度OEE", notes = "数字孪生看板-月度OEE")
    @GetMapping("/equipmentMonthOee")
    public Result<?> equipmentMonthOee(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquOeeMonth> result = dtBoardService.equipmentMonthOee(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备运行状态统计", notes = "数字孪生看板-设备运行状态")
    @GetMapping("/equipmentOperationStatistics")
    public Result<?> equipmentOperationStatistics(@ApiParam(value = "productionId", required = true) String productionId) {
        EquOperation result = dtBoardService.equipmentOperationStatistics(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备信息", notes = "数字孪生看板-设备信息")
    @GetMapping("/equipmentRunInfo")
    public Result<?> equipmentRunInfo(@ApiParam(value = "equipmentId", required = true) String equipmentId) {
        List<EquRunInfo> result = dtBoardService.equipmentRunInfo(equipmentId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备停机统计", notes = "数字孪生看板-设备停机统计")
    @GetMapping("/equDowntimeStatistics")
    public Result<?> equDowntimeStatistics(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquDowntimeInfo> result = dtBoardService.equDowntimeStatistics(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备报警", notes = "数字孪生看板-设备报警")
    @GetMapping("/equAlarmList")
    public Result<?> equAlarmList(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquAlarm> result = dtBoardService.equAlarmList(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备故障", notes = "数字孪生看板-设备故障")
    @GetMapping("/equRepairList")
    public Result<?> equRepairList(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquRepair> result = dtBoardService.equRepairList(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "数字孪生看板-设备安灯信息", notes = "数字孪生看板-设备安灯信息")
    @GetMapping("/equAndonList")
    public Result<?> equAndonList(@ApiParam(value = "productionId", required = true) String productionId) {
        List<EquAndon> result = dtBoardService.equAndonList(productionId);
        return Result.OK(result);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/mapper/DtBoardMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package org.jeecg.modules.board.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.board.vo.EquRepair;
import java.util.List;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-11
 * @Description:
 */
@Mapper
public interface DtBoardMapper {
    List<EquRepair> equRepairList(@Param("equipmentIdList") List<String> equipmentIdList, @Param("date") String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/mapper/xml/DtBoardMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
<?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.board.mapper.DtBoardMapper">
    <select id="equRepairList" resultType="org.jeecg.modules.board.vo.EquRepair">
        SELECT
            t3.equipment_code equipmentId,
            COUNT(*) faultNum,
            ROUND(
                    SUM(DATEDIFF(MINUTE, t2.fault_start_time, t1.actual_end_time)) / 60.0,
                    2
            ) faultTime
        FROM
            eam_repair_order t1
                LEFT JOIN eam_report_repair t2 ON t1.report_id = t2.id
                LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id
        WHERE
            t1.repair_status = 'COMPLETE'
            AND t2.fault_start_time > #{date}
            AND t3.equipment_code IN
            <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                #{ id }
            </foreach>
        GROUP BY
            t3.equipment_code
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/service/IDtBoardService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package org.jeecg.modules.board.service;
import org.jeecg.modules.board.vo.*;
import org.jeecg.modules.system.entity.MdcProduction;
import java.util.List;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-30
 * @Description:
 */
public interface IDtBoardService {
    List<MdcProduction> productionList();
    List<EquUtilRateMonth> equipmentMonthUtilizationRate(String productionId);
    List<EquUtilRate> equipmentUtilizationRate(String productionId);
    List<EquOeeMonth> equipmentMonthOee(String productionId);
    EquOperation equipmentOperationStatistics(String productionId);
    List<EquRunInfo> equipmentRunInfo(String equipmentId);
    List<EquDowntimeInfo> equDowntimeStatistics(String productionId);
    List<EquAlarm> equAlarmList(String productionId);
    List<EquRepair> equRepairList(String productionId);
    List<EquAndon> equAndonList(String productionId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/service/impl/DtBoardServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,382 @@
package org.jeecg.modules.board.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.modules.board.mapper.DtBoardMapper;
import org.jeecg.modules.board.service.IDtBoardService;
import org.jeecg.modules.board.vo.*;
import org.jeecg.modules.mdc.entity.*;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysDictService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-30
 * @Description:
 */
@Service
public class DtBoardServiceImpl implements IDtBoardService {
    @Resource
    private IMdcProductionService mdcProductionService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
    @Resource
    private IMdcOeeInfoService mdcOeeInfoService;
    @Resource
    private IEquipmentService equipmentService;
    @Resource
    private IEquipmentWorkLineService equipmentWorkLineService;
    @Resource
    private IMdcDriveTypeParamConfigService mdcDriveTypeParamConfigService;
    @Resource
    private ISysDictService sysDictService;
    @Resource
    private IMdcDowntimeService mdcDowntimeService;
    @Resource
    private IEquipmentAlarmService equipmentAlarmService;
    @Resource
    private IMdcAlarmInfoService mdcAlarmInfoService;
    @Resource
    private DtBoardMapper dtBoardMapper;
    @Resource
    private IAndonOrderService andonOrderService;
    /**
     * è½¦é—´ä¿¡æ¯
     */
    @Override
    public List<MdcProduction> productionList() {
        return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, CommonConstant.ORG_TYPE_2).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0).orderByAsc(MdcProduction::getProductionOrder));
    }
    /**
     * è®¾å¤‡æœˆåº¦åˆ©ç”¨çއ
     */
    @Override
    public List<EquUtilRateMonth> equipmentMonthUtilizationRate(String productionId) {
        // ç»„装返回数据
        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);
        Map<String, EquUtilRateMonth> resultMap = monthBetween.stream().collect(Collectors.toMap(
                date -> date,
                date -> new EquUtilRateMonth(date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月"),
                (existing, replacement) -> existing, // å¤„理键冲突的合并函数(通常不会冲突)
                LinkedHashMap::new // æŒ‡å®šä½¿ç”¨LinkedHashMap保持插入顺序
        ));
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return new ArrayList<>(resultMap.values());
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return new ArrayList<>(resultMap.values());
        }
        for (String month : monthBetween) {
            MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquIdsAndMonth(equipmentIdList, month.replaceAll("-", ""));
            if (mdcEquipmentStatisticalInfo != null) {
                if (resultMap.containsKey(month)) {
                    EquUtilRateMonth equUtilRateMonth = resultMap.get(month);
                    if (mdcEquipmentStatisticalInfo.getProcessLong().compareTo(BigDecimal.ZERO) > 0) {
                        equUtilRateMonth.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
                    }
                    resultMap.put(month, equUtilRateMonth);
                }
            }
        }
        return new ArrayList<>(resultMap.values());
    }
    /**
     * è®¾å¤‡åˆ©ç”¨çއ(昨天)
     */
    @Override
    public List<EquUtilRate> equipmentUtilizationRate(String productionId) {
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return null;
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return null;
        }
        Map<String, EquUtilRate> resultMap = new LinkedHashMap<>();
        equipmentIdList.forEach(equipmentId -> {
            EquUtilRate equUtilRate = new EquUtilRate(equipmentId);
            resultMap.put(equipmentId, equUtilRate);
        });
        String yesterday = LocalDate.now().plusDays(-1).toString();
        List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfoList = mdcEquipmentStatisticalInfoService.findByEquipmentAndDate(equipmentIdList, yesterday.replaceAll("-", ""));
        if (mdcEquipmentStatisticalInfoList != null && !mdcEquipmentStatisticalInfoList.isEmpty()) {
            mdcEquipmentStatisticalInfoList.forEach(mdcEquipmentStatisticalInfo -> {
                if (resultMap.containsKey(mdcEquipmentStatisticalInfo.getEquipmentId())) {
                    EquUtilRate equUtilRate = resultMap.get(mdcEquipmentStatisticalInfo.getEquipmentId());
                    if (mdcEquipmentStatisticalInfo.getProcessLong().compareTo(BigDecimal.ZERO) > 0) {
                        equUtilRate.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
                    }
                    resultMap.put(mdcEquipmentStatisticalInfo.getEquipmentId(), equUtilRate);
                }
            });
        }
        return new ArrayList<>(resultMap.values());
    }
    /**
     * æœˆåº¦è®¾å¤‡ç»¼åˆæ•ˆçއ
     */
    @Override
    public List<EquOeeMonth> equipmentMonthOee(String productionId) {
        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);
        Map<String, EquOeeMonth> resultMap = monthBetween.stream().collect(Collectors.toMap(
                date -> date,
                date -> new EquOeeMonth(date.substring(date.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月"),
                (existing, replacement) -> existing, // å¤„理键冲突的合并函数(通常不会冲突)
                LinkedHashMap::new // æŒ‡å®šä½¿ç”¨LinkedHashMap保持插入顺序
        ));
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return new ArrayList<>(resultMap.values());
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return new ArrayList<>(resultMap.values());
        }
        for (String month : monthBetween) {
            BigDecimal oee = mdcOeeInfoService.findByEquIdAndMonth(equipmentIdList, month);
            if (oee != null) {
                EquOeeMonth equOeeMonth = resultMap.get(month);
                equOeeMonth.setOee(oee.setScale(2, RoundingMode.HALF_UP));
                resultMap.put(month, equOeeMonth);
            }
        }
        return new ArrayList<>(resultMap.values());
    }
    /**
     * è®¾å¤‡çŠ¶æ€ç»Ÿè®¡
     */
    @Override
    public EquOperation equipmentOperationStatistics(String productionId) {
        EquOperation equOperation = new EquOperation();
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return equOperation;
        }
        List<Equipment> equipmentList = equipmentService.listByProds(proIds);
        if (equipmentList == null || equipmentList.isEmpty()) {
            return equOperation;
        }
        for (Equipment equipment : equipmentList) {
            if (equipment.getOporation() != null) {
                switch (equipment.getOporation()) {
                    case 1:
                    case 2:
                        equOperation.setStandby(equOperation.getStandby() + 1);
                        break;
                    case 3:
                        equOperation.setRun(equOperation.getRun() + 1);
                        break;
                    case 22:
                        equOperation.setAlarm(equOperation.getAlarm() + 1);
                        break;
                    default:
                        equOperation.setShutdown(equOperation.getShutdown() + 1);
                        break;
                }
            } else {
                equOperation.setShutdown(equOperation.getShutdown() + 1);
            }
        }
        return equOperation;
    }
    /**
     * è®¾å¤‡è¿è¡Œä¿¡æ¯
     */
    @Override
    public List<EquRunInfo> equipmentRunInfo(String equipmentId) {
        List<EquRunInfo> equRunInfoList = new ArrayList<>();
        Equipment equipment = equipmentService.findByEquId(equipmentId);
        if (equipment != null) {
            //填充设备基础信息
            equRunInfoList.add(new EquRunInfo("设备名称", equipment.getEquipmentname(), ""));
            equRunInfoList.add(new EquRunInfo("设备编号", equipment.getEquipmentid(), ""));
            if (equipment.getOporation() != null && equipment.getOporation() != 0) {
                String saveTableName = equipment.getSavetablename();
                Map<String, Object> mapData = equipmentWorkLineService.getDataList(saveTableName);
                if (mapData != null) {
                    //获取 MDC é©±åŠ¨å¯¹åº”çš„å±•ç¤ºå‚æ•°   å¹¶æ ¹æ®key æ‹¼è£…从 workData  æŸ¥è¯¢çš„æ•°æ®
                    List<MdcDriveTypeParamConfig> mdcDriveTypeParamList = mdcDriveTypeParamConfigService.getShowDriveParam(equipment.getDrivetype());
                    if (mdcDriveTypeParamList != null && !mdcDriveTypeParamList.isEmpty()) {
                        List<DictModel> dictItems = sysDictService.getDictItems(CommonConstant.DICT_EQUIPMENT_RUN_UNIT);
                        Map<String, DictModel> resultMap = new HashMap<>();
                        dictItems.forEach(dictModel -> {
                            resultMap.put(dictModel.getText(), dictModel);
                        });
                        for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamList) {
                            EquRunInfo equRunInfo = new EquRunInfo();
                            String englishName = mdcDriveTypeParamConfig.getEnglishName();
                            String chineseName = mdcDriveTypeParamConfig.getChineseName();
                            equRunInfo.setKey(chineseName);
                            if (mapData.containsKey(englishName)) {
                                Object object = mapData.get(englishName);
                                String value = "";
                                if ("CollectTime".equals(englishName)) {
                                    Date date = object == null ? null : (Date) object;
                                    value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL);
                                } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "spindlespeed".equals(englishName) && equipment.getOporation() == 3) {
                                    // ZUOLAN设备主轴转速字段spindlespeed
                                    value = String.valueOf(((new Random().nextInt(35)) + 1) * 100);
                                } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "spindleload".equals(englishName) && equipment.getOporation() == 3) {
                                    // ZUOLAN设备主轴负荷字段spindleload
                                    value = String.valueOf(Integer.valueOf(new Random().nextInt(21)));
                                } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "spindlebeilv".equals(englishName) && equipment.getOporation() == 3) {
                                    // ZUOLAN设备主轴倍率字段spindlebeilv
                                    value = String.valueOf((new Random().nextInt(13)) * 10);
                                } else if ("ZUOLAN".equals(equipment.getDrivetype()) && "feedbeilv".equals(englishName) && equipment.getOporation() == 3) {
                                    // ZUOLAN设备进给倍率字段feedbeilv
                                    value = String.valueOf((new Random().nextInt(13)) * 10);
                                } else {
                                    value = object == null ? "" : object.toString();
                                }
                                equRunInfo.setValue(value);
                                // è®¾ç½®å•位
                                if (resultMap.containsKey(chineseName)) {
                                    DictModel dictModel = resultMap.get(chineseName);
                                    equRunInfo.setUnit(dictModel.getValue());
                                }
                                equRunInfoList.add(equRunInfo);
                            }
                        }
                    }
                }
            }
        }
        return equRunInfoList;
    }
    /**
     * è®¾å¤‡åœæœºç»Ÿè®¡
     */
    @Override
    public List<EquDowntimeInfo> equDowntimeStatistics(String productionId) {
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return null;
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return null;
        }
        LocalDate end = LocalDate.now();
        LocalDate start = end.plusDays(-30);
        List<EquDowntimeInfo> result = mdcDowntimeService.equDowntimeStatistics(equipmentIdList, start.toString(), end.toString());
        result.forEach(equDowntimeInfo -> {
            equDowntimeInfo.setDuration(equDowntimeInfo.getDuration().setScale(2, RoundingMode.HALF_UP));
        });
        return result;
    }
    /**
     * è®¾å¤‡æŠ¥è­¦åˆ—表
     */
    @Override
    public List<EquAlarm> equAlarmList(String productionId) {
        List<EquAlarm> result = new ArrayList<>();
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return null;
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return null;
        }
        List<EquipmentAlarm> equipmentAlarmList = equipmentAlarmService.equAlarmList(equipmentIdList);
        if (equipmentAlarmList == null || equipmentAlarmList.isEmpty()) {
            return null;
        }
        for (EquipmentAlarm equipmentAlarm : equipmentAlarmList) {
            MdcAlarmInfo mdcAlarmInfo = mdcAlarmInfoService.findAlarmContent(equipmentAlarm.getAlarmNo(), equipmentAlarm.getEquipmentid());
            EquAlarm equAlarm = new EquAlarm();
            equAlarm.setEquipmentId(equipmentAlarm.getEquipmentid());
            if (mdcAlarmInfo != null) {
                equAlarm.setAlarmInfo(mdcAlarmInfo.getAlarmContent());
            } else {
                equAlarm.setAlarmInfo(equipmentAlarm.getAlarmContent());
            }
            result.add(equAlarm);
        }
        return result;
    }
    /**
     * è®¾å¤‡æ•…éšœ
     */
    @Override
    public List<EquRepair> equRepairList(String productionId) {
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return null;
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return null;
        }
        LocalDateTime currentDate = LocalDate.now().minusMonths(1).atStartOfDay();
        String format = currentDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        List<EquRepair> result = dtBoardMapper.equRepairList(equipmentIdList, format);
        return result;
    }
    /**
     * è®¾å¤‡å®‰ç¯é—®é¢˜
     */
    @Override
    public List<EquAndon> equAndonList(String productionId) {
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return null;
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return null;
        }
        List<EquAndon> result = andonOrderService.equAndonList(equipmentIdList);
        return result;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquAlarm.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-09
 * @Description: è®¾å¤‡æŠ¥è­¦ä¿¡æ¯
 */
@Data
public class EquAlarm {
    /**
     * è®¾å¤‡ç¼–号
     */
    private String equipmentId;
    /**
     * æŠ¥è­¦ä¿¡æ¯
     */
    private String alarmInfo;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquAndon.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-12
 * @Description: å®‰ç¯ä¿¡æ¯
 */
@Data
public class EquAndon {
    /**
     * è®¾å¤‡ç¼–号
     */
    private String equipmentId;
    /**
     * å®‰ç¯é—®é¢˜
     */
    private String andonInfo;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquDowntimeInfo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-09
 * @Description: è®¾å¤‡åœæœºç»Ÿè®¡
 */
@Data
public class EquDowntimeInfo {
    /**
     * åœæœºåŽŸå› 
     */
    private String shutdownInfo;
    /**
     * åœæœºæ—¶é•¿
     */
    private BigDecimal duration;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquOeeMonth.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-30
 * @Description:
 */
@Data
public class EquOeeMonth {
    private String month;
    private BigDecimal oee = BigDecimal.ZERO;
    public EquOeeMonth(String month) {
        this.month = month;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquOperation.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-06
 * @Description:
 */
@Data
public class EquOperation {
    private Integer shutdown = 0;
    private Integer alarm = 0;
    private Integer standby = 0;
    private Integer run = 0;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquRepair.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-10
 * @Description: è®¾å¤‡æ•…éšœ
 */
@Data
public class EquRepair {
    /**
     * è®¾å¤‡ç¼–号
     */
    private String equipmentId;
    /**
     *  æ•…障次数
     */
    private BigDecimal faultNum;
    /**
     * æ•…障时长
     */
    private BigDecimal faultTime;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquRunInfo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-06
 * @Description:
 */
@Data
public class EquRunInfo {
    private String key;
    private String value;
    private String unit;
    public EquRunInfo() {
    }
    public EquRunInfo(String key, String value, String unit) {
        this.key = key;
        this.value = value;
        this.unit = unit;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquStatus.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-05
 * @Description:
 */
@Data
public class EquStatus {
    private String equipmentId;
    private Integer state;
    private String plantName;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquUtilRate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-30
 * @Description:
 */
@Data
public class EquUtilRate {
    private String deviceNum;
    private BigDecimal utilizationRate = BigDecimal.ZERO;
    public EquUtilRate(String deviceNum) {
        this.deviceNum = deviceNum;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/board/vo/EquUtilRateMonth.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.board.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-30
 * @Description:
 */
@Data
public class EquUtilRateMonth {
    private String month;
    private BigDecimal utilizationRate = BigDecimal.ZERO;
    public EquUtilRateMonth(String month) {
        this.month = month;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/AndonOrderController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
package org.jeecg.modules.mdc.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.mdc.entity.AndonOrder;
import org.jeecg.modules.mdc.service.IAndonOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description: andon_order
* @Author: jeecg-boot
* @Date:   2025-06-11
* @Version: V1.0
*/
@Api(tags="andon_order")
@RestController
@RequestMapping("/AndonOrder/andonOrder")
@Slf4j
public class AndonOrderController extends JeecgController<AndonOrder, IAndonOrderService> {
   @Autowired
   private IAndonOrderService andonOrderService;
    /**
     * ç¨‹åºå‘¼å«
     *
     * @param andonOrder
     * @return
     */
    @AutoLog(value = "安灯工单-程序呼叫")
    @ApiOperation(value = "安灯工单-程序呼叫", notes = "安灯工单-程序呼叫")
    @PostMapping(value = "/procedureCall")
    public Result<?> procedureCall(@RequestBody AndonOrder andonOrder) {
        andonOrderService.procedureCall(andonOrder);
        return Result.OK("呼叫成功!");
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyDto.java
@@ -55,6 +55,17 @@
     * å…³æœºæ—¶é•¿
     */
    private BigDecimal closeLong;
    /**
     * æ•…障时长
     */
    private BigDecimal faultLong;
    /**
     * æ•…障率
     */
    private BigDecimal faultRate;
    /**
     * è¿è¡Œæ—¶é•¿(去除故障时间)
     */
    private BigDecimal removeFaultRunLong;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyResultDto.java
@@ -43,11 +43,23 @@
     */
    private BigDecimal closeLong = 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) {
    public MdcEfficiencyResultDto(String theDate, BigDecimal processLong, BigDecimal utilizationRate, BigDecimal startRate, BigDecimal openRate, BigDecimal openLong, BigDecimal waitLong, BigDecimal closeLong, BigDecimal faultLong, BigDecimal faultRate, BigDecimal removeFaultRunLong) {
        this.theDate = theDate;
        this.processLong = processLong;
        this.utilizationRate = utilizationRate;
@@ -56,6 +68,9 @@
        this.openLong = openLong;
        this.waitLong = waitLong;
        this.closeLong = closeLong;
        this.faultLong = faultLong;
        this.faultRate = faultRate;
        this.removeFaultRunLong = removeFaultRunLong;
    }
    public MdcEfficiencyResultDto() {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentStatisticalDto.java
@@ -37,6 +37,22 @@
     */
    private BigDecimal totalLong = new BigDecimal("0");
    /**
     * æ•…障时长
     */
    private BigDecimal faultLong = new BigDecimal("0");
    /**
     * æ•…障率
     */
    private BigDecimal faultRate = new BigDecimal("0");
    /**
     * è¿è¡Œæ—¶é•¿(去除故障时间)
     */
    private BigDecimal removeFaultRunLong = new BigDecimal("0");
    /**
     * åŽ»é™¤æ•…éšœæ—¶é—´åˆ©ç”¨çŽ‡
     */
    private BigDecimal removeFaultRate = new BigDecimal("0");
    /**
     * å¤©æ•°
     */
    private BigDecimal dayNum;
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/AndonOrder.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,165 @@
package org.jeecg.modules.mdc.entity;
import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
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.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.CommonConstant;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * @Description: andon_order
 * @Author: jeecg-boot
 * @Date: 2025-06-11
 * @Version: V1.0
 */
@Data
@TableName("andon_order")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "andon_order对象", description = "andon_order")
public class AndonOrder implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸»é”®
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * è®¾å¤‡ç¼–号
     */
    @Excel(name = "设备编号", width = 15)
    @ApiModelProperty(value = "设备编号")
    private String equipmentId;
    /**
     * æ‰€å±žåŽ‚æˆ¿
     */
    @Excel(name = "所属厂房", width = 15)
    @ApiModelProperty(value = "所属厂房")
    private String plantName;
    /**
     * å®‰ç¯ç±»åž‹
     */
    @Excel(name = "安灯类型", width = 15)
    @ApiModelProperty(value = "安灯类型")
    @Dict(dicCode = "andon_type")
    private String andonType;
    /**
     * å®‰ç¯äºº(呼叫人)
     */
    @Excel(name = "安灯人", width = 15)
    @ApiModelProperty(value = "安灯人")
    private String operator;
    /**
     * å‘¼å«åŽŸå› 
     */
    @Excel(name = "呼叫原因", width = 15)
    @ApiModelProperty(value = "呼叫原因")
    private String callReason;
    /**
     * å®‰ç¯æ—¶é—´
     */
    @Excel(name = "安灯时间", width = 15, format = DatePattern.NORM_DATETIME_PATTERN)
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @ApiModelProperty(value = "安灯时间")
    private Date operateTime;
    /**
     * å“åº”人(责任人)
     */
    @Excel(name = "响应人", width = 15)
    @ApiModelProperty(value = "响应人")
    private String responder;
    /**
     * å“åº”æ—¶é—´
     */
    @Excel(name = "响应时间", width = 15, format = DatePattern.NORM_DATETIME_PATTERN)
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @ApiModelProperty(value = "响应时间")
    private Date responseTime;
    /**
     * å¤„理人
     */
    @Excel(name = "处理人", width = 15)
    @ApiModelProperty(value = "处理人")
    private String processor;
    /**
     * å¤„理完成时间
     */
    @Excel(name = "处理完成时间", width = 15, format = DatePattern.NORM_DATETIME_PATTERN)
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @ApiModelProperty(value = "处理完成时间")
    private Date processTime;
    /**
     * å®‰ç¯çŠ¶æ€;待响应、待处理、已完成
     */
    @Excel(name = "安灯状态;待响应、待处理、已完成", width = 15)
    @ApiModelProperty(value = "安灯状态;待响应、待处理、已完成")
    @Dict(dicCode = "order_status")
    private String orderStatus;
    /**
     * é—®é¢˜æè¿°
     */
    @Excel(name = "问题描述", width = 15)
    @ApiModelProperty(value = "问题描述")
    private String problemDescreption;
    /**
     * å¤„理结果描述
     */
    @Excel(name = "处理结果描述", width = 15)
    @ApiModelProperty(value = "处理结果描述")
    private String resolutionDescreption;
    /**
     * å¤„理结果图片
     */
    @Excel(name = "处理结果图片", width = 15)
    @ApiModelProperty(value = "处理结果图片")
    private String imageFiles;
    /**
     * åˆ é™¤æ ‡è®°
     */
    @Excel(name = "删除标记", width = 15)
    @ApiModelProperty(value = "删除标记")
    @TableLogic
    private Integer delFlag = CommonConstant.DEL_FLAG_0;
    /**
     * åˆ›å»ºäºº
     */
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**
     * æ›´æ–°äºº
     */
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**
     * æ›´æ–°æ—¶é—´
     */
    @JsonFormat(timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentStatisticalInfoMonth.java
@@ -78,6 +78,18 @@
    @ApiModelProperty(value = "报警时长")
    private Integer errorLong;
    /**
     * æ•…障时长
     */
    @Excel(name = "故障时长", width = 15)
    @ApiModelProperty(value = "故障时长")
    private Integer faultLong;
    /**
     * åŽ»é™¤æ•…éšœæ—¶é—´çš„è¿è¡Œæ—¶é—´
     */
    @Excel(name = "去除故障时间的运行时间", width = 15)
    @ApiModelProperty(value = "去除故障时间的运行时间")
    private Integer removeFaultRunLong;
    /**
     * åˆ©ç”¨çއ
     */
    @Excel(name = "利用率", width = 15)
@@ -96,6 +108,18 @@
    @ApiModelProperty(value = "开机率")
    private BigDecimal openRate;
    /**
     * æ•…障率
     */
    @Excel(name = "故障率", width = 15)
    @ApiModelProperty(value = "故障率")
    private BigDecimal faultRate;
    /**
     * åŽ»é™¤æ•…éšœæ—¶é—´åˆ©ç”¨çŽ‡
     */
    @Excel(name = "去除故障时间利用率", width = 15)
    @ApiModelProperty(value = "去除故障时间利用率")
    private BigDecimal removeFaultRate;
    /**
     * åˆ›å»ºæ—¶é—´
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/CollectEquipmentDataMonthJob.java
@@ -84,7 +84,7 @@
            if (StringUtils.isNotBlank(this.parameter)) {
                date = DateUtils.format(DateUtils.toDate(this.parameter, DateUtils.STRYEARMONTH), DateUtils.STRYEARMONTH);
            } else {
                date = DateUtils.format(DateUtils.getNow(), DateUtils.STRYEARMONTH);
                date = DateUtils.format(DateUtils.addMonth(-1, DateUtils.getNow()), DateUtils.STRYEARMONTH);
            }
            mdcEquipmentStatisticalInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalInfoMonth>().eq(MdcEquipmentStatisticalInfoMonth::getTheMonth, date));
            mdcEquipmentStatisticalShiftInfoMonthService.remove(new LambdaQueryWrapper<MdcEquipmentStatisticalShiftInfoMonth>().eq(MdcEquipmentStatisticalShiftInfoMonth::getTheMonth, date));
@@ -100,14 +100,20 @@
                    MdcEquipmentStatisticalInfoMonth mdcEquipmentStatisticalInfoMonth = new MdcEquipmentStatisticalInfoMonth();
                    mdcEquipmentStatisticalInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcEquipmentStatisticalInfoMonth.setTheMonth(date);
                    if (mdcEquipmentStatisticalDto != null) {
                    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));
                        mdcEquipmentStatisticalInfoMonth.setOpenRate(mdcEquipmentStatisticalDto.getOpenLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                        mdcEquipmentStatisticalInfoMonth.setStartRate(mdcEquipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentStatisticalDto.getProcessLong().divide(mdcEquipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                        mdcEquipmentStatisticalInfoMonth.setUtilizationRate(mdcEquipmentStatisticalDto.getProcessLong().divide((new BigDecimal("864").multiply(mdcEquipmentStatisticalDto.getDayNum())), 4, RoundingMode.HALF_UP));
                        mdcEquipmentStatisticalInfoMonth.setFaultLong(mdcEquipmentStatisticalDto.getFaultLong().intValue());
                        mdcEquipmentStatisticalInfoMonth.setFaultRate(mdcEquipmentStatisticalDto.getFaultRate());
                        mdcEquipmentStatisticalInfoMonth.setRemoveFaultRate(mdcEquipmentStatisticalDto.getRemoveFaultRate());
                        mdcEquipmentStatisticalInfoMonth.setRemoveFaultRunLong(mdcEquipmentStatisticalDto.getRemoveFaultRunLong().intValue());
                    }
                    mdcEquipmentStatisticalInfoMonthList.add(mdcEquipmentStatisticalInfoMonth);
                    // step.3 æ±‡æ€»ç­æ¬¡åˆ©ç”¨çŽ‡æ•°æ®
                    MdcEquipmentStatisticalDto mdcEquipmentShiftStatisticalDto = mdcEquipmentStatisticalShiftInfoService.findByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
@@ -115,15 +121,17 @@
                    mdcEquipmentShiftInfoMonth.setEquipmentId(mdcEquipment.getEquipmentId());
                    mdcEquipmentShiftInfoMonth.setTheMonth(date);
                    mdcEquipmentShiftInfoMonth.setShiftType(CommonConstant.SHIFT_TYPE_1);
                    if (mdcEquipmentShiftStatisticalDto != null) {
                    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);
                        mdcEquipmentShiftInfoMonth.setUtilizationRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                        mdcEquipmentShiftInfoMonth.setStartRate(mdcEquipmentShiftStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getProcessLong().divide(mdcEquipmentShiftStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                        mdcEquipmentShiftInfoMonth.setOpenRate(mdcEquipmentShiftStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? mdcEquipmentShiftStatisticalDto.getOpenLong().divide(mdcEquipmentShiftStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                    }
                    mdcEquipmentStatisticalShiftInfoMonthList.add(mdcEquipmentShiftInfoMonth);
                    // step.4 æ±‡æ€»å„班次利用率数据
                    List<MdcEquipmentStatisticalDto> essdList = mdcEquipmentStatisticalShiftInfoService.findShiftByEquipmentAndMonth(mdcEquipment.getEquipmentId(), date);
@@ -139,9 +147,9 @@
                            equipmentStatisticalShiftInfoMonth.setErrorLong(equipmentStatisticalDto.getErrorLong().intValue());
                            equipmentStatisticalShiftInfoMonth.setWaitLong(equipmentStatisticalDto.getWaitLong().intValue());
                            equipmentStatisticalShiftInfoMonth.setProcessLong(equipmentStatisticalDto.getProcessLong().intValue());
                            equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setUtilizationRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setStartRate(equipmentStatisticalDto.getOpenLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getProcessLong().divide(equipmentStatisticalDto.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            equipmentStatisticalShiftInfoMonth.setOpenRate(equipmentStatisticalDto.getTotalLong().compareTo(BigDecimal.ZERO) > 0 ? equipmentStatisticalDto.getOpenLong().divide(equipmentStatisticalDto.getTotalLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO);
                            mdcEquipmentStatisticalShiftInfoMonthList.add(equipmentStatisticalShiftInfoMonth);
                        }
                    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/WebsocketPushEquStatusJob.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,111 @@
package org.jeecg.modules.mdc.job;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.WebsocketConst;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.board.vo.EquStatus;
import org.jeecg.modules.mdc.entity.Equipment;
import org.jeecg.modules.mdc.service.IEquipmentService;
import org.jeecg.modules.mdc.util.ThrowableUtil;
import org.jeecg.modules.message.websocket.WebSocket;
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.IMdcProductionService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * @Author: Lius
 * @CreateTime: 2025-06-05
 * @Description: websocket推送设备状态任务
 */
@DisallowConcurrentExecution
@Slf4j
public class WebsocketPushEquStatusJob implements Job {
    @Resource
    private IQuartzJobService quartzJobService;
    @Resource
    private ISysQuartzLogService sysQuartzLogService;
    @Resource
    private RedisUtil redisUtil;
    @Resource
    private WebSocket webSocket;
    @Resource
    private IEquipmentService equipmentService;
    @Resource
    private IMdcProductionService mdcProductionService;
    final private static String redisKey = "board:equipment:status:";
    @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());
        }
        long startTime = System.currentTimeMillis();
        try {
            List<Equipment> equipmentList = equipmentService.list();
            if (equipmentList != null && !equipmentList.isEmpty()) {
                List<EquStatus> equStatusList = new ArrayList<>();
                for (Equipment equipment : equipmentList) {
                    if (equipment.getOporation() == null) {
                        equipment.setOporation(0);
                    }
                    String key = redisKey + equipment.getEquipmentid();
                    if (redisUtil.hasKey(key)) {
                        Integer status = (Integer) redisUtil.get(key);
                        if (!status.equals(equipment.getOporation())) {
                            EquStatus equStatus = new EquStatus();
                            equStatus.setEquipmentId(equipment.getEquipmentid());
                            equStatus.setState(equipment.getOporation());
                            // é€šè¿‡equipmentId获取设备车间名称
                            String productionName = mdcProductionService.findProName(equipment.getEquipmentid());
                            equStatus.setPlantName(productionName);
                            equStatusList.add(equStatus);
                            redisUtil.set(key, equipment.getOporation());
                        }
                    } else {
                        EquStatus equStatus = new EquStatus();
                        equStatus.setEquipmentId(equipment.getEquipmentid());
                        equStatus.setState(equipment.getOporation());
                        // é€šè¿‡equipmentId获取设备车间名称
                        String productionName = mdcProductionService.findProName(equipment.getEquipmentid());
                        equStatus.setPlantName(productionName);
                        equStatusList.add(equStatus);
                        redisUtil.set(key, equipment.getOporation());
                    }
                }
                JSONObject jsonObject = new JSONObject();
                jsonObject.put(WebsocketConst.MSG_CMD, "equStatus");
                jsonObject.put("data", equStatusList);
                webSocket.sendMessage(jsonObject.toJSONString());
            }
            quartzLog.setIsSuccess(0);
        } catch (Exception e) {
            quartzLog.setIsSuccess(-1);
            quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
        }
        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/AndonOrderMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.AndonOrder;
import java.util.List;
/**
 * @Description: andon_order
 * @Author: jeecg-boot
 * @Date:   2025-06-11
 * @Version: V1.0
 */
public interface AndonOrderMapper extends BaseMapper<AndonOrder> {
    List<AndonOrder> equAndonList(@Param("equipmentIdList") List<String> equipmentIdList);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentAlarmMapper.java
@@ -1,11 +1,17 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.EquipmentAlarm;
import java.util.List;
/**
 * @author: LiuS
 * @create: 2023-04-12 16:39
 */
public interface EquipmentAlarmMapper extends BaseMapper<EquipmentAlarm> {
    List<EquipmentAlarm> equAlarmList(@Param("equipmentIdList") List<String> equipmentIdList);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcAlarmInfoMapper.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.mdc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.MdcAlarmInfo;
/**
@@ -11,4 +12,6 @@
 */
public interface MdcAlarmInfoMapper extends BaseMapper<MdcAlarmInfo> {
    MdcAlarmInfo findAlarmContent(@Param("alarmNo") String alarmNo, @Param("equipmentId") String equipmentId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.board.vo.EquDowntimeInfo;
import org.jeecg.modules.mdc.dto.MdcDowntimeDto;
import org.jeecg.modules.mdc.entity.MdcDowntime;
import org.jeecg.modules.mdc.vo.MdcDowntimeVo;
@@ -20,4 +21,6 @@
    IPage<MdcDowntimeDto> pageList(Page<MdcDowntimeDto> page, @Param("mdcDowntimeVo") MdcDowntimeVo mdcDowntimeVo);
    List<MdcDowntime> findPlanTimeDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate, @Param("closeType") String closeType);
    List<EquDowntimeInfo> equDowntimeStatistics(@Param("equipmentIdList") List<String> equipmentIdList, @Param("start") String start, @Param("end") String end);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java
@@ -5,6 +5,8 @@
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
import java.util.List;
/**
 * @Description: è®¾å¤‡å•日运行数据表
 * @Author: jeecg-boot
@@ -28,4 +30,8 @@
    Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date);
    MdcEquipmentStatisticalInfo findByEquIdsAndMonth(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month);
    List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(@Param("equipmentIdList") List<String> equipmentIdList, @Param("date") String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java
@@ -7,6 +7,9 @@
import org.jeecg.modules.mdc.entity.MdcOeeInfo;
import org.jeecg.modules.mdc.vo.MdcOeeInfoVo;
import java.math.BigDecimal;
import java.util.List;
/**
 * @Description: OEE表
 * @Author: lius
@@ -22,4 +25,6 @@
     * @return
     */
    IPage<MdcOeeInfo> pageList(Page<MdcOeeInfo> page, @Param("mdcOeeInfoVo") MdcOeeInfoVo mdcOeeInfoVo);
    BigDecimal findByEquIdAndMonth(@Param("equipmentIdList") List<String> equipmentIdList, @Param("month") String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/AndonOrderMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
<?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.AndonOrderMapper">
    <select id="equAndonList" resultType="org.jeecg.modules.mdc.entity.AndonOrder">
        SELECT
            *
        FROM
            andon_order
        WHERE
            CONVERT ( DATE, create_time ) = CONVERT ( DATE, GETDATE( ) )
          AND equipment_id IN
        <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        ORDER BY
            create_time
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentAlarmMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
<?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.EquipmentAlarmMapper">
    <select id="equAlarmList" resultType="org.jeecg.modules.mdc.entity.EquipmentAlarm">
        SELECT TOP 15 *
        FROM
            EquipmentAlarm
        WHERE EquipmentID IN
        <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        AND alarmNo != ''
        ORDER BY collecttime DESC
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcAlarmInfoMapper.xml
@@ -2,4 +2,14 @@
<!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.MdcAlarmInfoMapper">
    <select id="findAlarmContent" resultType="org.jeecg.modules.mdc.entity.MdcAlarmInfo">
        SELECT
            t1.*
        FROM
            mdc_alarm_info t1
                LEFT JOIN mdc_equipment t2 ON t1.drive_type = t2.drive_type
        WHERE
            t2.equipment_id = #{equipmentId} AND t1.alarm_code = #{alarmNo}
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml
@@ -40,4 +40,22 @@
            AND t2.downtime_type = #{closeType}
            AND t1.the_date = #{validDate}
    </select>
    <select id="equDowntimeStatistics" resultType="org.jeecg.modules.board.vo.EquDowntimeInfo">
        SELECT
            t2.downtime_description AS shutdown_info,
            SUM ( DATEDIFF( SECOND, t1.start_date, t1.end_date ) ) / 3600.0 AS duration
        FROM
            mdc_downtime t1
                LEFT JOIN mdc_downtime_reason t2 ON t1.reason_id = t2.id
        WHERE
            t1.reason_id != ''
            AND t1.the_date BETWEEN #{start} AND #{end}
            AND t1.equipment_id IN
            <foreach collection="equipmentIdList" item="equipmentId" index="index" open="(" close=")" separator=",">
                #{ equipmentId }
            </foreach>
        GROUP BY
            t2.downtime_description
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEfficiencyReportMapper.xml
@@ -18,10 +18,14 @@
            t1.open_long / 86400 openRate,
            t1.open_long openLong,
            t1.wait_long waitLong,
            t1.close_long closeLong
            t1.close_long closeLong,
            COALESCE(t3.fault_long, 0) faultLong,
            COALESCE(t3.fault_rate, 0) faultRate,
            COALESCE(t3.remove_fault_run_long, 0) removeFaultRunLong
        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 }
@@ -191,7 +195,8 @@
        SELECT
            t3.equipment_name,
            t1.utilization_rate AS utilizationRate,
            t2.utilization_rate AS shiftUtilizationRate
            t2.utilization_rate AS shiftUtilizationRate,
            t1.remove_fault_rate AS amendUtilizationRate
        FROM
            mdc_equipment_statistical_info_month t1
                LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month AND t2.shift_type = 1
@@ -211,7 +216,8 @@
        SELECT
            t3.team_code AS teamCode,
            t1.utilization_rate AS utilizationRate,
            t2.utilization_rate AS shiftUtilizationRate
            t2.utilization_rate AS shiftUtilizationRate,
            t1.remove_fault_rate AS amendUtilizationRate
        FROM
            mdc_equipment_statistical_info_month t1
                LEFT JOIN mdc_equipment_statistical_shift_info_month t2 ON t1.the_month = t2.the_month AND t2.shift_type = 1
@@ -230,6 +236,7 @@
            t1.the_month AS theMonth,
            AVG ( t1.utilization_rate ) AS utilizationRate,
            AVG ( t2.utilization_rate ) AS shiftUtilizationRate,
            AVG ( t1.remove_fault_rate ) AS amendUtilizationRate,
            SUM ( t1.process_long ) AS processLong
        FROM
            mdc_equipment_statistical_info_month t1
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml
@@ -15,15 +15,49 @@
    <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 ( t1.open_long ) openLong,
            SUM ( t1.close_long ) closeLong,
            SUM ( t1.wait_long ) waitLong,
            SUM ( t1.process_long ) processLong,
            SUM ( t1.error_long ) errorLong,
            SUM ( t2.fault_long ) faultLong,
            AVG ( t2.fault_rate ) faultRate,
            SUM ( t2.remove_fault_run_long ) removeFaultRunLong,
            AVG ( t2.remove_fault_rate ) removeFaultRate,
            COUNT(*) dayNum
        FROM
            mdc_equipment_statistical_info t1 LEFT JOIN mdc_equipment_fault_info t2 ON t1.equipment_id = t2.equipment_id AND t1.the_date = t2.the_date
        WHERE
            t1.equipment_id = #{equipmentId} AND t1.the_date LIKE CONCAT(#{date}, '%')
    </select>
    <select id="findByEquIdsAndMonth" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
        AVG(open_long) openLong,
        AVG(close_long) closeLong,
        AVG(wait_long) waitLong,
        AVG(process_long) processLong,
        AVG(error_long) errorLong
        FROM
            mdc_equipment_statistical_info
        WHERE
            equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%')
        equipment_id IN
        <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
            #{ id }
        </foreach>
        AND the_date LIKE CONCAT(#{month}, '%')
    </select>
    <select id="findByEquipmentAndDate" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
        *
        FROM
        mdc_equipment_statistical_info
        WHERE
        equipment_id IN
        <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
            #{ id }
        </foreach>
        AND the_date = #{date}
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml
@@ -27,4 +27,17 @@
        </where>
        ORDER BY the_date DESC, equipment_id ASC
    </select>
    <select id="findByEquIdAndMonth" resultType="java.math.BigDecimal">
        SELECT
        AVG(oee)
        FROM
        mdc_oee_info
        WHERE
        the_date LIKE CONCAT(#{month}, '%')
        AND equipment_id IN
        <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
            #{ id }
        </foreach>
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.mdc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.board.vo.EquAndon;
import org.jeecg.modules.mdc.entity.AndonOrder;
import java.util.List;
/**
 * @Description: andon_order
 * @Author: jeecg-boot
 * @Date:   2025-06-11
 * @Version: V1.0
 */
public interface IAndonOrderService extends IService<AndonOrder> {
    void procedureCall(AndonOrder andonOrder);
    List<EquAndon> equAndonList(List<String> equipmentIdList);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentAlarmService.java
@@ -12,4 +12,6 @@
 */
public interface IEquipmentAlarmService extends IService<EquipmentAlarm> {
    List<EquipmentAlarm> findEquipmentAlarmByDate(String equipmentId, Date startTime, Date endTime);
    List<EquipmentAlarm> equAlarmList(List<String> equipmentIdList);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java
@@ -3,11 +3,13 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.board.vo.EquDowntimeInfo;
import org.jeecg.modules.mdc.dto.MdcDowntimeDto;
import org.jeecg.modules.mdc.entity.MdcDowntime;
import org.jeecg.modules.mdc.vo.MdcDowntimeVo;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
 * @Description: å¾…机停机表
@@ -35,4 +37,6 @@
     * @return
     */
    Integer findPlanTimeDuration(String equipmentId, String validDate, String closeType);
    List<EquDowntimeInfo> equDowntimeStatistics(List<String> equipmentIdList, String start, String end);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
@@ -4,6 +4,8 @@
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
 * @Description: è®¾å¤‡å•日运行数据表
 * @Author: lius
@@ -29,4 +31,8 @@
    Integer selectProcessLong(String equipmentId, String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date);
    MdcEquipmentStatisticalInfo findByEquIdsAndMonth(List<String> equipmentIdList, String month);
    List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentIdList, String date);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java
@@ -9,6 +9,8 @@
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
/**
 * @Description: OEE表
@@ -44,4 +46,5 @@
     */
    void computeOee(MdcOeeComputeVo mdcOeeComputeVo);
    BigDecimal findByEquIdAndMonth(List<String> equipmentIdList, String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/AndonOrderServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
package org.jeecg.modules.mdc.service.impl;
import cn.hutool.core.date.DatePattern;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.WebsocketConst;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.board.vo.EquAndon;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.entity.AndonOrder;
import org.jeecg.modules.mdc.mapper.AndonOrderMapper;
import org.jeecg.modules.mdc.service.IAndonOrderService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.vo.AndonOrderWebSocketVo;
import org.jeecg.modules.message.websocket.WebSocket;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecg.modules.system.service.ISysUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @Description: andon_order
 * @Author: jeecg-boot
 * @Date: 2025-06-11
 * @Version: V1.0
 */
@Service
public class AndonOrderServiceImpl extends ServiceImpl<AndonOrderMapper, AndonOrder> implements IAndonOrderService {
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private WebSocket webSocket;
    @Resource
    private ISysUserService userService;
    @Resource
    private ISysDictService sysDictService;
    @Override
    public void procedureCall(AndonOrder andonOrder) {
        if (StringUtils.isBlank(andonOrder.getEquipmentId())) {
            throw new JeecgBootException("请选择设备!");
        }
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        List<String> equipmentIds = Arrays.asList(andonOrder.getEquipmentId().split(StringPool.COMMA));
        List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(equipmentIds);
        Map<String, MdcEquProDto> equipmentIdToProductionIdMap = equipmentList.stream().collect(Collectors.toMap(MdcEquProDto::getEquipmentId, comRateDto -> comRateDto));
        List<AndonOrder> list = Lists.newArrayList();
        for (String equipmentId : equipmentIds) {
            AndonOrder andonOrderInfo = new AndonOrder();
            andonOrderInfo.setEquipmentId(equipmentId);
            andonOrderInfo.setPlantName(equipmentIdToProductionIdMap != null && equipmentIdToProductionIdMap.containsKey(equipmentId) ? equipmentIdToProductionIdMap.get(equipmentId).getId() : null);
            andonOrderInfo.setAndonType(StringPool.ONE);
            andonOrderInfo.setOrderStatus(StringPool.ONE);
            andonOrderInfo.setOperator(andonOrder.getOperator());
            andonOrderInfo.setOperateTime(new Date());
            andonOrderInfo.setResponder(userId);
            andonOrderInfo.setCallReason(andonOrder.getCallReason());
            list.add(andonOrderInfo);
        }
        if (this.saveBatch(list)) {
            List<AndonOrderWebSocketVo> andonOrderWebSocketVoList = Lists.newArrayList();
            //设置websocket请求消息数据
            for (AndonOrder order : list) {
                AndonOrderWebSocketVo andonOrderWebSocketVo = new AndonOrderWebSocketVo();
                andonOrderWebSocketVo.setEquipmentId(order.getEquipmentId());
                andonOrderWebSocketVo.setCallPersonnel(userService.getById(order.getOperator()).getRealname());
                andonOrderWebSocketVo.setCallTime(DateUtils.format(order.getOperateTime(), DatePattern.NORM_DATE_PATTERN));
                andonOrderWebSocketVo.setCallReason(order.getCallReason());
                andonOrderWebSocketVo.setAndonType("程序呼叫");
                andonOrderWebSocketVo.setPersonResponsible(user.getRealname());
                andonOrderWebSocketVo.setRepairTime(StringPool.EMPTY);
                andonOrderWebSocketVo.setFaultInfo(StringPool.EMPTY);
                andonOrderWebSocketVo.setPlantName(equipmentIdToProductionIdMap != null && equipmentIdToProductionIdMap.containsKey(order.getEquipmentId()) ? equipmentIdToProductionIdMap.get(order.getEquipmentId()).getProductionName() : null);
                andonOrderWebSocketVoList.add(andonOrderWebSocketVo);
            }
            //发送websocket请求
            JSONObject jsonObject = new JSONObject();
            jsonObject.put(WebsocketConst.MSG_CMD, "andon");
            jsonObject.put("data", andonOrderWebSocketVoList);
            webSocket.sendMessage(jsonObject.toJSONString());
        }
    }
    /**
     * å®‰ç¯é—®é¢˜åˆ—表
     */
    @Override
    public List<EquAndon> equAndonList(List<String> equipmentIdList) {
        List<EquAndon> result = new ArrayList<>();
        List<AndonOrder> andonOrderList = this.baseMapper.equAndonList(equipmentIdList);
        if (andonOrderList != null && !andonOrderList.isEmpty()) {
            andonOrderList.forEach(andonOrder -> {
                EquAndon equAndon = new EquAndon();
                equAndon.setEquipmentId(andonOrder.getEquipmentId());
                StringBuilder infoBuilder = new StringBuilder();
                infoBuilder.append("安灯类型: ").append(sysDictService.queryDictTextByKey("andon_type",andonOrder.getAndonType())).append("\n");
                infoBuilder.append("安灯人: ").append(sysDictService.queryTableDictTextByKey("sys_user", "realname", "id", andonOrder.getOperator())).append("\n");
                infoBuilder.append("安灯时间: ").append(DateUtils.format(andonOrder.getOperateTime(), DateUtils.STR_DATE_TIME_SMALL)).append("\n");
                infoBuilder.append("安灯状态: ").append(sysDictService.queryDictTextByKey("order_status",andonOrder.getOrderStatus())).append("\n");
                equAndon.setAndonInfo(infoBuilder.toString());
                result.add(equAndon);
            });
        }
        return result;
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentAlarmServiceImpl.java
@@ -22,4 +22,9 @@
                .ge(EquipmentAlarm::getCollecttime, startTime).le(EquipmentAlarm::getCollecttime, endTime)
                .eq(EquipmentAlarm::getEquipmentid, equipmentId).orderByDesc(EquipmentAlarm::getCollecttime));
    }
    @Override
    public List<EquipmentAlarm> equAlarmList(List<String> equipmentIdList) {
        return this.baseMapper.equAlarmList(equipmentIdList);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcAlarmInfoServiceImpl.java
@@ -15,4 +15,9 @@
@Service
public class MdcAlarmInfoServiceImpl extends ServiceImpl<MdcAlarmInfoMapper, MdcAlarmInfo> implements IMdcAlarmInfoService {
    @Override
    public MdcAlarmInfo findAlarmContent(String alarmNo, String equipmentId) {
        return this.baseMapper.findAlarmContent(alarmNo, equipmentId);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.board.vo.EquDowntimeInfo;
import org.jeecg.modules.mdc.dto.MdcDowntimeDto;
import org.jeecg.modules.mdc.entity.MdcDowntime;
import org.jeecg.modules.mdc.mapper.MdcDowntimeMapper;
@@ -68,6 +69,11 @@
        return result;
    }
    @Override
    public List<EquDowntimeInfo> equDowntimeStatistics(List<String> equipmentIdList, String start, String end) {
        return this.baseMapper.equDowntimeStatistics(equipmentIdList, start, end);
    }
    private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) {
        if (StringUtils.isNotEmpty(mdcDowntimeVo.getEquipmentId())) {
            return Collections.singletonList(mdcDowntimeVo.getEquipmentId());
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -196,6 +196,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));
                    long rate = mdcEfficiencyResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -284,6 +290,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));
                    long rate = mdcEfficiencyResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -349,7 +361,10 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
@@ -392,7 +407,10 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
@@ -696,7 +714,10 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).ifPresent(result::add);
                });
        for (MdcEfficiencyResultDto mdcEfficiencyResultDto : result) {
            mdcEfficiencyResultDto.setUtilizationRate(mdcEfficiencyResultDto.getUtilizationRate().divide(new BigDecimal(mdcEfficiencyList.size()), 4, RoundingMode.HALF_UP));
@@ -706,6 +727,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));
            long rate = mdcEfficiencyResultDto.getStartRate().multiply(new BigDecimal("100")).longValue();
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -740,12 +764,16 @@
                            a.getOpenRate().add(b.getOpenRate()),
                            a.getOpenLong().add(b.getOpenLong()),
                            a.getWaitLong().add(b.getWaitLong()),
                            a.getCloseLong().add(b.getCloseLong()))).ifPresent(result::add);
                            a.getCloseLong().add(b.getCloseLong()),
                            a.getFaultLong().add(b.getFaultLong()),
                            a.getFaultRate().add(b.getFaultRate()),
                            a.getRemoveFaultRunLong().add(b.getRemoveFaultRunLong()))).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));
            long rate = mdcEfficiencyResultDto.getStartRate().multiply(new BigDecimal("100")).longValue();
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -2146,6 +2174,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());
                    long rate = efficiencyDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue();
                    for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                        if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) {
@@ -2163,6 +2194,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"));
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) {
                    mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor());
@@ -2178,6 +2212,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"));
            for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) {
                if (0 >= mdcUtilizationRate.getMinimumRange() && 0 < mdcUtilizationRate.getMaximumRange()) {
                    mdcEfficiencyResultDto.setColor(mdcUtilizationRate.getRateParameterColor());
@@ -2191,6 +2228,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()));
        return mdcEfficiencyResultDto;
    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -323,4 +323,14 @@
    public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) {
        return this.baseMapper.findByEquipmentAndMonth(equipmentId, date);
    }
    @Override
    public MdcEquipmentStatisticalInfo findByEquIdsAndMonth(List<String> equipmentIdList, String month) {
        return this.baseMapper.findByEquIdsAndMonth(equipmentIdList, month);
    }
    @Override
    public List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentIdList, String date) {
        return this.baseMapper.findByEquipmentAndDate(equipmentIdList, date);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
@@ -243,4 +243,9 @@
        super.saveBatch(result);
    }
    @Override
    public BigDecimal findByEquIdAndMonth(List<String> equipmentIdList, String month) {
        return this.baseMapper.findByEquIdAndMonth(equipmentIdList, month);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/AndonOrderWebSocketVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
package org.jeecg.modules.mdc.vo;
import lombok.Data;
@Data
public class AndonOrderWebSocketVo {
    /**
     * è®¾å¤‡ç¼–号
     */
    private String equipmentId;
    /**
     * å‘¼å«äººå‘˜
     */
    private String callPersonnel;
    /**
     * å®‰ç¯ç±»åž‹
     */
    private String andonType;
    /**
     * å‘¼å«æ—¶é—´
     */
    private String callTime;
    /**
     * å‘¼å«åŽŸå› 
     */
    private String callReason;
    /**
     * è´£ä»»äºº
     */
    private String personResponsible;
    /**
     * æŠ¥ä¿®æ—¶é—´
     */
    private String repairTime;
    /**
     * æ•…障描述
     */
    private String faultInfo;
    /**
     * æ‰€å±žåŽ‚æˆ¿
     */
    private String plantName;
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -61,4 +61,8 @@
    List<String> findTeamValue(@Param("userId") String userId, @Param("productionList") List<String> productionList);
    List<String> findProIdsByUId(@Param("userId") String userId, @Param("allProductionIds") List<String> allProductionIds);
    List<String> findChildByProId(@Param("productionId") String productionId);
    String findProName(@Param("equipmentId") String equipmentId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -138,4 +138,67 @@
            </foreach>
          AND user_id = #{userId}
    </select>
    <select id="findChildByProId" resultType="java.lang.String">
        WITH temp ( id ) AS (
            SELECT
                id
            FROM
                mdc_production
            WHERE
                id = #{ productionId }
              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="findProName" resultType="java.lang.String">
        WITH production_hierarchy AS (
            SELECT
                t3.id,
                t3.parent_id,
                t3.production_name,
                t3.org_type,
                0 AS level
            FROM
                mdc_equipment t1
                    JOIN
                mdc_production_equipment t2 ON t1.id = t2.equipment_id
                    JOIN
                mdc_production t3 ON t2.production_id = t3.id
            WHERE
                t1.equipment_id = #{equipmentId}
            UNION ALL
            SELECT
                t4.id,
                t4.parent_id,
                t4.production_name,
                t4.org_type,
                ph.level + 1
            FROM
                production_hierarchy ph
                    JOIN
                mdc_production t4 ON ph.parent_id = t4.id
            WHERE
                ph.parent_id IS NOT NULL
        )
        SELECT TOP 1
            production_name
        FROM
            production_hierarchy
        WHERE
            org_type = 2
        ORDER BY
            level ASC
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -177,6 +177,15 @@
    List<String> findProIdsByUId(String userId, List<String> allProductionIds);
    /**
     *
     * @param productionId
     * @return
     */
    List<String> findChildByProId(String productionId);
    String findProName(String equipmentId);
    /**
     * æ ¹æ®äº§çº¿orgCode查询产线
     * @param orgCode
     * @return
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -629,6 +629,16 @@
    }
    @Override
    public List<String> findChildByProId(String productionId) {
        return this.baseMapper.findChildByProId(productionId);
    }
    @Override
    public String findProName(String equipmentId) {
        return this.baseMapper.findProName(equipmentId);
    }
    @Override
    public MdcProduction findByOrgCode(String orgCode){
        return this.baseMapper.selectOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgCode, orgCode));
    }