From 6356dff6dabcaee38ccd48e3d2673a31f87491e3 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 27 十一月 2025 18:22:51 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/DeviceServiceImpl.java |  156 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 94 insertions(+), 62 deletions(-)

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 b058e6b..86fa98a 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
@@ -7,28 +7,31 @@
 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.model.param.request.CustomBroadcastRequest;
+import com.doumee.core.haikang.model.param.request.TransparentChannelSingleRequest;
 import com.doumee.core.haikang.service.HKService;
-import com.doumee.core.model.PageData;
-import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.*;
+import com.doumee.dao.business.model.*;
+import com.doumee.service.business.third.model.LoginUserInfo;
+import com.doumee.service.business.third.model.PageData;
+import com.doumee.service.business.third.model.PageWrap;
 import com.doumee.core.utils.Constants;
 import com.doumee.core.utils.Utils;
-import com.doumee.dao.business.DeviceMapper;
-import com.doumee.dao.business.PlatformBroadcastLogMapper;
-import com.doumee.dao.business.model.Device;
-import com.doumee.dao.business.model.PlatformBroadcastLog;
 import com.doumee.service.business.DeviceService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.doumee.service.business.impl.hksync.HkSyncPushServiceImpl;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
+import lombok.extern.slf4j.Slf4j;
 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.*;
+import java.util.stream.Collectors;
 
 /**
  * 璁惧淇℃伅琛⊿ervice瀹炵幇
@@ -36,10 +39,15 @@
  * @date 2023/11/30 15:33
  */
 @Service
+@Slf4j
 public class DeviceServiceImpl implements DeviceService {
 
     @Autowired
     private DeviceMapper deviceMapper;
+    @Autowired
+    private PlatformMapper platformMapper;
+    @Autowired
+    private PlatformDeviceMapper platformDeviceMapper;
     @Autowired
     private SystemDictDataBiz systemDictDataBiz;
     @Autowired
@@ -47,14 +55,24 @@
 
 
     @Override
-    public Integer create(Device device) {
-        deviceMapper.insert(device);
-        return device.getId();
+    public Integer create(Device model) {
+        model.setCreator(model.getLoginUserInfo().getId()+"");
+        model.setEdirot(model.getCreator());
+        model.setIsdeleted(Constants.ZERO);
+        model.setEditDate(new Date());
+        model.setCreateDate(model.getEditDate());
+        deviceMapper.insert(model);
+        return model.getId();
     }
 
     @Override
-    public void deleteById(Integer id) {
-        deviceMapper.deleteById(id);
+    public void deleteById(Integer id, LoginUserInfo userInfo) {
+        Device update = new Device();
+        update.setEdirot(userInfo.getId()+"");
+        update.setEditDate(new Date());
+        update.setIsdeleted(Constants.ONE);
+        update.setId(id);
+        deviceMapper.updateById(update);
     }
 
     @Override
@@ -64,15 +82,19 @@
     }
 
     @Override
-    public void deleteByIdInBatch(List<Integer> ids) {
+    public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo userInfo) {
         if (CollectionUtils.isEmpty(ids)) {
             return;
         }
-        deviceMapper.deleteBatchIds(ids);
+        for(Integer id :ids){
+            deleteById(id,userInfo);
+        }
     }
 
     @Override
     public void updateById(Device device) {
+        device.setEdirot(device.getLoginUserInfo().getId()+"");
+        device.setEditDate(new Date());
         deviceMapper.updateById(device);
     }
 
@@ -109,6 +131,7 @@
         wrapper.select(Device::getId, Device::getName, Device::getDoorName,Device::getRegionPathName, Device::getRegionName);
         wrapper.eq(null != param.getType(),Device::getType,param.getType())
                .eq(null !=param.getIsdeleted(),Device::getIsdeleted,param.getIsdeleted())
+               .eq(Objects.isNull(param.getIsdeleted()),Device::getIsdeleted,Constants.ZERO)
                .eq(null != param.getHkStatus(),Device::getHkStatus,param.getHkStatus());
         return deviceMapper.selectList(wrapper);
     }
@@ -229,6 +252,22 @@
     }
 
     @Override
