db/dbo.sql
¶Ô±ÈÐÂÎļþ ÎļþÌ«´ó jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/entity/Equipment.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,188 @@ package org.jeecg.modules.iot.mdc.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * @Description: éé设å¤è¡¨ * @Author: liuS * @Date: 2023-03-23 * @Version: V1.0 */ @Data @TableName("Equipment") @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @ApiModel(value = "Equipment对象", description = "éé设å¤è¡¨") public class Equipment { /** * ç³»ç»id */ @Excel(name = "ç³»ç»id", width = 15) @ApiModelProperty(value = "ç³»ç»id") private String beltlineid; /** * 设å¤ç¼ç */ @Excel(name = "设å¤ç¼ç ", width = 15) @ApiModelProperty(value = "设å¤ç¼ç ") @TableId(type = IdType.AUTO) private String equipmentid; /** * å·¥åid */ @Excel(name = "å·¥åid", width = 15) @ApiModelProperty(value = "å·¥åid") private String factoryid; /** * ç³»ç»åç§° */ @Excel(name = "ç³»ç»åç§°", width = 15) @ApiModelProperty(value = "ç³»ç»åç§°") private String beltlinename; /** * 设å¤ç±»å */ @Excel(name = "设å¤ç±»å", width = 15) @ApiModelProperty(value = "设å¤ç±»å") private String equipmentmodel; /** * 设å¤åç§° */ @Excel(name = "设å¤åç§°", width = 15) @ApiModelProperty(value = "设å¤åç§°") private String equipmentname; /** * 设å¤åç±» */ @Excel(name = "设å¤åç±»", width = 15) @ApiModelProperty(value = "设å¤åç±»") private String equipmentclassify; /** * 设å¤ä½ç½® */ @Excel(name = "设å¤ä½ç½®", width = 15) @ApiModelProperty(value = "设å¤ä½ç½®") private String equipmentlocation; /** * æ¥è¦å· */ @Excel(name = "æ¥è¦å·", width = 15) @ApiModelProperty(value = "æ¥è¦å·") private String alarm; /** * ééæ¶é´ */ @Excel(name = "ééæ¶é´", width = 20, format = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "ééæ¶é´") private Date collecttime; /** * 设å¤ç±»å */ @Excel(name = "设å¤ç±»å", width = 15) @ApiModelProperty(value = "设å¤ç±»å") private String equipmenttype; /** * åºå®ä½ç½® */ @Excel(name = "åºå®ä½ç½®", width = 15) @ApiModelProperty(value = "åºå®ä½ç½®") private String fixlocation; /** * 宿¶ç¶æ */ @Excel(name = "宿¶ç¶æ", width = 15) @ApiModelProperty(value = "宿¶ç¶æ") private Integer oporation; /** * è®¾å¤æ°æ® */ @Excel(name = "è®¾å¤æ°æ®", width = 15) @ApiModelProperty(value = "è®¾å¤æ°æ®") private Object equipmentdata; /** * 设å¤ip */ @Excel(name = "设å¤ip", width = 15) @ApiModelProperty(value = "设å¤ip") private String equipmentip; /** * 夿³¨ */ @Excel(name = "夿³¨", width = 15) @ApiModelProperty(value = "夿³¨") private String remark; /** * æ¥è¦å· */ @Excel(name = "æ¥è¦å·", width = 15) @ApiModelProperty(value = "æ¥è¦å·") private String alarmno; /** * æ¥è¦å 容 */ @Excel(name = "æ¥è¦å 容", width = 15) @ApiModelProperty(value = "æ¥è¦å 容") private String alarmcontent; /** * äº§åæ°é */ @Excel(name = "äº§åæ°é", width = 15) @ApiModelProperty(value = "äº§åæ°é") private String productcount; /** * 驱å¨ç±»å */ @Excel(name = "驱å¨ç±»å", width = 15) @ApiModelProperty(value = "驱å¨ç±»å") private String drivetype; /** * æ°æ®ç«¯å£ */ @Excel(name = "æ°æ®ç«¯å£", width = 15) @ApiModelProperty(value = "æ°æ®ç«¯å£") private String dataport; /** * æ§å¶ç³»ç» */ @Excel(name = "æ§å¶ç³»ç»", width = 15) @ApiModelProperty(value = "æ§å¶ç³»ç»") private String controlsystem; /** * 表å */ @Excel(name = "表å", width = 15) @ApiModelProperty(value = "表å") private String savetablename; /** * éè¦æ§ */ @Excel(name = "éè¦æ§", width = 15) @ApiModelProperty(value = "éè¦æ§") private Integer isimportant; /** * ç»´æ¤ç¶æ */ @Excel(name = "ç»´æ¤ç¶æ", width = 15) @ApiModelProperty(value = "ç»´æ¤ç¶æ") private Integer maintaintype; /** * é«ä½æ§å¶ */ @Excel(name = "é«ä½æ§å¶", width = 15) @ApiModelProperty(value = "é«ä½æ§å¶") private String highlowcontrol; } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/entity/EquipmentAlarm.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package org.jeecg.modules.iot.mdc.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("EquipmentAlarm") public class EquipmentAlarm implements Serializable { private static final long serialVersionUID = -4762333096168370779L; @TableId(type = IdType.AUTO) private String equipmentid; private Date collecttime; @TableField(value = "alarmNo") private String alarmNo; @TableField(value = "alarmContent") private String alarmContent; private String isexamine; private String iseffective; private Date examinetime; private String examineperson; private String remark; } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/entity/EquipmentLog.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,43 @@ package org.jeecg.modules.iot.mdc.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; import java.util.Date; @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("EquipmentLog") @ApiModel(value = "设å¤åå²è¡¨") public class EquipmentLog implements Serializable { private static final long serialVersionUID = 6978749606363390023L; @ApiModelProperty(value = "设å¤ID") @TableId(value = "EquipmentID") private String equipmentId; @TableField(value = "EquipmentName") private String equipmentName; @TableField(value = "CollectTime") private Date collectTime; @TableField(value = "Oporation") private Integer oporation; @TableField(value = "Alarm") private String alarm; @TableField(exist = false) private String createBy = "admin"; @TableField(exist = false) private String oporationName; } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/entity/MdcDriveTypeParamConfig.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,66 @@ package org.jeecg.modules.iot.mdc.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.jeecg.common.system.base.entity.JeecgEntity; import org.jeecgframework.poi.excel.annotation.Excel; /** * @Description: 驱å¨åæ°é ç½® * @Author: jeecg-boot * @Date: 2023-04-20 * @Version: V1.0 */ @Data @TableName("mdc_drive_type_param_config") @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @ApiModel(value = "mdc_drive_type_param_config对象", description = "驱å¨åæ°é ç½®") public class MdcDriveTypeParamConfig extends JeecgEntity { /** * æ§å¶ç³»ç»ç±»å */ @Excel(name = "æ§å¶ç³»ç»ç±»å", width = 15) @ApiModelProperty(value = "æ§å¶ç³»ç»ç±»å") private String controlSystemType; /** * 䏿åç§° */ @Excel(name = "䏿åç§°", width = 15) @ApiModelProperty(value = "䏿åç§°") private String chineseName; /** * è±æåç§° */ @Excel(name = "è±æåç§°", width = 15) @ApiModelProperty(value = "è±æåç§°") private String englishName; /** * åºå· */ @Excel(name = "åºå·", width = 15) @ApiModelProperty(value = "åºå·") private Integer sortNo; /** * å±ç¤ºæ å¿ */ @Excel(name = "å±ç¤ºæ å¿", width = 15, replace = {"æ¯_Y", "å¦_N"}) @ApiModelProperty(value = "å±ç¤ºæ å¿") private String showFlag; /** * 工使²çº¿çææ è®° */ @Excel(name = "工使²çº¿çææ è®°", width = 15, replace = {"æ¯_Y", "å¦_N"}) @ApiModelProperty(value = "工使²çº¿çææ è®°") private String curveGenerationFlags; @TableField(exist = false) @ApiModelProperty(value = "ééå¼") private String value; } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/EquipmentAlarmMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,11 @@ package org.jeecg.modules.iot.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.iot.mdc.entity.EquipmentAlarm; /** * @author: LiuS * @create: 2023-04-12 16:39 */ public interface EquipmentAlarmMapper extends BaseMapper<EquipmentAlarm> { } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/EquipmentLogMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ package org.jeecg.modules.iot.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.iot.mdc.entity.EquipmentLog; import java.util.Date; import java.util.List; /** * @author: LiuS * @create: 2023-04-12 14:44 */ public interface EquipmentLogMapper extends BaseMapper<EquipmentLog> { EquipmentLog getRow(@Param("equipmentid") String equipmentid, @Param("startTime") Date startTime); EquipmentLog selectEquipmentOporation(@Param("equipmentId") String equipmentId); List<EquipmentLog> getEquipmentStatusList(@Param("equipmentIdList") List<String> equipmentIdList); } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/EquipmentMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ package org.jeecg.modules.iot.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.*; import org.jeecg.modules.iot.mdc.entity.Equipment; import org.springframework.stereotype.Component; /** * @Description: éé设å¤è¡¨ * @Author: liuS * @Date: 2023-03-23 * @Version: V1.0 */ @Component("mdcEquipmentMapper") @Mapper public interface EquipmentMapper extends BaseMapper<Equipment> { @Select(" SELECT name FROM SysObjects Where XType='U' AND name = '${saveTableName}' ") String checkTableExists(@Param("saveTableName") String saveTableName); @Select(" SELECT COUNT(CollectTime) num FROM ${saveTableName} WHERE CollectTime < '${day}' ") Integer checkTableDataNum(@Param("saveTableName") String saveTableName, @Param("day") String day); @Insert(" INSERT INTO ${tableName} SELECT * FROM ${lastTableName} WHERE CollectTime < '${date}' ") void insertTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date); @Delete(" delete from ${tableName} where CollectTime < '${day}' ") void deleteTableData(@Param("tableName") String saveTableName, @Param("day") String day); @Insert(" SELECT * INTO ${tableName} FROM ${lastTableName} WHERE CollectTime < '${date}' ") void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date); } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/MdcDriveTypeParamConfigMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,27 @@ package org.jeecg.modules.iot.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.iot.mdc.entity.MdcDriveTypeParamConfig; import java.util.List; /** * @Description: 驱å¨åæ°é ç½® * @Author: jeecg-boot * @Date: 2023-04-20 * @Version: V1.0 */ public interface MdcDriveTypeParamConfigMapper extends BaseMapper<MdcDriveTypeParamConfig> { /** * æ ¹æ®è®¾å¤ç¼ç è·å工使²çº¿åæ° */ List<MdcDriveTypeParamConfig> findWorkCurveParamList(@Param("equipmentId") String equipmentId); /** * è·åæ§å¶ç³»ç»ç±»å䏿æ¡é项 */ List<String> getDriveParamOptions(); } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/xml/EquipmentLogMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ <?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.iot.mdc.mapper.EquipmentLogMapper"> <select id="getRow" resultType="org.jeecg.modules.iot.mdc.entity.EquipmentLog"> SELECT top 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentid } AND CollectTime <= #{ startTime } AND Oporation in ('0','1','2','3') ORDER BY CollectTime ASC </select> <select id="selectEquipmentOporation" resultType="org.jeecg.modules.iot.mdc.entity.EquipmentLog"> SELECT TOP 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentId } ORDER BY CollectTime DESC </select> <!--æ¥è¯¢è®¾å¤ææ°ä¸æ¡æ°æ®--> <select id="getEquipmentStatusList" resultType="org.jeecg.modules.iot.mdc.entity.EquipmentLog"> SELECT t1.* FROM EquipmentLog t1 INNER JOIN ( SELECT MAX ( CollectTime ) AS CollectTime, EquipmentID FROM EquipmentLog GROUP BY EquipmentID ) t2 ON t1.CollectTime= t2.CollectTime AND t1.EquipmentID= t2.EquipmentID <if test="equipmentIdList != null and equipmentIdList.size() > 0"> AND t1.EquipmentID IN <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </if> </select> </mapper> jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/xml/EquipmentMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.iot.mdc.mapper.EquipmentMapper"> </mapper> jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +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.iot.mdc.mapper.MdcDriveTypeParamConfigMapper"> <!--æ ¹æ®è®¾å¤ç¼ç è·å工使²çº¿åæ°--> <select id="findWorkCurveParamList" resultType="org.jeecg.modules.iot.mdc.entity.MdcDriveTypeParamConfig"> SELECT mdtpc.* FROM mdc_drive_type_param_config mdtpc LEFT JOIN mdc_equipment me ON mdtpc.control_system_type = me.drive_type WHERE mdtpc.curve_generation_flags = 'Y' AND me.equipment_id = #{equipmentId} </select> <select id="getDriveParamOptions" resultType="java.lang.String"> SELECT DISTINCT control_system_type FROM mdc_drive_type_param_config </select> </mapper> jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/IEquipmentAlarmService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,15 @@ package org.jeecg.modules.iot.mdc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.iot.mdc.entity.EquipmentAlarm; import java.util.Date; import java.util.List; /** * @author: LiuS * @create: 2023-04-12 16:38 */ public interface IEquipmentAlarmService extends IService<EquipmentAlarm> { List<EquipmentAlarm> findEquipmentAlarmByDate(String equipmentId, Date startTime, Date endTime); } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/IEquipmentLogService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,33 @@ package org.jeecg.modules.iot.mdc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.iot.mdc.entity.EquipmentLog; import java.util.Date; import java.util.List; /** * @author: LiuS * @create: 2023-04-12 14:40 */ public interface IEquipmentLogService extends IService<EquipmentLog> { /** * æ¥è¯¢æä¸ªè®¾å¤æä¸ªæ¶é´ç¹ä¹åçæ°æ® */ List<EquipmentLog> findEquipmentLogByEndTime(String equipmentId, Date maxDate); /** * æ¥è¯¢æä¸ªè®¾å¤æä¸ªæ¶é´ç¹ä¹åçæ°æ®(æ¥è¦æ°æ®) */ List<EquipmentLog> findEquipmentLogByErrorEndTime(String equipmentId, Date endTime); /** * è·åè®¾å¤æä¸ªæ¶é´ç¹ä¹åçææ°ä¸æ¡æ°æ® */ EquipmentLog getRow(String equipmentid, Date startTime); EquipmentLog selectEquipmentOporation(String equipmentId); List<EquipmentLog> getEquipmentStatusList(List<String> equipmentIdList); } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/IEquipmentService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,51 @@ package org.jeecg.modules.iot.mdc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.iot.mdc.entity.Equipment; /** * @Description: éé设å¤è¡¨ * @Author: liuS * @Date: 2023-03-23 * @Version: V1.0 */ public interface IEquipmentService extends IService<Equipment> { /** * æ ¹æ®æ°æ®è¡¨åç§°æ¥è¯¢æ°æ®è¡¨æ¯å¦åå¨ * @param saveTableName * @return */ String checkTableExists(String saveTableName); /** * æ¥è¯¢éå¤ä»½æ°æ®é * @param saveTableName * @param day * @return */ Integer checkTableDataNum(String saveTableName, String day); /** * æ°æ®è¿ç§» * @param backupTableName * @param tableName * @param day */ void insertTableData(String backupTableName, String tableName, String day); /** * å é¤åæ°æ®è¡¨æ°æ® * @param tableName * @param day */ void deleteTableData(String tableName, String day); /** * å建å¤ä»½è¡¨ * @param backupTableName * @param tableName * @param day */ void insertNoTableData(String backupTableName, String tableName, String day); } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/IMdcDriveTypeParamConfigService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package org.jeecg.modules.iot.mdc.service; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.iot.mdc.entity.MdcDriveTypeParamConfig; import java.util.List; /** * @Description: 驱å¨åæ°é ç½® * @Author: jeecg-boot * @Date: 2023-04-20 * @Version: V1.0 */ public interface IMdcDriveTypeParamConfigService extends IService<MdcDriveTypeParamConfig> { } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/impl/EquipmentAlarmServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ package org.jeecg.modules.iot.mdc.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.iot.mdc.entity.EquipmentAlarm; import org.jeecg.modules.iot.mdc.mapper.EquipmentAlarmMapper; import org.jeecg.modules.iot.mdc.service.IEquipmentAlarmService; import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; /** * @author: LiuS * @create: 2023-04-12 16:39 */ @Service public class EquipmentAlarmServiceImpl extends ServiceImpl<EquipmentAlarmMapper, EquipmentAlarm> implements IEquipmentAlarmService { @Override public List<EquipmentAlarm> findEquipmentAlarmByDate(String equipmentId, Date startTime, Date endTime) { return this.list(new LambdaQueryWrapper<EquipmentAlarm>() .ge(EquipmentAlarm::getCollecttime, startTime).le(EquipmentAlarm::getCollecttime, endTime) .eq(EquipmentAlarm::getEquipmentid, equipmentId).orderByDesc(EquipmentAlarm::getCollecttime)); } } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/impl/EquipmentLogServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,61 @@ package org.jeecg.modules.iot.mdc.service.impl; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.iot.mdc.entity.EquipmentLog; import org.jeecg.modules.iot.mdc.mapper.EquipmentLogMapper; import org.jeecg.modules.iot.mdc.service.IEquipmentLogService; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.Date; import java.util.List; /** * @author: LiuS * @create: 2023-04-12 14:41 */ @Service public class EquipmentLogServiceImpl extends ServiceImpl<EquipmentLogMapper, EquipmentLog> implements IEquipmentLogService { @Override public List<EquipmentLog> findEquipmentLogByEndTime(String equipmentId, Date maxDate) { LambdaQueryChainWrapper<EquipmentLog> lambdaQuery = this.lambdaQuery(); lambdaQuery.eq(EquipmentLog::getEquipmentId, equipmentId); if (maxDate != null) { lambdaQuery.ge(EquipmentLog::getCollectTime, maxDate); } lambdaQuery.ne(EquipmentLog::getOporation, 22); lambdaQuery.ne(EquipmentLog::getOporation, 23); lambdaQuery.orderByAsc(EquipmentLog::getCollectTime); return lambdaQuery.list(); } @Override public List<EquipmentLog> findEquipmentLogByErrorEndTime(String equipmentId, Date endTime) { LambdaQueryChainWrapper<EquipmentLog> lambdaQuery = this.lambdaQuery(); lambdaQuery.eq(EquipmentLog::getEquipmentId, equipmentId); if (endTime != null) { lambdaQuery.ge(EquipmentLog::getCollectTime, endTime); } lambdaQuery.in(EquipmentLog::getOporation, Arrays.asList(0, 22, 23)); lambdaQuery.orderByAsc(EquipmentLog::getCollectTime); return lambdaQuery.list(); } @Override public EquipmentLog getRow(String equipmentid, Date startTime) { return this.baseMapper.getRow(equipmentid, startTime); } @Override public EquipmentLog selectEquipmentOporation(String equipmentId) { return this.baseMapper.selectEquipmentOporation(equipmentId); } @Override public List<EquipmentLog> getEquipmentStatusList(List<String> equipmentIdList) { return this.baseMapper.getEquipmentStatusList(equipmentIdList); } } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/impl/EquipmentServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,42 @@ package org.jeecg.modules.iot.mdc.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.iot.mdc.entity.Equipment; import org.jeecg.modules.iot.mdc.mapper.EquipmentMapper; import org.jeecg.modules.iot.mdc.service.IEquipmentService; import org.springframework.stereotype.Service; /** * @Description: éé设å¤è¡¨ * @Author: liuS * @Date: 2023-03-23 * @Version: V1.0 */ @Service("mdcEquipmentServiceImpl") public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment> implements IEquipmentService { @Override public String checkTableExists(String saveTableName) { return this.baseMapper.checkTableExists(saveTableName); } @Override public Integer checkTableDataNum(String saveTableName, String day) { return this.baseMapper.checkTableDataNum(saveTableName, day); } @Override public void insertTableData(String backupTableName, String tableName, String day) { this.baseMapper.insertTableData(backupTableName, tableName, day); } @Override public void deleteTableData(String tableName, String day) { this.baseMapper.deleteTableData(tableName, day); } @Override public void insertNoTableData(String backupTableName, String tableName, String day) { this.baseMapper.insertNoTableData(backupTableName, tableName, day); } } jeecg-boot-module-system/src/main/java/org/jeecg/modules/iot/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,21 @@ package org.jeecg.modules.iot.mdc.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.common.constant.CommonConstant; import org.jeecg.modules.iot.mdc.entity.MdcDriveTypeParamConfig; import org.jeecg.modules.iot.mdc.mapper.MdcDriveTypeParamConfigMapper; import org.jeecg.modules.iot.mdc.service.IMdcDriveTypeParamConfigService; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; /** * @Description: 驱å¨åæ°é ç½® * @Author: jeecg-boot * @Date: 2023-04-20 * @Version: V1.0 */ @Service public class MdcDriveTypeParamConfigServiceImpl extends ServiceImpl<MdcDriveTypeParamConfigMapper, MdcDriveTypeParamConfig> implements IMdcDriveTypeParamConfigService { } jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/job/SampleParamJob.java
@@ -7,9 +7,10 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.iot.depository.Influxdb; import org.jeecg.modules.iot.depository.InfluxdbTest; import org.jeecg.modules.iot.depository.MysqlDataWriter; import org.jeecg.modules.iot.entity.Equipment; import org.jeecg.modules.iot.entity.InfluxdbDeploy; import org.jeecg.modules.iot.mdc.entity.EquipmentLog; import org.jeecg.modules.iot.mdc.service.IEquipmentLogService; import org.jeecg.modules.iot.service.IEquipmentService; import org.jeecg.modules.iot.service.IInfluxdbDeployService; import org.quartz.Job; @@ -24,6 +25,7 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -39,6 +41,8 @@ private DataSource dataSource; @Autowired private IEquipmentService equipmentService; @Autowired private IEquipmentLogService equipmentLogService; @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { @@ -89,14 +93,21 @@ // æ ¹æ®æ¶é´è¿è¡åç» Map<String, List<Influxdb>> timeListMap = timeList.stream() .collect(Collectors.groupingBy(Influxdb::getAcquisitionTime)); timeListMap.forEach((measurement, influxdbList) -> { int lastIndex = table.lastIndexOf('.'); String code = table.substring(lastIndex + 1); // å¤ç设å¤ç¶æ int lastIndex = table.lastIndexOf('.'); String code = table.substring(lastIndex + 1); EquipmentLog equipmentLog = equipmentLogService.selectEquipmentOporation(code); // 设å¤ç¶æ Integer equipmentState = null; for (Map.Entry<String, List<Influxdb>> entry : timeListMap.entrySet()) { String measurement = entry.getKey(); List<Influxdb> influxdbList = entry.getValue(); Equipment equipment = equipmentService.findEquipmentByCode(code); String tableName = equipment.getControlSystem() + '_' + equipment.getEqptCode(); // è·å表å String[] columns = new String[influxdbList.size() + 2]; Object[] values = new Object[influxdbList.size() + 2]; String state = ""; // éåå½å设å¤ä¸çææåæ° for (int i = 0; i < influxdbList.size(); i++) { String parameter = influxdbList.get(i).getParameter(); @@ -104,7 +115,12 @@ values[i] = influxdbList.get(i).getValue(); if (values[i] == null || values[i] == "") { values[i] = ""; } else { if (columns[i].equals("Oporation")) { state = values[i].toString(); } } } // éªè¯æ°æ®æ¯å¦é½ä¸ºç©º if (!allEmptyStrings(values)) { @@ -119,8 +135,23 @@ values[influxdbList.size()] = tableName; // æå ¥æ°æ® equipmentService.insertMysqlData(tableName, columns, values); if (!state.equals("")) { EquipmentLog log = new EquipmentLog(); log.setOporation(Integer.parseInt(state)); log.setEquipmentId(equipment.getEqptCode()); log.setEquipmentName(equipment.getEqptName()); log.setCollectTime(Date.from(dateTime.atZone(java.time.ZoneId.systemDefault()).toInstant())); // éªè¯è®¾å¤ç¶ææ¯å¦éè¦åå¨ if (equipmentLog == null) { equipmentLogService.save(log); equipmentState = Integer.parseInt(state); } else if (equipmentState == null && equipmentLog.getOporation() != Integer.parseInt(state)) { equipmentState = Integer.parseInt(state); equipmentLogService.save(log); } } } }); }; }); } catch (Exception e) { log.error(String.valueOf(e)); jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/entity/Equipment.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/entity/EquipmentAlarm.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/entity/EquipmentLog.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/entity/MdcDriveTypeParamConfig.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/EquipmentAlarmMapper.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/EquipmentLogMapper.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/EquipmentMapper.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/MdcDriveTypeParamConfigMapper.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/xml/EquipmentLogMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ <?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.iot.mdc.mapper.EquipmentLogMapper"> <select id="getRow" resultType="org.jeecg.modules.iot.mdc.entity.EquipmentLog"> SELECT top 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentid } AND CollectTime <= #{ startTime } AND Oporation in ('0','1','2','3') ORDER BY CollectTime ASC </select> <select id="selectEquipmentOporation" resultType="org.jeecg.modules.iot.mdc.entity.EquipmentLog"> SELECT TOP 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentId } ORDER BY CollectTime DESC </select> <!--æ¥è¯¢è®¾å¤ææ°ä¸æ¡æ°æ®--> <select id="getEquipmentStatusList" resultType="org.jeecg.modules.iot.mdc.entity.EquipmentLog"> SELECT t1.* FROM EquipmentLog t1 INNER JOIN ( SELECT MAX ( CollectTime ) AS CollectTime, EquipmentID FROM EquipmentLog GROUP BY EquipmentID ) t2 ON t1.CollectTime= t2.CollectTime AND t1.EquipmentID= t2.EquipmentID <if test="equipmentIdList != null and equipmentIdList.size() > 0"> AND t1.EquipmentID IN <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </if> </select> </mapper> jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/xml/EquipmentMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.iot.mdc.mapper.EquipmentMapper"> </mapper> jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/mapper/xml/MdcDriveTypeParamConfigMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +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.iot.mdc.mapper.MdcDriveTypeParamConfigMapper"> <!--æ ¹æ®è®¾å¤ç¼ç è·å工使²çº¿åæ°--> <select id="findWorkCurveParamList" resultType="org.jeecg.modules.iot.mdc.entity.MdcDriveTypeParamConfig"> SELECT mdtpc.* FROM mdc_drive_type_param_config mdtpc LEFT JOIN mdc_equipment me ON mdtpc.control_system_type = me.drive_type WHERE mdtpc.curve_generation_flags = 'Y' AND me.equipment_id = #{equipmentId} </select> <select id="getDriveParamOptions" resultType="java.lang.String"> SELECT DISTINCT control_system_type FROM mdc_drive_type_param_config </select> </mapper> jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/IEquipmentAlarmService.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/IEquipmentLogService.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/IEquipmentService.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/IMdcDriveTypeParamConfigService.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/impl/EquipmentAlarmServiceImpl.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/impl/EquipmentLogServiceImpl.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/impl/EquipmentServiceImpl.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/iot/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.classBinary files differ
jeecg-boot-module-system/target/classes/org/jeecg/modules/quartz/job/SampleParamJob.classBinary files differ