Šī revīzija ir iekļauta:
caixiang 2021-09-16 11:10:08 +08:00
vecāks 09035cd750
revīzija 5c20deaae1
2 mainīti faili ar 42 papildinājumiem un 4 dzēšanām

Parādīt failu

@ -4,13 +4,17 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.qgs.dc.common.utils.CommonFunction;
import com.qgs.dc.mq.entity.CallbackMessageEntity;
import com.qgs.dc.mq.producer.component.RabbitSender;
import com.qgs.dc.mq.entity.MQMessage;
import com.qgs.dc.mq.entity.common.Header;
import com.qgs.dc.mq.entity.specificBody.QueryEQStatusBody;
import com.qgs.dc.opcua.controller.R;
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.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
@ -29,6 +33,40 @@ public class TestController {
@Autowired
RabbitSender rabbitSender;
@PostMapping("/eapRequest")
/**
* desc : 回复EAP的request 的回调接口向rabbitmq中发送消息direct模式
* MES => DC(数据采集中间件) => MQ => EAP
*/
public R eapRequest(){
try {
//properties 这里的参数是写在MQ消息 header里面的如果EAP端 需要某些参数 可以写在这里eap去取更方便一些
Map<String,Object> properties = new HashMap<>();
CallbackMessageEntity callbackMessageEntity = new CallbackMessageEntity();
properties.put("equipmentName","PID001");
callbackMessageEntity.setExchangeName("00B_Exchange");
callbackMessageEntity.setRoutingKey("00B_EAP_Request_Queue_RoutingKey");
MQMessage mesResponse = new MQMessage();
Header header = new Header("Request","Execute","QUERYEQPStatus","12");
QueryEQStatusBody queryEQStatusBody = new QueryEQStatusBody();
queryEQStatusBody.setVidType("u4");
List<String> vids = new ArrayList<>();
vids.add("10000");
vids.add("10001");
vids.add("10002");
queryEQStatusBody.setVidList(vids);
mesResponse.setBody(JSONObject.toJSONString(queryEQStatusBody));
mesResponse.setHeader(header);
callbackMessageEntity.setMqMessage(mesResponse);
properties.put("transitionId", "12312");
rabbitSender.reply(callbackMessageEntity.getMqMessage(),properties, callbackMessageEntity.getExchangeName(), callbackMessageEntity.getRoutingKey());
return R.ok("回复成功");
}catch (Exception e){
return R.error().put("result",e.getMessage());
}
}
public static void main(String[] args) throws IOException {

Parādīt failu

@ -97,7 +97,7 @@ public class OperateController {
}
}
@GetMapping("/getBrows")
@PostMapping("/getBrows")
public R getBrows(@RequestBody BrowsArgEntity browsArgEntity){
NodeIdKey nodeIdKey = uaService.browseA(browsArgEntity.getPlcName(), browsArgEntity.getRootNameSpace(), browsArgEntity.getIdenrifier());
if(nodeIdKey == null){
@ -138,7 +138,7 @@ public class OperateController {
}
@GetMapping("/read")
@PostMapping("/read")
//public R read(Integer nameSpace,String identifier,String plcName) {
public R read(@RequestBody ReadArgEntity readArgEntity) {
try {
@ -393,14 +393,14 @@ public class OperateController {
}
}
@GetMapping("getUniqueWebSocketId")
@PostMapping("getUniqueWebSocketId")
public R getUniqueWebSocketId() throws Exception {
String uniqeId = webSocketServer.getUniqeId();
return R.ok().put("result",uniqeId);
}
@GetMapping("getConnectedPLC")
@PostMapping("getConnectedPLC")
public R getConnectedPLC() {
return R.ok().put("result",uaService.getConnectedPLC());
}