WEB端解绑设备
This commit is contained in:
@ -41,7 +41,6 @@ public class AppDeviceController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<AppDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
public TableDataInfo<AppDeviceVo> list(DeviceQueryCriteria bo, PageQuery pageQuery) {
|
||||||
|
|
||||||
return appDeviceService.queryAppDeviceList(bo,pageQuery);
|
return appDeviceService.queryAppDeviceList(bo,pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,12 @@ public class AppDeviceBizService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int unBindDevice(Long id) {
|
public int unBindDevice(Long id) {
|
||||||
|
return unBindDevice(id, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int unBindDevice(Long id, Long userId) {
|
||||||
Device device = deviceMapper.selectById(id);
|
Device device = deviceMapper.selectById(id);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
throw new RuntimeException("请先将设备入库!!!");
|
throw new RuntimeException("请先将设备入库!!!");
|
||||||
@ -216,7 +221,9 @@ public class AppDeviceBizService {
|
|||||||
.set("binding_time", null);
|
.set("binding_time", null);
|
||||||
deviceMapper.update(null, deviceUpdateWrapper);
|
deviceMapper.update(null, deviceUpdateWrapper);
|
||||||
|
|
||||||
Long userId = AppLoginHelper.getUserId();
|
if (userId == null){
|
||||||
|
userId = AppLoginHelper.getUserId();
|
||||||
|
}
|
||||||
QueryWrapper<AppDeviceBindRecord> bindRecordQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<AppDeviceBindRecord> bindRecordQueryWrapper = new QueryWrapper<>();
|
||||||
bindRecordQueryWrapper.eq("device_id", device.getId());
|
bindRecordQueryWrapper.eq("device_id", device.getId());
|
||||||
bindRecordQueryWrapper.eq("binding_user_id", userId);
|
bindRecordQueryWrapper.eq("binding_user_id", userId);
|
||||||
@ -228,6 +235,7 @@ public class AppDeviceBizService {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AppDeviceDetailVo getInfo(Long id) {
|
public AppDeviceDetailVo getInfo(Long id) {
|
||||||
Device device = deviceMapper.selectById(id);
|
Device device = deviceMapper.selectById(id);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
|
@ -2,7 +2,7 @@ package com.fuyuanshen.global.mqtt.rule;
|
|||||||
|
|
||||||
import com.fuyuanshen.common.json.utils.JsonUtils;
|
import com.fuyuanshen.common.json.utils.JsonUtils;
|
||||||
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||||
import com.fuyuanshen.equipment.utils.c.map.GetAddressFromLatUtil;
|
import com.fuyuanshen.equipment.utils.map.GetAddressFromLatUtil;
|
||||||
import com.fuyuanshen.global.mqtt.base.MqttMessageRule;
|
import com.fuyuanshen.global.mqtt.base.MqttMessageRule;
|
||||||
import com.fuyuanshen.global.mqtt.base.MqttRuleContext;
|
import com.fuyuanshen.global.mqtt.base.MqttRuleContext;
|
||||||
import com.fuyuanshen.global.mqtt.config.MqttGateway;
|
import com.fuyuanshen.global.mqtt.config.MqttGateway;
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.fuyuanshen.web.controller.device;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
||||||
|
import com.fuyuanshen.common.core.utils.file.FileUtil;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||||
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
|
import com.fuyuanshen.customer.mapper.CustomerMapper;
|
||||||
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
|
import com.fuyuanshen.equipment.domain.dto.DeviceExcelImportDTO;
|
||||||
|
import com.fuyuanshen.equipment.domain.dto.ImportResult;
|
||||||
|
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||||
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||||
|
import com.fuyuanshen.equipment.excel.DeviceImportParams;
|
||||||
|
import com.fuyuanshen.equipment.excel.UploadDeviceDataListener;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
|
||||||
|
import com.fuyuanshen.equipment.service.DeviceTypeService;
|
||||||
|
import com.fuyuanshen.equipment.service.impl.DeviceExportService;
|
||||||
|
import com.fuyuanshen.system.service.ISysOssService;
|
||||||
|
import com.fuyuanshen.web.service.WEBDeviceService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.undertow.util.BadRequestException;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: WY
|
||||||
|
* @Date: 2025/5/16
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "web:设备管理", description = "web:设备管理")
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/device")
|
||||||
|
public class WEBDeviceController extends BaseController {
|
||||||
|
|
||||||
|
private final WEBDeviceService deviceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
* @ModelAttribute 主要用于将请求参数绑定到 Java 对象上,它会从 HTTP 请求的查询参数(Query Parameters)
|
||||||
|
* 或表单数据(Form Data)中提取值,并自动填充到指定的对象属性中。
|
||||||
|
*/
|
||||||
|
// @Log("解绑设备")
|
||||||
|
@Operation(summary = "WEB端解绑设备")
|
||||||
|
@DeleteMapping(value = "/unbind")
|
||||||
|
public R<Void> unbindDevice(Long id, Long userId) {
|
||||||
|
return toAjax(deviceService.webUnBindDevice(id, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.fuyuanshen.web.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import com.fuyuanshen.equipment.domain.Device;
|
||||||
|
import com.fuyuanshen.equipment.domain.dto.AppDeviceBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||||
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: WY
|
||||||
|
* @Date: 2025/5/16
|
||||||
|
**/
|
||||||
|
public interface WEBDeviceService extends IService<Device> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WEB端解绑设备
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int webUnBindDevice(Long id, Long userId);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.fuyuanshen.web.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.lang.UUID;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fuyuanshen.app.service.AppDeviceBizService;
|
||||||
|
import com.fuyuanshen.common.core.domain.model.LoginUser;
|
||||||
|
import com.fuyuanshen.common.core.exception.BadRequestException;
|
||||||
|
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||||
|
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.common.satoken.utils.LoginHelper;
|
||||||
|
import com.fuyuanshen.customer.domain.Customer;
|
||||||
|
import com.fuyuanshen.customer.mapper.CustomerMapper;
|
||||||
|
import com.fuyuanshen.equipment.constants.DeviceConstants;
|
||||||
|
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.dto.AppDeviceBo;
|
||||||
|
import com.fuyuanshen.equipment.domain.form.DeviceForm;
|
||||||
|
import com.fuyuanshen.equipment.domain.query.DeviceAssignmentQuery;
|
||||||
|
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
|
||||||
|
import com.fuyuanshen.equipment.domain.query.DeviceTypeQueryCriteria;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
|
||||||
|
import com.fuyuanshen.equipment.domain.vo.CustomerVo;
|
||||||
|
import com.fuyuanshen.equipment.enums.BindingStatusEnum;
|
||||||
|
import com.fuyuanshen.equipment.enums.CommunicationModeEnum;
|
||||||
|
import com.fuyuanshen.equipment.enums.DeviceActiveStatusEnum;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceMapper;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper;
|
||||||
|
import com.fuyuanshen.equipment.mapper.DeviceTypeMapper;
|
||||||
|
import com.fuyuanshen.equipment.service.DeviceAssignmentsService;
|
||||||
|
import com.fuyuanshen.equipment.service.DeviceTypeGrantsService;
|
||||||
|
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||||
|
import com.fuyuanshen.system.service.ISysOssService;
|
||||||
|
import com.fuyuanshen.web.service.WEBDeviceService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: WY
|
||||||
|
* @Date: 2025/5/16
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class WEBDeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements WEBDeviceService {
|
||||||
|
|
||||||
|
private final AppDeviceBizService appDeviceService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WEB端解绑设备
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int webUnBindDevice(Long id, Long userId) {
|
||||||
|
return appDeviceService.unBindDevice(id,userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -147,19 +147,19 @@ public class DeviceController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* @param id
|
// * @param id
|
||||||
* @return
|
// * @return
|
||||||
* @ModelAttribute 主要用于将请求参数绑定到 Java 对象上,它会从 HTTP 请求的查询参数(Query Parameters)
|
// * @ModelAttribute 主要用于将请求参数绑定到 Java 对象上,它会从 HTTP 请求的查询参数(Query Parameters)
|
||||||
* 或表单数据(Form Data)中提取值,并自动填充到指定的对象属性中。
|
// * 或表单数据(Form Data)中提取值,并自动填充到指定的对象属性中。
|
||||||
*/
|
// */
|
||||||
// @Log("解绑设备")
|
// // @Log("解绑设备")
|
||||||
@Operation(summary = "WEB端解绑设备")
|
// @Operation(summary = "WEB端解绑设备")
|
||||||
@GetMapping(value = "/unbind")
|
// @GetMapping(value = "/unbind")
|
||||||
public R<Void> unbindDevice(@Validated Long id) {
|
// public R<Void> unbindDevice(@Validated Long id) {
|
||||||
return toAjax(deviceService.webUnBindDevice(id));
|
// return toAjax(deviceService.webUnBindDevice(id));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Operation(summary = "导出数据设备")
|
@Operation(summary = "导出数据设备")
|
||||||
|
Reference in New Issue
Block a user