lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentAlarmMapper.java
@@ -1,11 +1,22 @@ 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 org.jeecg.modules.screen.dto.AlarmInfoDto; import java.util.List; /** * @author: LiuS * @create: 2023-04-12 16:39 */ public interface EquipmentAlarmMapper extends BaseMapper<EquipmentAlarm> { /** * æ ¹æ®æ¯çidè·åæ¥è¦ä¿¡æ¯ * * @param productionId * @return */ List<AlarmInfoDto> getAlarmInfo(@Param("productionId") String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentAlarmMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,21 @@ <?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="getAlarmInfo" resultType="org.jeecg.modules.screen.dto.AlarmInfoDto"> SELECT TOP 10 t1.EquipmentID equipmentId, t1."collectTime" collectTime, t1."AlarmNo" alarmNo FROM equipmentalarm t1 INNER JOIN mdc_equipment t2 ON t1.EquipmentID = t2.equipment_id INNER JOIN mdc_production_equipment t3 ON t2.id = t3.equipment_id INNER JOIN mdc_production t4 ON t3.production_id = t4.id WHERE t4.parent_id = #{productionId} AND t1.AlarmNo != '' ORDER BY t1.collectTime DESC </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml
@@ -4,27 +4,36 @@ <select id="getBigScreenInfo" resultType="org.jeecg.modules.mdc.dto.MdcBigScreenEquipmentDto"> WITH LatestEquipmentLog AS ( SELECT mew.id id, a.EquipmentID equipmentId, me.equipment_name equipmentName, me.equipment_type equipmentType, met.equipment_type_pictures equipmentImage, a.Oporation equipmentStatus, mew.coordinate_left coordinateLeft, mew.coordinate_top coordinateTop, mew.vw vw, mew.vh vh, me.id equId EquipmentID, MAX(CollectTime) AS maxgdtime FROM EquipmentLog GROUP BY EquipmentID ) SELECT mew.id AS id, a.EquipmentID AS equipmentId, me.equipment_name AS equipmentName, me.equipment_type AS equipmentType, met.equipment_type_pictures AS equipmentImage, a.Oporation AS equipmentStatus, mew.coordinate_left AS coordinateLeft, mew.coordinate_top AS coordinateTop, mew.vw AS vw, mew.vh AS vh, me.id AS equId FROM EquipmentLog a INNER JOIN ( SELECT EquipmentID, MAX ( CollectTime ) maxgdtime FROM EquipmentLog GROUP BY EquipmentID ) b ON a.EquipmentID= b.EquipmentID INNER JOIN LatestEquipmentLog b ON a.EquipmentID = b.EquipmentID AND a.CollectTime = b.maxgdtime INNER JOIN mdc_workshop_equipment mew ON mew.equipment_id = a.EquipmentID INNER JOIN mdc_equipment me ON me.equipment_id = a.EquipmentID INNER JOIN mdc_equipment_type met ON me.equipment_type = met.equipment_type_name INNER JOIN mdc_workshop_info mwi ON mew.workshop_id = mwi.id AND a.CollectTime= b.maxgdtime AND mwi.production_id = #{ productionId } WHERE mwi.production_id = #{productionId} </select> <select id="listByUser" resultType="org.jeecg.modules.mdc.entity.MdcWorkshopInfo"> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentAlarmService.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.entity.EquipmentAlarm; import org.jeecg.modules.screen.dto.AlarmInfoDto; import java.util.Date; import java.util.List; @@ -12,4 +13,6 @@ */ public interface IEquipmentAlarmService extends IService<EquipmentAlarm> { List<EquipmentAlarm> findEquipmentAlarmByDate(String equipmentId, Date startTime, Date endTime); List<AlarmInfoDto> getAlarmInfo(String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentAlarmServiceImpl.java
@@ -5,6 +5,7 @@ import org.jeecg.modules.mdc.entity.EquipmentAlarm; import org.jeecg.modules.mdc.mapper.EquipmentAlarmMapper; import org.jeecg.modules.mdc.service.IEquipmentAlarmService; import org.jeecg.modules.screen.dto.AlarmInfoDto; import org.springframework.stereotype.Service; import java.util.Date; @@ -22,4 +23,9 @@ .ge(EquipmentAlarm::getCollecttime, startTime).le(EquipmentAlarm::getCollecttime, endTime) .eq(EquipmentAlarm::getEquipmentid, equipmentId).orderByDesc(EquipmentAlarm::getCollecttime)); } @Override public List<AlarmInfoDto> getAlarmInfo(String productionId) { return this.baseMapper.getAlarmInfo(productionId); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.screen.dto.AlarmInfoDto; import org.jeecg.modules.screen.dto.EquipmentStatusOverview; import org.jeecg.modules.screen.service.MdcLargeScreenService; import org.springframework.web.bind.annotation.GetMapping; @@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** @@ -43,16 +45,23 @@ @ApiOperation(value = "大å±çæ¿-å¨å©ç¨çè¶å¿", notes = "大å±çæ¿-å¨å©ç¨çè¶å¿") @GetMapping("/weekUtilizationTendency") public Result<?> weekUtilizationTendency(String productionId) { public Result<Map<String, Object>> weekUtilizationTendency(String productionId) { Map<String, Object> result = mdcLargeScreenService.weekUtilizationTendency(productionId); return Result.OK(result); } @ApiOperation(value = "大å±çæ¿-æ¥å©ç¨çè¶å¿", notes = "大å±çæ¿-æ¥å©ç¨çè¶å¿") @GetMapping("/dayUtilizationTendency") public Result<?> dayUtilizationTendency(String productionId) { public Result<Map<String, Object>> dayUtilizationTendency(String productionId) { Map<String, Object> result = mdcLargeScreenService.dayUtilizationTendency(productionId); return Result.OK(result); } @ApiOperation(value = "大å±çæ¿-è®¾å¤æ¥è¦ä¿¡æ¯", notes = "大å±çæ¿-è®¾å¤æ¥è¦ä¿¡æ¯") @GetMapping("/getAlarmInfo") public Result<List<AlarmInfoDto>> getAlarmInfo(String productionId) { List<AlarmInfoDto> result = mdcLargeScreenService.getAlarmInfo(productionId); return Result.OK(result); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/AlarmInfoDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,30 @@ package org.jeecg.modules.screen.dto; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * @Author: Lius * @CreateTime: 2025-03-04 * @Description: */ @Data @ApiModel(value = "æ¥è¦ä¿¡æ¯resp", description = "æ¥è¦ä¿¡æ¯resp") public class AlarmInfoDto { @ApiModelProperty(value = "设å¤ç¼å·") private String equipmentId; @ApiModelProperty(value = "æ¥è¦æ¶é´") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date collectTime; @ApiModelProperty(value = "æ¥è¦å·") private String alarmNo; } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/UtilizationRateDto.java
@@ -30,6 +30,6 @@ * æå©ç¨ç */ @ApiModelProperty(value = "å©ç¨çéå") private List<UtilizationRate> utilizationMonthList; private List<UtilizationRate> utilizationRateList; } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java
@@ -1,7 +1,9 @@ package org.jeecg.modules.screen.service; import org.jeecg.modules.screen.dto.AlarmInfoDto; import org.jeecg.modules.screen.dto.EquipmentStatusOverview; import java.util.List; import java.util.Map; /** @@ -43,4 +45,11 @@ */ Map<String, Object> dayUtilizationTendency(String productionId); /** * è®¾å¤æ¥è¦ä¿¡æ¯ * * @param productionId * @return */ List<AlarmInfoDto> getAlarmInfo(String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
@@ -4,13 +4,11 @@ import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.DictModel; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.mdc.service.IEquipmentAlarmService; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.screen.dto.EquipmentStatusOverview; import org.jeecg.modules.screen.dto.UtilizationDayDto; import org.jeecg.modules.screen.dto.UtilizationRate; import org.jeecg.modules.screen.dto.UtilizationRateDto; import org.jeecg.modules.screen.dto.*; import org.jeecg.modules.screen.service.MdcLargeScreenService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; @@ -42,6 +40,9 @@ @Resource private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; @Resource private IEquipmentAlarmService equipmentAlarmService; /** * 设å¤ç¶ææ åµ @@ -165,7 +166,7 @@ return utilizationMonth; }) .collect(Collectors.toList()); utilizationRateDto.setUtilizationMonthList(utilizationRates); utilizationRateDto.setUtilizationRateList(utilizationRates); utilizationMonthDtoList.add(utilizationRateDto); } //è®¡ç®æ»åçå©ç¨ç @@ -180,7 +181,7 @@ return utilizationMonth; }) .collect(Collectors.toList()); utilizationRateDto.setUtilizationMonthList(utilizationRates); utilizationRateDto.setUtilizationRateList(utilizationRates); utilizationMonthDtoList.add(utilizationRateDto); result.put("dataList", utilizationMonthDtoList); return result; @@ -220,6 +221,17 @@ } /** * è®¾å¤æ¥è¦ä¿¡æ¯ * * @param productionId * @return */ @Override public List<AlarmInfoDto> getAlarmInfo(String productionId) { return equipmentAlarmService.getAlarmInfo(productionId); } /** * å建åç产çæåº¦å©ç¨ç DTO */ private UtilizationRateDto createUtilizationMonthDto(MdcProduction mdcProduction, List<String[]> dateLists) { @@ -228,7 +240,7 @@ utilizationMonthDto.setProductionName(mdcProduction.getProductionName()); List<UtilizationRate> utilizationMonthList = calculateUtilizationRates(mdcProduction.getId(), dateLists); utilizationMonthDto.setUtilizationMonthList(utilizationMonthList); utilizationMonthDto.setUtilizationRateList(utilizationMonthList); return utilizationMonthDto; } @@ -241,7 +253,7 @@ utilizationMonthDto.setProductionName("æ»å"); List<UtilizationRate> utilizationMonthList = calculateUtilizationRatesTotal(productionId, dateLists); utilizationMonthDto.setUtilizationMonthList(utilizationMonthList); utilizationMonthDto.setUtilizationRateList(utilizationMonthList); return utilizationMonthDto; }