mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善
This commit is contained in:
@@ -100,7 +100,7 @@ rabbitmq add_vhost /coal
|
||||
docker compose exec -it rabbitmq bash
|
||||
|
||||
rabbitmqctl add_user datacollector datacollector
|
||||
rabbitmqctl set_permissions --vhost /coal/test datacollector '' 'sysExchange' 'pms\.client\.*|dataCollector\.*'
|
||||
rabbitmqctl set_permissions --vhost /coal/test datacollector '' 'sysExchange|amq.default' 'pms\.client\.*|dataCollector\.*'
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.dataCollector.dto.CreateDataCollectorDto;
|
||||
import cn.lihongjie.coal.dataCollector.dto.DataCollectorDto;
|
||||
import cn.lihongjie.coal.dataCollector.dto.UpdateDataCollectorDto;
|
||||
import cn.lihongjie.coal.dataCollector.dto.*;
|
||||
import cn.lihongjie.coal.dataCollector.service.DataCollectorService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -60,4 +58,29 @@ public class DataCollectorController {
|
||||
public Page<DataCollectorDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/deleteLocalStatus")
|
||||
public Object deleteLocalStatus(@RequestBody DeleteLocalStatusRequest request) {
|
||||
return this.service.deleteLocalStatus(request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/updateLocalStatus")
|
||||
public Object updateLocalStatus(@RequestBody UpdateLocalStatus request) {
|
||||
return this.service.updateLocalStatus(request);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getLocalStatus")
|
||||
public Object getLocalStatus(@RequestBody GetLocalStatusRequest request) {
|
||||
return this.service.getLocalStatus(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package cn.lihongjie.coal.dataCollector.dto;
|
||||
import java.util.List;
|
||||
|
||||
public record DeleteLocalStatusRequest(String appKey, List<String> keys){}
|
||||
@@ -0,0 +1,2 @@
|
||||
package cn.lihongjie.coal.dataCollector.dto;
|
||||
public record GetLocalStatusRequest(String appKey){}
|
||||
@@ -0,0 +1,5 @@
|
||||
package cn.lihongjie.coal.dataCollector.dto;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public record UpdateLocalStatus(String appKey, List<Map<String,String>> status){}
|
||||
@@ -3,9 +3,7 @@ package cn.lihongjie.coal.dataCollector.service;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.dataCollector.dto.CreateDataCollectorDto;
|
||||
import cn.lihongjie.coal.dataCollector.dto.DataCollectorDto;
|
||||
import cn.lihongjie.coal.dataCollector.dto.UpdateDataCollectorDto;
|
||||
import cn.lihongjie.coal.dataCollector.dto.*;
|
||||
import cn.lihongjie.coal.dataCollector.entity.DataCollectorEntity;
|
||||
import cn.lihongjie.coal.dataCollector.mapper.DataCollectorMapper;
|
||||
import cn.lihongjie.coal.dataCollector.repository.DataCollectorRepository;
|
||||
@@ -34,7 +32,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -77,28 +74,31 @@ public class DataCollectorService
|
||||
}
|
||||
@Autowired private RabbitMQService rabbitMQService;
|
||||
|
||||
public Object getLocalStatus(String appKey) {
|
||||
public Object getLocalStatus(GetLocalStatusRequest getLocalStatusRequest) {
|
||||
|
||||
var o =
|
||||
rabbitTemplate.convertSendAndReceive(
|
||||
"dataCollector." + appKey, Map.of("action", "getLocalStatus"));
|
||||
new CorrelationData(UUID.randomUUID().toString());
|
||||
"dataCollector." + getLocalStatusRequest.appKey(),
|
||||
Map.of("action", "getLocalStatus")
|
||||
);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
public void updateLocalStatus(String appKey, List<Map<String, String>> status) {
|
||||
public Object updateLocalStatus(UpdateLocalStatus updateLocalStatus) {
|
||||
|
||||
rabbitTemplate.convertSendAndReceive(
|
||||
"dataCollector." + appKey, Map.of("action", "updateLocalStatus", "data", status));
|
||||
new CorrelationData(UUID.randomUUID().toString());
|
||||
return rabbitTemplate.convertSendAndReceive(
|
||||
"dataCollector." + updateLocalStatus.appKey(),
|
||||
Map.of("action", "updateLocalStatus", "data", updateLocalStatus.status())
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteLocalStatus(String appKey, List<String> keys) {
|
||||
public Object deleteLocalStatus(DeleteLocalStatusRequest deleteLocalStatusRequest) {
|
||||
|
||||
return rabbitTemplate.convertSendAndReceive(
|
||||
"dataCollector." + deleteLocalStatusRequest.appKey(), Map.of("action", "deleteLocalStatus", "data", deleteLocalStatusRequest.keys())
|
||||
);
|
||||
|
||||
rabbitTemplate.convertSendAndReceive(
|
||||
"dataCollector." + appKey, Map.of("action", "deleteLocalStatus", "data", keys));
|
||||
new CorrelationData(UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
public Object sendMsg(String id, String action, Object data, Map<String, String> headers) {
|
||||
|
||||
Reference in New Issue
Block a user