1、修复昨日95值不显示问题。
2、开发frpc端口自动分配功能。
This commit is contained in:
+2
@@ -178,5 +178,7 @@ public class RmResourceRegistrationRemote extends BaseEntity
|
||||
@Excel(name = "上机时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onboardTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date delAlarmTime;
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -15,6 +15,8 @@ public enum MsgEnum {
|
||||
|
||||
多公网IP探测("NETWORK_DETECT"),
|
||||
|
||||
修改frp配置文件应答("UPDATE_FRP_RSP"),
|
||||
|
||||
获取最新策略("GET_POLICY"),
|
||||
|
||||
获取最新策略应答("GET_POLICY_RSP"),
|
||||
|
||||
+10
-11
@@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -157,16 +156,16 @@ public class RmResourceRegistrationController extends BaseController
|
||||
@GetMapping("/getAlarmFlag")
|
||||
public AjaxResult getAlarmFlag()
|
||||
{
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(new RmResourceRegistration());
|
||||
for (RmResourceRegistration item : list) {
|
||||
|
||||
boolean isAlarm = (item.getCpuUtil() != null && item.getCpuUtil().compareTo(BigDecimal.valueOf(80)) >= 0) ||
|
||||
(item.getMemUtil() != null && item.getMemUtil().compareTo(BigDecimal.valueOf(60)) >= 0);
|
||||
|
||||
if (isAlarm) {
|
||||
return success(true); // 只要有一个告警就返回
|
||||
}
|
||||
}
|
||||
// List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(new RmResourceRegistration());
|
||||
// for (RmResourceRegistration item : list) {
|
||||
//
|
||||
// boolean isAlarm = (item.getCpuUtil() != null && item.getCpuUtil().compareTo(BigDecimal.valueOf(80)) >= 0) ||
|
||||
// (item.getMemUtil() != null && item.getMemUtil().compareTo(BigDecimal.valueOf(60)) >= 0);
|
||||
//
|
||||
// if (isAlarm) {
|
||||
// return success(true); // 只要有一个告警就返回
|
||||
// }
|
||||
// }
|
||||
return success(false);
|
||||
}
|
||||
|
||||
|
||||
+78
-34
@@ -174,45 +174,89 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
||||
epsInitialTrafficData.setStartTime(epsServerRevenueConfig.getStartTime());
|
||||
epsInitialTrafficData.setEndTime(epsServerRevenueConfig.getEndTime());
|
||||
List<EpsInitialTrafficData> dataList = epsInitialTrafficDataService.getAllTraficMsg(epsInitialTrafficData);
|
||||
|
||||
if (dataList == null || dataList.isEmpty()) {
|
||||
return R.ok("没有需要处理的数据");
|
||||
}
|
||||
|
||||
List<EpsInitialTrafficData> batchList = new ArrayList<>();
|
||||
for (EpsInitialTrafficData initialTrafficData : dataList) {
|
||||
// 根据clientId查询业务名称
|
||||
RmResourceRegistration rmResourceRegistration = new RmResourceRegistration();
|
||||
rmResourceRegistration.setClientId(initialTrafficData.getClientId());
|
||||
List<RmResourceRegistration> registerLst = rmResourceRegistrationMapper.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
if(registerLst != null && !registerLst.isEmpty()){
|
||||
RmResourceRegistration registerMsg = registerLst.get(0);
|
||||
// 赋值
|
||||
if(registerMsg != null){
|
||||
String businessName = registerMsg.getBusinessName();
|
||||
if(businessName != null){
|
||||
initialTrafficData.setBusinessName(businessName);
|
||||
// 根据业务名称查询业务代码
|
||||
EpsBusiness epsBusiness = epsBusinessMapper.selectEpsBusinessByName(businessName);
|
||||
if(epsBusiness != null){
|
||||
initialTrafficData.setBusinessId(epsBusiness.getId());
|
||||
int batchSize = 1000; // 每批处理数量
|
||||
int totalCount = 0;
|
||||
int successCount = 0;
|
||||
int batchNumber = 0;
|
||||
|
||||
try {
|
||||
for (EpsInitialTrafficData initialTrafficData : dataList) {
|
||||
// 根据clientId查询业务名称
|
||||
RmResourceRegistration rmResourceRegistration = new RmResourceRegistration();
|
||||
rmResourceRegistration.setClientId(initialTrafficData.getClientId());
|
||||
List<RmResourceRegistration> registerLst = rmResourceRegistrationMapper.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
|
||||
if(registerLst != null && !registerLst.isEmpty()){
|
||||
RmResourceRegistration registerMsg = registerLst.get(0);
|
||||
// 赋值
|
||||
if(registerMsg != null){
|
||||
String businessName = registerMsg.getBusinessName();
|
||||
if(businessName != null){
|
||||
initialTrafficData.setBusinessName(businessName);
|
||||
// 根据业务名称查询业务代码
|
||||
EpsBusiness epsBusiness = epsBusinessMapper.selectEpsBusinessByName(businessName);
|
||||
if(epsBusiness != null){
|
||||
initialTrafficData.setBusinessId(epsBusiness.getId());
|
||||
}
|
||||
}
|
||||
initialTrafficData.setServiceSn(registerMsg.getHardwareSn());
|
||||
initialTrafficData.setRevenueMethod("1");
|
||||
}
|
||||
initialTrafficData.setServiceSn(registerMsg.getHardwareSn());
|
||||
initialTrafficData.setRevenueMethod("1");
|
||||
}
|
||||
// id自增
|
||||
initialTrafficData.setId(null);
|
||||
batchList.add(initialTrafficData);
|
||||
|
||||
// 达到批次大小时保存
|
||||
if (batchList.size() >= batchSize) {
|
||||
batchNumber++;
|
||||
totalCount += batchList.size();
|
||||
epsInitialTrafficData.setDataList(batchList);
|
||||
epsInitialTrafficDataService.saveBatch(epsInitialTrafficData);
|
||||
log.info("第{}批流量数据批量入库成功,数据量:{}", batchNumber, batchList.size());
|
||||
|
||||
// 处理接口名称
|
||||
processInterfaceNames(batchList);
|
||||
|
||||
successCount += batchList.size();
|
||||
// 清空当前批次,准备下一批
|
||||
batchList = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
// id自增
|
||||
initialTrafficData.setId(null);
|
||||
batchList.add(initialTrafficData);
|
||||
}
|
||||
epsInitialTrafficData.setDataList(batchList);
|
||||
// 流量相关数据入库
|
||||
try {
|
||||
epsInitialTrafficDataService.saveBatch(epsInitialTrafficData);
|
||||
log.info("流量数据批量入库成功,数据量:{}", batchList.size());
|
||||
// 接口名称保存
|
||||
processInterfaceNames(batchList);
|
||||
return R.ok("数据保存成功");
|
||||
|
||||
// 处理最后一批不足1000条的数据
|
||||
if (!batchList.isEmpty()) {
|
||||
batchNumber++;
|
||||
totalCount += batchList.size();
|
||||
epsInitialTrafficData.setDataList(batchList);
|
||||
epsInitialTrafficDataService.saveBatch(epsInitialTrafficData);
|
||||
log.info("第{}批流量数据批量入库成功,数据量:{}", batchNumber, batchList.size());
|
||||
|
||||
// 处理最后一批的接口名称
|
||||
processInterfaceNames(batchList);
|
||||
|
||||
successCount += batchList.size();
|
||||
}
|
||||
|
||||
log.info("流量数据批量入库完成,总批次数:{},总数据量:{},成功数量:{}",
|
||||
batchNumber, totalCount, successCount);
|
||||
|
||||
if (successCount == totalCount) {
|
||||
return R.ok("数据保存成功,共处理" + successCount + "条数据");
|
||||
} else {
|
||||
return R.fail("数据保存部分成功,应处理" + totalCount + "条,实际成功" + successCount + "条");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("流量数据入库失败,数据量:{},错误原因:{}",
|
||||
batchList.size(), e.getMessage(), e);
|
||||
return R.fail("数据保存失败:" + e.getMessage());
|
||||
log.error("流量数据入库失败,已处理批次:{},成功数量:{},当前批次数量:{},错误原因:{}",
|
||||
batchNumber, successCount, batchList.size(), e.getMessage(), e);
|
||||
return R.fail("数据保存失败:" + e.getMessage() + ",已成功保存" + successCount + "条");
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -261,7 +305,7 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
||||
records.sort(Comparator
|
||||
.comparing(AllInterfaceName::getInterfaceName)
|
||||
.thenComparing(AllInterfaceName::getClientId)
|
||||
.thenComparing(AllInterfaceName::getSwitchIp)
|
||||
.thenComparing(AllInterfaceName::getServerIp)
|
||||
.thenComparing(AllInterfaceName::getResourceType));
|
||||
|
||||
allInterfaceNameMapper.batchInsert(records);
|
||||
|
||||
+8
@@ -177,6 +177,10 @@ public class RmMonitorConfigServiceImpl implements IRmMonitorConfigService
|
||||
rmMonitorConfig.setDeployDevice(clientIds.toString());
|
||||
}
|
||||
List<EpsInitialTrafficData> serverTrafficList = epsInitialTrafficDataService.getServerTrafficByMonitorView(rmMonitorConfig);
|
||||
if(serverTrafficList == null || serverTrafficList.isEmpty()){
|
||||
log.warn("该监控项暂无数据");
|
||||
continue;
|
||||
}
|
||||
RmMonitorConfigDetails configDetailsQuery = new RmMonitorConfigDetails();
|
||||
configDetailsQuery.setMonitorId(rmMonitorConfig.getId());
|
||||
// 查询该数据是否存在
|
||||
@@ -206,6 +210,10 @@ public class RmMonitorConfigServiceImpl implements IRmMonitorConfigService
|
||||
}
|
||||
}else{
|
||||
List<InitialSwitchInfoDetails> switchInfoDetailsList = initialSwitchInfoDetailsService.getMonitorViewDetails(rmMonitorConfig);
|
||||
if(switchInfoDetailsList == null || switchInfoDetailsList.isEmpty()){
|
||||
log.warn("该监控项暂无数据");
|
||||
continue;
|
||||
}
|
||||
RmMonitorConfigDetails configDetailsQuery = new RmMonitorConfigDetails();
|
||||
configDetailsQuery.setMonitorId(rmMonitorConfig.getId());
|
||||
// 查询该数据是否存在
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="reportedBandwidth" column="reported_bandwidth" />
|
||||
<result property="delAarmTime" column="del_alarm_time" />
|
||||
<result property="delAlarmTime" column="del_alarm_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmResourceRegistrationVo">
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.PageDomain;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.RmFrpcConfigManage;
|
||||
import com.tongran.rocketmq.service.IRmFrpcConfigManageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* FRPC配置管理Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/frpcConfigManage")
|
||||
@RequiresPermissions("rocketmq:frpcConfigManage")
|
||||
public class RmFrpcConfigManageController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmFrpcConfigManageService rmFrpcConfigManageService;
|
||||
|
||||
/**
|
||||
* 查询FRPC配置管理列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(rmFrpcConfigManage.getPageNum());
|
||||
pageDomain.setPageSize(rmFrpcConfigManage.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<RmFrpcConfigManage> list = rmFrpcConfigManageService.selectRmFrpcConfigManageList(rmFrpcConfigManage);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出FRPC配置管理列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:frpcConfigManage:export")
|
||||
@Log(title = "FRPC配置管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, @RequestBody RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
List<RmFrpcConfigManage> list = rmFrpcConfigManageService.selectRmFrpcConfigManageList(rmFrpcConfigManage);
|
||||
ExcelUtil<RmFrpcConfigManage> util = new ExcelUtil<RmFrpcConfigManage>(RmFrpcConfigManage.class);
|
||||
util.showColumn(rmFrpcConfigManage.getProperties());
|
||||
util.exportExcel(response, list, "FRPC配置管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取FRPC配置管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:frpcConfigManage:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmFrpcConfigManageService.selectRmFrpcConfigManageById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增FRPC配置管理
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:frpcConfigManage:add")
|
||||
@Log(title = "FRPC配置管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
return toAjax(rmFrpcConfigManageService.insertRmFrpcConfigManage(rmFrpcConfigManage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改FRPC配置管理
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:frpcConfigManage:edit")
|
||||
@Log(title = "FRPC配置管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
return toAjax(rmFrpcConfigManageService.updateRmFrpcConfigManage(rmFrpcConfigManage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除FRPC配置管理
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:frpcConfigManage:remove")
|
||||
@Log(title = "FRPC配置管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmFrpcConfigManageService.deleteRmFrpcConfigManageByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成FRP连接
|
||||
*/
|
||||
@Log(title = "生成FRP连接", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/addFrpConnect")
|
||||
public AjaxResult addFrpConnect(@RequestBody RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
return toAjax(rmFrpcConfigManageService.addFrpConnect(rmFrpcConfigManage));
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.RmFrpcPortMapping;
|
||||
import com.tongran.rocketmq.service.IRmFrpcPortMappingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* FRPC端口映射配置Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/frpcPortMapping")
|
||||
public class RmFrpcPortMappingController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmFrpcPortMappingService rmFrpcPortMappingService;
|
||||
|
||||
/**
|
||||
* 查询FRPC端口映射配置列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:frpcPortMapping:list")
|
||||
@PostMapping("/list")
|
||||
public AjaxResult list(@RequestBody RmFrpcPortMapping rmFrpcPortMapping)
|
||||
{
|
||||
List<RmFrpcPortMapping> list = rmFrpcPortMappingService.selectRmFrpcPortMappingList(rmFrpcPortMapping);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取FRPC端口映射配置详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmFrpcPortMappingService.selectRmFrpcPortMappingById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增FRPC端口映射配置
|
||||
*/
|
||||
@Log(title = "FRPC端口映射配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmFrpcPortMapping rmFrpcPortMapping)
|
||||
{
|
||||
return toAjax(rmFrpcPortMappingService.insertRmFrpcPortMapping(rmFrpcPortMapping));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* FRPC配置管理对象 rm_frpc_config_manage
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@Data
|
||||
public class RmFrpcConfigManage extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** FRPC服务器地址 */
|
||||
@Excel(name = "FRPC服务器地址")
|
||||
private String frpcServerAddr;
|
||||
|
||||
/** FRPC服务器端口 */
|
||||
@Excel(name = "FRPC服务器端口")
|
||||
private String frpcServerPort;
|
||||
|
||||
/** FRPC远程端口 */
|
||||
@Excel(name = "FRPC远程端口")
|
||||
private String frpcRemotePort;
|
||||
|
||||
/** FRPC本地端口 */
|
||||
@Excel(name = "FRPC本地端口")
|
||||
private String frpcLocalPort;
|
||||
|
||||
/** FRPC本地IP */
|
||||
@Excel(name = "FRPC本地IP")
|
||||
private String frpcLocalIp;
|
||||
|
||||
/** FRPC配置名称 */
|
||||
@Excel(name = "FRPC配置名称")
|
||||
private String frpcName;
|
||||
|
||||
/** FRP连接地址生成状态(0-未生成,1-生成中,2已生成) */
|
||||
@Excel(name = "FRP连接地址生成状态", readConverterExp = "0=未生成,1=生成中,2=已生成")
|
||||
private Long frpcConnectionStatus;
|
||||
|
||||
/** FRPC服务状态(0-未运行,1-运行) */
|
||||
@Excel(name = "FRPC服务状态", readConverterExp = "0=未运行,1=运行")
|
||||
private String frpcStatus;
|
||||
|
||||
/** FRPC连接生成时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "FRPC连接生成时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date frpcCreateTime;
|
||||
/** 起始远程端口 */
|
||||
private Integer startRemotePort;
|
||||
|
||||
/** 结束远程端口 */
|
||||
private Integer endRemotePort;
|
||||
// 管理网相关字段
|
||||
|
||||
@Excel(name = "管理网-公网IP")
|
||||
private String mgmtPublicIp; // 管理网-公网IP
|
||||
|
||||
@Excel(name = "管理网-接口名称")
|
||||
private String mgmtInterfaceName; // 管理网-接口名称
|
||||
|
||||
@Excel(name = "管理网-mac地址")
|
||||
private String mgmtMacAddress; // 管理网-mac地址
|
||||
|
||||
@Excel(name = "管理网-接口类型")
|
||||
private String mgmtInterfaceType; // 管理网-接口类型
|
||||
|
||||
@Excel(name = "管理网-IPv4地址")
|
||||
private String mgmtIpv4Address; // 管理网-IPv4地址
|
||||
|
||||
@Excel(name = "管理网-网关")
|
||||
private String mgmtGateway; // 管理网-网关地址
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* FRPC端口映射配置对象 rm_frpc_port_mapping
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@Data
|
||||
public class RmFrpcPortMapping extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 起始远程端口 */
|
||||
@Excel(name = "起始远程端口")
|
||||
private Integer startRemotePort;
|
||||
|
||||
/** 结束远程端口 */
|
||||
@Excel(name = "结束远程端口")
|
||||
private Integer endRemotePort;
|
||||
|
||||
/** 服务器端口 */
|
||||
@Excel(name = "服务器端口")
|
||||
private String serverPort;
|
||||
|
||||
/** 服务器地址 */
|
||||
@Excel(name = "服务器地址")
|
||||
private String serverAddr;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.tongran.rocketmq.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* FRPC端口映射配置对象 rm_frpc_port_mapping
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@Data
|
||||
public class FrpMsgVo
|
||||
{
|
||||
|
||||
/** 远程端口 */
|
||||
private Integer remotePort;
|
||||
|
||||
/** 服务器端口 */
|
||||
private String serverPort;
|
||||
|
||||
/** 服务器地址 */
|
||||
private String serverAddr;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.tongran.rocketmq.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FrpRspVo {
|
||||
/**
|
||||
* 状态码,0、失败;1、成功
|
||||
*/
|
||||
private Integer resCode;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String resMsg;
|
||||
|
||||
/** frps地址 */
|
||||
private String serverAddr;
|
||||
/** frps端口 */
|
||||
private String serverPort;
|
||||
/** frpc端口 */
|
||||
private String remotePort;
|
||||
/** frpc 名称 */
|
||||
private String name;
|
||||
/** frpc 类型 */
|
||||
private String type;
|
||||
/** frpc 映射ip */
|
||||
private String localIP;
|
||||
/** frpc 映射端口 */
|
||||
private String localPort;
|
||||
/** frpc运行状态(0未运行,1已运行) */
|
||||
private String isRunning;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private Long timestamp = Instant.now().getEpochSecond();
|
||||
}
|
||||
@@ -17,6 +17,8 @@ public class PolicyTypeVo {
|
||||
private String routes;
|
||||
/** 业务网卡名称*/
|
||||
private String netName;
|
||||
/** frp配置信息 */
|
||||
private String frpMsg;
|
||||
/** 时间戳 */
|
||||
private Long timestamp = Instant.now().getEpochSecond();
|
||||
}
|
||||
|
||||
@@ -7,14 +7,10 @@ import com.tongran.common.core.enums.MsgEnum;
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.common.core.utils.StringUtils;
|
||||
import com.tongran.rocketmq.domain.*;
|
||||
import com.tongran.rocketmq.domain.vo.CollectDataVo;
|
||||
import com.tongran.rocketmq.domain.vo.RegisterMsgVo;
|
||||
import com.tongran.rocketmq.domain.vo.RspResultVo;
|
||||
import com.tongran.rocketmq.domain.vo.RspVo;
|
||||
import com.tongran.rocketmq.domain.vo.*;
|
||||
import com.tongran.rocketmq.enums.AlarmTypeEnum;
|
||||
import com.tongran.rocketmq.enums.PushMethodEnum;
|
||||
import com.tongran.rocketmq.service.*;
|
||||
import com.tongran.rocketmq.snmp.scheduler.MultiSwitchCollectionScheduler;
|
||||
import com.tongran.rocketmq.utils.DataProcessUtil;
|
||||
import com.tongran.rocketmq.utils.JsonDataParser;
|
||||
import com.tongran.rocketmq.utils.WeChatWorkBot;
|
||||
@@ -101,7 +97,7 @@ public class MessageHandler {
|
||||
@Autowired
|
||||
private IRmAlarmPushConfigService rmAlarmPushConfigService;
|
||||
@Autowired
|
||||
private MultiSwitchCollectionScheduler multiSwitchCollectionScheduler;
|
||||
private IRmFrpcConfigManageService rmFrpcConfigManageService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -124,6 +120,39 @@ public class MessageHandler {
|
||||
registerHandler(MsgEnum.系统其他上报.getValue(), this::handleOtherSystemMessage);
|
||||
registerHandler(MsgEnum.心跳上报.getValue(), this::handleHeartbeatMessage);
|
||||
registerHandler(MsgEnum.多公网IP探测.getValue(), this::handleNetWorkDelectMessage);
|
||||
registerHandler(MsgEnum.修改frp配置文件应答.getValue(), this::handleUpdateFrpMessage);
|
||||
}
|
||||
|
||||
private void handleUpdateFrpMessage(DeviceMessage message) {
|
||||
List<FrpRspVo> rspVoList = JsonDataParser.parseJsonData(message.getData(), FrpRspVo.class);
|
||||
if (!rspVoList.isEmpty()) {
|
||||
FrpRspVo rsp = rspVoList.get(0);
|
||||
// 时间戳转换
|
||||
long timestamp = rsp.getTimestamp();
|
||||
long millis = timestamp * 1000;
|
||||
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||
if(rsp.getResCode() == 1) {
|
||||
// 运行成功 修改相关信息
|
||||
RmFrpcConfigManage frpcData = new RmFrpcConfigManage();
|
||||
frpcData.setClientId(message.getClientId());
|
||||
frpcData.setFrpcName(rsp.getName());
|
||||
frpcData.setFrpcStatus(rsp.getIsRunning());
|
||||
frpcData.setFrpcLocalPort(rsp.getLocalPort());
|
||||
frpcData.setFrpcLocalIp(rsp.getLocalIP());
|
||||
frpcData.setFrpcCreateTime(createTime);
|
||||
frpcData.setFrpcConnectionStatus(2L);
|
||||
frpcData.setFrpcRemotePort(rsp.getRemotePort());
|
||||
frpcData.setFrpcServerAddr(rsp.getServerAddr());
|
||||
frpcData.setFrpcServerPort(rsp.getServerPort());
|
||||
rmFrpcConfigManageService.insertRmFrpcConfigManage(frpcData);
|
||||
} else if(rsp.getResCode() == 2){
|
||||
RmFrpcConfigManage configManage = new RmFrpcConfigManage();
|
||||
configManage.setFrpcRemotePort(rsp.getRemotePort());
|
||||
rmFrpcConfigManageService.addFrpConnect(configManage);
|
||||
} else{
|
||||
log.error("生成连接失败:{}",rsp.getResMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.rocketmq.domain.RmFrpcConfigManage;
|
||||
|
||||
/**
|
||||
* FRPC配置管理Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
public interface RmFrpcConfigManageMapper
|
||||
{
|
||||
/**
|
||||
* 查询FRPC配置管理
|
||||
*
|
||||
* @param id FRPC配置管理主键
|
||||
* @return FRPC配置管理
|
||||
*/
|
||||
public RmFrpcConfigManage selectRmFrpcConfigManageById(Long id);
|
||||
|
||||
/**
|
||||
* 查询FRPC配置管理列表
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return FRPC配置管理集合
|
||||
*/
|
||||
public List<RmFrpcConfigManage> selectRmFrpcConfigManageList(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
|
||||
/**
|
||||
* 新增FRPC配置管理
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmFrpcConfigManage(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
|
||||
/**
|
||||
* 修改FRPC配置管理
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmFrpcConfigManage(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
|
||||
/**
|
||||
* 删除FRPC配置管理
|
||||
*
|
||||
* @param id FRPC配置管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcConfigManageById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除FRPC配置管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcConfigManageByIds(Long[] ids);
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.RmFrpcPortMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* FRPC端口映射配置Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
public interface RmFrpcPortMappingMapper
|
||||
{
|
||||
/**
|
||||
* 查询FRPC端口映射配置
|
||||
*
|
||||
* @param id FRPC端口映射配置主键
|
||||
* @return FRPC端口映射配置
|
||||
*/
|
||||
public RmFrpcPortMapping selectRmFrpcPortMappingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询FRPC端口映射配置列表
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return FRPC端口映射配置集合
|
||||
*/
|
||||
public List<RmFrpcPortMapping> selectRmFrpcPortMappingList(RmFrpcPortMapping rmFrpcPortMapping);
|
||||
|
||||
/**
|
||||
* 新增FRPC端口映射配置
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmFrpcPortMapping(RmFrpcPortMapping rmFrpcPortMapping);
|
||||
|
||||
/**
|
||||
* 修改FRPC端口映射配置
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmFrpcPortMapping(RmFrpcPortMapping rmFrpcPortMapping);
|
||||
|
||||
/**
|
||||
* 删除FRPC端口映射配置
|
||||
*
|
||||
* @param id FRPC端口映射配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcPortMappingById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除FRPC端口映射配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcPortMappingByIds(Long[] ids);
|
||||
|
||||
void truncateFrpcPortMapping();
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.RmFrpcConfigManage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* FRPC配置管理Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
public interface IRmFrpcConfigManageService
|
||||
{
|
||||
/**
|
||||
* 查询FRPC配置管理
|
||||
*
|
||||
* @param id FRPC配置管理主键
|
||||
* @return FRPC配置管理
|
||||
*/
|
||||
public RmFrpcConfigManage selectRmFrpcConfigManageById(Long id);
|
||||
|
||||
/**
|
||||
* 查询FRPC配置管理列表
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return FRPC配置管理集合
|
||||
*/
|
||||
public List<RmFrpcConfigManage> selectRmFrpcConfigManageList(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
|
||||
/**
|
||||
* 新增FRPC配置管理
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmFrpcConfigManage(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
|
||||
/**
|
||||
* 修改FRPC配置管理
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmFrpcConfigManage(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
|
||||
/**
|
||||
* 批量删除FRPC配置管理
|
||||
*
|
||||
* @param ids 需要删除的FRPC配置管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcConfigManageByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除FRPC配置管理信息
|
||||
*
|
||||
* @param id FRPC配置管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcConfigManageById(Long id);
|
||||
|
||||
/**
|
||||
* 生成frp连接
|
||||
* @param rmFrpcConfigManage
|
||||
* @return
|
||||
*/
|
||||
int addFrpConnect(RmFrpcConfigManage rmFrpcConfigManage);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.rocketmq.domain.RmFrpcPortMapping;
|
||||
|
||||
/**
|
||||
* FRPC端口映射配置Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
public interface IRmFrpcPortMappingService
|
||||
{
|
||||
/**
|
||||
* 查询FRPC端口映射配置
|
||||
*
|
||||
* @param id FRPC端口映射配置主键
|
||||
* @return FRPC端口映射配置
|
||||
*/
|
||||
public RmFrpcPortMapping selectRmFrpcPortMappingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询FRPC端口映射配置列表
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return FRPC端口映射配置集合
|
||||
*/
|
||||
public List<RmFrpcPortMapping> selectRmFrpcPortMappingList(RmFrpcPortMapping rmFrpcPortMapping);
|
||||
|
||||
/**
|
||||
* 新增FRPC端口映射配置
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmFrpcPortMapping(RmFrpcPortMapping rmFrpcPortMapping);
|
||||
|
||||
/**
|
||||
* 修改FRPC端口映射配置
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmFrpcPortMapping(RmFrpcPortMapping rmFrpcPortMapping);
|
||||
|
||||
/**
|
||||
* 批量删除FRPC端口映射配置
|
||||
*
|
||||
* @param ids 需要删除的FRPC端口映射配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcPortMappingByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除FRPC端口映射配置信息
|
||||
*
|
||||
* @param id FRPC端口映射配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmFrpcPortMappingById(Long id);
|
||||
}
|
||||
+286
@@ -0,0 +1,286 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tongran.common.core.enums.MsgEnum;
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.rocketmq.domain.DeviceMessage;
|
||||
import com.tongran.rocketmq.domain.RmFrpcConfigManage;
|
||||
import com.tongran.rocketmq.domain.RmFrpcPortMapping;
|
||||
import com.tongran.rocketmq.domain.RmNetworkInterface;
|
||||
import com.tongran.rocketmq.domain.vo.FrpMsgVo;
|
||||
import com.tongran.rocketmq.domain.vo.PolicyTypeVo;
|
||||
import com.tongran.rocketmq.mapper.RmFrpcConfigManageMapper;
|
||||
import com.tongran.rocketmq.mapper.RmFrpcPortMappingMapper;
|
||||
import com.tongran.rocketmq.model.ProducerMode;
|
||||
import com.tongran.rocketmq.producer.MessageProducer;
|
||||
import com.tongran.rocketmq.service.IRmFrpcConfigManageService;
|
||||
import com.tongran.rocketmq.service.IRmNetworkInterfaceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* FRPC配置管理Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@Service
|
||||
public class RmFrpcConfigManageServiceImpl implements IRmFrpcConfigManageService
|
||||
{
|
||||
// Redis key定义
|
||||
private static final String USED_PORTS_KEY = "frpc:used_ports";
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
@Autowired
|
||||
private RmFrpcConfigManageMapper rmFrpcConfigManageMapper;
|
||||
@Autowired
|
||||
private RmFrpcPortMappingMapper rmFrpcPortMappingMapper;
|
||||
@Autowired
|
||||
private IRmNetworkInterfaceService rmNetworkInterfaceService;
|
||||
@Autowired
|
||||
private ProducerMode producerMode;
|
||||
|
||||
/**
|
||||
* 查询FRPC配置管理
|
||||
*
|
||||
* @param id FRPC配置管理主键
|
||||
* @return FRPC配置管理
|
||||
*/
|
||||
@Override
|
||||
public RmFrpcConfigManage selectRmFrpcConfigManageById(Long id)
|
||||
{
|
||||
RmFrpcConfigManage rmFrpcConfigManage = rmFrpcConfigManageMapper.selectRmFrpcConfigManageById(id);
|
||||
setNetWorkMsg(rmFrpcConfigManage);
|
||||
return rmFrpcConfigManage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询FRPC配置管理列表
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return FRPC配置管理
|
||||
*/
|
||||
@Override
|
||||
public List<RmFrpcConfigManage> selectRmFrpcConfigManageList(RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
List<RmFrpcConfigManage> list = rmFrpcConfigManageMapper.selectRmFrpcConfigManageList(rmFrpcConfigManage);
|
||||
if(list != null){
|
||||
for (RmFrpcConfigManage configManage : list) {
|
||||
// 设置管理网信息
|
||||
setNetWorkMsg(configManage);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 网卡信息赋值
|
||||
* @param frpcConfigManage
|
||||
*/
|
||||
public void setNetWorkMsg(RmFrpcConfigManage frpcConfigManage) {
|
||||
String clientId = frpcConfigManage.getClientId();
|
||||
// 根据clientId查询网卡信息
|
||||
RmNetworkInterface queryParam = new RmNetworkInterface();
|
||||
queryParam.setClientId(clientId);
|
||||
queryParam.setNewFlag(1);
|
||||
// 获取网络接口列表
|
||||
List<RmNetworkInterface> networkList = rmNetworkInterfaceService.selectRmNetworkInterfaceList(queryParam);
|
||||
|
||||
if (networkList == null || networkList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (RmNetworkInterface network : networkList) {
|
||||
if ("2".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
|
||||
// 管理网IP处理
|
||||
frpcConfigManage.setMgmtPublicIp(network.getPublicIp());
|
||||
frpcConfigManage.setMgmtInterfaceName(network.getInterfaceName());
|
||||
frpcConfigManage.setMgmtMacAddress(network.getMacAddress());
|
||||
frpcConfigManage.setMgmtInterfaceType(network.getInterfaceType());
|
||||
frpcConfigManage.setMgmtIpv4Address(network.getIpv4Address());
|
||||
frpcConfigManage.setMgmtGateway(network.getGateway());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增FRPC配置管理
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmFrpcConfigManage(RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
rmFrpcConfigManage.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = rmFrpcConfigManageMapper.insertRmFrpcConfigManage(rmFrpcConfigManage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改FRPC配置管理
|
||||
*
|
||||
* @param rmFrpcConfigManage FRPC配置管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmFrpcConfigManage(RmFrpcConfigManage rmFrpcConfigManage)
|
||||
{
|
||||
rmFrpcConfigManage.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmFrpcConfigManageMapper.updateRmFrpcConfigManage(rmFrpcConfigManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除FRPC配置管理
|
||||
*
|
||||
* @param ids 需要删除的FRPC配置管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmFrpcConfigManageByIds(Long[] ids)
|
||||
{
|
||||
return rmFrpcConfigManageMapper.deleteRmFrpcConfigManageByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除FRPC配置管理信息
|
||||
*
|
||||
* @param id FRPC配置管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmFrpcConfigManageById(Long id)
|
||||
{
|
||||
return rmFrpcConfigManageMapper.deleteRmFrpcConfigManageById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addFrpConnect(RmFrpcConfigManage rmFrpcConfigManage) {
|
||||
// 查询frps配置
|
||||
List<RmFrpcPortMapping> portMappingList = rmFrpcPortMappingMapper.selectRmFrpcPortMappingList(new RmFrpcPortMapping());
|
||||
Integer startRemotePort = rmFrpcConfigManage.getStartRemotePort();
|
||||
Integer endRemotePort = rmFrpcConfigManage.getEndRemotePort();
|
||||
String serverPort = null;
|
||||
String serverAddr = null;
|
||||
if(portMappingList != null && !portMappingList.isEmpty()){
|
||||
RmFrpcPortMapping portMapping = portMappingList.get(0);
|
||||
startRemotePort = portMapping.getStartRemotePort();
|
||||
endRemotePort = portMapping.getEndRemotePort();
|
||||
serverPort = portMapping.getServerPort();
|
||||
serverAddr = portMapping.getServerAddr();
|
||||
}
|
||||
if(startRemotePort == null || endRemotePort == null){
|
||||
throw new RuntimeException("请先设置FRPS端口范围");
|
||||
}
|
||||
String clientId = rmFrpcConfigManage.getClientId();
|
||||
if(rmFrpcConfigManage.getFrpcRemotePort() != null){
|
||||
// 此端口被占用存储到redis,再次随机可用端口
|
||||
addUsedPort(Integer.parseInt(rmFrpcConfigManage.getFrpcRemotePort()));
|
||||
}
|
||||
// 获取一个可用的随机端口
|
||||
int availablePort = getRandomAvailablePort(startRemotePort, endRemotePort);
|
||||
|
||||
if (availablePort != -1) {
|
||||
// 将端口标记为已使用
|
||||
if (addUsedPort(availablePort)) {
|
||||
// 构建端口下发信息
|
||||
FrpMsgVo frpMsgVo = new FrpMsgVo();
|
||||
frpMsgVo.setServerPort(serverPort);
|
||||
frpMsgVo.setServerAddr(serverAddr);
|
||||
frpMsgVo.setRemotePort(availablePort);
|
||||
String frpMsgStr = JSONObject.toJSONString(frpMsgVo);
|
||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
||||
policyTypeVo.setFrpMsg(frpMsgStr);
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
String configJson = JSONObject.toJSONString(policyTypeVo);
|
||||
DeviceMessage message = new DeviceMessage();
|
||||
message.setClientId(clientId);
|
||||
message.setData(configJson);
|
||||
message.setDataType(MsgEnum.获取最新策略应答.getValue());
|
||||
|
||||
messageProducer.sendAsyncProducerMessage(
|
||||
producerMode.getAgentTopic(),
|
||||
"",
|
||||
"",
|
||||
JSONObject.toJSONString(message)
|
||||
);
|
||||
}
|
||||
return 1;
|
||||
}else{
|
||||
throw new RuntimeException("该端口范围内无可用端口:" + startRemotePort + "~" + endRemotePort);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取下一个可用的随机端口
|
||||
*/
|
||||
public int getRandomAvailablePort(int startPort, int endPort) {
|
||||
validatePortRange(startPort, endPort);
|
||||
|
||||
// 获取已使用的端口集合
|
||||
Set<String> usedPorts = redisTemplate.opsForSet().members(USED_PORTS_KEY);
|
||||
if (usedPorts == null) {
|
||||
usedPorts = new HashSet<>();
|
||||
}
|
||||
|
||||
// 创建所有端口的列表
|
||||
List<Integer> allPorts = new ArrayList<>();
|
||||
for (int i = startPort; i <= endPort; i++) {
|
||||
allPorts.add(i);
|
||||
}
|
||||
|
||||
// 随机打乱
|
||||
Collections.shuffle(allPorts);
|
||||
|
||||
// 查找第一个未在Redis中存储的端口
|
||||
for (int port : allPorts) {
|
||||
if (!usedPorts.contains(String.valueOf(port))) {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // 没有可用端口
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断端口是否可用(只检查Redis中是否存在)
|
||||
*/
|
||||
public boolean isPortAvailable(int port) {
|
||||
// 检查Redis中是否已使用
|
||||
Boolean isUsed = redisTemplate.opsForSet().isMember(USED_PORTS_KEY, String.valueOf(port));
|
||||
return !Boolean.TRUE.equals(isUsed);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加端口到已用集合
|
||||
*/
|
||||
public boolean addUsedPort(int port) {
|
||||
Long result = redisTemplate.opsForSet().add(USED_PORTS_KEY, String.valueOf(port));
|
||||
return result != null && result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从已用集合中移除端口
|
||||
*/
|
||||
public boolean removeUsedPort(int port) {
|
||||
Long result = redisTemplate.opsForSet().remove(USED_PORTS_KEY, String.valueOf(port));
|
||||
return result != null && result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证端口范围参数
|
||||
*/
|
||||
private void validatePortRange(int startPort, int endPort) {
|
||||
if (startPort < 1 || startPort > 65535) {
|
||||
throw new IllegalArgumentException("起始端口必须在1-65535之间");
|
||||
}
|
||||
if (endPort < 1 || endPort > 65535) {
|
||||
throw new IllegalArgumentException("结束端口必须在1-65535之间");
|
||||
}
|
||||
if (startPort > endPort) {
|
||||
throw new IllegalArgumentException("起始端口不能大于结束端口");
|
||||
}
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.rocketmq.domain.RmFrpcPortMapping;
|
||||
import com.tongran.rocketmq.mapper.RmFrpcPortMappingMapper;
|
||||
import com.tongran.rocketmq.service.IRmFrpcPortMappingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* FRPC端口映射配置Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-12-19
|
||||
*/
|
||||
@Service
|
||||
public class RmFrpcPortMappingServiceImpl implements IRmFrpcPortMappingService
|
||||
{
|
||||
@Autowired
|
||||
private RmFrpcPortMappingMapper rmFrpcPortMappingMapper;
|
||||
|
||||
/**
|
||||
* 查询FRPC端口映射配置
|
||||
*
|
||||
* @param id FRPC端口映射配置主键
|
||||
* @return FRPC端口映射配置
|
||||
*/
|
||||
@Override
|
||||
public RmFrpcPortMapping selectRmFrpcPortMappingById(Long id)
|
||||
{
|
||||
return rmFrpcPortMappingMapper.selectRmFrpcPortMappingById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询FRPC端口映射配置列表
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return FRPC端口映射配置
|
||||
*/
|
||||
@Override
|
||||
public List<RmFrpcPortMapping> selectRmFrpcPortMappingList(RmFrpcPortMapping rmFrpcPortMapping)
|
||||
{
|
||||
return rmFrpcPortMappingMapper.selectRmFrpcPortMappingList(rmFrpcPortMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增FRPC端口映射配置
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmFrpcPortMapping(RmFrpcPortMapping rmFrpcPortMapping)
|
||||
{
|
||||
// 清理配置表
|
||||
rmFrpcPortMappingMapper.truncateFrpcPortMapping();
|
||||
// 插入表
|
||||
int rows = rmFrpcPortMappingMapper.insertRmFrpcPortMapping(rmFrpcPortMapping);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改FRPC端口映射配置
|
||||
*
|
||||
* @param rmFrpcPortMapping FRPC端口映射配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmFrpcPortMapping(RmFrpcPortMapping rmFrpcPortMapping)
|
||||
{
|
||||
rmFrpcPortMapping.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmFrpcPortMappingMapper.updateRmFrpcPortMapping(rmFrpcPortMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除FRPC端口映射配置
|
||||
*
|
||||
* @param ids 需要删除的FRPC端口映射配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmFrpcPortMappingByIds(Long[] ids)
|
||||
{
|
||||
return rmFrpcPortMappingMapper.deleteRmFrpcPortMappingByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除FRPC端口映射配置信息
|
||||
*
|
||||
* @param id FRPC端口映射配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmFrpcPortMappingById(Long id)
|
||||
{
|
||||
return rmFrpcPortMappingMapper.deleteRmFrpcPortMappingById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?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.tongran.rocketmq.mapper.RmFrpcConfigManageMapper">
|
||||
|
||||
<resultMap type="RmFrpcConfigManage" id="RmFrpcConfigManageResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="frpcServerAddr" column="frpc_server_addr" />
|
||||
<result property="frpcServerPort" column="frpc_server_port" />
|
||||
<result property="frpcRemotePort" column="frpc_remote_port" />
|
||||
<result property="frpcLocalPort" column="frpc_local_port" />
|
||||
<result property="frpcName" column="frpc_name" />
|
||||
<result property="frpcConnectionStatus" column="frpc_connection_status" />
|
||||
<result property="frpcCreateTime" column="frpc_create_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="frpcLocalIp" column="frpc_local_ip" />
|
||||
<result property="frpcStatus" column="frpc_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmFrpcConfigManageVo">
|
||||
select id, client_id, frpc_server_addr, frpc_server_port, frpc_remote_port, frpc_local_port, frpc_name, frpc_connection_status, frpc_create_time, create_time, update_time, create_by, update_by, frpc_local_ip, frpc_status from rm_frpc_config_manage
|
||||
</sql>
|
||||
|
||||
<select id="selectRmFrpcConfigManageList" parameterType="RmFrpcConfigManage" resultMap="RmFrpcConfigManageResult">
|
||||
<include refid="selectRmFrpcConfigManageVo"/>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="frpcServerAddr != null and frpcServerAddr != ''"> and frpc_server_addr = #{frpcServerAddr}</if>
|
||||
<if test="frpcServerPort != null and frpcServerPort != ''"> and frpc_server_port = #{frpcServerPort}</if>
|
||||
<if test="frpcRemotePort != null and frpcRemotePort != ''"> and frpc_remote_port = #{frpcRemotePort}</if>
|
||||
<if test="frpcLocalPort != null and frpcLocalPort != ''"> and frpc_local_port = #{frpcLocalPort}</if>
|
||||
<if test="frpcName != null and frpcName != ''"> and frpc_name like concat('%', #{frpcName}, '%')</if>
|
||||
<if test="frpcConnectionStatus != null "> and frpc_connection_status = #{frpcConnectionStatus}</if>
|
||||
<if test="frpcCreateTime != null "> and frpc_create_time = #{frpcCreateTime}</if>
|
||||
<if test="frpcLocalIp != null and frpcLocalIp != ''"> and frpc_local_ip = #{frpcLocalIp}</if>
|
||||
<if test="frpcStatus != null and frpcStatus != ''"> and frpc_status = #{frpcStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmFrpcConfigManageById" parameterType="Long" resultMap="RmFrpcConfigManageResult">
|
||||
<include refid="selectRmFrpcConfigManageVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmFrpcConfigManage" parameterType="RmFrpcConfigManage" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO rm_frpc_config_manage
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="frpcServerAddr != null">frpc_server_addr,</if>
|
||||
<if test="frpcServerPort != null">frpc_server_port,</if>
|
||||
<if test="frpcRemotePort != null">frpc_remote_port,</if>
|
||||
<if test="frpcLocalPort != null">frpc_local_port,</if>
|
||||
<if test="frpcName != null">frpc_name,</if>
|
||||
<if test="frpcConnectionStatus != null">frpc_connection_status,</if>
|
||||
<if test="frpcCreateTime != null">frpc_create_time,</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>
|
||||
<if test="frpcLocalIp != null">frpc_local_ip,</if>
|
||||
<if test="frpcStatus != null">frpc_status,</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="frpcServerAddr != null">#{frpcServerAddr},</if>
|
||||
<if test="frpcServerPort != null">#{frpcServerPort},</if>
|
||||
<if test="frpcRemotePort != null">#{frpcRemotePort},</if>
|
||||
<if test="frpcLocalPort != null">#{frpcLocalPort},</if>
|
||||
<if test="frpcName != null">#{frpcName},</if>
|
||||
<if test="frpcConnectionStatus != null">#{frpcConnectionStatus},</if>
|
||||
<if test="frpcCreateTime != null">#{frpcCreateTime},</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>
|
||||
<if test="frpcLocalIp != null">#{frpcLocalIp},</if>
|
||||
<if test="frpcStatus != null">#{frpcStatus},</if>
|
||||
</trim>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
<trim suffixOverrides=",">
|
||||
<if test="clientId != null">client_id = VALUES(client_id),</if>
|
||||
<if test="frpcServerAddr != null">frpc_server_addr = VALUES(frpc_server_addr),</if>
|
||||
<if test="frpcServerPort != null">frpc_server_port = VALUES(frpc_server_port),</if>
|
||||
<if test="frpcRemotePort != null">frpc_remote_port = VALUES(frpc_remote_port),</if>
|
||||
<if test="frpcLocalPort != null">frpc_local_port = VALUES(frpc_local_port),</if>
|
||||
<if test="frpcName != null">frpc_name = VALUES(frpc_name),</if>
|
||||
<if test="frpcConnectionStatus != null">frpc_connection_status = VALUES(frpc_connection_status),</if>
|
||||
<if test="frpcCreateTime != null">frpc_create_time = VALUES(frpc_create_time),</if>
|
||||
<!-- 通常更新时间字段在更新时会设置为当前时间 -->
|
||||
update_time = NOW(),
|
||||
<if test="updateBy != null">update_by = VALUES(update_by),</if>
|
||||
<if test="frpcLocalIp != null">frpc_local_ip = VALUES(frpc_local_ip),</if>
|
||||
<if test="frpcStatus != null">frpc_status = VALUES(frpc_status),</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmFrpcConfigManage" parameterType="RmFrpcConfigManage">
|
||||
update rm_frpc_config_manage
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
<if test="frpcServerAddr != null">frpc_server_addr = #{frpcServerAddr},</if>
|
||||
<if test="frpcServerPort != null">frpc_server_port = #{frpcServerPort},</if>
|
||||
<if test="frpcRemotePort != null">frpc_remote_port = #{frpcRemotePort},</if>
|
||||
<if test="frpcLocalPort != null">frpc_local_port = #{frpcLocalPort},</if>
|
||||
<if test="frpcName != null">frpc_name = #{frpcName},</if>
|
||||
<if test="frpcConnectionStatus != null">frpc_connection_status = #{frpcConnectionStatus},</if>
|
||||
<if test="frpcCreateTime != null">frpc_create_time = #{frpcCreateTime},</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>
|
||||
<if test="frpcLocalIp != null">frpc_local_ip = #{frpcLocalIp},</if>
|
||||
<if test="frpcStatus != null">frpc_status = #{frpcStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmFrpcConfigManageById" parameterType="Long">
|
||||
delete from rm_frpc_config_manage where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmFrpcConfigManageByIds" parameterType="String">
|
||||
delete from rm_frpc_config_manage where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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.tongran.rocketmq.mapper.RmFrpcPortMappingMapper">
|
||||
|
||||
<resultMap type="RmFrpcPortMapping" id="RmFrpcPortMappingResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="startRemotePort" column="start_remote_port" />
|
||||
<result property="endRemotePort" column="end_remote_port" />
|
||||
<result property="serverPort" column="server_port" />
|
||||
<result property="serverAddr" column="server_addr" />
|
||||
<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="selectRmFrpcPortMappingVo">
|
||||
select id, start_remote_port, end_remote_port, server_port, server_addr, create_time, update_time, create_by, update_by from rm_frpc_port_mapping
|
||||
</sql>
|
||||
|
||||
<select id="selectRmFrpcPortMappingList" parameterType="RmFrpcPortMapping" resultMap="RmFrpcPortMappingResult">
|
||||
<include refid="selectRmFrpcPortMappingVo"/>
|
||||
<where>
|
||||
<if test="startRemotePort != null "> and start_remote_port = #{startRemotePort}</if>
|
||||
<if test="endRemotePort != null "> and end_remote_port = #{endRemotePort}</if>
|
||||
<if test="serverPort != null "> and server_port = #{serverPort}</if>
|
||||
<if test="serverAddr != null and serverAddr != ''"> and server_addr = #{serverAddr}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmFrpcPortMappingById" parameterType="Long" resultMap="RmFrpcPortMappingResult">
|
||||
<include refid="selectRmFrpcPortMappingVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmFrpcPortMapping" parameterType="RmFrpcPortMapping" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_frpc_port_mapping
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="startRemotePort != null">start_remote_port,</if>
|
||||
<if test="endRemotePort != null">end_remote_port,</if>
|
||||
<if test="serverPort != null">server_port,</if>
|
||||
<if test="serverAddr != null">server_addr,</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="startRemotePort != null">#{startRemotePort},</if>
|
||||
<if test="endRemotePort != null">#{endRemotePort},</if>
|
||||
<if test="serverPort != null">#{serverPort},</if>
|
||||
<if test="serverAddr != null">#{serverAddr},</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="updateRmFrpcPortMapping" parameterType="RmFrpcPortMapping">
|
||||
update rm_frpc_port_mapping
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="startRemotePort != null">start_remote_port = #{startRemotePort},</if>
|
||||
<if test="endRemotePort != null">end_remote_port = #{endRemotePort},</if>
|
||||
<if test="serverPort != null">server_port = #{serverPort},</if>
|
||||
<if test="serverAddr != null">server_addr = #{serverAddr},</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 id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmFrpcPortMappingById" parameterType="Long">
|
||||
delete from rm_frpc_port_mapping where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmFrpcPortMappingByIds" parameterType="String">
|
||||
delete from rm_frpc_port_mapping where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!-- 清空指定表 -->
|
||||
<delete id="truncateFrpcPortMapping">
|
||||
TRUNCATE TABLE rm_frpc_port_mapping
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user