设备激活相关接口
This commit is contained in:
@ -0,0 +1,37 @@
|
|||||||
|
package com.fastbee.data.controller.deviceActivation;
|
||||||
|
|
||||||
|
import com.fastbee.common.core.controller.BaseController;
|
||||||
|
import com.fastbee.common.core.domain.AjaxResult;
|
||||||
|
import com.fastbee.iot.service.IDeviceActivationService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
@Api(tags = "设备激活")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/deviceactivation")
|
||||||
|
public class DeviceActivationController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
IDeviceActivationService deviceActivationService;
|
||||||
|
|
||||||
|
@PutMapping("/activation")
|
||||||
|
@ApiOperation("项目激活测试接口")
|
||||||
|
public AjaxResult getDevieceList(@RequestBody DeviceActivationDto deviceActivationDto)
|
||||||
|
{
|
||||||
|
//获取tenantId和tenantName
|
||||||
|
String[] idAndName=deviceActivationDto.tenantIdAndName.split(",",2);
|
||||||
|
|
||||||
|
Long tenantId= Long.valueOf(idAndName[0].replace(" ",""));
|
||||||
|
String tenantName=idAndName[1].trim();
|
||||||
|
|
||||||
|
return AjaxResult.success(deviceActivationService.selectDevice(deviceActivationDto.serialNumber,tenantId,tenantName,deviceActivationDto.longitude,deviceActivationDto.latitude,deviceActivationDto.imgUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@GetMapping("/info/{userId}")
|
||||||
|
@ApiOperation("获取项目信息")
|
||||||
|
public AjaxResult getProjectInfo(@PathVariable("userId") Long userId){
|
||||||
|
return success(projectService.selectProjectByUserId(userId));
|
||||||
|
}*/
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.fastbee.data.controller.deviceActivation;
|
||||||
|
|
||||||
|
public class DeviceActivationDto {
|
||||||
|
public String serialNumber;
|
||||||
|
public String tenantIdAndName;
|
||||||
|
public double longitude;
|
||||||
|
public double latitude;
|
||||||
|
public String imgUrl;
|
||||||
|
|
||||||
|
}
|
@ -166,19 +166,18 @@
|
|||||||
<version>3.8.5</version>
|
<version>3.8.5</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.fastbee</groupId>
|
<!-- <groupId>com.fastbee</groupId>-->
|
||||||
<artifactId>fastbee-project-service</artifactId>
|
<!-- <artifactId>fastbee-project-service</artifactId>-->
|
||||||
<version>3.8.5</version>
|
<!-- <version>3.8.5</version>-->
|
||||||
<scope>compile</scope>
|
<!-- <scope>compile</scope>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.fastbee</groupId>
|
<!-- <groupId>com.fastbee</groupId>-->
|
||||||
<artifactId>fastbee-project-service</artifactId>
|
<!-- <artifactId>fastbee-project-service</artifactId>-->
|
||||||
<version>3.8.5</version>
|
<!-- <version>3.8.5</version>-->
|
||||||
<scope>compile</scope>
|
<!-- <scope>compile</scope>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.fastbee.iot.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备激活Service接口
|
||||||
|
*/
|
||||||
|
public interface IDeviceActivationService
|
||||||
|
{
|
||||||
|
public int selectDevice(String serialNumber,Long tenantId,String tenantName,double longitude,double latitude,String imgUrl);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.fastbee.iot.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import com.fastbee.iot.mapper.DeviceMapper;
|
||||||
|
import com.fastbee.iot.service.IDeviceActivationService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
/**
|
||||||
|
* 设备激活Service业务层处理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DeviceActivationServiceImpl implements IDeviceActivationService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int selectDevice(String serialNumber,Long tenantId,String tenantName,double longitude,double latitude,String imgUrl)
|
||||||
|
{
|
||||||
|
//获取激活时间/更新时间
|
||||||
|
DateTime activationTime=DateTime.now();
|
||||||
|
|
||||||
|
return deviceMapper.updateDeviceActivationStatus(serialNumber,activationTime,tenantId,tenantName,longitude,latitude,imgUrl);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user