新增移动端手表绑定解绑接口
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
package com.renkang.watch.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TianZi
|
||||||
|
* @date 2023/11/7 14:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BindDeviceDTO {
|
||||||
|
|
||||||
|
@Schema(title = "手表编号")
|
||||||
|
private String watchNo;
|
||||||
|
}
|
||||||
+2
-4
@@ -11,10 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -327,4 +324,5 @@ public class WatchController {
|
|||||||
// }
|
// }
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -185,6 +185,12 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
|
|||||||
return watchDeviceService.bindUser(dto);
|
return watchDeviceService.bindUser(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "移动端绑定设备(手表)", description = "移动端绑定设备(手表)")
|
||||||
|
@GetMapping("/app/bindDevice")
|
||||||
|
public Result bindDevice(@RequestParam(name = "watchNo") String watchNo) throws ParseException {
|
||||||
|
return watchDeviceService.bindDevice(watchNo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解绑用户
|
* 解绑用户
|
||||||
*
|
*
|
||||||
@@ -194,10 +200,16 @@ public class WatchDeviceController extends JeecgController<WatchDevice, IWatchDe
|
|||||||
@Operation(summary = "解绑用户", description = "解绑用户")
|
@Operation(summary = "解绑用户", description = "解绑用户")
|
||||||
@PostMapping(value = "/unbundleUser")
|
@PostMapping(value = "/unbundleUser")
|
||||||
@RequiresPermissions("watch:watch_device:unbindUser")
|
@RequiresPermissions("watch:watch_device:unbindUser")
|
||||||
public Result unbundleUser(@RequestBody() BindUserDTO dto) throws ParseException {
|
public Result unbundleUser(@RequestBody() BindUserDTO dto) {
|
||||||
return watchDeviceService.unbundleUser(dto);
|
return watchDeviceService.unbundleUser(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "移动端解绑设备(手表)", description = "移动端解绑设备(手表)")
|
||||||
|
@GetMapping("/app/unbundleDevice")
|
||||||
|
public Result unbundleDevice(@RequestParam(name = "watchNo") String watchNo) {
|
||||||
|
return watchDeviceService.unbundleDevice(watchNo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置上传频次
|
* 设置上传频次
|
||||||
*
|
*
|
||||||
|
|||||||
+5
-1
@@ -43,12 +43,16 @@ public interface IWatchDeviceService extends IService<WatchDevice> {
|
|||||||
*/
|
*/
|
||||||
Result bindUser(BindUserDTO dto) throws ParseException;
|
Result bindUser(BindUserDTO dto) throws ParseException;
|
||||||
|
|
||||||
|
Result bindDevice(String watchNo) throws ParseException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定用户
|
* 绑定用户
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Result unbundleUser(BindUserDTO dto) throws ParseException;
|
Result unbundleUser(BindUserDTO dto);
|
||||||
|
|
||||||
|
Result unbundleDevice(String watchNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工具开关
|
* 工具开关
|
||||||
|
|||||||
+20
-1
@@ -350,6 +350,16 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
|||||||
return Result.ok("操作成功");
|
return Result.ok("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Result bindDevice(String watchNo) throws ParseException {
|
||||||
|
BindUserDTO dto = new BindUserDTO();
|
||||||
|
dto.setBindUserId(GlobalUtils.getLoginUser().getId());
|
||||||
|
dto.setWatchNo(watchNo);
|
||||||
|
dto.setBindDate(new Date());
|
||||||
|
return bindUser(dto);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户拉取数据
|
* 修改用户拉取数据
|
||||||
*
|
*
|
||||||
@@ -385,7 +395,7 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result unbundleUser(BindUserDTO dto) throws ParseException {
|
public Result unbundleUser(BindUserDTO dto){
|
||||||
WatchDevice watchDevice = getDeviceByWatchNo(dto.getWatchNo());
|
WatchDevice watchDevice = getDeviceByWatchNo(dto.getWatchNo());
|
||||||
if (watchDevice == null) {
|
if (watchDevice == null) {
|
||||||
return Result.error("该设备不存在");
|
return Result.error("该设备不存在");
|
||||||
@@ -409,6 +419,15 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
|
|||||||
return Result.ok("操作成功");
|
return Result.ok("操作成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Result unbundleDevice(String watchNo){
|
||||||
|
BindUserDTO dto = new BindUserDTO();
|
||||||
|
dto.setBindUserId(GlobalUtils.getLoginUser().getId());
|
||||||
|
dto.setWatchNo(watchNo);
|
||||||
|
dto.setBindDate(new Date());
|
||||||
|
return unbundleUser(dto);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据手表编号获取手表信息
|
* 根据手表编号获取手表信息
|
||||||
|
|||||||
Reference in New Issue
Block a user