diff --git a/fastbee-open-api/src/main/java/com/fastbee/data/controller/deviceActivation/DeviceActivationController.java b/fastbee-open-api/src/main/java/com/fastbee/data/controller/deviceActivation/DeviceActivationController.java new file mode 100644 index 0000000..84a701c --- /dev/null +++ b/fastbee-open-api/src/main/java/com/fastbee/data/controller/deviceActivation/DeviceActivationController.java @@ -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)); + }*/ +} diff --git a/fastbee-open-api/src/main/java/com/fastbee/data/controller/deviceActivation/DeviceActivationDto.java b/fastbee-open-api/src/main/java/com/fastbee/data/controller/deviceActivation/DeviceActivationDto.java new file mode 100644 index 0000000..3f2f22b --- /dev/null +++ b/fastbee-open-api/src/main/java/com/fastbee/data/controller/deviceActivation/DeviceActivationDto.java @@ -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; + +} diff --git a/fastbee-service/fastbee-iot-service/pom.xml b/fastbee-service/fastbee-iot-service/pom.xml index 6c7ce57..43c1a7c 100644 --- a/fastbee-service/fastbee-iot-service/pom.xml +++ b/fastbee-service/fastbee-iot-service/pom.xml @@ -166,19 +166,18 @@ 3.8.5 compile - - com.fastbee - fastbee-project-service - 3.8.5 - compile - - - com.fastbee - fastbee-project-service - 3.8.5 - compile - - + + + + + + + + + + + + diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/IDeviceActivationService.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/IDeviceActivationService.java new file mode 100644 index 0000000..09aca0e --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/IDeviceActivationService.java @@ -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); + +} diff --git a/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/DeviceActivationServiceImpl.java b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/DeviceActivationServiceImpl.java new file mode 100644 index 0000000..d6b801e --- /dev/null +++ b/fastbee-service/fastbee-iot-service/src/main/java/com/fastbee/iot/service/impl/DeviceActivationServiceImpl.java @@ -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); + } +}