+    public void setBroadcaseBobao(Device model){
+        List<String> ids = new ArrayList<>();
+        ids.add(model.getHkId());
+        CustomBroadcastRequest request = new CustomBroadcastRequest();
+        request.setAudioPointIndexCode(ids);
+        request.setPlayDuration(15);//鍗曚綅绉�
+        request.setBroadCastMode("tts");
+        request.setPriority(1);
+        request.setState(1);//鎾斁/鍋滄鏍囪瘑 1-鎾斁锛�0-鍋滄
+        request.setPlayTtsContent(model.getSendInfo());
+        BaseResponse response =  HKService.customBroadcast(request);
+        if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
+          throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"鍙戦�佸け璐ワ細"+ JSONObject.toJSONString(response));
+        }
+    }
+    @Override
     public void setLedContent(TransparentChannelSingleRequest model) {
         Device device = findById(model.getDeviceId());
         if(device == null
@@ -236,33 +275,6 @@
                 || !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.getNo());
-        body.setMethod("ControlLedGereral");//鍥哄畾鍊�
-        request.setIndexCode(device.getNo());
-        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(8);
-        body.setParams(request);
-        BaseResponse response =  HKService.transparentchannel(head,body);*/
         if(model.getSpeed()<=0){
             int speed = 13;
             try {
@@ -271,28 +283,48 @@
             }
             model.setSpeed(speed);
         }
-        BaseResponse response =  HkSyncPushServiceImpl.dealLedContentBiz(device.getNo(),model.getContent(),model.getSpeed(),1);
-        PlatformBroadcastLog log = new PlatformBroadcastLog();
-        log.setCreateDate(new Date());
-        log.setBizType(Constants.ONE);
-        log.setHkDate(new Date());
-        log.setDeviceType(Constants.ONE);
-        log.setObjType(Constants.ONE);
-        log.setIds(device.getNo());
-        log.setRemark(device.getName());
-        if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
-            log.setHkInfo("璇锋眰澶辫触锛�"+JSONObject.toJSONString(response));
-            log.setHkStatus(Constants.THREE);
-        }else{
-            log.setHkInfo("璇锋眰鎴愬姛");
-            log.setHkStatus(Constants.TWO);
-        }
-        log.setName("璁剧疆LED灞忔樉鍐呭");
-        log.setInfo(model.getContent());
-        log.setNum(Constants.ONE);
+        PlatformBroadcastLog log  =  HkSyncPushServiceImpl.dealLedContentBiz(0,device.getNo(),device.getName(),model.getContent(),model.getSpeed(),1);
         platformBroadcastLogMapper.insert(log);
-        if(response == null || !StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE)){
-            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝灞忓箷鍐呭璁剧疆澶辫触"+(response!=null?response.getMsg():""));
+        if(log.getHkStatus() == null || !Constants.equalsInteger(log.getHkStatus(), Constants.TWO)){
+            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵逛笉璧凤紝灞忓箷鍐呭璁剧疆澶辫触"+(log!=null?log.getHkInfo():""));
         }
     }
+    @Override
+    public void allLedDefualtContent() {
+        log.error( "灞忓箷鍐呭璁剧疆=======================寮�濮�========" );
+        int speed = 13;
+        try {
+            speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode());
+        }catch (Exception e){
+        }
+        //鎵�鏈夋湀鍙板叧鑱旇澶囦俊鎭�
+        List<PlatformDevice> list =  platformDeviceMapper.selectList(new MPJLambdaWrapper<PlatformDevice>().
+                 selectAll(PlatformDevice.class)
+                .selectAs(Platform::getLedContent,PlatformDevice::getLedContent)
+                .leftJoin(Platform.class,Platform::getId,PlatformDevice::getPlatformId)
+                .eq(PlatformDevice::getType,Constants.ZERO)
+                .eq(PlatformDevice::getIsdeleted,Constants.ZERO)
+                .eq(Platform::getIsdeleted,Constants.ZERO)
+        );
+        if(list==null || list.size()==0){
+            return;
+        }
+        for(PlatformDevice device :list){
+            try {
+                String content = device.getLedContent();
+                if(StringUtils.isBlank(content)){
+                    continue;
+                }
+                PlatformBroadcastLog log1  =  HkSyncPushServiceImpl.dealLedContentBiz(0,device.getHkNo(),device.getName(),content,speed,1);
+                platformBroadcastLogMapper.insert(log1);
+                if(log1.getHkStatus() == null || !Constants.equalsInteger(log1.getHkStatus(), Constants.TWO)){
+                    log.error( "瀵逛笉璧凤紝灞忓箷鍐呭璁剧疆澶辫触"+(log1!=null?log1.getHkInfo():""));
+                }
+            }catch (Exception e){
+                log.error( "瀵逛笉璧凤紝灞忓箷鍐呭璁剧疆寮傚父"+ device.getName());
+            }
+
+        }
+        log.error( "灞忓箷鍐呭璁剧疆=======================缁撴潫========" );
+    }
 }

--
Gitblit v1.9.3