You've already forked FrameTour-BE
AioDevice人脸上传
This commit is contained in:
@@ -3,7 +3,9 @@ package com.ycwl.basic.controller.extern;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.mapper.AioDeviceMapper;
|
||||
import com.ycwl.basic.mapper.MemberMapper;
|
||||
import com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity;
|
||||
import com.ycwl.basic.model.aio.entity.AioDeviceEntity;
|
||||
import com.ycwl.basic.model.aio.resp.AioDeviceInfoResp;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
|
||||
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
|
||||
@@ -46,7 +48,28 @@ public class AioDeviceController {
|
||||
@Autowired
|
||||
private AioDeviceMapper aioDeviceMapper;
|
||||
|
||||
@Autowired
|
||||
@GetMapping("/info")
|
||||
public ApiResponse<AioDeviceInfoResp> getDeviceInfo(HttpServletRequest request) {
|
||||
String deviceId = request.getHeader("X-DeviceId");
|
||||
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||
if (aioDevice == null) {
|
||||
return ApiResponse.fail("设备不存在");
|
||||
}
|
||||
List<AioDeviceBannerEntity> banners = aioDeviceMapper.getBannerByDeviceId(aioDevice.getId());
|
||||
return ApiResponse.success(new AioDeviceInfoResp(aioDevice, banners));
|
||||
}
|
||||
|
||||
@GetMapping("/banners")
|
||||
public ApiResponse<List<AioDeviceBannerEntity>> getBanners(HttpServletRequest request) {
|
||||
String deviceId = request.getHeader("X-DeviceId");
|
||||
AioDeviceEntity aioDevice = aioDeviceMapper.getByKey(deviceId);
|
||||
if (aioDevice == null) {
|
||||
return ApiResponse.fail("设备不存在");
|
||||
}
|
||||
List<AioDeviceBannerEntity> banners = aioDeviceMapper.getBannerByDeviceId(aioDevice.getId());
|
||||
return ApiResponse.success(banners);
|
||||
}
|
||||
|
||||
@PostMapping("/faceUpload")
|
||||
public ApiResponse<FaceRecognizeResp> faceUpload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
String deviceId = request.getHeader("X-DeviceId");
|
||||
|
@@ -1,8 +1,13 @@
|
||||
package com.ycwl.basic.mapper;
|
||||
|
||||
import com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity;
|
||||
import com.ycwl.basic.model.aio.entity.AioDeviceEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AioDeviceMapper {
|
||||
AioDeviceEntity getById(Long id);
|
||||
AioDeviceEntity getByKey(String key);
|
||||
List<AioDeviceBannerEntity> getBannerByDeviceId(Long deviceId);
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package com.ycwl.basic.model.aio.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 智能设备横幅实体类
|
||||
*/
|
||||
@Data
|
||||
public class AioDeviceBannerEntity {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 横幅URL
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 状态 (0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createAt;
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.ycwl.basic.model.aio.resp;
|
||||
|
||||
import com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity;
|
||||
import com.ycwl.basic.model.aio.entity.AioDeviceEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class AioDeviceInfoResp {
|
||||
private AioDeviceEntity info;
|
||||
private List<AioDeviceBannerEntity> banners;
|
||||
}
|
@@ -7,4 +7,7 @@
|
||||
<select id="getByKey" resultType="com.ycwl.basic.model.aio.entity.AioDeviceEntity">
|
||||
select * from aio_device where access_key = #{accessKey} limit 1
|
||||
</select>
|
||||
<select id="getBannerByDeviceId" resultType="com.ycwl.basic.model.aio.entity.AioDeviceBannerEntity">
|
||||
select * from aio_device_banner where device_id = #{deviceId}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user