新增开发终端管理器,任务偏好设置,配置管理,采集器类型
parent
931194abcf
commit
7c9d82f24d
@ -0,0 +1,40 @@
|
|||||||
|
package com.docus.server.controller;
|
||||||
|
|
||||||
|
import com.docus.core.util.DateUtil;
|
||||||
|
import com.docus.core.util.json.JSON;
|
||||||
|
import com.docus.server.api.scheduling.management.CommMsgApi;
|
||||||
|
import com.docus.server.common.netty.CommMsg;
|
||||||
|
import com.docus.server.common.netty.server.ChannelRepository;
|
||||||
|
import com.docus.server.convert.CommMsgConvert;
|
||||||
|
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import io.netty.channel.Channel;
|
||||||
|
import io.netty.util.CharsetUtil;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用消息体 TCP API
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-07-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class CommMsgController implements CommMsgApi {
|
||||||
|
@Resource
|
||||||
|
private ChannelRepository channelRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientCommand(CommMsgDTO commMsgDTO) {
|
||||||
|
Channel channel = channelRepository.get(commMsgDTO.getTerminatorIp());
|
||||||
|
|
||||||
|
CommMsg commMsg = CommMsgConvert.INSTANCE.convertDO(commMsgDTO);
|
||||||
|
commMsg.setMessageTime(DateUtil.formatDateTime(new Date()));
|
||||||
|
|
||||||
|
if (channel != null) {
|
||||||
|
channel.writeAndFlush(Unpooled.copiedBuffer(JSON.toJSON(commMsg), CharsetUtil.UTF_8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.docus.server.convert;
|
||||||
|
|
||||||
|
import com.docus.server.common.netty.CommMsg;
|
||||||
|
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mappings;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用消息转换器
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-07-15
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CommMsgConvert {
|
||||||
|
|
||||||
|
CommMsgConvert INSTANCE = Mappers.getMapper(CommMsgConvert.class);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
CommMsg convertDO(CommMsgDTO commMsgDTO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.docus.server.api.scheduling.management;
|
||||||
|
|
||||||
|
import com.docus.server.dto.scheduling.management.schterminator.CommMsgDTO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用消息体 TCP API
|
||||||
|
*
|
||||||
|
* @author AutoGenerator
|
||||||
|
* @since 2023-07-15
|
||||||
|
*/
|
||||||
|
@Api(value = "通用消息TCP接口", tags = "通用消息TCP接口")
|
||||||
|
@FeignClient(value = "collector-scheduling-management", contextId = "collector-scheduling-management.CommMsgApi")
|
||||||
|
@RequestMapping("/sch/commMsg")
|
||||||
|
public interface CommMsgApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向客户端发送TCP命令
|
||||||
|
*
|
||||||
|
* @param commMsgDTO 消息体
|
||||||
|
*/
|
||||||
|
@ApiOperation("向客户端发送TCP命令")
|
||||||
|
@PostMapping("/clientCommand")
|
||||||
|
void clientCommand(@RequestBody CommMsgDTO commMsgDTO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.docus.server.dto.scheduling.management.schterminator;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "CommMsgDTO对象", description = "TCP 重启命令")
|
||||||
|
public class CommMsgDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "终端IP")
|
||||||
|
public String terminatorIp;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "消息类型")
|
||||||
|
public String messageType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "消息内容")
|
||||||
|
public String content;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.docus.server.enums;
|
||||||
|
|
||||||
|
import com.docus.infrastructure.core.db.enums.IIntegerEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忙闲状态
|
||||||
|
*/
|
||||||
|
public enum ConfigTypeEnum implements IIntegerEnum {
|
||||||
|
|
||||||
|
PUBLIC_CONFIG(0, "公共配置"),
|
||||||
|
|
||||||
|
PRIVATE_CONFIG(1, "私有配置");
|
||||||
|
|
||||||
|
private Integer value;
|
||||||
|
private String display;
|
||||||
|
|
||||||
|
ConfigTypeEnum(Integer value, String display) {
|
||||||
|
this.value = value;
|
||||||
|
this.display = display;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplay() {
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue