From 01c13248f347b4bc7091fb70ba92d03676abaa8b Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期日, 29 九月 2024 11:30:32 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmvisit

---
 server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/TransparentChannelSingleRequest.java |   15 +++++
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java                                   |    2 
 admin/src/views/business/deviceLed.vue                                                                                       |    6 +-
 admin/src/components/business/OperaDeviceLedWindow.vue                                                                       |   74 ++++++++++++++++++++++++
 server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/HkSyncCloudController.java                                  |   12 ++++
 server/visits/dmvisit_admin/pom.xml                                                                                          |    1 
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java                          |   50 ++++++++++++++++
 admin/src/api/business/device.js                                                                                             |    4 +
 8 files changed, 160 insertions(+), 4 deletions(-)

diff --git a/admin/src/api/business/device.js b/admin/src/api/business/device.js
index 12662a9..5dbdb73 100644
--- a/admin/src/api/business/device.js
+++ b/admin/src/api/business/device.js
@@ -29,3 +29,7 @@
 export function updateEntranceById (data) {
   return request.post('/visitsAdmin/cloudService/business/device/updateEntranceById', data)
 }
+// 鍙戠敓led灞忓唴瀹�
+export function setLedContent (data) {
+  return request.post('/visitsAdmin/cloudService/business/device/setLedContent', data)
+}
diff --git a/admin/src/components/business/OperaDeviceLedWindow.vue b/admin/src/components/business/OperaDeviceLedWindow.vue
new file mode 100644
index 0000000..f22ae44
--- /dev/null
+++ b/admin/src/components/business/OperaDeviceLedWindow.vue
@@ -0,0 +1,74 @@
+<template>
+    <GlobalWindow
+        :title="title"
+        :visible.sync="visible"
+        :confirm-working="isWorking"
+        @confirm="confirm"
+    >
+        <el-form :model="form" ref="form" :rules="rules">
+            <el-form-item label="鏄剧ず鍐呭" prop="title">
+                <el-input v-model="form.title" placeholder="璇疯緭鍏ED灞忔樉绀哄唴瀹�" v-trim/>
+            </el-form-item>
+        </el-form>
+    </GlobalWindow>
+</template>
+
+<script>
+import BaseOpera from '@/components/base/BaseOpera'
+import GlobalWindow from '@/components/common/GlobalWindow'
+export default {
+  name: 'OperaDeviceWindow',
+  extends: BaseOpera,
+  components: { GlobalWindow },
+  data () {
+    return {
+      // 琛ㄥ崟鏁版嵁
+      form: {
+        id: null,
+        title: ''
+      },
+      // 楠岃瘉瑙勫垯
+      rules: {
+        title: [
+          { required: true, message: '璇疯緭鍏ED灞忔樉绀哄唴瀹�' }
+        ]
+      }
+    }
+  },
+  created () {
+    this.config({
+      api: '/business/device',
+      'field.id': 'id'
+    })
+  },
+  methods: {
+    confirm () {
+      this.$refs.form.validate((valid) => {
+        if (!valid) {
+          return
+        }
+        this.confirmDo()
+      })
+    },
+    confirmDo () {
+      // 璋冪敤鏂板缓鎺ュ彛
+      this.isWorking = true
+      this.api.setLedContent({
+        id: this.form.id,
+        content: this.form.title
+      })
+        .then(() => {
+          this.visible = false
+          this.$tip.apiSuccess('鍙戦�佹垚鍔�')
+          this.$emit('success')
+        })
+        .catch(e => {
+          // this.$tip.apiFailed(e)
+        })
+        .finally(() => {
+          this.isWorking = false
+        })
+    }
+  }
+}
+</script>
diff --git a/admin/src/views/business/deviceLed.vue b/admin/src/views/business/deviceLed.vue
index 3ab4c39..a79b284 100644
--- a/admin/src/views/business/deviceLed.vue
+++ b/admin/src/views/business/deviceLed.vue
@@ -41,7 +41,7 @@
             </pagination>
         </template>
         <!-- 鏂板缓/淇敼 -->
-<!--        <OperaDeviceWindow ref="operaDeviceWindow" @success="handlePageChange"/>-->
+        <OperaDeviceLedWindow ref="OperaDeviceLedWindow" @success="handlePageChange"/>
     </TableLayout>
 </template>
 
@@ -49,12 +49,12 @@
 import BaseTable from '@/components/base/BaseTable'
 import TableLayout from '@/layouts/TableLayout'
 import Pagination from '@/components/common/Pagination'
