lxzn-boot-base-core/src/main/java/org/jeecg/config/Swagger2Config.java
@@ -178,6 +178,24 @@ .groupName("eam"); } @Bean(value = "defaultApiBoard") public Docket activitiApiBoard() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() //æ¤å è·¯å¾ä¸çç±»ï¼æçææ¥å£ææ¡£ .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.board")) //å äºApiOperation注解çç±»ï¼æçææ¥å£ææ¡£ .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) .paths(PathSelectors.any()) .build() .securitySchemes(Collections.singletonList(securityScheme())) .securityContexts(securityContexts()) .globalOperationParameters(setHeaderToken()) .groupName("æ°ååªççæ¿"); } /*** * oauth2é ç½® * éè¦å¢å swaggerææåè°å°å lxzn-module-mdc/src/main/java/org/jeecg/modules/board/controller/DtBoardController.java
@@ -92,5 +92,12 @@ 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/service/IDtBoardService.java
@@ -29,4 +29,7 @@ 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
@@ -16,6 +16,7 @@ import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -70,6 +71,9 @@ @Resource private DtBoardMapper dtBoardMapper; @Resource private IAndonOrderService andonOrderService; /** * 车é´ä¿¡æ¯ @@ -326,7 +330,7 @@ if (equipmentIdList == null || equipmentIdList.isEmpty()) { return null; } List<EquipmentAlarm> equipmentAlarmList = equipmentAlarmService.list(new LambdaQueryWrapper<EquipmentAlarm>().in(EquipmentAlarm::getEquipmentid, equipmentIdList).orderByDesc(EquipmentAlarm::getCollecttime).isNotNull(EquipmentAlarm::getAlarmNo).last("TOP 15")); List<EquipmentAlarm> equipmentAlarmList = equipmentAlarmService.equAlarmList(equipmentIdList); if (equipmentAlarmList == null || equipmentAlarmList.isEmpty()) { return null; } @@ -346,8 +350,6 @@ /** * è®¾å¤æ é * @param productionId * @return */ @Override public List<EquRepair> equRepairList(String productionId) { @@ -365,4 +367,21 @@ 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/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/mdc/mapper/AndonOrderMapper.java
@@ -1,7 +1,10 @@ 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 @@ -11,4 +14,5 @@ */ 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,15 @@ 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/xml/AndonOrderMapper.xml
@@ -2,4 +2,18 @@ <!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/MdcDowntimeMapper.xml
@@ -44,7 +44,7 @@ <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_hours 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 @@ -57,7 +57,5 @@ </foreach> GROUP BY t2.downtime_description ORDER BY duration_hours DESC </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IAndonOrderService.java
@@ -1,7 +1,10 @@ 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 @@ -12,4 +15,6 @@ 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/impl/AndonOrderServiceImpl.java
@@ -2,14 +2,19 @@ import cn.hutool.core.date.DatePattern; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.parser.Feature; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; 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.common.util.TranslateDictTextUtils; 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; @@ -18,7 +23,9 @@ 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.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -28,7 +35,7 @@ /** * @Description: andon_order * @Author: jeecg-boot * @Date: 2025-06-11 * @Date: 2025-06-11 * @Version: V1.0 */ @Service @@ -40,6 +47,9 @@ private WebSocket webSocket; @Resource private ISysUserService userService; @Resource private ISysDictService sysDictService; @Override public void procedureCall(AndonOrder andonOrder) { if (StringUtils.isBlank(andonOrder.getEquipmentId())) { @@ -89,4 +99,27 @@ 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
@@ -7,6 +7,7 @@ import org.jeecg.modules.mdc.service.IEquipmentAlarmService; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.Date; import java.util.List; @@ -22,4 +23,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); } }