1
0

23 Commits

Author SHA1 Message Date
2800b89e06 Merge branch 'main' into prod 2025-07-23 10:55:30 +08:00
da6b888934 Merge branch 'dyf-device' 2025-07-23 10:54:20 +08:00
619356209b 删除设备 2025-07-23 10:53:26 +08:00
d84a7cde3b 帐号状态(0正常 1停用)status 2025-07-23 09:52:28 +08:00
e4dbee15dd 设备分享功能开发 2025-07-22 18:37:02 +08:00
33e53de5a1 设备主题 2025-07-22 16:13:39 +08:00
3bce279d7b 修改客户-用户名重复校验 2025-07-22 09:58:49 +08:00
9338b0d24b 设备详情功能开发 2025-07-21 15:24:26 +08:00
637e46c510 Merge branch 'main' into prod 2025-07-21 08:40:34 +08:00
879e485056 Merge branch 'dyf-device' 2025-07-21 08:39:55 +08:00
69c4cc2004 APP设备分享功能开发2 2025-07-19 14:28:07 +08:00
a7340c744e APP客户设备绑定-绑定时间 2025-07-19 14:22:36 +08:00
31c2158c8e Merge branch 'main' into prod 2025-07-19 10:22:33 +08:00
6bbe9cbdd1 Merge branch 'dyf-device' 2025-07-19 10:21:11 +08:00
3feafc2cd9 删除设备类型 2025-07-19 10:20:07 +08:00
13986bb493 APP设备分享功能开发 2025-07-19 09:36:35 +08:00
f2921ff12f 分页查询设备-设备类型 2025-07-19 09:17:14 +08:00
ec89dd8c1e 新增设备 校验 2025-07-18 18:12:36 +08:00
57322c9c87 蓝牙名称 2025-07-18 17:57:58 +08:00
c7c21dc358 Merge branch 'main' into prod 2025-07-18 15:17:54 +08:00
a7e0803b00 Merge branch 'main' into prod 2025-07-17 16:42:14 +08:00
55cacbd322 Merge branch 'main' into prod 2025-07-17 09:24:45 +08:00
99ec6eaff0 prod 2025-07-15 08:40:20 +08:00
43 changed files with 1529 additions and 91 deletions

View File

@ -94,10 +94,10 @@
</dependency>
<!-- demo模块 -->
<dependency>
<!--<dependency>
<groupId>com.fuyuanshen</groupId>
<artifactId>fys-demo</artifactId>
</dependency>
</dependency>-->
<!-- 工作流模块 -->
<dependency>

View File

@ -100,7 +100,7 @@ public class AppAuthController {
*/
@PostMapping("/logout")
public R<Void> logout() {
// loginService.logout();
loginService.logout();
return R.ok("退出成功");
}

View File

@ -1,16 +1,20 @@
package com.fuyuanshen.app.controller;
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
import com.fuyuanshen.app.service.equipment.APPDeviceService;
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
import com.fuyuanshen.app.service.AppDeviceBizService;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.core.validate.AddGroup;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import com.fuyuanshen.equipment.domain.dto.AppDeviceSendMsgBo;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import com.fuyuanshen.equipment.service.DeviceService;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -26,18 +30,16 @@ import java.util.List;
@RequestMapping("/app/device")
public class AppDeviceController extends BaseController {
private final DeviceService deviceService;
private final AppDeviceBizService appDeviceService;
private final APPDeviceService appDeviceService;
/**
* 查询设备列表
*/
@GetMapping("/list")
public TableDataInfo<AppDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
return deviceService.queryAppDeviceList(bo,pageQuery);
return appDeviceService.queryAppDeviceList(bo,pageQuery);
}
/**
@ -45,7 +47,7 @@ public class AppDeviceController extends BaseController {
*/
@PostMapping("/bind")
public R<Void> bind(@RequestBody AppDeviceBo bo) {
return toAjax(deviceService.bindDevice(bo));
return toAjax(appDeviceService.bindDevice(bo));
}
@ -54,7 +56,7 @@ public class AppDeviceController extends BaseController {
*/
@DeleteMapping("/unBind")
public R<Void> unBind(Long id) {
return toAjax(deviceService.unBindDevice(id));
return toAjax(appDeviceService.unBindDevice(id));
}
/**
@ -76,4 +78,31 @@ public class AppDeviceController extends BaseController {
appDeviceService.reName(reNameDTO);
return R.ok("重命名成功!!!");
}
/**
* 获取设备详细信息
*
* @param id 主键
*/
@GetMapping("/{id}")
public R<AppDeviceDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(appDeviceService.getInfo(id));
}
/**
* 人员信息登记
*/
@PostMapping(value = "/registerPersonInfo")
public R<Void> registerPersonInfo(@Validated(AddGroup.class) @RequestBody AppPersonnelInfoBo bo) {
return toAjax(appDeviceService.registerPersonInfo(bo));
}
/**
* 发送信息
*/
@PostMapping(value = "/sendMessage")
public R<Void> sendMessage(@RequestBody AppDeviceSendMsgBo bo) {
return toAjax(appDeviceService.sendMessage(bo));
}
}

View File

@ -0,0 +1,118 @@
package com.fuyuanshen.app.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.util.RandomUtil;
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
import com.fuyuanshen.app.domain.vo.AppDeviceShareDetailVo;
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
import com.fuyuanshen.app.service.AppDeviceShareService;
import com.fuyuanshen.app.service.IAppDeviceShareService;
import com.fuyuanshen.common.core.constant.Constants;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.core.validate.AddGroup;
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.ratelimiter.annotation.RateLimiter;
import com.fuyuanshen.common.redis.utils.RedisUtils;
import com.fuyuanshen.common.web.core.BaseController;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.sms4j.api.SmsBlend;
import org.dromara.sms4j.api.entity.SmsResponse;
import org.dromara.sms4j.core.factory.SmsFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.time.Duration;
import java.util.LinkedHashMap;
import static com.fuyuanshen.common.core.constant.GlobalConstants.DEVICE_SHARE_CODES_KEY;
/**
* APP 设备分享
*
* @author Lion Li
* @date 2025-07-16
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/deviceShare")
public class AppDeviceShareController extends BaseController {
private final IAppDeviceShareService deviceShareService;
private final AppDeviceShareService appDeviceShareService;
/**
* 分享管理列表
*/
@GetMapping("/deviceShareList")
public TableDataInfo<AppDeviceShareVo> list(AppDeviceShareBo bo, PageQuery pageQuery) {
return deviceShareService.queryPageList(bo, pageQuery);
}
/**
* 他人分享管理列表
*/
@GetMapping("/otherDeviceShareList")
public TableDataInfo<AppDeviceShareVo> otherDeviceShareList(AppDeviceShareBo bo, PageQuery pageQuery) {
return deviceShareService.otherDeviceShareList(bo, pageQuery);
}
/**
* 获取设备分享详细信息
*
* @param id 主键
*/
@GetMapping("/{id}")
public R<AppDeviceShareDetailVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(appDeviceShareService.getInfo(id));
}
/**
* 新增设备分享
*/
@RepeatSubmit()
@PostMapping("/deviceShare")
public R<Void> deviceShare(@Validated(AddGroup.class) @RequestBody AppDeviceShareBo bo) {
return toAjax(appDeviceShareService.deviceShare(bo));
}
/**
* 移除分享用户
*
* @param ids 主键串
*/
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(appDeviceShareService.remove(ids));
}
/**
* 短信验证码
*
* @param phonenumber 用户手机号
*/
@SaIgnore
@RateLimiter(key = "#phonenumber", time = 60, count = 1)
@GetMapping("/sms/code")
public R<Void> smsCode(@NotBlank(message = "{user.phonenumber.not.blank}") String phonenumber) {
String key = DEVICE_SHARE_CODES_KEY + phonenumber;
String code = RandomUtil.randomNumbers(4);
RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
map.put("code", code);
SmsBlend smsBlend = SmsFactory.getSmsBlend("config1");
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, map);
if (!smsResponse.isSuccess()) {
return R.fail(smsResponse.getData().toString());
}
return R.ok();
}
}

