mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 01:48:47 +08:00
unipush 对接初始化
This commit is contained in:
parent
5c0563c1a0
commit
33e9e869b3
@ -3,6 +3,9 @@ package org.dromara.web.controller.app;
|
|||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -23,6 +26,7 @@ import org.dromara.web.device.iot.DeviceDto;
|
|||||||
import org.dromara.web.domain.bo.*;
|
import org.dromara.web.domain.bo.*;
|
||||||
import org.dromara.web.domain.vo.*;
|
import org.dromara.web.domain.vo.*;
|
||||||
import org.dromara.web.service.*;
|
import org.dromara.web.service.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -148,6 +152,39 @@ public class EqDeviceController extends BaseController {
|
|||||||
return R.ok(eqEquipmentService.getDeviceMsg(bo));
|
return R.ok(eqEquipmentService.getDeviceMsg(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IEqClientIdService eqClientIdService;
|
||||||
|
/**
|
||||||
|
* app通知
|
||||||
|
*/
|
||||||
|
@GetMapping("/appAdvice")
|
||||||
|
public R<Void> appAdvice(@RequestBody EqEquipmentLogBo param){
|
||||||
|
JSONObject pushInfo = new JSONObject();
|
||||||
|
//设备查询
|
||||||
|
EqEquipmentBo eqEquipmentBo = new EqEquipmentBo();
|
||||||
|
eqEquipmentBo.setEquipmentCode(param.getEquipmentCode());
|
||||||
|
List<EqEquipmentVo> eqEquipmentVos = eqEquipmentService.queryList(eqEquipmentBo);
|
||||||
|
if (CollectionUtils.isEmpty(eqEquipmentVos)) return R.ok("设备未绑定用户");
|
||||||
|
EqEquipmentVo eqEquipmentVo = eqEquipmentVos.get(0);
|
||||||
|
|
||||||
|
//cid查询
|
||||||
|
EqClientIdBo bo = new EqClientIdBo();
|
||||||
|
bo.setUserId(eqEquipmentVo.getUserId());
|
||||||
|
List<EqClientIdVo> eqClientIdVos = eqClientIdService.queryList(bo);
|
||||||
|
if (CollectionUtils.isEmpty(eqClientIdVos)) return R.ok("为查询到设备cid");
|
||||||
|
EqClientIdVo eqClientId = eqClientIdVos.get(0);
|
||||||
|
|
||||||
|
|
||||||
|
pushInfo.put("cids", Collections.singletonList(eqClientId.getCid()));
|
||||||
|
//pushInfo.put("getui_alias","unipush2_"+ pay0rder.getStoreId());
|
||||||
|
pushInfo.put("title","莫克通知");
|
||||||
|
pushInfo.put("content",param.getStatus());//todo
|
||||||
|
pushInfo.put("data",new JSONObject());
|
||||||
|
HttpResponse response = HttpUtil.createPost("appPushconfig.getuniPushcloudurl()").body(pushInfo.toJSONString()).execute();
|
||||||
|
return R.ok("消息发送成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取日志
|
* 获取日志
|
||||||
|
|||||||
@ -97,7 +97,7 @@ spring.data:
|
|||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 2
|
database: 2
|
||||||
# redis 密码必须配置
|
# redis 密码必须配置
|
||||||
# password: ruoyi123
|
password: ruoyi123
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user