Browse Source

commit image move and scale

lihao16 1 year ago
parent
commit
ea94b03762

+ 27 - 9
inspur-admin/src/main/java/com/inspur/web/controller/partywork/RemoteControlController.java

@@ -2,16 +2,13 @@ package com.inspur.web.controller.partywork;
 
 import com.inspur.common.core.controller.BaseController;
 import com.inspur.common.core.domain.AjaxResult;
-import com.inspur.common.core.page.TableDataInfo;
-import com.inspur.face.domain.PartyFaceRecognition;
+import com.inspur.domain.partywork.ImageMoveReqVo;
 import com.inspur.netty.message.push.UrlControl;
 import com.inspur.service.partywork.IRemoteControlService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.List;
-
 /**
  * 远程控制 controller
  * @author lihao16
@@ -56,14 +53,35 @@ public class RemoteControlController extends BaseController {
     }
 
     @GetMapping("/takePhotoSign")
-    public AjaxResult takePhotoSign(@RequestParam("meetingId") Long meetingId, @RequestParam("deviceId")Long deviceId)
-    {
-        return remoteControlService.takePhotoSign(meetingId,deviceId);
+    public AjaxResult takePhotoSign(@RequestParam("meetingId") Long meetingId, @RequestParam("deviceId") Long deviceId) {
+        return remoteControlService.takePhotoSign(meetingId, deviceId);
     }
 
     @PostMapping("/photo/upload")
-    public AjaxResult photoUpload(@RequestParam Long meetingId,@RequestBody MultipartFile file)  {
-        return remoteControlService.photoUpload(meetingId,file);
+    public AjaxResult photoUpload(@RequestParam Long meetingId, @RequestBody MultipartFile file) {
+        return remoteControlService.photoUpload(meetingId, file);
+    }
+
+    /**
+     * 图片移动控制
+     *
+     * @param param
+     * @return
+     */
+    @PostMapping("/image/move")
+    public AjaxResult imageMove(@RequestBody ImageMoveReqVo param) {
+        return remoteControlService.imageMove(param);
+    }
+
+    /**
+     * 图片缩放控制
+     *
+     * @param param
+     * @return
+     */
+    @PostMapping("/image/scale")
+    public AjaxResult imageScale(@RequestBody ImageMoveReqVo param) {
+        return remoteControlService.imageScale(param);
     }
 
 }

+ 43 - 0
inspur-party/src/main/java/com/inspur/domain/partywork/ImageMoveReqVo.java

@@ -0,0 +1,43 @@
+package com.inspur.domain.partywork;
+
+import lombok.Data;
+
+/**
+ * 远程控制-图片移动请求参数
+ *
+ * @author lihao16
+ */
+@Data
+public class ImageMoveReqVo {
+
+    /**
+     * 移动方向 1-上 2-下
+     */
+    private Integer direction;
+
+    /**
+     * 会议ID
+     */
+    private Long meetingId;
+
+    /**
+     * 移动距离
+     */
+    private Integer distance;
+
+    /**
+     * 设备ID
+     */
+    private Long deviceId;
+
+    /**
+     * 图片索引
+     */
+    private Integer imageIndex;
+
+    /**
+     * 缩放比例
+     */
+    private Integer scale;
+
+}

+ 15 - 0
inspur-party/src/main/java/com/inspur/service/partywork/IRemoteControlService.java

@@ -2,6 +2,7 @@ package com.inspur.service.partywork;
 
 import com.inspur.common.core.domain.AjaxResult;
 import com.inspur.common.core.page.TableDataInfo;
+import com.inspur.domain.partywork.ImageMoveReqVo;
 import com.inspur.netty.message.push.UrlControl;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -75,4 +76,18 @@ public interface IRemoteControlService {
      * @return
      */
     public AjaxResult takePhotoSign(Long meetingId, Long deviceId);
+
+    /**
+     * 图片移动
+     * @param param
+     * @return
+     */
+    public AjaxResult imageMove(ImageMoveReqVo param);
+
+    /**
+     * 图片缩放
+     * @param param
+     * @return
+     */
+    public AjaxResult imageScale(ImageMoveReqVo param);
 }