View File

@ -0,0 +1,237 @@
package com.fuyuanshen.app.service;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuyuanshen.app.domain.AppPersonnelInfo;
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper;
import com.fuyuanshen.common.core.exception.ServiceException;
import com.fuyuanshen.common.core.utils.MapstructUtils;
import com.fuyuanshen.common.core.utils.ObjectUtils;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceType;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import com.fuyuanshen.equipment.domain.dto.AppDeviceSendMsgBo;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
import com.fuyuanshen.equipment.mapper.DeviceMapper;
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
import com.fuyuanshen.equipment.utils.c.ReliableTextToBitmap;
import com.fuyuanshen.system.mqtt.config.MqttGateway;
import com.fuyuanshen.system.mqtt.constants.MqttConstants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
@RequiredArgsConstructor
public class AppDeviceBizService {
private final APPDeviceMapper appDeviceMapper;
private final DeviceMapper deviceMapper;
private final AppPersonnelInfoMapper appPersonnelInfoMapper;
private final DeviceTypeMapper deviceTypeMapper;
private final MqttGateway mqttGateway;
public List<APPDeviceTypeVo> getTypeList() {
Long userId = AppLoginHelper.getUserId();
return appDeviceMapper.getTypeList(userId);
}
public void reName(APPReNameDTO reNameDTO) {
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", reNameDTO.getId())
.eq("binding_user_id", AppLoginHelper.getUserId())
.set("device_name", reNameDTO.getDeviceName());
deviceMapper.update(updateWrapper);
}
public int sendMessage(AppDeviceSendMsgBo bo) {
List<Long> deviceIds = bo.getDeviceIds();
if(deviceIds == null || deviceIds.isEmpty()){
throw new ServiceException("请选择设备");
}
for (Long deviceId : deviceIds){
Device deviceObj = deviceMapper.selectById(deviceId);
if(deviceObj==null) {
throw new ServiceException("设备不存在"+deviceId);
}
byte[] msg = ReliableTextToBitmap.textToBitmapBytes(bo.getSendMsg());
Map<String,Object> linkHashMap = new HashMap<>();
linkHashMap.put("message",msg);
String sendMsg = JSON.toJSONString(linkHashMap);
mqttGateway.sendMsgToMqtt(MqttConstants.GLOBAL_PUB_KEY+deviceObj.getDeviceImei(), 1 ,sendMsg);
log.info("发送设备消息:{}", bo.getSendMsg());
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", deviceId)
.eq("binding_user_id", AppLoginHelper.getUserId())
.set("send_msg", bo.getSendMsg());
deviceMapper.update(updateWrapper);
}
return 1;
}
public TableDataInfo<AppDeviceVo> queryAppDeviceList(DeviceQueryCriteria bo, PageQuery pageQuery) {
if (bo.getBindingUserId() == null) {
Long userId = AppLoginHelper.getUserId();
bo.setBindingUserId(userId);
}
Page<AppDeviceVo> result = deviceMapper.queryAppBindDeviceList(pageQuery.build(), bo);
return TableDataInfo.build(result);
}
public int bindDevice(AppDeviceBo bo) {
Integer mode = bo.getCommunicationMode();
Long userId = AppLoginHelper.getUserId();
if (mode == CommunicationModeEnum.FOUR_G.getValue()) {
String deviceImei = bo.getDeviceImei();
QueryWrapper<Device> qw = new QueryWrapper<Device>()
.eq("device_imei", deviceImei);
List<Device> devices = deviceMapper.selectList(qw);
if (devices.isEmpty()) {
throw new RuntimeException("请先将设备入库!!!");
}
Device device = devices.get(0);
if (device.getBindingStatus() != null && device.getBindingStatus() == BindingStatusEnum.BOUND.getCode()) {
throw new RuntimeException("设备已绑定");
}
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("id", device.getId())
.set("binding_status", BindingStatusEnum.BOUND.getCode())
.set("binding_user_id", userId)
.set("binding_time", new Date());
return deviceMapper.update(null, deviceUpdateWrapper);
} else if (mode == CommunicationModeEnum.BLUETOOTH.getValue()) {
String deviceMac = bo.getDeviceMac();
QueryWrapper<Device> qw = new QueryWrapper<Device>()
.eq("device_mac", deviceMac);
List<Device> devices = deviceMapper.selectList(qw);
if (devices.isEmpty()) {
throw new RuntimeException("请先将设备入库!!!");
}
Device device = devices.get(0);
if (device.getBindingStatus() != null && device.getBindingStatus() == BindingStatusEnum.BOUND.getCode()) {
throw new RuntimeException("设备已绑定");
}
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("id", device.getId())
.set("binding_status", BindingStatusEnum.BOUND.getCode())
.set("binding_user_id", userId)
.set("binding_time", new Date());
return deviceMapper.update(null, deviceUpdateWrapper);
} else {
throw new RuntimeException("通讯方式错误");
}
}
public int unBindDevice(Long id) {
Device device = deviceMapper.selectById(id);
if (device == null) {
throw new RuntimeException("请先将设备入库!!!");
}
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("id", device.getId())
.set("binding_status", BindingStatusEnum.UNBOUND.getCode())
.set("binding_user_id", null)
.set("binding_time", null);
return deviceMapper.update(null, deviceUpdateWrapper);
}
public AppDeviceDetailVo getInfo(Long id) {
Device device = deviceMapper.selectById(id);
if (device == null) {
throw new RuntimeException("请先将设备入库!!!");
}
AppDeviceDetailVo vo = new AppDeviceDetailVo();
vo.setDeviceId(device.getId());
vo.setDeviceName(device.getDeviceName());
vo.setDevicePic(device.getDevicePic());
vo.setDeviceImei(device.getDeviceImei());
vo.setDeviceMac(device.getDeviceMac());
vo.setDeviceStatus(device.getDeviceStatus());
DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
if(deviceType!=null){
vo.setCommunicationMode(Integer.valueOf(deviceType.getCommunicationMode()));
vo.setTypeName(deviceType.getTypeName());
}
vo.setBluetoothName(device.getBluetoothName());
vo.setSendMsg(device.getSendMsg());
QueryWrapper<AppPersonnelInfo> qw = new QueryWrapper<AppPersonnelInfo>()
.eq("device_id", device.getId());
AppPersonnelInfo appPersonnelInfo = appPersonnelInfoMapper.selectOne(qw);
if(appPersonnelInfo != null){
AppPersonnelInfoVo personnelInfoVo = MapstructUtils.convert(appPersonnelInfo, AppPersonnelInfoVo.class);
vo.setPersonnelInfo(personnelInfoVo);
}
return vo;
}
public boolean registerPersonInfo(AppPersonnelInfoBo bo) {
Long deviceId = bo.getDeviceId();
Device deviceObj = deviceMapper.selectById(deviceId);
if(deviceObj == null){
throw new RuntimeException("请先将设备入库!!!");
}
QueryWrapper<AppPersonnelInfo> qw = new QueryWrapper<AppPersonnelInfo>()
.eq("device_id", deviceId);
List<AppPersonnelInfoVo> appPersonnelInfoVos = appPersonnelInfoMapper.selectVoList(qw);
// unitName,position,name,id
byte[] unitName = ReliableTextToBitmap.textToBitmapBytes(bo.getUnitName());
byte[] position = ReliableTextToBitmap.textToBitmapBytes(bo.getPosition());
byte[] name = ReliableTextToBitmap.textToBitmapBytes(bo.getName());
byte[] id = ReliableTextToBitmap.textToBitmapBytes(bo.getCode());
Map<String,Object> linkHashMap = new HashMap<>();
linkHashMap.put("unitName",unitName);
linkHashMap.put("position",position);
linkHashMap.put("name",name);
linkHashMap.put("id",id);
String personnelInfo = JSON.toJSONString(linkHashMap);
mqttGateway.sendMsgToMqtt(MqttConstants.GLOBAL_PUB_KEY+deviceObj.getDeviceImei(), 1 ,personnelInfo);
log.info("发送点阵数据到设备消息:{}", bo);
if(ObjectUtils.length(appPersonnelInfoVos) == 0){
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
return appPersonnelInfoMapper.insertOrUpdate(appPersonnelInfo);
}else {
UpdateWrapper<AppPersonnelInfo> uw = new UpdateWrapper<>();
uw.eq("device_id", deviceId)
.set("name", bo.getName())
.set("position", bo.getPosition())
.set("unit_name", bo.getUnitName())
.set("code",bo.getCode());
return appPersonnelInfoMapper.update(null, uw)>0;
}
}
}

