导出接收参数,增加服务器离线日志。
This commit is contained in:
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
|
||||
import com.ruoyi.system.api.domain.InitialSwitchInfoDetailsRemote;
|
||||
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
|
||||
import com.ruoyi.system.api.factory.RemoteRevenueConfigFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -33,4 +34,7 @@ public interface RemoteRevenueConfigService
|
||||
*/
|
||||
@PostMapping("/switchInfoDetails/autoSaveSwitchTraffic")
|
||||
public R<String> autoSaveSwitchTraffic(@RequestBody InitialSwitchInfoDetailsRemote queryParam, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@PostMapping("/registration/updateStatusByResource")
|
||||
public R<String> updateStatusByResource(@RequestBody RmResourceRegistrationRemote queryParam, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 资源注册对象 rm_resource_registration
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@Data
|
||||
public class RmResourceRegistrationRemote extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 硬件SN */
|
||||
@Excel(name = "硬件SN")
|
||||
private String hardwareSn;
|
||||
|
||||
/** 资源类型
|
||||
* 1 服务器,2 交换机*/
|
||||
@Excel(name = "资源类型",readConverterExp = "1=服务器,2=交换机")
|
||||
private String resourceType;
|
||||
|
||||
/** 资源名称 */
|
||||
@Excel(name = "资源名称")
|
||||
private String resourceName;
|
||||
|
||||
/** IP地址 */
|
||||
@Excel(name = "IP地址")
|
||||
private String ipAddress;
|
||||
|
||||
/** 端口1.162(SNMP),2.其他 */
|
||||
@Excel(name = "端口")
|
||||
private String resourcePort;
|
||||
|
||||
/**其他端口名称 */
|
||||
private String otherPortName;
|
||||
|
||||
/** agent版本 */
|
||||
@Excel(name = "agent版本")
|
||||
private String agentVersion;
|
||||
|
||||
|
||||
/** 协议 1.TCP,2.UDP */
|
||||
@Excel(name = "协议",readConverterExp = "1=TCP,2=UDP")
|
||||
private String protocol;
|
||||
|
||||
/** SNMP探测 0=否,1=是 */
|
||||
@Excel(name = "",readConverterExp = "0=否,1=是")
|
||||
private String snmpDetect;
|
||||
/** 版本(1.SNMPv2,2.SNMPv3) */
|
||||
@Excel(name = "SNMP版本",readConverterExp = "1=华为SNMPv2c,2=华为SNMPv3")
|
||||
private String resourceVersion;
|
||||
|
||||
/** 读写权限(1.RW,2.ReadOnly) */
|
||||
@Excel(name = "读写权限",readConverterExp = "1=只读,2=可读可写")
|
||||
private String rwPermission;
|
||||
/** 团体名称 */
|
||||
@Excel(name = "团体名称")
|
||||
private String teamName;
|
||||
|
||||
/** SNMP采集地址 */
|
||||
@Excel(name = "SNMP采集地址")
|
||||
private String snmpCollectAddr;
|
||||
|
||||
/** 安全级别(1.authPriv、2.authNoPriv,3.noAuthNoPriv) */
|
||||
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")
|
||||
private String securityLevel;
|
||||
|
||||
/** 加密方式 1.md5,2.SHA */
|
||||
@Excel(name = "加密方式",readConverterExp = "1=MD5,2=SHA")
|
||||
private String encryption;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String resourceUserName;
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String resourcePwd;
|
||||
|
||||
/** 注册状态 0-未注册,1-已注册 */
|
||||
@Excel(name = "注册状态",readConverterExp = "0=未注册,1=已注册")
|
||||
private String registrationStatus;
|
||||
|
||||
/** 在线状态 0-离线,1-在线 */
|
||||
@Excel(name = "在线状态",readConverterExp = "0=离线,1=在线")
|
||||
private String onlineStatus;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 设备业务客户id */
|
||||
private Long customerId;
|
||||
|
||||
/** 设备业务客户名称 */
|
||||
@Excel(name = "设备业务客户")
|
||||
private String customerName;
|
||||
|
||||
/** 业务号 */
|
||||
@Excel(name = "业务号")
|
||||
private String serviceNumber;
|
||||
|
||||
/** 创建人id */
|
||||
private Long creatorId;
|
||||
|
||||
/** 创建人名称 */
|
||||
private String creatorName;
|
||||
|
||||
/** 修改人id */
|
||||
private Long updaterId;
|
||||
|
||||
/** 修改人名称 */
|
||||
private String updaterName;
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.api.RemoteRevenueConfigService;
|
||||
import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
|
||||
import com.ruoyi.system.api.domain.InitialSwitchInfoDetailsRemote;
|
||||
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
@@ -34,6 +35,11 @@ public class RemoteRevenueConfigFallbackFactory implements FallbackFactory<Remot
|
||||
public R<String> autoSaveSwitchTraffic(InitialSwitchInfoDetailsRemote queryParam, String source) {
|
||||
return R.fail("保存交换机流量数据失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> updateStatusByResource(RmResourceRegistrationRemote queryParam, String source) {
|
||||
return R.fail("资源状态修改失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class EpsBusinessController extends BaseController
|
||||
@RequiresPermissions("system:business:export")
|
||||
@Log(title = "业务信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EpsBusiness epsBusiness)
|
||||
public void export(HttpServletResponse response, @RequestBody EpsBusiness epsBusiness)
|
||||
{
|
||||
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
|
||||
ExcelUtil<EpsBusiness> util = new ExcelUtil<EpsBusiness>(EpsBusiness.class);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class EpsMethodChangeRecordController extends BaseController
|
||||
@RequiresPermissions("system:record:export")
|
||||
@Log(title = "收益方式修改记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EpsMethodChangeRecord epsMethodChangeRecord)
|
||||
public void export(HttpServletResponse response, @RequestBody EpsMethodChangeRecord epsMethodChangeRecord)
|
||||
{
|
||||
List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
|
||||
ExcelUtil<EpsMethodChangeRecord> util = new ExcelUtil<EpsMethodChangeRecord>(EpsMethodChangeRecord.class);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
@RequiresPermissions("system:bandwidth:export")
|
||||
@Log(title = "节点带宽信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EpsNodeBandwidth epsNodeBandwidth)
|
||||
public void export(HttpServletResponse response, @RequestBody EpsNodeBandwidth epsNodeBandwidth)
|
||||
{
|
||||
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
ExcelUtil<EpsNodeBandwidth> util = new ExcelUtil<EpsNodeBandwidth>(EpsNodeBandwidth.class);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class EpsServerRevenueConfigController extends BaseController
|
||||
@RequiresPermissions("system:config:export")
|
||||
@Log(title = "服务器收益方式配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EpsServerRevenueConfig epsServerRevenueConfig)
|
||||
public void export(HttpServletResponse response, @RequestBody EpsServerRevenueConfig epsServerRevenueConfig)
|
||||
{
|
||||
List<EpsServerRevenueConfig> list = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
|
||||
ExcelUtil<EpsServerRevenueConfig> util = new ExcelUtil<EpsServerRevenueConfig>(EpsServerRevenueConfig.class);
|
||||
|
||||
@@ -54,6 +54,7 @@ public class KnowledgeBaseController extends BaseController
|
||||
{
|
||||
List<KnowledgeBase> list = knowledgeBaseService.selectKnowledgeBaseList(knowledgeBase);
|
||||
ExcelUtil<KnowledgeBase> util = new ExcelUtil<KnowledgeBase>(KnowledgeBase.class);
|
||||
util.showColumn(knowledgeBase.getProperties());
|
||||
util.exportExcel(response, list, "知识库数据");
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RmEpsTopologyManagementController extends BaseController
|
||||
@RequiresPermissions("system:management:export")
|
||||
@Log(title = "拓扑管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmEpsTopologyManagement rmEpsTopologyManagement)
|
||||
public void export(HttpServletResponse response, @RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
|
||||
{
|
||||
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
|
||||
ExcelUtil<RmEpsTopologyManagement> util = new ExcelUtil<RmEpsTopologyManagement>(RmEpsTopologyManagement.class);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class RmResourceGroupController extends BaseController
|
||||
@RequiresPermissions("system:group:export")
|
||||
@Log(title = "资源分组", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmResourceGroup rmResourceGroup)
|
||||
public void export(HttpServletResponse response, @RequestBody RmResourceGroup rmResourceGroup)
|
||||
{
|
||||
List<RmResourceGroup> list = rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup);
|
||||
ExcelUtil<RmResourceGroup> util = new ExcelUtil<RmResourceGroup>(RmResourceGroup.class);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
@@ -7,6 +8,7 @@ import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
|
||||
@@ -51,7 +53,7 @@ public class RmResourceRegistrationController extends BaseController
|
||||
@RequiresPermissions("system:registration:export")
|
||||
@Log(title = "资源注册", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmResourceRegistration rmResourceRegistration)
|
||||
public void export(HttpServletResponse response, @RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
|
||||
@@ -129,4 +131,18 @@ public class RmResourceRegistrationController extends BaseController
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测到服务器离线,修改状态为离线
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/updateStatusByResource")
|
||||
public R<String> updateStatusByResource(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
R<String> rows = rmResourceRegistrationService.updateStatusByResource(rmResourceRegistration);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -77,4 +77,11 @@ public interface RmResourceRegistrationMapper
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration);
|
||||
|
||||
/**
|
||||
* 检测到服务器离线,修改状态为离线
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
Integer updateStatusByResource(RmResourceRegistration rmResourceRegistration);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
|
||||
import java.util.List;
|
||||
@@ -78,5 +79,10 @@ public interface IRmResourceRegistrationService
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration);
|
||||
|
||||
/**
|
||||
* 检测到服务器离线,修改状态为离线
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
R<String> updateStatusByResource(RmResourceRegistration rmResourceRegistration);
|
||||
}
|
||||
|
||||
@@ -304,6 +304,8 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
|
||||
// 3. 计算各时间段95值
|
||||
calculateTimeSegments95(queryParam, records, dailyStartTime, dailyEndTime);
|
||||
}else{
|
||||
calculateNormalDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -430,12 +432,21 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
dailyResult = epsInitialTrafficData.getPackageBandwidth();
|
||||
epsInitialTrafficData.setBandwidthType("3");
|
||||
}else{
|
||||
if(CalculateUtil.isEff(dataList)){
|
||||
if("1".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("5");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("6");
|
||||
}
|
||||
}else {
|
||||
if("1".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
saveBandwidthResult(epsInitialTrafficData, dailyResult, startTime);
|
||||
}
|
||||
@@ -491,17 +502,4 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为有效
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
private Boolean isEff(List<EpsInitialTrafficData> list){
|
||||
if(!list.isEmpty()){
|
||||
if(list.size()<288){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,6 +452,8 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
|
||||
// 计算各时间段95值
|
||||
calculateSwitchTimeSegments95(queryParam, records, dailyStartTime, dailyEndTime);
|
||||
}else {
|
||||
calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,12 +582,21 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
// 3. 保存结果
|
||||
InitialSwitchInfoDetails switchInfo = dataList.get(0);
|
||||
switchInfo.setResourceType("2");
|
||||
if(CalculateUtil.isEff(dataList)){
|
||||
if("1".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("5");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("6");
|
||||
}
|
||||
}else {
|
||||
if("1".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("2");
|
||||
}
|
||||
}
|
||||
saveSwitchBandwidthResult(switchInfo, dailyResult, startTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
@@ -229,4 +230,15 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
return rmResourceRegistrationMapper.selectAllResourceNameByType(resourceRegistration);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测到服务器离线,修改状态为离线
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<String> updateStatusByResource(RmResourceRegistration rmResourceRegistration) {
|
||||
rmResourceRegistrationMapper.updateStatusByResource(rmResourceRegistration);
|
||||
return R.ok("状态修改成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,4 +87,18 @@ public class CalculateUtil {
|
||||
throw new IllegalArgumentException("不支持的带宽类型: " + bandwidthType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为有效
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public static Boolean isEff(List<?> list){
|
||||
if(!list.isEmpty()){
|
||||
if(list.size()<288){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,4 +234,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from rm_resource_registration
|
||||
where hardware_sn = #{hardwareSn}
|
||||
</select>
|
||||
<update id="updateStatusByResource" parameterType="RmResourceRegistration">
|
||||
update rm_resource_registration
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
|
||||
<if test="resourceType != null">resource_type = #{resourceType},</if>
|
||||
<if test="resourceName != null">resource_name = #{resourceName},</if>
|
||||
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
|
||||
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
|
||||
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
|
||||
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
|
||||
<if test="protocol != null">protocol = #{protocol},</if>
|
||||
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
|
||||
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
|
||||
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
|
||||
<if test="teamName != null">team_name = #{teamName},</if>
|
||||
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
|
||||
<if test="securityLevel != null">security_level = #{securityLevel},</if>
|
||||
<if test="encryption != null">encryption = #{encryption},</if>
|
||||
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
|
||||
<if test="resourcePwd != null">resource_pwd = #{resourcePwd},</if>
|
||||
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
|
||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||
<if test="customerName != null">customer_name = #{customerName},</if>
|
||||
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="creatorId != null">creator_id = #{creatorId},</if>
|
||||
<if test="creatorName != null">creator_name = #{creatorName},</if>
|
||||
<if test="updaterId != null">updater_id = #{updaterId},</if>
|
||||
<if test="updaterName != null">updater_name = #{updaterName},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -17,6 +17,7 @@ import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -26,6 +27,7 @@ import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -36,6 +38,10 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
|
||||
// 在类中添加以下成员变量来记录心跳状态
|
||||
private final Map<String, Integer> heartbeatStatusMap = new ConcurrentHashMap<>(); // 客户端ID -> 连续丢失心跳次数
|
||||
private final Map<String, Long> lastHeartbeatTimeMap = new ConcurrentHashMap<>(); // 客户端ID -> 最后心跳时间
|
||||
|
||||
|
||||
private final IInitialBandwidthTrafficService initialBandwidthTrafficService;
|
||||
private final RemoteRevenueConfigService remoteRevenueConfigService;
|
||||
@@ -56,6 +62,8 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
@Autowired
|
||||
private IInitialSwitchInfoTempService initialSwitchInfoTempService;
|
||||
@Autowired
|
||||
private IInitialHeartbeatListenLogService initialHeartbeatListenLog;
|
||||
@Autowired
|
||||
public RocketMsgListener(IInitialBandwidthTrafficService initialBandwidthTrafficService,
|
||||
RemoteRevenueConfigService remoteRevenueConfigService) {
|
||||
this.initialBandwidthTrafficService = initialBandwidthTrafficService;
|
||||
@@ -120,6 +128,9 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
case "SWITCHBOARD":
|
||||
handleSwitchMessage(message);
|
||||
break;
|
||||
case "HEARTBEAT":
|
||||
handleHeartbeatMessage(message);
|
||||
break;
|
||||
default:
|
||||
log.warn("未知数据类型:{}",message.getDataType());
|
||||
}
|
||||
@@ -380,4 +391,77 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
throw new RuntimeException("系统data数据为空");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 监听心跳
|
||||
* @param message
|
||||
*/
|
||||
private void handleHeartbeatMessage(DeviceMessage message) {
|
||||
try {
|
||||
List<InitialHeartbeatListen> heartbeats = JsonDataParser.parseJsonData(message.getData(), InitialHeartbeatListen.class);
|
||||
if(!heartbeats.isEmpty()){
|
||||
InitialHeartbeatListen heartbeat = heartbeats.get(0);
|
||||
String clientId = message.getClientId();
|
||||
log.info("处理心跳消息,客户端ID: {}, 时间: {}", clientId, heartbeat.getTimestamp());
|
||||
|
||||
// 更新心跳状态
|
||||
heartbeatStatusMap.put(clientId, 0); // 重置为0表示收到心跳
|
||||
lastHeartbeatTimeMap.put(clientId, System.currentTimeMillis());
|
||||
|
||||
// 检查是否之前有丢失心跳的情况
|
||||
if (heartbeatStatusMap.getOrDefault(clientId, 0) > 0) {
|
||||
// 之前有丢失心跳,现在恢复了,记录恢复日志
|
||||
log.warn("客户端ID: {} 心跳恢复", clientId);
|
||||
insertHeartbeatLog(clientId, "2", "心跳恢复,服务器在线"); // 1表示恢复
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理心跳消息异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加一个定时任务方法,定期检查心跳状态
|
||||
@Scheduled(fixedRate = 60000) // 每分钟检查一次
|
||||
public void checkHeartbeatStatus() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long heartbeatTimeout = 180000; // 3分钟无心跳认为丢失
|
||||
|
||||
for (Map.Entry<String, Long> entry : lastHeartbeatTimeMap.entrySet()) {
|
||||
String clientId = entry.getKey();
|
||||
long lastHeartbeatTime = entry.getValue();
|
||||
|
||||
if (currentTime - lastHeartbeatTime > heartbeatTimeout) {
|
||||
// 心跳超时
|
||||
int lostCount = heartbeatStatusMap.getOrDefault(clientId, 0) + 1;
|
||||
heartbeatStatusMap.put(clientId, lostCount);
|
||||
|
||||
log.warn("客户端ID: {} 心跳丢失,连续次数: {}", clientId, lostCount);
|
||||
|
||||
if (lostCount == 3) {
|
||||
// 两次获取不到心跳
|
||||
insertHeartbeatLog(clientId, "3", "连续三次心跳丢失,服务器离线");
|
||||
// 把资源注册表资源信息改为离线
|
||||
// RmResourceRegistrationRemote rmResourceRegistrationRemote = new RmResourceRegistrationRemote();
|
||||
// rmResourceRegistrationRemote.setOnlineStatus("0");
|
||||
// remoteRevenueConfigService.updateStatusByResource(rmResourceRegistrationRemote, SecurityConstants.INNER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 插入心跳日志到数据库
|
||||
private void insertHeartbeatLog(String machineId, String status, String remark) {
|
||||
try {
|
||||
InitialHeartbeatListenLog listenLog = new InitialHeartbeatListenLog();
|
||||
listenLog.setClientId(machineId);
|
||||
listenLog.setStatus(status); // 0-离线 1-在线 2-恢复 3-三次丢失
|
||||
listenLog.setRemark(remark);
|
||||
listenLog.setCreateTime(new Date());
|
||||
|
||||
// 调用DAO或Service插入日志
|
||||
initialHeartbeatListenLog.insertInitialHeartbeatListenLog(listenLog);
|
||||
log.info("已记录心跳日志,客户端ID: {}, 状态: {}", machineId, status);
|
||||
} catch (Exception e) {
|
||||
log.error("插入心跳日志失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListen;
|
||||
import com.ruoyi.rocketmq.service.IInitialHeartbeatListenService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 心跳信息Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/heartbeatListen")
|
||||
public class InitialHeartbeatListenController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IInitialHeartbeatListenService initialHeartbeatListenService;
|
||||
|
||||
/**
|
||||
* 查询心跳信息列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:heartbeatListen:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
startPage();
|
||||
List<InitialHeartbeatListen> list = initialHeartbeatListenService.selectInitialHeartbeatListenList(initialHeartbeatListen);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出心跳信息列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:heartbeatListen:export")
|
||||
@Log(title = "心跳信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
List<InitialHeartbeatListen> list = initialHeartbeatListenService.selectInitialHeartbeatListenList(initialHeartbeatListen);
|
||||
ExcelUtil<InitialHeartbeatListen> util = new ExcelUtil<InitialHeartbeatListen>(InitialHeartbeatListen.class);
|
||||
util.exportExcel(response, list, "心跳信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取心跳信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:heartbeatListen:query")
|
||||
@GetMapping(value = "/{clientId}")
|
||||
public AjaxResult getInfo(@PathVariable("clientId") String clientId)
|
||||
{
|
||||
return success(initialHeartbeatListenService.selectInitialHeartbeatListenByClientId(clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增心跳信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:heartbeatListen:add")
|
||||
@Log(title = "心跳信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
return toAjax(initialHeartbeatListenService.insertInitialHeartbeatListen(initialHeartbeatListen));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改心跳信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:heartbeatListen:edit")
|
||||
@Log(title = "心跳信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
return toAjax(initialHeartbeatListenService.updateInitialHeartbeatListen(initialHeartbeatListen));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除心跳信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:heartbeatListen:remove")
|
||||
@Log(title = "心跳信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{clientIds}")
|
||||
public AjaxResult remove(@PathVariable String[] clientIds)
|
||||
{
|
||||
return toAjax(initialHeartbeatListenService.deleteInitialHeartbeatListenByClientIds(clientIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListenLog;
|
||||
import com.ruoyi.rocketmq.service.IInitialHeartbeatListenLogService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 心跳信息日志Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/log")
|
||||
public class InitialHeartbeatListenLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IInitialHeartbeatListenLogService initialHeartbeatListenLogService;
|
||||
|
||||
/**
|
||||
* 查询心跳信息日志列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:log:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
startPage();
|
||||
List<InitialHeartbeatListenLog> list = initialHeartbeatListenLogService.selectInitialHeartbeatListenLogList(initialHeartbeatListenLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出心跳信息日志列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:log:export")
|
||||
@Log(title = "心跳信息日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
List<InitialHeartbeatListenLog> list = initialHeartbeatListenLogService.selectInitialHeartbeatListenLogList(initialHeartbeatListenLog);
|
||||
ExcelUtil<InitialHeartbeatListenLog> util = new ExcelUtil<InitialHeartbeatListenLog>(InitialHeartbeatListenLog.class);
|
||||
util.exportExcel(response, list, "心跳信息日志数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取心跳信息日志详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:log:query")
|
||||
@GetMapping(value = "/{clientId}")
|
||||
public AjaxResult getInfo(@PathVariable("clientId") String clientId)
|
||||
{
|
||||
return success(initialHeartbeatListenLogService.selectInitialHeartbeatListenLogByClientId(clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增心跳信息日志
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:log:add")
|
||||
@Log(title = "心跳信息日志", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
return toAjax(initialHeartbeatListenLogService.insertInitialHeartbeatListenLog(initialHeartbeatListenLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改心跳信息日志
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:log:edit")
|
||||
@Log(title = "心跳信息日志", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
return toAjax(initialHeartbeatListenLogService.updateInitialHeartbeatListenLog(initialHeartbeatListenLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除心跳信息日志
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:log:remove")
|
||||
@Log(title = "心跳信息日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{clientIds}")
|
||||
public AjaxResult remove(@PathVariable String[] clientIds)
|
||||
{
|
||||
return toAjax(initialHeartbeatListenLogService.deleteInitialHeartbeatListenLogByClientIds(clientIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 心跳信息对象 initial_heartbeat_listen
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@Data
|
||||
public class InitialHeartbeatListen extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 客户端ID */
|
||||
private String clientId;
|
||||
|
||||
/** 强度值 */
|
||||
@Excel(name = "强度值")
|
||||
private Long strength;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 心跳信息日志对象 initial_heartbeat_listen_log
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
public class InitialHeartbeatListenLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 客户端ID */
|
||||
private String clientId;
|
||||
|
||||
/** 状态0-正常 1-恢复 2-两次丢失 3-三次丢失 */
|
||||
@Excel(name = "状态0-正常 1-恢复 2-两次丢失 3-三次丢失")
|
||||
private String status;
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("clientId", getClientId())
|
||||
.append("status", getStatus())
|
||||
.append("remark", getRemark())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListenLog;
|
||||
|
||||
/**
|
||||
* 心跳信息日志Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
public interface InitialHeartbeatListenLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询心跳信息日志
|
||||
*
|
||||
* @param clientId 心跳信息日志主键
|
||||
* @return 心跳信息日志
|
||||
*/
|
||||
public InitialHeartbeatListenLog selectInitialHeartbeatListenLogByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 查询心跳信息日志列表
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 心跳信息日志集合
|
||||
*/
|
||||
public List<InitialHeartbeatListenLog> selectInitialHeartbeatListenLogList(InitialHeartbeatListenLog initialHeartbeatListenLog);
|
||||
|
||||
/**
|
||||
* 新增心跳信息日志
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInitialHeartbeatListenLog(InitialHeartbeatListenLog initialHeartbeatListenLog);
|
||||
|
||||
/**
|
||||
* 修改心跳信息日志
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInitialHeartbeatListenLog(InitialHeartbeatListenLog initialHeartbeatListenLog);
|
||||
|
||||
/**
|
||||
* 删除心跳信息日志
|
||||
*
|
||||
* @param clientId 心跳信息日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenLogByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 批量删除心跳信息日志
|
||||
*
|
||||
* @param clientIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenLogByClientIds(String[] clientIds);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListen;
|
||||
|
||||
/**
|
||||
* 心跳信息Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
public interface InitialHeartbeatListenMapper
|
||||
{
|
||||
/**
|
||||
* 查询心跳信息
|
||||
*
|
||||
* @param clientId 心跳信息主键
|
||||
* @return 心跳信息
|
||||
*/
|
||||
public InitialHeartbeatListen selectInitialHeartbeatListenByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 查询心跳信息列表
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 心跳信息集合
|
||||
*/
|
||||
public List<InitialHeartbeatListen> selectInitialHeartbeatListenList(InitialHeartbeatListen initialHeartbeatListen);
|
||||
|
||||
/**
|
||||
* 新增心跳信息
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInitialHeartbeatListen(InitialHeartbeatListen initialHeartbeatListen);
|
||||
|
||||
/**
|
||||
* 修改心跳信息
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInitialHeartbeatListen(InitialHeartbeatListen initialHeartbeatListen);
|
||||
|
||||
/**
|
||||
* 删除心跳信息
|
||||
*
|
||||
* @param clientId 心跳信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 批量删除心跳信息
|
||||
*
|
||||
* @param clientIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenByClientIds(String[] clientIds);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListenLog;
|
||||
|
||||
/**
|
||||
* 心跳信息日志Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
public interface IInitialHeartbeatListenLogService
|
||||
{
|
||||
/**
|
||||
* 查询心跳信息日志
|
||||
*
|
||||
* @param clientId 心跳信息日志主键
|
||||
* @return 心跳信息日志
|
||||
*/
|
||||
public InitialHeartbeatListenLog selectInitialHeartbeatListenLogByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 查询心跳信息日志列表
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 心跳信息日志集合
|
||||
*/
|
||||
public List<InitialHeartbeatListenLog> selectInitialHeartbeatListenLogList(InitialHeartbeatListenLog initialHeartbeatListenLog);
|
||||
|
||||
/**
|
||||
* 新增心跳信息日志
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInitialHeartbeatListenLog(InitialHeartbeatListenLog initialHeartbeatListenLog);
|
||||
|
||||
/**
|
||||
* 修改心跳信息日志
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInitialHeartbeatListenLog(InitialHeartbeatListenLog initialHeartbeatListenLog);
|
||||
|
||||
/**
|
||||
* 批量删除心跳信息日志
|
||||
*
|
||||
* @param clientIds 需要删除的心跳信息日志主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenLogByClientIds(String[] clientIds);
|
||||
|
||||
/**
|
||||
* 删除心跳信息日志信息
|
||||
*
|
||||
* @param clientId 心跳信息日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenLogByClientId(String clientId);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListen;
|
||||
|
||||
/**
|
||||
* 心跳信息Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
public interface IInitialHeartbeatListenService
|
||||
{
|
||||
/**
|
||||
* 查询心跳信息
|
||||
*
|
||||
* @param clientId 心跳信息主键
|
||||
* @return 心跳信息
|
||||
*/
|
||||
public InitialHeartbeatListen selectInitialHeartbeatListenByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 查询心跳信息列表
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 心跳信息集合
|
||||
*/
|
||||
public List<InitialHeartbeatListen> selectInitialHeartbeatListenList(InitialHeartbeatListen initialHeartbeatListen);
|
||||
|
||||
/**
|
||||
* 新增心跳信息
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInitialHeartbeatListen(InitialHeartbeatListen initialHeartbeatListen);
|
||||
|
||||
/**
|
||||
* 修改心跳信息
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInitialHeartbeatListen(InitialHeartbeatListen initialHeartbeatListen);
|
||||
|
||||
/**
|
||||
* 批量删除心跳信息
|
||||
*
|
||||
* @param clientIds 需要删除的心跳信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenByClientIds(String[] clientIds);
|
||||
|
||||
/**
|
||||
* 删除心跳信息信息
|
||||
*
|
||||
* @param clientId 心跳信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialHeartbeatListenByClientId(String clientId);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.rocketmq.mapper.InitialHeartbeatListenLogMapper;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListenLog;
|
||||
import com.ruoyi.rocketmq.service.IInitialHeartbeatListenLogService;
|
||||
|
||||
/**
|
||||
* 心跳信息日志Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@Service
|
||||
public class InitialHeartbeatListenLogServiceImpl implements IInitialHeartbeatListenLogService
|
||||
{
|
||||
@Autowired
|
||||
private InitialHeartbeatListenLogMapper initialHeartbeatListenLogMapper;
|
||||
|
||||
/**
|
||||
* 查询心跳信息日志
|
||||
*
|
||||
* @param clientId 心跳信息日志主键
|
||||
* @return 心跳信息日志
|
||||
*/
|
||||
@Override
|
||||
public InitialHeartbeatListenLog selectInitialHeartbeatListenLogByClientId(String clientId)
|
||||
{
|
||||
return initialHeartbeatListenLogMapper.selectInitialHeartbeatListenLogByClientId(clientId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询心跳信息日志列表
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 心跳信息日志
|
||||
*/
|
||||
@Override
|
||||
public List<InitialHeartbeatListenLog> selectInitialHeartbeatListenLogList(InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
return initialHeartbeatListenLogMapper.selectInitialHeartbeatListenLogList(initialHeartbeatListenLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增心跳信息日志
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertInitialHeartbeatListenLog(InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
initialHeartbeatListenLog.setCreateTime(DateUtils.getNowDate());
|
||||
return initialHeartbeatListenLogMapper.insertInitialHeartbeatListenLog(initialHeartbeatListenLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改心跳信息日志
|
||||
*
|
||||
* @param initialHeartbeatListenLog 心跳信息日志
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateInitialHeartbeatListenLog(InitialHeartbeatListenLog initialHeartbeatListenLog)
|
||||
{
|
||||
initialHeartbeatListenLog.setUpdateTime(DateUtils.getNowDate());
|
||||
return initialHeartbeatListenLogMapper.updateInitialHeartbeatListenLog(initialHeartbeatListenLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除心跳信息日志
|
||||
*
|
||||
* @param clientIds 需要删除的心跳信息日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInitialHeartbeatListenLogByClientIds(String[] clientIds)
|
||||
{
|
||||
return initialHeartbeatListenLogMapper.deleteInitialHeartbeatListenLogByClientIds(clientIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除心跳信息日志信息
|
||||
*
|
||||
* @param clientId 心跳信息日志主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInitialHeartbeatListenLogByClientId(String clientId)
|
||||
{
|
||||
return initialHeartbeatListenLogMapper.deleteInitialHeartbeatListenLogByClientId(clientId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.rocketmq.mapper.InitialHeartbeatListenMapper;
|
||||
import com.ruoyi.rocketmq.domain.InitialHeartbeatListen;
|
||||
import com.ruoyi.rocketmq.service.IInitialHeartbeatListenService;
|
||||
|
||||
/**
|
||||
* 心跳信息Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-08
|
||||
*/
|
||||
@Service
|
||||
public class InitialHeartbeatListenServiceImpl implements IInitialHeartbeatListenService
|
||||
{
|
||||
@Autowired
|
||||
private InitialHeartbeatListenMapper initialHeartbeatListenMapper;
|
||||
|
||||
/**
|
||||
* 查询心跳信息
|
||||
*
|
||||
* @param clientId 心跳信息主键
|
||||
* @return 心跳信息
|
||||
*/
|
||||
@Override
|
||||
public InitialHeartbeatListen selectInitialHeartbeatListenByClientId(String clientId)
|
||||
{
|
||||
return initialHeartbeatListenMapper.selectInitialHeartbeatListenByClientId(clientId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询心跳信息列表
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 心跳信息
|
||||
*/
|
||||
@Override
|
||||
public List<InitialHeartbeatListen> selectInitialHeartbeatListenList(InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
return initialHeartbeatListenMapper.selectInitialHeartbeatListenList(initialHeartbeatListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增心跳信息
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertInitialHeartbeatListen(InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
initialHeartbeatListen.setCreateTime(DateUtils.getNowDate());
|
||||
return initialHeartbeatListenMapper.insertInitialHeartbeatListen(initialHeartbeatListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改心跳信息
|
||||
*
|
||||
* @param initialHeartbeatListen 心跳信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateInitialHeartbeatListen(InitialHeartbeatListen initialHeartbeatListen)
|
||||
{
|
||||
initialHeartbeatListen.setUpdateTime(DateUtils.getNowDate());
|
||||
return initialHeartbeatListenMapper.updateInitialHeartbeatListen(initialHeartbeatListen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除心跳信息
|
||||
*
|
||||
* @param clientIds 需要删除的心跳信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInitialHeartbeatListenByClientIds(String[] clientIds)
|
||||
{
|
||||
return initialHeartbeatListenMapper.deleteInitialHeartbeatListenByClientIds(clientIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除心跳信息信息
|
||||
*
|
||||
* @param clientId 心跳信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInitialHeartbeatListenByClientId(String clientId)
|
||||
{
|
||||
return initialHeartbeatListenMapper.deleteInitialHeartbeatListenByClientId(clientId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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="com.ruoyi.rocketmq.mapper.InitialHeartbeatListenLogMapper">
|
||||
|
||||
<resultMap type="InitialHeartbeatListenLog" id="InitialHeartbeatListenLogResult">
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialHeartbeatListenLogVo">
|
||||
select client_id, status, remark, create_time, update_time, create_by, update_by from initial_heartbeat_listen_log
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialHeartbeatListenLogList" parameterType="InitialHeartbeatListenLog" resultMap="InitialHeartbeatListenLogResult">
|
||||
<include refid="selectInitialHeartbeatListenLogVo"/>
|
||||
<where>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectInitialHeartbeatListenLogByClientId" parameterType="String" resultMap="InitialHeartbeatListenLogResult">
|
||||
<include refid="selectInitialHeartbeatListenLogVo"/>
|
||||
where client_id = #{clientId}
|
||||
</select>
|
||||
|
||||
<insert id="insertInitialHeartbeatListenLog" parameterType="InitialHeartbeatListenLog">
|
||||
insert into initial_heartbeat_listen_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateInitialHeartbeatListenLog" parameterType="InitialHeartbeatListenLog">
|
||||
update initial_heartbeat_listen_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where client_id = #{clientId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteInitialHeartbeatListenLogByClientId" parameterType="String">
|
||||
delete from initial_heartbeat_listen_log where client_id = #{clientId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInitialHeartbeatListenLogByClientIds" parameterType="String">
|
||||
delete from initial_heartbeat_listen_log where client_id in
|
||||
<foreach item="clientId" collection="array" open="(" separator="," close=")">
|
||||
#{clientId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?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="com.ruoyi.rocketmq.mapper.InitialHeartbeatListenMapper">
|
||||
|
||||
<resultMap type="InitialHeartbeatListen" id="InitialHeartbeatListenResult">
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="strength" column="strength" />
|
||||
<result property="timestamp" column="timestamp" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialHeartbeatListenVo">
|
||||
select client_id, strength, timestamp, create_time, update_time, create_by, update_by from initial_heartbeat_listen
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialHeartbeatListenList" parameterType="InitialHeartbeatListen" resultMap="InitialHeartbeatListenResult">
|
||||
<include refid="selectInitialHeartbeatListenVo"/>
|
||||
<where>
|
||||
<if test="strength != null "> and strength = #{strength}</if>
|
||||
<if test="timestamp != null "> and timestamp = #{timestamp}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectInitialHeartbeatListenByClientId" parameterType="String" resultMap="InitialHeartbeatListenResult">
|
||||
<include refid="selectInitialHeartbeatListenVo"/>
|
||||
where client_id = #{clientId}
|
||||
</select>
|
||||
|
||||
<insert id="insertInitialHeartbeatListen" parameterType="InitialHeartbeatListen">
|
||||
insert into initial_heartbeat_listen
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="strength != null">strength,</if>
|
||||
<if test="timestamp != null">timestamp,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="strength != null">#{strength},</if>
|
||||
<if test="timestamp != null">#{timestamp},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateInitialHeartbeatListen" parameterType="InitialHeartbeatListen">
|
||||
update initial_heartbeat_listen
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="strength != null">strength = #{strength},</if>
|
||||
<if test="timestamp != null">timestamp = #{timestamp},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where client_id = #{clientId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteInitialHeartbeatListenByClientId" parameterType="String">
|
||||
delete from initial_heartbeat_listen where client_id = #{clientId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInitialHeartbeatListenByClientIds" parameterType="String">
|
||||
delete from initial_heartbeat_listen where client_id in
|
||||
<foreach item="clientId" collection="array" open="(" separator="," close=")">
|
||||
#{clientId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user