From 532e9a9b241f736fe0ed6ebb2bbd7ed00f9955ce Mon Sep 17 00:00:00 2001
From: 严智鑫 <test>
Date: 星期二, 02 四月 2024 16:00:37 +0800
Subject: [PATCH] 更新
---
/dev/null | 13 -------------
CacheGlassModule/src/main/java/com/mes/controller/TidyUpGlassModuleController.java | 8 +-------
2 files changed, 1 insertions(+), 20 deletions(-)
diff --git a/CacheGlassModule/src/main/java/com/mes/controller/TidyUpGlassModuleController.java b/CacheGlassModule/src/main/java/com/mes/controller/TidyUpGlassModuleController.java
index 99d6d28..144473e 100644
--- a/CacheGlassModule/src/main/java/com/mes/controller/TidyUpGlassModuleController.java
+++ b/CacheGlassModule/src/main/java/com/mes/controller/TidyUpGlassModuleController.java
@@ -17,8 +17,7 @@
// TidyUpGlassModule 鐞嗙墖妯″潡
public class TidyUpGlassModuleController {
- @Autowired
- private SelectInfo SelectInfo;
+
@Autowired
private SelectdppService SelectppService;
@@ -30,7 +29,6 @@
@ResponseBody
public Result SelectTerritoryInfo(@RequestParam(name = "ProcessId", required = false) String ProcessId) {
List<Tempered> h = SelectppService.SelectTemperedTerritory(ProcessId);
- System.out.println(h.size()+":"+ProcessId);
return Result.seccess(h);
}
@@ -38,7 +36,6 @@
@ResponseBody
public Result CutTerritory(String ProcessId) {
List<Map> h = SelectppService.SelectCutTerritory(ProcessId);
- System.out.println(h.size());
return Result.seccess(h);
}
@@ -46,7 +43,6 @@
@ResponseBody
public Result SelectCutTerritory(String ProcessId) {
List<Map> h = SelectppService.SelectCutTerritory("P24032508");
- System.out.println(h.size());
return Result.seccess(h);
}
@@ -55,7 +51,6 @@
@ResponseBody
public Result SelectCageInfo(String ProcessId) {
List<Map> h = SelectppService.SelectCutTerritory("P24032508");
- System.out.println(h.size());
return Result.seccess(h);
}
@@ -64,7 +59,6 @@
@ResponseBody
public Result SelectEdgTask(String ProcessId) {
List<Map> EdgTasks = hangzhoumesService.SelectEdgInfo("1");
- System.out.println(EdgTasks.size());
return Result.seccess(EdgTasks);
}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/BigStorageCage.java b/CacheGlassModule/src/main/java/com/mes/entity/BigStorageCage.java
deleted file mode 100644
index cc3e6bf..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/BigStorageCage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`big_storage_cage`")
-public class BigStorageCage {
- @TableId(type = IdType.AUTO)
- private Integer id;//澶х悊鐗囩琛╥d
- private Integer device_id;//璁惧id
- private String slot;//鏍呮牸鍙�
- private String enable_state;//鍚敤鐘舵��
- private Integer remain_width;//鍓╀綑瀹藉害
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/BigStorageCageDetails.java b/CacheGlassModule/src/main/java/com/mes/entity/BigStorageCageDetails.java
deleted file mode 100644
index 3dd0188..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/BigStorageCageDetails.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`big_storage_cage_details`")
-public class BigStorageCageDetails {
- @TableId(type = IdType.AUTO)
- private Integer id;//澶х悊鐗囩璇︽儏琛╥d
- private Integer deviceid;//璁惧id
- private Integer slot;//鏍呮牸鍙�
- private Integer glassid;//鐜荤拑id
- private Integer sequence;//灏忕墖鍦ㄦ牸鍐呯殑椤哄簭
- private String flowcardid;//娴佺▼鍗″彿
- private Integer glasstype;//鐜荤拑绫诲瀷
- private Double width;//瀹�
- private Double height;//楂�
- private Double thickness;//鍘氬害
- private Integer temperinglayoutid;//閽㈠寲鐗堝浘id
- private Integer temperingfeedsequence;//閽㈠寲鐗堝浘鐗囧簭
- private Integer state;//鐘舵��
- private Integer gap;//鐜荤拑闂撮殭
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/DownGlassInfo.java b/CacheGlassModule/src/main/java/com/mes/entity/DownGlassInfo.java
deleted file mode 100644
index bb1d86e..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/DownGlassInfo.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`down_glass_info`")
-public class DownGlassInfo {
- @TableId(type = IdType.AUTO)
- private Integer id;//涓嬬墖鐜荤拑淇℃伅琛╥d
- private String flowcardid;//娴佺▼鍗″彿
- private Integer sequence;//椤哄簭
- private Integer width;//瀹�
- private Integer height;//楂�
- private Integer thickness;//鍘氬害
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/DownStorageCage.java b/CacheGlassModule/src/main/java/com/mes/entity/DownStorageCage.java
deleted file mode 100644
index 382f336..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/DownStorageCage.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`down_storage_cage`")
-public class DownStorageCage {
- @TableId(type = IdType.AUTO)
- private Integer id;//涓嬬墖鍓嶇悊鐗囩琛╥d
- private Integer deviceid;//璁惧id
- private String slot;//鏍呮牸鍙�
- private String enablestate;//鍚敤鐘舵��
- private Integer remainwidth;//鍓╀綑
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/DownStorageCagedetails.java b/CacheGlassModule/src/main/java/com/mes/entity/DownStorageCagedetails.java
deleted file mode 100644
index 9e26f5f..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/DownStorageCagedetails.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`down_storage_cage_details`")
-public class DownStorageCagedetails {
- @TableId(type = IdType.AUTO)
- private Integer id;//涓嬬墖鍓嶇悊鐗囩鏄庣粏琛╥d
- private Integer deviceid;//璁惧id
- private Integer slot;//鏍呮牸鍙�
- private Integer glassid;//鐜荤拑id
- private Integer sequence;//灏忕墖鍦ㄦ牸鍐呯殑椤哄簭
- private String flow_card_id;//娴佺▼鍗″彿
- private Integer glass_type;//鐜荤拑绫诲瀷
- private Double width;//瀹�
- private Double height;//楂�
- private Double thickness;//鍘氬害
- private Integer temperinglayoutid;//閽㈠寲鐗堝浘id
- private Integer tempering_feed_sequence;//閽㈠寲鐗堝浘鐗囧簭
- private Integer state;//鐘舵��
- private Integer gap;//鐜荤拑闂撮殭
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/DownWorkstation.java b/CacheGlassModule/src/main/java/com/mes/entity/DownWorkstation.java
deleted file mode 100644
index 847d157..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/DownWorkstation.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`down_workstation`")
-public class DownWorkstation {
- @TableId(type = IdType.AUTO)
- private Integer id;//涓嬬墖宸ヤ綅琛╥d
- private Integer flowcard_id;//宸ヤ綅id
- private String glass_type;//娴佺▼鍗″彿
- private Integer width;//璁惧id
- private Integer height;//鍚敤鐘舵��
- private Integer thickness;//宸ヤ綔鐘舵��
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/OrderTest.java b/CacheGlassModule/src/main/java/com/mes/entity/OrderTest.java
deleted file mode 100644
index e8ea030..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/OrderTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`order`")
-public class OrderTest {
- @TableId(type = IdType.AUTO)
- private Integer id;
- private String orderId;
- private String recipeNo;
- private String largeglassNo;
- private String largeglassCompleted;
- private String smallglassNo;
- private String smallglassCompleted;
- private String smallglassProcessing;
- private String smallglassWorn;
- private String orderStatus;
- private String orderMaker;
- private String makeTime;
- private String updateTime;
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/UpPattenUsage.java b/CacheGlassModule/src/main/java/com/mes/entity/UpPattenUsage.java
deleted file mode 100644
index 461e04d..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/UpPattenUsage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`up_patten_usage`")
-public class UpPattenUsage {
- @TableId(type = IdType.AUTO)
- private Integer id;//鍘熺墖浣跨敤鎯呭喌琛╥d
- private Integer engineeringid;//宸ョ▼鍙�
- private Integer filmsid;//鑶滅郴id
- private Double width;//瀹�
- private Double height;//楂�
- private Double thickness;//鍘氬害
- private Integer layoutsequence;//鍘熺墖鐗堝浘鐗囧簭
- private Integer state;//鐘舵��
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/entity/UpWorkstation.java b/CacheGlassModule/src/main/java/com/mes/entity/UpWorkstation.java
deleted file mode 100644
index 1f8cb3b..0000000
--- a/CacheGlassModule/src/main/java/com/mes/entity/UpWorkstation.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.mes.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data //lombok 绠�鍐檍ava浠g爜 瀹炰綋绫荤殑get涓巗et
-@TableName("`up_workstation`")
-public class UpWorkstation {
- @TableId(type = IdType.AUTO)
- private Integer id;//涓婄墖宸ヤ綅琛╥d
- private Integer workstationid;//宸ヤ綅鍙�
- private Integer deviceid;//璁惧id
- private Integer enablestate;//鍚敤鐘舵��
- private Integer workstate;//宸ヤ綔鐘舵��
- private Double patternwidth;//鍘熺墖瀹�
- private Double patternheigth;//鍘熺墖楂�
- private Double patternthickness;//鍘熺墖鍘氬害
- private Integer filmsid;//鑶滅郴
- private Integer number;//鏁伴噺
-
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/mapper/OrderTestMapper.java b/CacheGlassModule/src/main/java/com/mes/mapper/OrderTestMapper.java
deleted file mode 100644
index d12d4ce..0000000
--- a/CacheGlassModule/src/main/java/com/mes/mapper/OrderTestMapper.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.mes.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.mes.entity.OrderTest;
-import org.apache.ibatis.annotations.*;
-
-@Mapper
-public interface OrderTestMapper extends BaseMapper<OrderTest> {
-
-// @Select("select * from `order`")
-// List<Order> findAll();
-//
-// @Insert("INSERT `order`(order_id)VALUES(#{order_id})")
-// Integer insert(Order order);
-//
-// @Delete("delete from `order` where id=#{id}")
-// Integer deleteById(@Param("id") Integer id);
-//
-// @Update("update `order` set order_id=#{order_id} where id=#{id}")
-// Integer update(@Param("id") Integer id,@Param("order_id") String order_id);
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/service/IOrderService.java b/CacheGlassModule/src/main/java/com/mes/service/IOrderService.java
deleted file mode 100644
index 9e44ceb..0000000
--- a/CacheGlassModule/src/main/java/com/mes/service/IOrderService.java
+++ /dev/null
@@ -1,2 +0,0 @@
-package com.mes.service;public interface IOrderService {
-}
diff --git a/CacheGlassModule/src/main/java/com/mes/service/ModuleB.java b/CacheGlassModule/src/main/java/com/mes/service/ModuleB.java
deleted file mode 100644
index fbe2d62..0000000
--- a/CacheGlassModule/src/main/java/com/mes/service/ModuleB.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.mes.service;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-import com.rabbitmq.client.DeliverCallback;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class ModuleB {
- private final static String QUEUE_NAME = "hangzhou2";
-
- public static void main(String[] argv) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost("10.153.19.150");
- //factory.setHost("localhost");
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- Map<String, Object> args = new HashMap<>();
- args.put("x-max-length-bytes",20000);
-// args.put("x-max-length",5000);
- channel.queueDeclare(QUEUE_NAME, false, false, false, args);
-
- // 鍒涘缓娑堣垂鑰�
- DeliverCallback deliverCallback = (consumerTag, delivery) -> {
- String receivedMessage = new String(delivery.getBody(), "UTF-8");
- System.out.println(" [x] Received '" + receivedMessage + "'");
- };
- // 寮�濮嬫秷璐规秷鎭�
- channel.basicConsume(QUEUE_NAME, true, deliverCallback, consumerTag -> {
- });
- }
- }
-}
-
diff --git a/CacheGlassModule/src/main/java/com/mes/service/MqMessage.java b/CacheGlassModule/src/main/java/com/mes/service/MqMessage.java
deleted file mode 100644
index 9d4a539..0000000
--- a/CacheGlassModule/src/main/java/com/mes/service/MqMessage.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.mes.service;
-
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-
-
-
-
-
-@Service
-public class MqMessage {
- @Autowired
- private RabbitMQUtils rabbitMQUtils;
-
- public boolean Add(String message, String queueName,String messageId){
- try {
- return rabbitMQUtils.sendMessageWithId(message, queueName,messageId);
- } catch (Exception e) {
- // TODO: handle exception
- return false;//寮傚父鏃堕敊璇�
- }
- }
- //鏍规嵁ID鏌ユ壘娑堟伅
- public String SelectId(String queueName,boolean isDelete,String messageId){
-
- try {
- String content=rabbitMQUtils.consumeMessageById(messageId,queueName,isDelete);
-
- return content;
- } catch (Exception e) {
- // TODO: handle exception
- return null;//寮傚父鏃堕敊璇�
- }
- }
- public boolean Delete(String queueName,String messageId){
- try
- {
- rabbitMQUtils.consumeMessageById(messageId,queueName,false);
- return true;
- }catch(Exception e){
- return false;
- }
-
- }
- //鏃犱慨鏀�
- public void Update(){
-
- }
-
-
-}
-
diff --git a/CacheGlassModule/src/main/java/com/mes/service/RabbitMQUtils.java b/CacheGlassModule/src/main/java/com/mes/service/RabbitMQUtils.java
deleted file mode 100644
index 7914d4c..0000000
--- a/CacheGlassModule/src/main/java/com/mes/service/RabbitMQUtils.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package com.mes.service;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.rabbitmq.client.*;
-
-import java.util.*;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-
-import org.springframework.stereotype.Repository;
-
-@Repository
-public class RabbitMQUtils {
- // ObjectMapper瀵硅薄锛岀敤浜庡簭鍒楀寲鍜屽弽搴忓垪鍖朖SON
- private static ObjectMapper objectMapper = new ObjectMapper();
- private static String host = "10.153.19.150"; // RabbitMQ 涓绘満鍚�
- private static Map<String, Object> args = new HashMap<>(); // 闃熷垪鍙傛暟
-
- static {
- // 璁剧疆闃熷垪鍙傛暟
- args.put("x-max-length-bytes", 1024 * 1024);
- }
-
- // private static Map<String, Object> args = new HashMap<>();
-// args.put("x-max-length-bytes",1024 * 1024);
- // 鍙戦�佹秷鎭埌 RabbitMQ 闃熷垪涓�
- public String sendMessage(String message, String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鍙戦�佹秷鎭�
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 鍙戝竷娑堟伅鍒伴槦鍒�
- channel.basicPublish("", queueName, null, message.getBytes("UTF-8"));
- System.out.println(" [x] Sent '" + message + "' to queue '" + queueName + "'");
- }
-
- return message;
- }
-
-
- // 浠� RabbitMQ 闃熷垪涓帴鏀舵秷鎭�
- public String receiveMessage(String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 鍒涘缓闃诲闃熷垪
- BlockingQueue<String> messageQueue = new ArrayBlockingQueue<>(1);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鎺ユ敹娑堟伅
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 璁剧疆娑堟伅鎺ユ敹鍥炶皟
- DeliverCallback deliverCallback = (consumerTag, delivery) -> {
- String receivedMessage = new String(delivery.getBody(), "UTF-8");
- // System.out.println(" [x] Received '" + receivedMessage + "'");
-
- // 灏嗘帴鏀跺埌鐨勬秷鎭斁鍏ラ樆濉為槦鍒�
- try {
- messageQueue.put(receivedMessage);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- };
-
- // 娑堣垂闃熷垪涓殑娑堟伅
- channel.basicConsume(queueName, true, deliverCallback, consumerTag -> {
-
- });
-
- // 闃诲骞剁瓑寰呰幏鍙栨秷鎭�
- return messageQueue.take();
- }
- }
-
-
- //鑾峰彇娑堟伅 骞舵秷璐癸紵
- public List<String> readMessage(String queueName,boolean is) throws Exception {
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
- List<String> messages = new ArrayList<>();
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- boolean autoAck = false;
-
- GetResponse response = channel.basicGet(queueName, autoAck);
- if (response != null) {
- String message = new String(response.getBody(), "UTF-8");
- messages.add(message);
- // 鎵嬪姩纭娑堟伅澶勭悊瀹屾垚
- if(is){
- long deliveryTag = response.getEnvelope().getDeliveryTag();
- channel.basicAck(deliveryTag, false);
- }
-
- }
- }
-
- return messages;
- }
-
-
-
- private static Set<String> sentMessageIds = new HashSet<>();
-//鏍规嵁id鍙戦�佹秷鎭�
- public boolean sendMessageWithId(String queueName, String message, String messageId) throws Exception {
- if (sentMessageIds.contains(messageId)) {
- System.err.println("Message with ID " + messageId + " has already been sent.");
- return false; // 娑堟伅閲嶅锛屽彂閫佸け璐�
- }
-
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- try (Connection connection = factory.newConnection(); Channel channel = connection.createChannel()) {
- channel.queueDeclare(queueName, false, false, false, args);
-
- AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder()
- .messageId(messageId)
- .build();
-
- channel.basicPublish("", queueName, properties, message.getBytes("UTF-8"));
- System.out.println("Sent message with ID: " + messageId);
-
- sentMessageIds.add(messageId); // 灏� messageId 娣诲姞鍒板凡鍙戦�侀泦鍚堜腑
-
- return true; // 娑堟伅鎴愬姛鍙戦��
- } catch (Exception e) {
- System.err.println("Failed to send message: " + e.getMessage());
- return false; // 娑堟伅鍙戦�佸け璐�
- }
- }
- //鏍规嵁id鏌ユ壘娑堟伅 鏄惁鍒犻櫎
- public String consumeMessageById(String messageId,String queueName,boolean isDelete) throws Exception {
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- try (Connection connection = factory.newConnection(); Channel channel = connection.createChannel()) {
- channel.queueDeclare(queueName, false, false, false, args);
-
- GetResponse response;
- while ((response = channel.basicGet(queueName, false)) != null) {
- String receivedMessage = new String(response.getBody(), "UTF-8");
- if (response.getProps().getMessageId().equals(messageId)) {
- if(isDelete){
- long deliveryTag = response.getEnvelope().getDeliveryTag();
- channel.basicAck(deliveryTag, false);
- }
- System.out.println("Selected message: "+messageId+ receivedMessage);
- return receivedMessage; // 杩斿洖閫夊畾鐨勬秷鎭唴瀹�
- } else {
- // 瀵逛簬涓嶇鍚堟潯浠剁殑娑堟伅锛岃繘琛� Nack 鎿嶄綔
-// long deliveryTag = response.getEnvelope().getDeliveryTag();
-// channel.basicNack(deliveryTag, false, true);
- return "Specified message not found in the queue.";
- }
- }
-
- return "Specified message not found in the queue.";
- }
- }
-
-// //娑堣垂鎸囧畾娑堟伅
-// public String consumeSelectedMessage(int messageToConsume, String queueName) throws Exception {
-// ConnectionFactory factory = new ConnectionFactory();
-// factory.setHost(host);
-
-// try (Connection connection = factory.newConnection(); Channel channel = connection.createChannel()) {
-// channel.queueDeclare(queueName, false, false, false, args);
-
-// for (int i = 0; i < messageToConsume; i++) {
-// GetResponse response = channel.basicGet(queueName, false);
-// if (response == null) {
-// return "Queue does not have enough messages.";
-// }
-// // long deliveryTag = response.getEnvelope().getDeliveryTag();
-// // channel.basicAck(deliveryTag, false);
-// }
-
-// GetResponse selectedResponse = channel.basicGet(queueName, false);
-// if (selectedResponse != null) {
-// byte[] body = selectedResponse.getBody();
-// String selectedMessage = new String(body, "UTF-8");
-// long deliveryTag = selectedResponse.getEnvelope().getDeliveryTag();
-// channel.basicAck(deliveryTag, false);
-// return selectedMessage;
-// } else {
-// return "Specified message not found in the queue.";
-// }
-// }
-// }
-
- // 鍙戦�� JSON 娑堟伅鍒伴槦鍒�
- public boolean sendJsonMessage(Object message, String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鍙戦�� JSON 娑堟伅
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 灏嗗璞¤浆鎹负 JSON 瀛楃涓�
- String jsonMessage = objectMapper.writeValueAsString(message);
-
- // 鍙戝竷 JSON 娑堟伅鍒伴槦鍒�
- channel.basicPublish("", queueName, null, jsonMessage.getBytes());
- System.out.println(" [x] Sent JSON message: '" + jsonMessage + "' to queue '" + queueName + "'");
-
- return true; // 鍙戦�佹秷鎭垚鍔�
- } catch (Exception e) {
- e.printStackTrace();
- return false; // 鍙戦�佹秷鎭け璐�
- }
- }
-
- // 鎺ユ敹 JSON 娑堟伅骞惰浆鎹负瀵硅薄
- public <T> T receiveJsonMessage(Class<T> valueType, String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鎺ユ敹 JSON 娑堟伅
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 鑾峰彇闃熷垪涓殑娑堟伅
- GetResponse response = channel.basicGet(queueName, true);
- if (response != null) {
- byte[] body = response.getBody();
- String jsonMessage = new String(body, "UTF-8");
- System.out.println(" [x] Received JSON message: '" + jsonMessage + "' from queue '" + queueName + "'");
-
- // 灏� JSON 娑堟伅杞崲涓哄璞�
- return objectMapper.readValue(jsonMessage, valueType);
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- return null; // 鎺ユ敹娑堟伅澶辫触
- }
- }
-
-}
-
-// RabbitMQUtils.sendMessage("Hello, world!", "module_queue");
-//RabbitMQUtils.receiveMessage("module_queue");
-//RabbitMQUtils.sendJsonMessage(someObject, "another_queue");
-//RabbitMQUtils.receiveJsonMessage(SomeClass.class, "another_queue");
-// 闇�瑕佸皢 someObject 鏇挎崲涓轰綘瑕佸彂閫佺殑瀵硅薄锛屽苟灏� SomeClass 鏇挎崲涓轰綘瑕佹帴鏀跺苟杞崲鐨勫璞$被鍨嬨��
\ No newline at end of file
diff --git a/CacheGlassModule/src/main/java/com/mes/service/RabbitMQUtils33.java b/CacheGlassModule/src/main/java/com/mes/service/RabbitMQUtils33.java
deleted file mode 100644
index 5201c4a..0000000
--- a/CacheGlassModule/src/main/java/com/mes/service/RabbitMQUtils33.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.mes.service;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.rabbitmq.client.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-
-public class RabbitMQUtils33 {
- // ObjectMapper瀵硅薄锛岀敤浜庡簭鍒楀寲鍜屽弽搴忓垪鍖朖SON
- private static ObjectMapper objectMapper = new ObjectMapper();
- private static String host = "10.153.19.150"; // RabbitMQ 涓绘満鍚�
- private static Map<String, Object> args = new HashMap<>(); // 闃熷垪鍙傛暟
-
- static {
- // 璁剧疆闃熷垪鍙傛暟
- args.put("x-max-length-bytes", 1024 * 1024);
- }
-
- // private static Map<String, Object> args = new HashMap<>();
-// args.put("x-max-length-bytes",1024 * 1024);
- // 鍙戦�佹秷鎭埌 RabbitMQ 闃熷垪涓�
- public boolean sendMessage(String message, String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鍙戦�佹秷鎭�
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 鍙戝竷娑堟伅鍒伴槦鍒�
- channel.basicPublish("", queueName, null, message.getBytes("UTF-8"));
- System.out.println(" [x] Sent '" + message + "' to queue '" + queueName + "'");
- return true;
- } catch (Exception e) {
- // TODO: handle exception
- return false;
- }
-
-
- }
-
-
- // 浠� RabbitMQ 闃熷垪涓帴鏀舵秷鎭�
- public String receiveMessage(String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 鍒涘缓闃诲闃熷垪
- BlockingQueue<String> messageQueue = new ArrayBlockingQueue<>(1);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鎺ユ敹娑堟伅
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 璁剧疆娑堟伅鎺ユ敹鍥炶皟
- DeliverCallback deliverCallback = (consumerTag, delivery) -> {
- String receivedMessage = new String(delivery.getBody(), "UTF-8");
- // System.out.println(" [x] Received '" + receivedMessage + "'");
-
- // 灏嗘帴鏀跺埌鐨勬秷鎭斁鍏ラ樆濉為槦鍒�
- try {
- messageQueue.put(receivedMessage);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- };
-
- // 娑堣垂闃熷垪涓殑娑堟伅
- channel.basicConsume(queueName, true, deliverCallback, consumerTag -> {
-
- });
-
- // 闃诲骞剁瓑寰呰幏鍙栨秷鎭�
- return messageQueue.take();
- }
- }
-
-
-
- public List<String> readMessage(String queueName,boolean isDelete) throws Exception {
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
- List<String> messages = new ArrayList<>();
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- boolean autoAck = false;
-
- GetResponse response = channel.basicGet(queueName, autoAck);
- if (response != null) {
- String message = new String(response.getBody(), "UTF-8");
- messages.add(message);
-
-
- // 鎵嬪姩纭娑堟伅澶勭悊瀹屾垚
- if (isDelete) {
- long deliveryTag = response.getEnvelope().getDeliveryTag();
- channel.basicAck(deliveryTag, false);
- }
- }
- }
-
- return messages;
- }
-
- // 鍙戦�� JSON 娑堟伅鍒伴槦鍒�
- public static boolean sendJsonMessage(Object message, String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鍙戦�� JSON 娑堟伅
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 灏嗗璞¤浆鎹负 JSON 瀛楃涓�
- String jsonMessage = objectMapper.writeValueAsString(message);
-
- // 鍙戝竷 JSON 娑堟伅鍒伴槦鍒�
- channel.basicPublish("", queueName, null, jsonMessage.getBytes());
- System.out.println(" [x] Sent JSON message: '" + jsonMessage + "' to queue '" + queueName + "'");
-
- return true; // 鍙戦�佹秷鎭垚鍔�
- } catch (Exception e) {
- e.printStackTrace();
- return false; // 鍙戦�佹秷鎭け璐�
- }
- }
-
- // 鎺ユ敹 JSON 娑堟伅骞惰浆鎹负瀵硅薄
- public static <T> T receiveJsonMessage(Class<T> valueType, String queueName) throws Exception {
- // 鍒涘缓杩炴帴宸ュ巶骞惰缃富鏈哄悕
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
-
- // 浣跨敤 try-with-resources 璇彞鍒涘缓杩炴帴鍜岄�氶亾锛屽苟鎺ユ敹 JSON 娑堟伅
- try (Connection connection = factory.newConnection();
- Channel channel = connection.createChannel()) {
- // 澹版槑闃熷垪
- channel.queueDeclare(queueName, false, false, false, args);
-
- // 鑾峰彇闃熷垪涓殑娑堟伅
- GetResponse response = channel.basicGet(queueName, true);
- if (response != null) {
- byte[] body = response.getBody();
- String jsonMessage = new String(body, "UTF-8");
- System.out.println(" [x] Received JSON message: '" + jsonMessage + "' from queue '" + queueName + "'");
-
- // 灏� JSON 娑堟伅杞崲涓哄璞�
- return objectMapper.readValue(jsonMessage, valueType);
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- return null; // 鎺ユ敹娑堟伅澶辫触
- }
- }
-
-}
-
-// RabbitMQUtils.sendMessage("Hello, world!", "module_queue");
-//RabbitMQUtils.receiveMessage("module_queue");
-//RabbitMQUtils.sendJsonMessage(someObject, "another_queue");
-//RabbitMQUtils.receiveJsonMessage(SomeClass.class, "another_queue");
-// 闇�瑕佸皢 someObject 鏇挎崲涓轰綘瑕佸彂閫佺殑瀵硅薄锛屽苟灏� SomeClass 鏇挎崲涓轰綘瑕佹帴鏀跺苟杞崲鐨勫璞$被鍨嬨��
\ No newline at end of file
diff --git a/CacheGlassModule/src/main/java/com/mes/service/impl/OrderServiceImpl.java b/CacheGlassModule/src/main/java/com/mes/service/impl/OrderServiceImpl.java
deleted file mode 100644
index 5274aa6..0000000
--- a/CacheGlassModule/src/main/java/com/mes/service/impl/OrderServiceImpl.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.mes.service.impl;
-
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.mes.entity.OrderTest;
-import com.mes.mapper.OrderTestMapper;
-import com.mes.service.IOrderService;
-import org.springframework.stereotype.Service;
-
-@Service
-@DS("erp_sd")
-public class OrderServiceImpl extends ServiceImpl<OrderTestMapper, OrderTest> implements IOrderService {
-}
--
Gitblit v1.8.0