View File

@ -0,0 +1,135 @@
package com.fuyuanshen.app.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fuyuanshen.app.domain.AppDeviceShare;
import com.fuyuanshen.app.domain.AppPersonnelInfo;
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
import com.fuyuanshen.app.domain.vo.AppDeviceShareDetailVo;
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
import com.fuyuanshen.common.core.constant.Constants;
import com.fuyuanshen.common.core.constant.GlobalConstants;
import com.fuyuanshen.common.core.exception.ServiceException;
import com.fuyuanshen.common.core.exception.user.CaptchaExpireException;
import com.fuyuanshen.common.core.utils.MessageUtils;
import com.fuyuanshen.common.core.utils.StringUtils;
import com.fuyuanshen.common.redis.utils.RedisUtils;
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceType;
import com.fuyuanshen.equipment.mapper.DeviceMapper;
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@RequiredArgsConstructor
@Slf4j
@Service
public class AppDeviceShareService {
private final AppDeviceShareMapper appDeviceShareMapper;
private final DeviceMapper deviceMapper;
private final DeviceTypeMapper deviceTypeMapper;
private final AppPersonnelInfoMapper appPersonnelInfoMapper;
public AppDeviceShareDetailVo getInfo(Long id) {
LambdaQueryWrapper<AppDeviceShare> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AppDeviceShare::getDeviceId, id);
List<AppDeviceShareVo> appDeviceShareVos = appDeviceShareMapper.selectVoList(queryWrapper);
if(appDeviceShareVos==null || appDeviceShareVos.isEmpty()){
return null;
}
AppDeviceShareVo shareVo = appDeviceShareVos.get(0);
AppDeviceShareDetailVo shareDetailVo = new AppDeviceShareDetailVo();
shareDetailVo.setId(shareVo.getId());
shareDetailVo.setDeviceId(shareVo.getDeviceId());
shareDetailVo.setPhonenumber(shareVo.getPhonenumber());
shareDetailVo.setPermission(shareVo.getPermission());
Device device = deviceMapper.selectById(shareVo.getDeviceId());
shareDetailVo.setDeviceName(device.getDeviceName());
shareDetailVo.setDeviceImei(device.getDeviceImei());
shareDetailVo.setDeviceMac(device.getDeviceMac());
DeviceType deviceType = deviceTypeMapper.selectById(device.getDeviceType());
if(deviceType!=null){
shareDetailVo.setCommunicationMode(Integer.valueOf(deviceType.getCommunicationMode()));
}
shareDetailVo.setDevicePic(device.getDevicePic());
shareDetailVo.setTypeName(deviceType.getTypeName());
shareDetailVo.setBluetoothName(device.getBluetoothName());
shareDetailVo.setDeviceStatus(device.getDeviceStatus());
shareDetailVo.setSendMsg(device.getSendMsg());
LambdaQueryWrapper<AppPersonnelInfo> qw = new LambdaQueryWrapper<>();
qw.eq(AppPersonnelInfo::getDeviceId, device.getId());
List<AppPersonnelInfoVo> appPersonnelInfoVos = appPersonnelInfoMapper.selectVoList(qw);
if(appPersonnelInfoVos!=null && !appPersonnelInfoVos.isEmpty()){
shareDetailVo.setPersonnelInfo(appPersonnelInfoVos.get(0));
}
return shareDetailVo;
}
/**
* 校验短信验证码
*/
private boolean validateSmsCode(String tenantId, String phonenumber, String smsCode) {
String code = RedisUtils.getCacheObject(GlobalConstants.DEVICE_SHARE_CODES_KEY + phonenumber);
if (StringUtils.isBlank(code)) {
throw new ServiceException("验证码失效");
}
return code.equals(smsCode);
}
public int deviceShare(AppDeviceShareBo bo) {
boolean flag = validateSmsCode(AppLoginHelper.getTenantId(), bo.getPhonenumber(), bo.getSmsCode());
if(!flag){
throw new ServiceException("验证码错误");
}
Device device = deviceMapper.selectById(bo.getDeviceId());
if(device==null){
throw new ServiceException("设备不存在");
}
Long userId = AppLoginHelper.getUserId();
LambdaQueryWrapper<AppDeviceShare> lqw = new LambdaQueryWrapper<>();
lqw.eq(AppDeviceShare::getDeviceId, bo.getDeviceId());
lqw.eq(AppDeviceShare::getPhonenumber, bo.getPhonenumber());
Long count = appDeviceShareMapper.selectCount(lqw);
if(count>0){
UpdateWrapper<AppDeviceShare> uw = new UpdateWrapper<>();
uw.eq("device_id", bo.getDeviceId());
uw.eq("phonenumber", bo.getPhonenumber());
uw.set("permission", bo.getPermission());
uw.set("update_by", userId);
uw.set("update_time", new Date());
return appDeviceShareMapper.update(uw);
}else {
AppDeviceShare appDeviceShare = new AppDeviceShare();
appDeviceShare.setDeviceId(bo.getDeviceId());
appDeviceShare.setPhonenumber(bo.getPhonenumber());
appDeviceShare.setPermission(bo.getPermission());
appDeviceShare.setCreateBy(userId);
return appDeviceShareMapper.insert(appDeviceShare);
}
}
public int remove(Long[] ids) {
return appDeviceShareMapper.deleteByIds(Arrays.asList(ids));
}
}