+ 68 - 11
inspur-party/src/main/java/com/inspur/service/partywork/impl/RemoteControlServiceImpl.java

@@ -2,15 +2,13 @@ package com.inspur.service.partywork.impl;
 
 import com.alibaba.fastjson2.JSON;
 import com.inspur.common.config.InspurConfig;
-import com.inspur.common.constant.Constants;
 import com.inspur.common.core.domain.AjaxResult;
 import com.inspur.common.utils.DateUtils;
-import com.inspur.common.utils.SecurityUtils;
 import com.inspur.common.utils.StringUtils;
 import com.inspur.common.utils.file.FileUploadUtils;
 import com.inspur.common.utils.file.FileUtils;
 import com.inspur.domain.PcDevice;
-import com.inspur.domain.partywork.PartyMeetingAudio;
+import com.inspur.domain.partywork.ImageMoveReqVo;
 import com.inspur.domain.partywork.PartyMeetingFollow;
 import com.inspur.domain.partywork.PartyMeetingImage;
 import com.inspur.domain.partywork.PartyMeetingInfo;
@@ -19,10 +17,7 @@ import com.inspur.mapper.PartyMeetingFollowMapper;
 import com.inspur.mapper.PartyMeetingImageMapper;
 import com.inspur.mapper.PartyMeetingInfoMapper;
 import com.inspur.mapper.PcDeviceMapper;
-import com.inspur.netty.message.push.FileControl;
-import com.inspur.netty.message.push.PushMessage;
-import com.inspur.netty.message.push.PushMessageType;
-import com.inspur.netty.message.push.UrlControl;
+import com.inspur.netty.message.push.*;
 import com.inspur.netty.server.PushMessageUtil;
 import com.inspur.service.partywork.IRemoteControlService;
 import org.slf4j.Logger;
