Browse Source

fix:"优化商品显示屏蔽功能"

soobin 3 months ago
parent
commit
32d3d88bcc

+ 9 - 5
src/main/java/com/szwl/config/MqttConfig.java

@@ -83,11 +83,15 @@ public class MqttConfig {
                 // 将消息转发到处理逻辑
                 handleIncomingMessage(topic, payload);
 
-                MqttMsg mqttMsg = new MqttMsg();
-                mqttMsg.setCreateDate(new Date());
-                mqttMsg.setTopic(topic);
-                mqttMsg.setMessage(payload);
-                mqttMsgService.save(mqttMsg);
+                // 如果不是上下线消息
+                if (!topic.contains("connected")) {
+                    MqttMsg mqttMsg = new MqttMsg();
+                    mqttMsg.setCreateDate(new Date());
+                    mqttMsg.setTopic(topic);
+                    mqttMsg.setMessage(payload);
+                    mqttMsgService.save(mqttMsg);
+                }
+
             }
 
             @Override

+ 4 - 2
src/main/java/com/szwl/constant/OperationType.java

@@ -11,8 +11,10 @@ public enum OperationType implements IEnum<String> {
     UPDATE_TAX_RATE("updateTaxRate","修改税率"),
     LOG("log","上传日志"),
     UPLOAD_ORDER("uploadOrder","上传线下订单"),
-    LOGIN("LOGIN","登录"),
-    OFFLINE("OFFLINE","脱机"),
+    BAN_PAPER_MONEY("banPaperMoney","纸币器禁能"),
+    UPDATE_GOODS_NAME("updateGoodsName","修改商品名称"),
+    ELIMINATE("eliminate","消除屏幕报警"),
+    VOLUME("volume","修改音量"),
     PAY_ORDER("PAY_ORDER", "支付订单");
 
     private String code;

+ 13 - 42
src/main/java/com/szwl/controller/TEquipmentController.java

@@ -1028,48 +1028,6 @@ public class TEquipmentController {
         return R.ok(null, "修改成功");
     }
 
-    @ApiOperation(value = "查看是否远程来关机成功")
-    @PostMapping("/checkStatus")
-    public ResponseEntity<?> checkStatus(@RequestBody StatisticsParam param) {
-        String equipmentId = param.getEquipmentId();
-        Long id = Long.valueOf(equipmentId);
-        TEquipment equipment = tEquipmentService.getById(id);
-        String network = equipment.getNetwork();
-        Long nowTime2 = getNetworkTime();
-        if (network != null) {
-            Long old = Long.valueOf(network);
-            if (nowTime2 == null) {
-                nowTime2 = getNetworkTime();
-            }
-            if (nowTime2 == null) {
-                nowTime2 = System.currentTimeMillis();
-            }
-            if (nowTime2 - old < 15000) {
-                return ResponseEntity
-                        .status(HttpStatus.OK)
-                        .body(new ResultMessage()
-                                .setCode(true)
-                                .setData("SUCCESS")
-                                .setMessage("网络良好"));
-            } else {
-                return ResponseEntity
-                        .status(HttpStatus.OK)
-                        .body(new ResultMessage()
-                                .setCode(true)
-                                .setData("fail")
-                                .setMessage("网络不好,操作失败"));
-            }
-        } else {
-            return ResponseEntity
-                    .status(HttpStatus.OK)
-                    .body(new ResultMessage()
-                            .setCode(true)
-                            .setData("SUCCESS")
-                            .setMessage("该机器尚未更新系统"));
-        }
-
-    }
-
     public static Long getNetworkTime() {
         Long time = null;
         URL url;//取得资源对象http://time.tianqi.com/
@@ -1922,6 +1880,19 @@ public class TEquipmentController {
         return R.ok();
     }
 
+    @ApiOperation("禁用纸币器")
+    @PostMapping("/banPaperMoney")
+    public ResponseModel<?> banPaperMoney(@RequestBody TEquipment equipment) {
+        Long equipmentId = equipment.getId();
+        TEquipment equipment1 = tEquipmentService.getById(equipmentId);
+        if (equipment1 != null) {
+            tEquipmentService.sentMessage(equipment1.getClientId(), PushUtils.buildJson("banPaperMoney", "1").toString());
+            return R.ok();
+        } else {
+            return R.fail(ResponseCodesEnum.A0001, "设备不存在");
+        }
+    }
+
     /**
      * 上传日志
      *

+ 1 - 1
src/main/java/com/szwl/controller/TProductController.java

@@ -150,7 +150,7 @@ public class TProductController {
             }
         }
         tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("updateProductsShow", JSON.toJSONString(list)).toString());
-        tProductService.updateBatchById(products);
+//        tProductService.updateBatchById(products);
         return R.ok(null,"修改成功");
     }