View File

@ -63,11 +63,12 @@ public class CaptchaController {
String code = RandomUtil.randomNumbers(4);
RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
// 验证码模板id 自行处理 (查数据库或写死均可)
String templateId = "";
String templateId = "SMS_322180518";
LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
map.put("code", code);
SmsBlend smsBlend = SmsFactory.getSmsBlend("config1");
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, templateId, map);
// SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, templateId, map);
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, map);
if (!smsResponse.isSuccess()) {
log.error("验证码短信发送异常 => {}", smsResponse);
return R.fail(smsResponse.getData().toString());

View File

@ -303,6 +303,6 @@ mqtt:
password: #YtvpSfCNG
url: tcp://47.120.79.150:2883
subClientId: fys_subClient
subTopic: worker/alert/#,worker/location/#
pubTopic: worker/location
subTopic: A/#,worker/location/#
pubTopic: B/#
pubClientId: fys_pubClient

View File

@ -17,6 +17,11 @@ public interface GlobalConstants {
*/
String CAPTCHA_CODE_KEY = GLOBAL_REDIS_KEY + "captcha_codes:";
/**
* 设备分享验证码 redis key
*/
String DEVICE_SHARE_CODES_KEY = GLOBAL_REDIS_KEY + "device_share_codes:";
/**
* 防重提交 redis key
*/

View File

@ -0,0 +1,105 @@
//package com.fuyuanshen.app.controller;
//
//import java.util.List;
//
//import lombok.RequiredArgsConstructor;
//import jakarta.servlet.http.HttpServletResponse;
//import jakarta.validation.constraints.*;
//import cn.dev33.satoken.annotation.SaCheckPermission;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.validation.annotation.Validated;
//import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
//import com.fuyuanshen.common.log.annotation.Log;
//import com.fuyuanshen.common.web.core.BaseController;
//import com.fuyuanshen.common.mybatis.core.page.PageQuery;
//import com.fuyuanshen.common.core.domain.R;
//import com.fuyuanshen.common.core.validate.AddGroup;
//import com.fuyuanshen.common.core.validate.EditGroup;
//import com.fuyuanshen.common.log.enums.BusinessType;
//import com.fuyuanshen.common.excel.utils.ExcelUtil;
//import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
//import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
//import com.fuyuanshen.app.service.IAppDeviceShareService;
//import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
//
///**
// * 设备分享
// *
// * @author Lion Li
// * @date 2025-07-16
// */
//@Validated
//@RequiredArgsConstructor
//@RestController
//@RequestMapping("/app/deviceShare")
//public class AppDeviceShareController extends BaseController {
//
// private final IAppDeviceShareService appDeviceShareService;
//
// /**
// * 查询设备分享列表
// */
// @SaCheckPermission("app:deviceShare:list")
// @GetMapping("/list")
// public TableDataInfo<AppDeviceShareVo> list(AppDeviceShareBo bo, PageQuery pageQuery) {
// return appDeviceShareService.queryPageList(bo, pageQuery);
// }
//
// /**
// * 导出设备分享列表
// */
// @SaCheckPermission("app:deviceShare:export")
// @Log(title = "设备分享", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(AppDeviceShareBo bo, HttpServletResponse response) {
// List<AppDeviceShareVo> list = appDeviceShareService.queryList(bo);
// ExcelUtil.exportExcel(list, "设备分享", AppDeviceShareVo.class, response);
// }
//
// /**
// * 获取设备分享详细信息
// *
// * @param id 主键
// */
// @SaCheckPermission("app:deviceShare:query")
// @GetMapping("/{id}")
// public R<AppDeviceShareVo> getInfo(@NotNull(message = "主键不能为空")
// @PathVariable Long id) {
// return R.ok(appDeviceShareService.queryById(id));
// }
//
// /**
// * 新增设备分享
// */
// @SaCheckPermission("app:deviceShare:add")
// @Log(title = "设备分享", businessType = BusinessType.INSERT)
// @RepeatSubmit()
// @PostMapping()
// public R<Void> add(@Validated(AddGroup.class) @RequestBody AppDeviceShareBo bo) {
// return toAjax(appDeviceShareService.insertByBo(bo));
// }
//
// /**
// * 修改设备分享
// */
// @SaCheckPermission("app:deviceShare:edit")
// @Log(title = "设备分享", businessType = BusinessType.UPDATE)
// @RepeatSubmit()
// @PutMapping()
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody AppDeviceShareBo bo) {
// return toAjax(appDeviceShareService.updateByBo(bo));
// }
//
// /**
// * 删除设备分享
// *
// * @param ids 主键串
// */
// @SaCheckPermission("app:deviceShare:remove")
// @Log(title = "设备分享", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public R<Void> remove(@NotEmpty(message = "主键不能为空")
// @PathVariable Long[] ids) {
// return toAjax(appDeviceShareService.deleteWithValidByIds(List.of(ids), true));
// }
//}

View File

@ -3,7 +3,6 @@ package com.fuyuanshen.app.controller.equipment;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuyuanshen.app.domain.APPDevice;
import com.fuyuanshen.app.domain.APPDeviceType;
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
import com.fuyuanshen.app.service.equipment.APPDeviceService;
import com.fuyuanshen.common.core.domain.R;

View File

@ -0,0 +1,51 @@
package com.fuyuanshen.app.domain;
import com.fuyuanshen.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 设备分享对象 app_device_share
*
* @author Lion Li
* @date 2025-07-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("app_device_share")
public class AppDeviceShare extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 设备ID
*/
private Long deviceId;
/**
* 手机号
*/
private String phonenumber;
/**
* 功能权限1灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息
以逗号分隔
*/
private String permission;
/**
* 备注
*/
private String remark;
}

View File

@ -37,9 +37,9 @@ public class AppPersonnelInfo extends TenantEntity {
private String name;
/**
* 部门名称
* 职位
*/
private String deptName;
private String position;
/**
* 单位名称
@ -51,5 +51,6 @@ public class AppPersonnelInfo extends TenantEntity {
*/
private String sendMsg;
private String code;
}

View File

@ -0,0 +1,49 @@
package com.fuyuanshen.app.domain.bo;
import com.fuyuanshen.app.domain.AppDeviceShare;
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 设备分享业务对象 app_device_share
*
* @author Lion Li
* @date 2025-07-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = AppDeviceShare.class, reverseConvertGenerate = false)
public class AppDeviceShareBo extends BaseEntity {
/**
* 主键id
*/
private Long id;
/**
* 设备ID
*/
private Long deviceId;
/**
* 手机号
*/
private String phonenumber;
/**
* 功能权限1灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息
以逗号分隔
*/
private String permission;
/**
* 备注
*/
private String remark;
private String smsCode;
}