-import OperaDeviceWindow from '@/components/business/OperaDeviceWindow'
+import OperaDeviceLedWindow from '@/components/business/OperaDeviceLedWindow'
 import { syncDevices, updateEntranceById } from '@/api/business/device'
 export default {
   name: 'Device',
   extends: BaseTable,
-  components: { TableLayout, Pagination, OperaDeviceWindow },
+  components: { TableLayout, Pagination, OperaDeviceLedWindow },
   data () {
     return {
       // 鎼滅储
diff --git a/server/visits/dmvisit_admin/pom.xml b/server/visits/dmvisit_admin/pom.xml
index 21a00c1..56ff907 100644
--- a/server/visits/dmvisit_admin/pom.xml
+++ b/server/visits/dmvisit_admin/pom.xml
@@ -31,7 +31,6 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
-
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
diff --git a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/HkSyncCloudController.java b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/HkSyncCloudController.java
index a9d2dde..769dbb1 100644
--- a/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/HkSyncCloudController.java
+++ b/server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/HkSyncCloudController.java
@@ -19,6 +19,7 @@
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.DESUtil;
 import com.doumee.dao.business.model.Device;
+import com.doumee.service.business.DeviceService;
 import com.doumee.service.business.impl.hksync.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -31,7 +32,9 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -58,6 +61,8 @@
 
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
+    @Autowired
+    private DeviceService deviceService;
 
     @Autowired
     private RedisTemplate<String,Object> redisTemplate;
@@ -210,4 +215,11 @@
         return ApiResponse.success( url);
     }
 
+    @ApiOperation("銆愭捣搴枫�戣缃甃ED灞忔枃妗�")
+    @PostMapping("/setLedContent")
+    public ApiResponse<List<Map<String,Object>>> setLedContent(@RequestBody TransparentChannelSingleRequest body  , HttpServletResponse response) {
+        deviceService.setLedContent(body);
+        return ApiResponse.success(null);
+    }
+
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/TransparentChannelSingleRequest.java b/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/TransparentChannelSingleRequest.java
new file mode 100644
index 0000000..3d48f21
--- /dev/null
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/model/param/request/TransparentChannelSingleRequest.java
@@ -0,0 +1,15 @@
+package com.doumee.core.haikang.model.param.request;
+
+import lombok.Data;
+
+@Data
+public class TransparentChannelSingleRequest {
+ /**
+  * 鍙戦�佹秷鎭粰LED鎺ュ彛锛宧ead澶寸殑鍙傛暟锛宎bility鍊间紶鍙備负cld锛�
+  * treatyType鍊间紶鍙備负haixuan_led_net锛�
+  * operationType涓哄浐瀹氬��219锛�
+  * regionNo涓�1浠h〃绗竴琛岋紝渚濇绫绘帹锛屼笉鍚屽瀷鍙风殑LED璁惧鏀寔鐨勮鏁板彲鑳戒笉涓�鏍凤紱
+  */
+ private String content	; //String	true	鍐呭
+ private Integer deviceId; //	String	false	璁惧涓婚敭
+}
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
index 272e3e1..f752fd9 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/DeviceService.java
@@ -2,6 +2,7 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.doumee.core.haikang.model.param.request.AcsDeviceListRequest;
+import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.dao.business.model.Device;
@@ -104,4 +105,5 @@
      */
     long count(Device device);
 
+    void setLedContent(TransparentChannelSingleRequest body);
 }
diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
index 0992819..d213cd9 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java
@@ -1,6 +1,12 @@
 package com.doumee.service.business.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
+import com.doumee.core.haikang.model.HKConstants;
+import com.doumee.core.haikang.model.param.BaseResponse;
+import com.doumee.core.haikang.model.param.request.*;
+import com.doumee.core.haikang.service.HKService;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Constants;
@@ -12,11 +18,15 @@
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 璁惧淇℃伅琛⊿ervice瀹炵幇
@@ -212,4 +222,44 @@
         return deviceMapper.selectCount(wrapper);
     }
 
+    @Override
+    public void setLedContent(TransparentChannelSingleRequest model) {
+        Device device = findById(model.getDeviceId());
+        if(device == null
+                || Constants.equalsInteger(device.getIsdeleted(),Constants.ONE)
+                || !Constants.equalsInteger(device.getType(),Constants.TWO)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        TransparentChannelBodyRequest body = new TransparentChannelBodyRequest();
+        TransparentChannelHeadRequest head = new TransparentChannelHeadRequest();
+        TransparentChannelBodyParamRequest request = new TransparentChannelBodyParamRequest();
+        TransparentChannelBodyRegionRequest regions = new TransparentChannelBodyRegionRequest();
+        head.setAbility("cld");//鍥哄畾鍊�
+        head.setTreatyType("haixuan_led_net");//鍥哄畾鍊�
+        head.setDeviceIndexCode(device.getHkId());
+        body.setMethod("ControlLedGereral");//鍥哄畾鍊�
+        request.setIndexCode(device.getHkId());
+        request.setOperationType(219);//鍥哄畾鍊�
+        regions.setActionType(32);
+        regions.setContent(model.getContent());
+        regions.setRegionNo(1);
+        regions.setRegionType(14);
+        regions.setFontColor(1);
+        regions.setCircleTimes(1);//寰幆娆℃暟
+        regions.setFontSize(32);//
+        regions.setStayTime(1);//鍗曚綅锛燂紵
+        regions.setRegionLeftTopXPos(0);
+        regions.setRegionLeftTopYPos(0);
+        regions.setRegionRightBottomXPos(255);
+        regions.setRegionRightBottomYPos(31);
+        request.setRegions(new ArrayList<>());
+        request.getRegions().add(regions);
+        regions.setSpeed(13);
+        body.setParams(request);
+        BaseResponse response =  HKService.transparentchannel(head,body);
+        if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝灞忓箷鍐呭璁剧疆澶辫触"+(response!=null?response.getMsg():""));
+        }
+    }
+
 }

--
Gitblit v1.9.3