mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
websocket线程优化及发送控优化及ota版本优化
This commit is contained in:
parent
d0ca7ffdff
commit
dc475755d9
@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.dromara.common.core.constant.Constants;
|
import org.dromara.common.core.constant.Constants;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.domain.model.LoginUser;
|
import org.dromara.common.core.domain.model.LoginUser;
|
||||||
@ -55,6 +56,7 @@ import java.util.stream.Collectors;
|
|||||||
* @date 2024-07-14
|
* @date 2024-07-14
|
||||||
*/
|
*/
|
||||||
@Validated
|
@Validated
|
||||||
|
@Log4j2
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/device")
|
@RequestMapping("/app/device")
|
||||||
@ -131,6 +133,7 @@ public class EqDeviceController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/operate")
|
@GetMapping("/operate")
|
||||||
public R<String> operate(EqDeviceCmdBo bo){
|
public R<String> operate(EqDeviceCmdBo bo){
|
||||||
|
log.info("设备控制参数 userId:{}, equipmentCode:{}, operateType:{}",bo.getUserId(),bo.getEquipmentCode(),bo.getOperateType());
|
||||||
if (bo.getEquipmentCode() == null) throw new ServiceException("设备编码不能为空");
|
if (bo.getEquipmentCode() == null) throw new ServiceException("设备编码不能为空");
|
||||||
if (bo.getOperateType() == 0) throw new ServiceException("操作类型不能为0");
|
if (bo.getOperateType() == 0) throw new ServiceException("操作类型不能为0");
|
||||||
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
|
if (bo.getUserId() == null) throw new ServiceException("用户ID不能为空");
|
||||||
|
|||||||
@ -476,7 +476,8 @@ public class EqEquipmentServiceImpl implements IEqEquipmentService {
|
|||||||
eqVersionBo.setCurrentVersion(currentVersion);
|
eqVersionBo.setCurrentVersion(currentVersion);
|
||||||
eqVersionBo.setLatestVersion(null);
|
eqVersionBo.setLatestVersion(null);
|
||||||
}else{
|
}else{
|
||||||
eqVersionBo.setNeedUpdate(true);
|
if (StringUtils.isBlank(currentVersion)) throw new RuntimeException("设备无当前OTA版本");
|
||||||
|
eqVersionBo.setNeedUpdate(currentVersion.equals(lastOtaPackage.getVersion()));
|
||||||
eqVersionBo.setCurrentVersion(currentVersion);
|
eqVersionBo.setCurrentVersion(currentVersion);
|
||||||
eqVersionBo.setLatestVersion(lastOtaPackage.getVersion());
|
eqVersionBo.setLatestVersion(lastOtaPackage.getVersion());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -203,6 +203,8 @@ public class WebSocketBusinessHandler implements WebSocketApi {
|
|||||||
pageQuery.setPageSize(100);
|
pageQuery.setPageSize(100);
|
||||||
try {
|
try {
|
||||||
list = homeController.listForWebSocket(bo, pageQuery,loginUser);
|
list = homeController.listForWebSocket(bo, pageQuery,loginUser);
|
||||||
|
canSendFlag = true;
|
||||||
|
/* zc 去除去重
|
||||||
if (type == 1){
|
if (type == 1){
|
||||||
canSendFlag = true;
|
canSendFlag = true;
|
||||||
}else{
|
}else{
|
||||||
@ -211,9 +213,10 @@ public class WebSocketBusinessHandler implements WebSocketApi {
|
|||||||
List<EqEquipmentListVo> currentVoList = new ArrayList<>();
|
List<EqEquipmentListVo> currentVoList = new ArrayList<>();
|
||||||
if (rows !=null && !rows.isEmpty()){
|
if (rows !=null && !rows.isEmpty()){
|
||||||
currentVoList = BeanUtil.copyToList(rows, EqEquipmentListVo.class);
|
currentVoList = BeanUtil.copyToList(rows, EqEquipmentListVo.class);
|
||||||
|
|
||||||
if (RedisUtils.hasKey(key)){
|
if (RedisUtils.hasKey(key)){
|
||||||
List<EqEquipmentVo> cacheList = RedisUtils.getCacheList(key);
|
List<EqEquipmentListVo> cacheList = RedisUtils.getCacheList(key);
|
||||||
for (EqEquipmentVo cacheVo : cacheList) {
|
for (EqEquipmentListVo cacheVo : cacheList) {
|
||||||
for (EqEquipmentListVo currentVo : currentVoList) {
|
for (EqEquipmentListVo currentVo : currentVoList) {
|
||||||
if (cacheVo.getEquipmentId().equals(currentVo.getEquipmentId())){
|
if (cacheVo.getEquipmentId().equals(currentVo.getEquipmentId())){
|
||||||
if (
|
if (
|
||||||
@ -232,7 +235,7 @@ public class WebSocketBusinessHandler implements WebSocketApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (canSendFlag) RedisUtils.setCacheList(key,currentVoList);
|
||||||
}else{
|
}else{
|
||||||
RedisUtils.setCacheList(key,currentVoList);
|
RedisUtils.setCacheList(key,currentVoList);
|
||||||
canSendFlag = true;
|
canSendFlag = true;
|
||||||
@ -240,7 +243,7 @@ public class WebSocketBusinessHandler implements WebSocketApi {
|
|||||||
}else{
|
}else{
|
||||||
canSendFlag = true;
|
canSendFlag = true;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
isTure = false;
|
isTure = false;
|
||||||
sendMsg = "获取设备列表失败"+e.getMessage();
|
sendMsg = "获取设备列表失败"+e.getMessage();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user