View File

@ -23,13 +23,11 @@ public class AppPersonnelInfoBo extends BaseEntity {
/**
* 主键
*/
@NotNull(message = "主键不能为空", groups = { AddGroup.class, EditGroup.class })
private Long id;
/**
* 设备id
*/
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long deviceId;
/**
@ -37,6 +35,11 @@ public class AppPersonnelInfoBo extends BaseEntity {
*/
private String name;
/**
* 职位
*/
private String position;
/**
* 部门名称
*/
@ -52,5 +55,8 @@ public class AppPersonnelInfoBo extends BaseEntity {
*/
private String sendMsg;
/**
* ID号
*/
private String code;
}

View File

@ -0,0 +1,77 @@
package com.fuyuanshen.app.domain.vo;
import cn.idev.excel.annotation.ExcelProperty;
import lombok.Data;
import java.io.Serial;
@Data
public class AppDeviceDetailVo {
@Serial
private static final long serialVersionUID = 1L;
/**
* 设备ID
*/
@ExcelProperty(value = "设备ID")
private Long deviceId;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String phonenumber;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备IMEI
*/
private String deviceImei;
/**
* 设备MAC
*/
private String deviceMac;
/**
* 通讯方式 0:4G;1:蓝牙
*/
private Integer communicationMode;
/**
* 设备图片
*/
private String devicePic;
/**
* 设备类型
*/
private String typeName;
/**
* 蓝牙名称
*/
private String bluetoothName;
/**
* 设备状态
* 0 失效
* 1 正常
*/
private Integer deviceStatus;
/**
* 人员信息
*/
private AppPersonnelInfoVo personnelInfo;
/**
* 发送信息
*/
private String sendMsg;
}

View File

@ -0,0 +1,107 @@
package com.fuyuanshen.app.domain.vo;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import com.fuyuanshen.app.domain.AppDeviceShare;
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 设备分享视图对象 app_device_share
*
* @author Lion Li
* @date 2025-07-16
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = AppDeviceShare.class)
public class AppDeviceShareDetailVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 设备ID
*/
@ExcelProperty(value = "设备ID")
private Long deviceId;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String phonenumber;
/**
* 功能权限1灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息
以逗号分隔
*/
@ExcelProperty(value = "功能权限", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息")
private String permission;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备IMEI
*/
private String deviceImei;
/**
* 设备MAC
*/
private String deviceMac;
/**
* 通讯方式 0:4G;1:蓝牙
*/
private Integer communicationMode;
/**
* 设备图片
*/
private String devicePic;
/**
* 设备类型
*/
private String typeName;
/**
* 蓝牙名称
*/
private String bluetoothName;
/**
* 设备状态
* 0 失效
* 1 正常
*/
private Integer deviceStatus;
/**
* 人员信息
*/
private AppPersonnelInfoVo personnelInfo;
/**
* 发送信息
*/
private String sendMsg;
}

View File

@ -0,0 +1,76 @@
package com.fuyuanshen.app.domain.vo;
import com.fuyuanshen.app.domain.AppDeviceShare;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 设备分享视图对象 app_device_share
*
* @author Lion Li
* @date 2025-07-16
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = AppDeviceShare.class)
public class AppDeviceShareVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@ExcelProperty(value = "主键id")
private Long id;
/**
* 设备ID
*/
@ExcelProperty(value = "设备ID")
private Long deviceId;
/**
* 设备IMEI
*/
private String deviceImei;
/**
* 设备名称
*/
@ExcelProperty(value = "设备名称")
private String deviceName;
/**
* 手机号
*/
@ExcelProperty(value = "手机号")
private String phonenumber;
/**
* 功能权限1灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息
以逗号分隔
*/
@ExcelProperty(value = "功能权限", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "1=灯光模式2激光模式3开机画面4人员信息登记5发送信息6产品信息")
private String permission;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
// 设备图片
private String devicePic;
}

View File

@ -47,10 +47,10 @@ public class AppPersonnelInfoVo implements Serializable {
private String name;
/**
* 部门名称
* 岗位
*/
@ExcelProperty(value = "部门名称")
private String deptName;
@ExcelProperty(value = "岗位")
private String position;
/**
* 单位名称
@ -59,10 +59,10 @@ public class AppPersonnelInfoVo implements Serializable {
private String unitName;
/**
* 发送信息
* ID号
*/
@ExcelProperty(value = "发送信息")
private String sendMsg;
@ExcelProperty(value = "ID号")
private String code;
}

View File

@ -0,0 +1,19 @@
package com.fuyuanshen.app.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuyuanshen.app.domain.AppDeviceShare;
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
/**
* 设备分享Mapper接口
*
* @author Lion Li
* @date 2025-07-16
*/
public interface AppDeviceShareMapper extends BaseMapperPlus<AppDeviceShare, AppDeviceShareVo> {
IPage<AppDeviceShareVo> otherDeviceShareList(@Param("bo") AppDeviceShareBo bo, Page<AppDeviceShareVo> page);
}

View File

