parent
0bdfd5a3b4
commit
170000bb9e
|
|
@ -19,7 +19,15 @@ public class DJIConfig {
|
||||||
private String appLicense;
|
private String appLicense;
|
||||||
private String ntpServerHost;
|
private String ntpServerHost;
|
||||||
private Integer ntpServerPort;
|
private Integer ntpServerPort;
|
||||||
private String organizationName = "dji";
|
private DockBind dockBind = new DockBind();
|
||||||
private String organizationId = "djiId";
|
|
||||||
private String deviceBindCode = "djiCode";
|
@Data
|
||||||
|
public static class DockBind {
|
||||||
|
private String url;
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
private String organizationName;
|
||||||
|
private String organizationId;
|
||||||
|
private String deviceBindCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,12 @@ public class MiscController {
|
||||||
|
|
||||||
return new Result<>().ok(miscService.pageHmsLog(params));
|
return new Result<>().ok(miscService.pageHmsLog(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDockBindInfo")
|
||||||
|
@Operation(summary = "机库注册信息")
|
||||||
|
@RequiresPermissions("bus:misc:getDockBindInfo")
|
||||||
|
public Result<Object> getDockBindInfo() {
|
||||||
|
|
||||||
|
return new Result<>().ok(miscService.getDockBindInfo());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.multictrl.modules.business.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机库绑定参数
|
||||||
|
*
|
||||||
|
* @author Sdy
|
||||||
|
* @since 1.0.0 2026/6/22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(name = "机库绑定参数")
|
||||||
|
public class DockBindDTO {
|
||||||
|
@Schema(description = "MQTT网关地址")
|
||||||
|
private String url;
|
||||||
|
@Schema(description = "MQTT账号")
|
||||||
|
private String username;
|
||||||
|
@Schema(description = "MQTT密码")
|
||||||
|
private String password;
|
||||||
|
@Schema(description = "组织ID")
|
||||||
|
private String organizationId;
|
||||||
|
@Schema(description = "设备绑定码")
|
||||||
|
private String deviceBindCode;
|
||||||
|
}
|
||||||
|
|
@ -85,8 +85,9 @@ public class RequestsHandler implements MessageHandler {
|
||||||
}
|
}
|
||||||
deviceJson.set("device_callsign", System.currentTimeMillis());
|
deviceJson.set("device_callsign", System.currentTimeMillis());
|
||||||
deviceJson.set("is_device_bind_organization", true);
|
deviceJson.set("is_device_bind_organization", true);
|
||||||
deviceJson.set("organization_id", djiConfig.getOrganizationId());
|
DJIConfig.DockBind dockBind = djiConfig.getDockBind();
|
||||||
deviceJson.set("organization_name", djiConfig.getOrganizationName());
|
deviceJson.set("organization_id", dockBind.getOrganizationId());
|
||||||
|
deviceJson.set("organization_name", dockBind.getOrganizationName());
|
||||||
bindStatus.add(deviceJson);
|
bindStatus.add(deviceJson);
|
||||||
}
|
}
|
||||||
output.set("bind_status", bindStatus);
|
output.set("bind_status", bindStatus);
|
||||||
|
|
@ -102,7 +103,8 @@ public class RequestsHandler implements MessageHandler {
|
||||||
} else if (BusinessConstant.AIRPORT_ORGANIZATION_GET.equals(method)) {//第三步 查询设备绑定对应的组织信息
|
} else if (BusinessConstant.AIRPORT_ORGANIZATION_GET.equals(method)) {//第三步 查询设备绑定对应的组织信息
|
||||||
String deviceBindingCode = data.getStr("device_binding_code");
|
String deviceBindingCode = data.getStr("device_binding_code");
|
||||||
String organizationId = data.getStr("organization_id");
|
String organizationId = data.getStr("organization_id");
|
||||||
if (!djiConfig.getDeviceBindCode().equals(deviceBindingCode) || !djiConfig.getOrganizationId()
|
DJIConfig.DockBind dockBind = djiConfig.getDockBind();
|
||||||
|
if (!dockBind.getDeviceBindCode().equals(deviceBindingCode) || !dockBind.getOrganizationId()
|
||||||
.equals(organizationId)) {
|
.equals(organizationId)) {
|
||||||
data.set("result", 2);
|
data.set("result", 2);
|
||||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||||
|
|
@ -110,7 +112,7 @@ public class RequestsHandler implements MessageHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject output = new JSONObject();
|
JSONObject output = new JSONObject();
|
||||||
output.set("organization_name", djiConfig.getOrganizationName());
|
output.set("organization_name", dockBind.getOrganizationName());
|
||||||
data.set("result", 0);
|
data.set("result", 0);
|
||||||
data.set("output", output);
|
data.set("output", output);
|
||||||
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
mqttPushService.pushMessageByClient1(topic + BusinessConstant._REPLY, message.toString());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.multictrl.modules.business.service;
|
package com.multictrl.modules.business.service;
|
||||||
|
|
||||||
import com.multictrl.common.page.PageData;
|
import com.multictrl.common.page.PageData;
|
||||||
|
import com.multictrl.modules.business.dto.DockBindDTO;
|
||||||
import com.multictrl.modules.business.dto.HmsDTO;
|
import com.multictrl.modules.business.dto.HmsDTO;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -15,4 +16,7 @@ public interface MiscService {
|
||||||
|
|
||||||
//获取HMS健康日志
|
//获取HMS健康日志
|
||||||
PageData<HmsDTO> pageHmsLog(Map<String, Object> params);
|
PageData<HmsDTO> pageHmsLog(Map<String, Object> params);
|
||||||
|
|
||||||
|
//获取机库注册信息
|
||||||
|
DockBindDTO getDockBindInfo();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ package com.multictrl.modules.business.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.multictrl.common.config.DJIConfig;
|
||||||
import com.multictrl.common.constant.Constant;
|
import com.multictrl.common.constant.Constant;
|
||||||
import com.multictrl.common.page.PageData;
|
import com.multictrl.common.page.PageData;
|
||||||
import com.multictrl.common.utils.ConvertUtils;
|
import com.multictrl.common.utils.ConvertUtils;
|
||||||
import com.multictrl.common.utils.HmsUtils;
|
import com.multictrl.common.utils.HmsUtils;
|
||||||
import com.multictrl.modules.business.dao.HmsDao;
|
import com.multictrl.modules.business.dao.HmsDao;
|
||||||
|
import com.multictrl.modules.business.dto.DockBindDTO;
|
||||||
import com.multictrl.modules.business.dto.HmsDTO;
|
import com.multictrl.modules.business.dto.HmsDTO;
|
||||||
import com.multictrl.modules.business.entity.HmsEntity;
|
import com.multictrl.modules.business.entity.HmsEntity;
|
||||||
import com.multictrl.modules.business.service.MiscService;
|
import com.multictrl.modules.business.service.MiscService;
|
||||||
|
|
@ -27,6 +29,7 @@ import java.util.Map;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MiscServiceImpl implements MiscService {
|
public class MiscServiceImpl implements MiscService {
|
||||||
private final HmsDao hmsDao;
|
private final HmsDao hmsDao;
|
||||||
|
private final DJIConfig djiConfig;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<HmsDTO> pageHmsLog(Map<String, Object> params) {
|
public PageData<HmsDTO> pageHmsLog(Map<String, Object> params) {
|
||||||
|
|
@ -44,4 +47,11 @@ public class MiscServiceImpl implements MiscService {
|
||||||
|
|
||||||
return new PageData<>(list, page.getTotal());
|
return new PageData<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DockBindDTO getDockBindInfo() {
|
||||||
|
DJIConfig.DockBind dockBind = djiConfig.getDockBind();
|
||||||
|
|
||||||
|
return ConvertUtils.sourceToTarget(dockBind, DockBindDTO.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.multictrl.modules.security.controller;
|
package com.multictrl.modules.security.controller;
|
||||||
|
|
||||||
|
import com.multictrl.common.config.DJIConfig;
|
||||||
import com.multictrl.common.exception.ErrorCode;
|
import com.multictrl.common.exception.ErrorCode;
|
||||||
import com.multictrl.common.exception.RenException;
|
import com.multictrl.common.exception.RenException;
|
||||||
import com.multictrl.common.utils.IpUtils;
|
import com.multictrl.common.utils.IpUtils;
|
||||||
|
|
@ -56,6 +57,7 @@ public class LoginController {
|
||||||
private final CaptchaService captchaService;
|
private final CaptchaService captchaService;
|
||||||
private final SysLogLoginService sysLogLoginService;
|
private final SysLogLoginService sysLogLoginService;
|
||||||
private final DockService dockService;
|
private final DockService dockService;
|
||||||
|
private final DJIConfig djiConfig;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("captcha")
|
@GetMapping("captcha")
|
||||||
|
|
@ -158,11 +160,27 @@ public class LoginController {
|
||||||
return new MqttAuthVO().setResult("deny");
|
return new MqttAuthVO().setResult("deny");
|
||||||
}
|
}
|
||||||
|
|
||||||
//给机场配置专属用户名密码
|
//后端专属用户名密码
|
||||||
if (login.getUsername().equals("dock") && login.getPassword().equals("Dock@2023")) {
|
if (login.getUsername().equals("dock") && login.getPassword().equals("Dock@2023")) {
|
||||||
return new MqttAuthVO().setResult("allow").setIs_superuser(true).setAcl(new ArrayList<>());
|
return new MqttAuthVO().setResult("allow").setIs_superuser(true).setAcl(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//给机场配置专属用户名密码
|
||||||
|
DJIConfig.DockBind dockBind = djiConfig.getDockBind();
|
||||||
|
if (login.getUsername().equals(dockBind.getUsername()) && login.getPassword().equals(dockBind.getPassword())) {
|
||||||
|
List<MqttAuthVO.Acl> aclList = new ArrayList<>();
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("publish").setPermission("deny").setTopic("thing/product/+/services"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("publish").setPermission("deny").setTopic("thing/product/+/drc/down"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("publish").setPermission("allow").setTopic("#"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("subscribe").setPermission("deny").setTopic("thing/product/+/osd"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("subscribe").setPermission("deny").setTopic("thing/product/+/events"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("subscribe").setPermission("deny").setTopic("thing/product/+/status"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("subscribe").setPermission("deny").setTopic("thing/product/+/state"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("subscribe").setPermission("deny").setTopic("thing/product/+/requests"));
|
||||||
|
aclList.add(new MqttAuthVO.Acl().setAction("subscribe").setPermission("allow").setTopic("#"));
|
||||||
|
return new MqttAuthVO().setResult("allow").setIs_superuser(false).setAcl(aclList);
|
||||||
|
}
|
||||||
|
|
||||||
//用户、账号、密码校验
|
//用户、账号、密码校验
|
||||||
SysUserDTO user = sysUserService.getByUsername(login.getUsername());
|
SysUserDTO user = sysUserService.getByUsername(login.getUsername());
|
||||||
if (user == null || user.getStatus() == UserStatusEnum.DISABLE.value() ||
|
if (user == null || user.getStatus() == UserStatusEnum.DISABLE.value() ||
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,13 @@ dji:
|
||||||
appLicense: fr/l8puzVxAIHCGa5Gkq7Swu1BQ0C4BjLJhGiWE8eaujp7KrDRcg1/AZ+sMuuOmR/MZiHktUK5f+gg+JWopwAe8cfTp6A4aYqIXbCh6DGMgCYYu3BBodrGxG2U6MSJ8q2lhh144iMT/Bv/wEZXX/IMt22wtT28TSwNCQ7CI+0vw=
|
appLicense: fr/l8puzVxAIHCGa5Gkq7Swu1BQ0C4BjLJhGiWE8eaujp7KrDRcg1/AZ+sMuuOmR/MZiHktUK5f+gg+JWopwAe8cfTp6A4aYqIXbCh6DGMgCYYu3BBodrGxG2U6MSJ8q2lhh144iMT/Bv/wEZXX/IMt22wtT28TSwNCQ7CI+0vw=
|
||||||
ntpServerHost: ${host.ip}
|
ntpServerHost: ${host.ip}
|
||||||
ntpServerPort: 61627
|
ntpServerPort: 61627
|
||||||
|
dockBind:
|
||||||
|
url: tcp://${host.ip}:61627
|
||||||
|
username: dockbind
|
||||||
|
password: dock@123.1
|
||||||
|
organizationName: dji
|
||||||
|
organizationId: djidock
|
||||||
|
deviceBindCode: djicode
|
||||||
|
|
||||||
srs:
|
srs:
|
||||||
ip: ${host.ip}
|
ip: ${host.ip}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,13 @@ dji:
|
||||||
appLicense: fr/l8puzVxAIHCGa5Gkq7Swu1BQ0C4BjLJhGiWE8eaujp7KrDRcg1/AZ+sMuuOmR/MZiHktUK5f+gg+JWopwAe8cfTp6A4aYqIXbCh6DGMgCYYu3BBodrGxG2U6MSJ8q2lhh144iMT/Bv/wEZXX/IMt22wtT28TSwNCQ7CI+0vw=
|
appLicense: fr/l8puzVxAIHCGa5Gkq7Swu1BQ0C4BjLJhGiWE8eaujp7KrDRcg1/AZ+sMuuOmR/MZiHktUK5f+gg+JWopwAe8cfTp6A4aYqIXbCh6DGMgCYYu3BBodrGxG2U6MSJ8q2lhh144iMT/Bv/wEZXX/IMt22wtT28TSwNCQ7CI+0vw=
|
||||||
ntpServerHost: ${host.ip}
|
ntpServerHost: ${host.ip}
|
||||||
ntpServerPort: 61627
|
ntpServerPort: 61627
|
||||||
|
dockBind:
|
||||||
|
url: tcp://${host.ip}:61627
|
||||||
|
username: dockbind
|
||||||
|
password: dock@123.1
|
||||||
|
organizationName: dji
|
||||||
|
organizationId: djidock
|
||||||
|
deviceBindCode: djicode
|
||||||
|
|
||||||
srs:
|
srs:
|
||||||
ip: ${host.ip}
|
ip: ${host.ip}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue