app 修改bug

This commit is contained in:
2025-07-08 18:32:47 +08:00
parent 1cbaa5795c
commit e7a860ef16
8 changed files with 117 additions and 6 deletions

View File

@ -108,6 +108,9 @@ public class Device extends BaseEntity implements Serializable {
@ApiModelProperty(value = "绑定状态")
private Integer bindingStatus;
@ApiModelProperty(value = "通讯方式", example = "0:4G;1:蓝牙")
private Integer communicationMode;
public void copy(Device source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fuyuanshen.base.BaseEntity;
import com.fuyuanshen.modules.system.domain.Device;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@ -100,6 +101,8 @@ public class APPDevice extends BaseEntity implements Serializable {
@ApiModelProperty(value = "绑定类型")
private Integer bindingType;
@Schema(name = "通讯方式", example = "0:4G;1:蓝牙")
private String communicationMode;
public void copy(Device source) {
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));

View File

@ -86,6 +86,7 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
List<Device> devices = new ArrayList<>();
if (criteria.getCommunicationMode().equals(CommunicationModeEnum.BLUETOOTH.getValue())) {
devices = deviceMapper.selectList(new QueryWrapper<Device>().eq("device_mac", criteria.getDeviceMac()));
if (CollectionUtil.isEmpty(devices)) {
@ -109,8 +110,9 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
throw new BadRequestException("该设备已绑定!!!");
}
}
Device device = devices.get(0);
device.setCommunicationMode(criteria.getCommunicationMode());
device.setBindingStatus(BindingStatusEnum.BOUND.getCode());
deviceMapper.updateById(device);
@ -171,6 +173,9 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
}
queryWrapper.eq("binding_type", UserType.APP.getValue());
APPDevice appDevice = appDeviceMapper.selectOne(queryWrapper);
if (appDevice == null) {
throw new BadRequestException("设备不存在!!!");
}
appDeviceMapper.delete(queryWrapper);
List<Device> devices = deviceMapper.selectList(qw);
@ -186,5 +191,4 @@ public class APPDeviceServiceImpl extends ServiceImpl<APPDeviceMapper, APPDevice
deviceMapper.updateById(device);
}
}

View File

@ -149,11 +149,12 @@ file:
logging:
level:
com.fuyuanshen: debug
# MQTT配置
mqtt:
username: admin
password: fys123456
url: tcp://127.0.0.1:1883
url: tcp://47.107.152.87:1883
subClientId: wuLang_subClient_01
subTopic: worker/alert/#,worker/location/#
pubTopic: worker/location

View File

@ -155,3 +155,14 @@ file:
pic: /home/eladmin/app_avatar/ #设备图片存储路径
#ip: http://fuyuanshen.com:81/ #服务器地址
ip: https://fuyuanshen.com/ #服务器地址
# MQTT配置
mqtt:
username: admin
password: fys123456
url: tcp://47.107.152.87:1883
subClientId: wuLang_subClient_01
subTopic: worker/alert/#,worker/location/#
pubTopic: worker/location
pubClientId: wuLang_pubClient_01

View File

@ -34,7 +34,7 @@ spring:
check-template-location: false
profiles:
# 激活的环境,如果需要 quartz 分布式支持,需要修改 active: dev,quartz
active: dev
active: prod
data:
redis:
repositories:

View File

@ -21,7 +21,7 @@
<!-- APP用户设备列表 -->
<select id="appDeviceList" resultType="com.fuyuanshen.modules.system.domain.app.APPDevice">
select d.* from app_device as d
select d.* ,d.app_device_id AS id from app_device as d
<where>
<!-- 时间范围等其他条件保持原样 -->
<if test="criteria.deviceName != null and criteria.deviceName.trim() != ''">
@ -87,5 +87,4 @@
order by d.create_time desc
</select>
</mapper>