@ -0,0 +1,70 @@
package com.fuyuanshen.app.service;
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 设备分享Service接口
*
* @author Lion Li
* @date 2025-07-16
*/
public interface IAppDeviceShareService {
/**
* 查询设备分享
*
* @param id 主键
* @return 设备分享
*/
AppDeviceShareVo queryById(Long id);
/**
* 分页查询设备分享列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备分享分页列表
*/
TableDataInfo<AppDeviceShareVo> queryPageList(AppDeviceShareBo bo, PageQuery pageQuery);
/**
* 查询符合条件的设备分享列表
*
* @param bo 查询条件
* @return 设备分享列表
*/
List<AppDeviceShareVo> queryList(AppDeviceShareBo bo);
/**
* 新增设备分享
*
* @param bo 设备分享
* @return 是否新增成功
*/
Boolean insertByBo(AppDeviceShareBo bo);
/**
* 修改设备分享
*
* @param bo 设备分享
* @return 是否修改成功
*/
Boolean updateByBo(AppDeviceShareBo bo);
/**
* 校验并批量删除设备分享信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
TableDataInfo<AppDeviceShareVo> otherDeviceShareList(AppDeviceShareBo bo, PageQuery pageQuery);
}

View File

@ -4,6 +4,7 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import java.util.Collection;
import java.util.List;
@ -65,4 +66,6 @@ public interface IAppPersonnelInfoService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
boolean registerPersonInfo(AppPersonnelInfoBo bo);
}

View File

@ -8,7 +8,9 @@ import com.fuyuanshen.app.domain.dto.APPReNameDTO;
import com.fuyuanshen.app.domain.dto.APPUnbindDTO;
import com.fuyuanshen.app.domain.query.APPDeviceQueryCriteria;
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import java.util.List;
@ -73,4 +75,5 @@ public interface APPDeviceService extends IService<APPDevice> {
TableDataInfo<APPDevice> queryAppDeviceList(DeviceQueryCriteria criteria);
int sendMessage(AppDeviceBo bo);
}

View File

@ -0,0 +1,169 @@
package com.fuyuanshen.app.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuyuanshen.common.core.utils.MapstructUtils;
import com.fuyuanshen.common.core.utils.StringUtils;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.mapper.DeviceMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.fuyuanshen.app.domain.bo.AppDeviceShareBo;
import com.fuyuanshen.app.domain.vo.AppDeviceShareVo;
import com.fuyuanshen.app.domain.AppDeviceShare;
import com.fuyuanshen.app.mapper.AppDeviceShareMapper;
import com.fuyuanshen.app.service.IAppDeviceShareService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 设备分享Service业务层处理
*
* @author Lion Li
* @date 2025-07-16
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class AppDeviceShareServiceImpl implements IAppDeviceShareService {
private final AppDeviceShareMapper baseMapper;
private final DeviceMapper deviceMapper;
/**
* 查询设备分享
*
* @param id 主键
* @return 设备分享
*/
@Override
public AppDeviceShareVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询设备分享列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 设备分享分页列表
*/
@Override
public TableDataInfo<AppDeviceShareVo> queryPageList(AppDeviceShareBo bo, PageQuery pageQuery) {
Long userId = AppLoginHelper.getUserId();
bo.setCreateBy(userId);
LambdaQueryWrapper<AppDeviceShare> lqw = buildQueryWrapper(bo);
Page<AppDeviceShareVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
List<AppDeviceShareVo> records = result.getRecords();
records.forEach(r -> {
Device device = deviceMapper.selectById(r.getDeviceId());
if(device != null){
r.setDevicePic(device.getDevicePic());
r.setDeviceName(device.getDeviceName());
r.setDeviceImei(device.getDeviceImei());
}
});
return TableDataInfo.build(result);
}
/**
* 查询符合条件的设备分享列表
*
* @param bo 查询条件
* @return 设备分享列表
*/
@Override
public List<AppDeviceShareVo> queryList(AppDeviceShareBo bo) {
LambdaQueryWrapper<AppDeviceShare> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<AppDeviceShare> buildQueryWrapper(AppDeviceShareBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<AppDeviceShare> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getDeviceId() != null, AppDeviceShare::getDeviceId, bo.getDeviceId());
lqw.eq(StringUtils.isNotBlank(bo.getPhonenumber()), AppDeviceShare::getPhonenumber, bo.getPhonenumber());
lqw.eq(StringUtils.isNotBlank(bo.getPermission()), AppDeviceShare::getPermission, bo.getPermission());
lqw.eq(bo.getCreateBy()!=null, AppDeviceShare::getCreateBy, bo.getCreateBy());
return lqw;
}
/**
* 新增设备分享
*
* @param bo 设备分享
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(AppDeviceShareBo bo) {
AppDeviceShare add = MapstructUtils.convert(bo, AppDeviceShare.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改设备分享
*
* @param bo 设备分享
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(AppDeviceShareBo bo) {
AppDeviceShare update = MapstructUtils.convert(bo, AppDeviceShare.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(AppDeviceShare entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除设备分享信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public TableDataInfo<AppDeviceShareVo> otherDeviceShareList(AppDeviceShareBo bo, PageQuery pageQuery) {
String username = AppLoginHelper.getUsername();
bo.setPhonenumber(username);
Page<AppDeviceShareVo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
IPage<AppDeviceShareVo> result = baseMapper.otherDeviceShareList(bo, page);
List<AppDeviceShareVo> records = result.getRecords();
records.forEach(r -> {
Device device = deviceMapper.selectById(r.getDeviceId());
if(device != null){
r.setDevicePic(device.getDevicePic());
r.setDeviceName(device.getDeviceName());
r.setDeviceImei(device.getDeviceImei());
}
});
return TableDataInfo.build(result);
}
}

View File

@ -1,5 +1,6 @@
package com.fuyuanshen.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fuyuanshen.common.core.utils.MapstructUtils;
import com.fuyuanshen.common.core.utils.StringUtils;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
@ -7,6 +8,8 @@ import com.fuyuanshen.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -75,7 +78,6 @@ public class AppPersonnelInfoServiceImpl implements IAppPersonnelInfoService {
LambdaQueryWrapper<AppPersonnelInfo> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getDeviceId() != null, AppPersonnelInfo::getDeviceId, bo.getDeviceId());
lqw.like(StringUtils.isNotBlank(bo.getName()), AppPersonnelInfo::getName, bo.getName());
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), AppPersonnelInfo::getDeptName, bo.getDeptName());
lqw.like(StringUtils.isNotBlank(bo.getUnitName()), AppPersonnelInfo::getUnitName, bo.getUnitName());
lqw.eq(StringUtils.isNotBlank(bo.getSendMsg()), AppPersonnelInfo::getSendMsg, bo.getSendMsg());
return lqw;
@ -132,4 +134,13 @@ public class AppPersonnelInfoServiceImpl implements IAppPersonnelInfoService {
}
return baseMapper.deleteByIds(ids) > 0;
}
@Override
public boolean registerPersonInfo(AppPersonnelInfoBo bo) {
AppPersonnelInfo appPersonnelInfo = MapstructUtils.convert(bo, AppPersonnelInfo.class);
return baseMapper.insertOrUpdate(appPersonnelInfo);
}
}

View File

@ -23,8 +23,8 @@ import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
import com.fuyuanshen.common.satoken.utils.LoginHelper;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceType;
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
import com.fuyuanshen.equipment.mapper.DeviceMapper;
@ -227,5 +227,14 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
return null;
}
@Override
public int sendMessage(AppDeviceBo bo) {
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", bo.getDeviceId())
.eq("binding_user_id", AppLoginHelper.getUserId())
.set("send_msg", bo.getSendMsg());
return deviceMapper.update(updateWrapper);
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuyuanshen.app.mapper.AppDeviceShareMapper">
<select id="otherDeviceShareList" resultType="com.fuyuanshen.app.domain.vo.AppDeviceShareVo">
SELECT * FROM app_device_share a where a.phonenumber = #{bo.phonenumber}
</select>
</mapper>

View File

@ -92,7 +92,7 @@ public class Customer extends TenantEntity {
/**
* 帐号状态0正常 1停用
*/
private String status;
private String status = "0";
/**
* 删除标志0代表存在 1代表删除

View File

@ -1,9 +1,11 @@
package com.fuyuanshen.customer.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuyuanshen.common.core.domain.model.LoginUser;
import com.fuyuanshen.common.core.utils.StringUtils;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.satoken.utils.LoginHelper;
import com.fuyuanshen.customer.constant.ArrayConstants;
@ -92,6 +94,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
}
customer.setUserLevel((byte) (loginUser.getUserLevel() + 1));
customer.setPid(loginUser.getUserId());
customer.setStatus("0");
save(customer);
@ -106,18 +109,40 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
/**
* 修改客户
* 不是因为寂寞才想你,只是因为想你才寂寞。
*
* @param resources /
* @param customer /
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateCustomer(Customer resources) throws Exception {
if (resources.getEnabled()) {
resources.setStatus("0");
} else {
resources.setStatus("1");
public void updateCustomer(Customer customer) throws Exception {
UserQueryCriteria userQueryCriteria = new UserQueryCriteria();
if (StringUtils.isNotEmpty(customer.getUserName())) {
userQueryCriteria.setCustomerName(customer.getUserName());
List<Customer> customers = customerMapper.queryCustomers(userQueryCriteria);
if (!customers.isEmpty()) {
throw new BadRequestException("用户名已存在!!!");
}
saveOrUpdate(resources);
}
if (customer.getEnabled()) {
customer.setStatus("0");
} else {
// 强制下线
// StpUtil.logout(customer.getCustomerId());
// StpUtil.kickout(customer.getCustomerId());
customer.setStatus("1");
// 检查目标用户是否有有效的登录状态
if (StpUtil.isLogin(customer.getCustomerId())) {
// 用户已登录,可以执行踢出操作
StpUtil.kickout(customer.getCustomerId());
} else {
// 用户未登录,无法踢出
System.out.println("目标用户未登录,无法执行踢出操作");
}
}
saveOrUpdate(customer);
}

View File

@ -21,6 +21,9 @@ import java.util.Date;
@JsonInclude(JsonInclude.Include.ALWAYS) // 关键注解
public class Device extends TenantEntity {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
@Schema(name = "ID")
private Long id;
@ -29,6 +32,9 @@ public class Device extends TenantEntity {
@TableField(exist = false)
private Long assignId;
/**
* device_type
*/
@Schema(name = "设备类型")
private Long deviceType;
@ -99,9 +105,6 @@ public class Device extends TenantEntity {
@Schema(name = "设备状态")
private Integer deviceStatus;
/**
* 绑定状态
* 0 未绑定
@ -117,5 +120,23 @@ public class Device extends TenantEntity {
private Long bindingUserId;
/**
* 绑定时间
*/
private Date bindingTime;
private String sendMsg;
/**
* 发布主题格式A/{device_id}
* pub_topic
*/
private String pubTopic;
/**
* 订阅主题格式B/{device_id}
* sub_topic
*/
private String subTopic;
}

View File

@ -25,6 +25,7 @@ public class DeviceAssignments extends TenantEntity {
/**
* 设备id
* device_id
*/
private Long deviceId;

View File

@ -28,4 +28,7 @@ public class AppDeviceBo {
@NotNull(message = "通讯方式不能为空", groups = { EditGroup.class })
private Integer communicationMode;
private String sendMsg;
private Long deviceId;
}

View File

@ -0,0 +1,16 @@
package com.fuyuanshen.equipment.domain.dto;
import lombok.Data;
import java.util.List;
/**
* 绑定设备参数
*/
@Data
public class AppDeviceSendMsgBo {
private String sendMsg;
private List<Long> deviceIds;
}

View File

@ -58,7 +58,9 @@ public class DeviceExcelImportDTO {
private String remark;
@ExcelProperty("设备类型名称")
@ColumnWidth(20)
private String typeName;
@ExcelProperty("蓝牙名称")
private String bluetoothName;
}

View File

@ -1,10 +1,12 @@
package com.fuyuanshen.equipment.domain.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class AppDeviceVo {
public class AppDeviceVo implements Serializable {
private Long id;
@ -49,4 +51,10 @@ public class AppDeviceVo {
* 1 正常
*/
private Integer deviceStatus;
/**
* 绑定时间
*/
private Date bindingTime;
}

View File

@ -85,6 +85,14 @@ public interface DeviceService extends IService<Device> {
*/
void unbindDevice(DeviceForm deviceForm);
/**
* WEB端查看APP客户设备绑定
*
* @param bo
* @param pageQuery
* @return
*/
TableDataInfo<AppDeviceVo> queryAppDeviceList(DeviceQueryCriteria bo, PageQuery pageQuery);
int bindDevice(AppDeviceBo bo);

View File

@ -44,7 +44,6 @@ import com.fuyuanshen.system.domain.vo.SysOssVo;
import com.fuyuanshen.system.service.ISysOssService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -101,6 +100,12 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
public TableDataInfo<Device> queryAll(DeviceQueryCriteria criteria, Page<Device> page) throws IOException {
criteria.setCurrentOwnerId(LoginHelper.getUserId());
if (criteria.getDeviceType() != null) {
DeviceTypeGrants deviceTypeGrant = deviceTypeGrantsMapper.selectById(criteria.getDeviceType());
if (deviceTypeGrant != null) {
criteria.setDeviceType(deviceTypeGrant.getDeviceTypeId());
}
}
IPage<Device> devices = deviceMapper.findAll(criteria, page);
List<Device> records = devices.getRecords();
@ -142,6 +147,16 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Override
@Transactional(rollbackFor = Exception.class)
public void addDevice(DeviceForm deviceForm) throws Exception {
Device device1 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_mac", deviceForm.getDeviceMac()));
if (device1 != null) {
throw new BadRequestException("设备MAC已存在");
}
Device device2 = deviceMapper.selectOne(new QueryWrapper<Device>().eq("device_imei", deviceForm.getDeviceImei()));
if (device2 != null) {
throw new BadRequestException("设备IMEI已存在");
}
DeviceTypeQueryCriteria queryCriteria = new DeviceTypeQueryCriteria();
queryCriteria.setDeviceTypeId(deviceForm.getDeviceType());
queryCriteria.setCustomerId(LoginHelper.getUserId());
@ -171,6 +186,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
device.setCreateByName(loginUser.getNickname());
device.setTypeName(deviceTypes.getTypeName());
device.setDeviceType(deviceTypes.getId());
if (device.getDeviceImei() != null) {
device.setPubTopic("A/" + device.getDeviceImei());
device.setSubTopic("B/" + device.getDeviceImei());
}
deviceMapper.insert(device);
@ -278,14 +297,18 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
for (Long id : ids) {
DeviceAssignments deviceAssignment = deviceAssignmentsMapper.selectById(id);
Device deviceType = deviceMapper.selectById(deviceAssignment.getDeviceId());
Device device = deviceMapper.selectById(deviceAssignment.getDeviceId());
if (StringUtils.isNotEmpty(deviceAssignment.getAssigneeName())) {
throw new BadRequestException(deviceType.getDeviceName() + ":设备已分配,请先解绑设备!!!");
throw new BadRequestException(device.getDeviceName() + ":设备已分配,请先解绑设备!!!");
}
if (device.getBindingStatus().equals(1)){
throw new BadRequestException(device.getDeviceName() + ":设备已绑定,请先解绑设备!!!");
}
// 接收者
if (Objects.equals(deviceAssignment.getAssigneeId(), deviceType.getOriginalOwnerId())) {
if (Objects.equals(deviceAssignment.getAssigneeId(), device.getOriginalOwnerId())) {
invalidIds.add(deviceAssignment.getDeviceId());
}
@ -455,7 +478,13 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
}
/**
* WEB端查看APP客户设备绑定
*
* @param bo
* @param pageQuery
* @return
*/
@Override
public TableDataInfo<AppDeviceVo> queryAppDeviceList(DeviceQueryCriteria bo, PageQuery pageQuery) {
if (bo.getBindingUserId() == null) {

View File

@ -1,6 +1,8 @@
package com.fuyuanshen.equipment.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -10,11 +12,13 @@ import com.fuyuanshen.common.core.utils.PageUtil;
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
import com.fuyuanshen.common.satoken.utils.LoginHelper;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.DeviceAssignments;
import com.fuyuanshen.equipment.domain.DeviceType;
import com.fuyuanshen.equipment.domain.DeviceTypeGrants;
import com.fuyuanshen.equipment.domain.form.DeviceTypeForm;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
import com.fuyuanshen.equipment.mapper.DeviceMapper;
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
@ -41,6 +45,7 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
private final DeviceMapper deviceMapper;
private final DeviceTypeGrantsMapper deviceTypeGrantsMapper;
private final DeviceAssignmentsMapper deviceAssignmentsMapper;
/**
@ -155,30 +160,33 @@ public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceT
@Transactional(rollbackFor = Exception.class)
public void deleteAll(List<Long> ids) {
List<Long> deviceTypeId = new ArrayList<>();
for (Long id : ids) {
DeviceTypeGrants deviceTypeGrant = deviceTypeGrantsMapper.selectById(id);
// List<DeviceTypeGrants> deviceTypeGrants = deviceTypeGrantsMapper.selectList(new QueryWrapper<DeviceTypeGrants>()
// .eq("device_type_id", deviceTypeGrant.getDeviceTypeId()));
// List<DeviceTypeGrants> deviceAssignments = deviceTypeGrantsMapper.selectList(new QueryWrapper<DeviceTypeGrants>()
// .eq("device_id", deviceTypeGrant.getDeviceTypeId()));
// if (CollectionUtil.isNotEmpty(deviceAssignments)) {
// throw new RuntimeException("该设备类型已绑定设备,无法删除");
// }
// Device device = deviceMapper.selectById(deviceTypeGrant.getDeviceTypeId());
List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>()
.eq("device_type", deviceTypeGrant.getDeviceTypeId()));
if (CollectionUtil.isNotEmpty(devices)) {
throw new RuntimeException("该设备类型已绑定设备,无法删除!!!");
}
deviceTypeId.add(deviceTypeGrant.getDeviceTypeId());
}
deviceTypeGrantsMapper.deleteByIds(ids);
//
// List<Long> invalidIds = new ArrayList<>();
// List<Long> invalidId2 = new ArrayList<>();
// for (Long id : ids) {
// DeviceType deviceType = deviceTypeMapper.selectById(id);
// if (deviceType == null || !Objects.equals(deviceType.getOwnerCustomerId(), LoginHelper.getUserId())) {
// invalidIds.add(id);
// }
// DeviceQueryCriteria deviceQueryCriteria = new DeviceQueryCriteria();
// deviceQueryCriteria.setDeviceType(id);
// List<Device> devices = deviceMapper.findAll(deviceQueryCriteria);
// if (!devices.isEmpty()) {
// invalidId2.add(id);
// }
// }
// if (!invalidIds.isEmpty()) {
// throw new RuntimeException("以下设备类型无法删除ID 不存在或无权限): " + invalidIds);
// }
// if (!invalidId2.isEmpty()) {
// throw new RuntimeException("以下设备类型无法删除(已绑定设备): " + invalidId2);
// }
//
// deviceTypeMapper.deleteByIds(ids);
deviceTypeMapper.deleteByIds(deviceTypeId);
}

View File

@ -38,13 +38,19 @@
<!-- 分页查询设备 -->
<select id="findAll" resultType="com.fuyuanshen.equipment.domain.Device">
select
SELECT *
FROM (
SELECT
da.id AS id, d.device_name, d.bluetooth_name,
d.device_pic, d.device_mac, d.device_sn, d.update_by,d.device_imei,
d.update_time, dg.id AS device_type, d.remark, d.binding_status,t.type_name AS typeName,
da.assignee_id AS customerId, da.assignee_name AS customerName, da.active AS deviceStatus,
da.create_time AS create_time , da.assigner_name AS createByName , da.id AS assignId
from device d
d.pub_topic, d.sub_topic, d.device_pic,
d.device_mac, d.device_sn, d.update_by,
d.device_imei, d.update_time, dg.id AS device_type,
d.remark, d.binding_status, t.type_name AS typeName,
da.assignee_id AS customerId, da.assignee_name AS customerName,
da.active AS deviceStatus, da.create_time AS create_time,
da.assigner_name AS createByName, da.id AS assignId,
ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY da.create_time DESC) AS rn
FROM device d
LEFT JOIN device_type t ON d.device_type = t.id
LEFT JOIN device_type_grants dg ON dg.device_type_id = t.id
LEFT JOIN device_assignments da ON da.device_id = d.id
@ -71,9 +77,12 @@
AND da.assignee_id = #{criteria.currentOwnerId}
AND dg.customer_id = #{criteria.currentOwnerId}
</where>
ORDER BY da.create_time DESC
) AS ranked
WHERE rn = 1
ORDER BY create_time DESC
</select>
<select id="findAllDevices" resultType="com.fuyuanshen.equipment.domain.Device">
select
d.id, d.customer_id, d.device_name,d.bluetooth_name,
@ -138,7 +147,8 @@
d.device_pic,
dt.type_name,
dt.communication_mode,
d.bluetooth_name
d.bluetooth_name,
d.binding_time
from device d
inner join device_type dt on d.device_type = dt.id
where d.binding_user_id = #{criteria.bindingUserId}

View File

@ -44,7 +44,7 @@ public class MqttOutboundConfiguration {
mqttPahoClientFactory
);
mqttPahoMessageHandler.setDefaultQos(1);
mqttPahoMessageHandler.setDefaultTopic("worker/location");
mqttPahoMessageHandler.setDefaultTopic("B/#");
mqttPahoMessageHandler.setAsync(true);
return mqttPahoMessageHandler;
}

View File

@ -0,0 +1,16 @@
package com.fuyuanshen.system.mqtt.constants;
public interface MqttConstants {
/**
* 全局发布消息的key
*/
String GLOBAL_PUB_KEY = "B/";
/**
* 全局订阅消息的key
*/
String GLOBAL_SUB_KEY = "A/";
}

View File

@ -27,5 +27,6 @@ public class ReceiverMessageHandler implements MessageHandler {
String timestamp = Objects.requireNonNull(headers.get("timestamp")).toString();
log.info("MQTT payload= {} \n receivedTopic = {} \n receivedQos = {} \n timestamp = {}"
,payload,receivedTopic,receivedQos,timestamp);
}
}

16
pom.xml
View File

@ -83,10 +83,10 @@
<monitor.username>fys</monitor.username>
<monitor.password>123456</monitor.password>
</properties>
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
<!-- <activation> -->
<!-- &lt;!&ndash; 默认环境 &ndash;&gt; -->
<!-- <activeByDefault>true</activeByDefault> -->
<!-- </activation> -->
</profile>
<profile>
<id>prod</id>
@ -96,10 +96,10 @@
<monitor.username>fys</monitor.username>
<monitor.password>123456</monitor.password>
</properties>
<!-- <activation> -->
<!-- &lt;!&ndash; 默认环境 &ndash;&gt; -->
<!-- <activeByDefault>true</activeByDefault> -->
<!-- </activation> -->
<activation>
<!-- 默认环境 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>