@@ -30,7 +25,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.HashMap;
@@ -81,12 +75,75 @@ public class RemoteControlServiceImpl implements IRemoteControlService {
         String controlParam = JSON.toJSONString(pushMessage);
         // 推送消息
         PcDevice pcDevice = pcDeviceMapper.selectPcDeviceById(deviceId.longValue());
-        PushMessageUtil.remoteMeetingControl(pcDevice.getWiredMac(),pcDevice.getWirelessMac(),controlUrl,controlParam);
-        log.info("远程控制开始,参数:{}",controlParam);
+        PushMessageUtil.remoteMeetingControl(pcDevice.getWiredMac(), pcDevice.getWirelessMac(), controlUrl, controlParam);
+        log.info("远程控制开始,参数:{}", controlParam);
         String msg = "";
         if (0 == index) {
             msg = "远程控制开始";
-        }else {
+        } else {
+            msg = "切换成功";
+        }
+        return AjaxResult.success(msg);
+    }
+
+    @Override
+    public AjaxResult imageMove(ImageMoveReqVo reqParam) {
+        Integer index = reqParam.getImageIndex() - 1;
+        List<PartyMeetingFollow> imageList = partyMeetingFollowMapper.selectPartyMeetingFollowByMId(reqParam.getMeetingId(), 2);
+        String imageUrl = imageList.get(index).getFileUrl();
+
+        ImageMoveControl nettyMessage = new ImageMoveControl();
+        nettyMessage.setIndex(index);
+        nettyMessage.setMeetingId(reqParam.getMeetingId());
+        nettyMessage.setDirection(reqParam.getDirection());
+        nettyMessage.setImageUrl(imageUrl);
+        nettyMessage.setDistance(reqParam.getDistance());
+        String reqParamJson = JSON.toJSONString(nettyMessage);
+
+        PushMessage pushMessage = new PushMessage();
+        pushMessage.setMessageType(PushMessageType.CONTROL_IMAGE_MOVE.getValue());
+        pushMessage.setMessageData(reqParamJson);
+        String controlParam = JSON.toJSONString(pushMessage);
+
+        // 推送消息
+        PcDevice pcDevice = pcDeviceMapper.selectPcDeviceById(reqParam.getDeviceId());
+        PushMessageUtil.remoteMeetingControl(pcDevice.getWiredMac(), pcDevice.getWirelessMac(), controlUrl, controlParam);
+        log.info("远程控制开始,参数:{}", reqParamJson);
+        String msg = "";
+        if (0 == index) {
+            msg = "远程控制开始";
+        } else {
+            msg = "切换成功";
+        }
+        return AjaxResult.success(msg);
+    }
+
+    @Override
+    public AjaxResult imageScale(ImageMoveReqVo reqParam) {
+        Integer index = reqParam.getImageIndex() - 1;
+        List<PartyMeetingFollow> imageList = partyMeetingFollowMapper.selectPartyMeetingFollowByMId(reqParam.getMeetingId(), 2);
+        String imageUrl = imageList.get(index).getFileUrl();
+
+        ImageScaleControl nettyMessage = new ImageScaleControl();
+        nettyMessage.setIndex(index);
+        nettyMessage.setMeetingId(reqParam.getMeetingId());
+        nettyMessage.setScale(reqParam.getScale());
+        nettyMessage.setImageUrl(imageUrl);
+        String reqParamJson = JSON.toJSONString(nettyMessage);
+
+        PushMessage pushMessage = new PushMessage();
+        pushMessage.setMessageType(PushMessageType.CONTROL_IMAGE_SCALE.getValue());
+        pushMessage.setMessageData(reqParamJson);
+        String controlParam = JSON.toJSONString(pushMessage);
+
+        // 推送消息
+        PcDevice pcDevice = pcDeviceMapper.selectPcDeviceById(reqParam.getDeviceId());
+        PushMessageUtil.remoteMeetingControl(pcDevice.getWiredMac(), pcDevice.getWirelessMac(), controlUrl, controlParam);
+        log.info("远程控制开始,参数:{}", reqParamJson);
+        String msg = "";
+        if (0 == index) {
+            msg = "远程控制开始";
+        } else {
             msg = "切换成功";
         }
         return AjaxResult.success(msg);

+ 29 - 0
inspur-pc/src/main/java/com/inspur/netty/message/push/ImageMoveControl.java

@@ -0,0 +1,29 @@
+package com.inspur.netty.message.push;
+
+import lombok.Data;
+
+/**
+ * @Description: 图片移动控制
+ * @author: lihao16
+ * @date: 2020/8/26 16:43
+ */
+@Data
+public class ImageMoveControl {
+
+    private String imageUrl;
+
+    private Long meetingId;
+
+    private Integer index;
+
+    /**
+     * 移动距离
+     */
+    private Integer distance;
+
+    /**
+     * 移动方向 1-上 2-下
+     */
+    private Integer direction;
+
+}

+ 21 - 0
inspur-pc/src/main/java/com/inspur/netty/message/push/ImageScaleControl.java

@@ -0,0 +1,21 @@
+package com.inspur.netty.message.push;
+
+import lombok.Data;
+
+/**
+ * @Description: 图片缩放控制
+ * @author: lihao16
+ * @date: 2020/12/10 10:30
+ */
+@Data
+public class ImageScaleControl {
+
+    private String imageUrl;
+
+    private Long meetingId;
+
+    private Integer index;
+
+    private Integer scale;
+
+}

+ 11 - 1
inspur-pc/src/main/java/com/inspur/netty/message/push/PushMessageType.java

@@ -87,7 +87,17 @@ public enum PushMessageType {
     /**
      * 会议控制 - 拍照签到
      */
-    CONTROL_TAKE_PHOTO_SIGN("2017");
+    CONTROL_TAKE_PHOTO_SIGN("2017"),
+
+    /**
+     * 会议控制 - 图片移动
+     */
+    CONTROL_IMAGE_MOVE("2018"),
+
+    /**
+     * 会议控制 - 图片缩放
+     */
+    CONTROL_IMAGE_SCALE("2019");
 
     private String value;