You've already forked FrameTour-BE
查询景区信息和机位接口实现
This commit is contained in:
@ -0,0 +1,15 @@
|
|||||||
|
package com.ycwl.basic.controller.mobile;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:longbinbin
|
||||||
|
* @Date:2024/12/6 10:18
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/mobile/scenic/v1")
|
||||||
|
@Api(tags = "设备相关接口")
|
||||||
|
public class AppDeviceController {
|
||||||
|
}
|
@ -1,8 +1,17 @@
|
|||||||
package com.ycwl.basic.controller.mobile;
|
package com.ycwl.basic.controller.mobile;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
@ -13,5 +22,25 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Api(tags = "景区相关接口")
|
@Api(tags = "景区相关接口")
|
||||||
public class AppScenicController {
|
public class AppScenicController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AppScenicService appScenicService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询景区列表")
|
||||||
|
@PostMapping("/page")
|
||||||
|
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(@RequestBody ScenicReqQuery scenicReqQuery){
|
||||||
|
return appScenicService.pageQuery(scenicReqQuery);
|
||||||
|
}
|
||||||
|
@ApiOperation("根据id查询景区详情")
|
||||||
|
@GetMapping("getDetails/{id}")
|
||||||
|
public ApiResponse<ScenicRespVO> getDetails(@PathVariable Long id){
|
||||||
|
return appScenicService.getDetails(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询景区设备总数和拍到用户的机位数量")
|
||||||
|
@GetMapping("/deviceCountByScenicId/{scenicId}")
|
||||||
|
public ApiResponse<ScenicDeviceCountVO> deviceCountByScenicId(@PathVariable Long scenicId){
|
||||||
|
return appScenicService.deviceCountByScenicId(scenicId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ycwl.basic.mapper.pc;
|
package com.ycwl.basic.mapper.pc;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||||
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
||||||
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
||||||
@ -23,4 +24,6 @@ public interface DeviceMapper {
|
|||||||
int updateStatus(Long id);
|
int updateStatus(Long id);
|
||||||
|
|
||||||
List<DeviceRespVO> listByScenicId(Long scenicId);
|
List<DeviceRespVO> listByScenicId(Long scenicId);
|
||||||
|
|
||||||
|
ScenicDeviceCountVO deviceCountByScenicId(Long scenicId, String userId);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.ycwl.basic.mapper.pc;
|
package com.ycwl.basic.mapper.pc;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -41,4 +43,8 @@ public interface ScenicMapper {
|
|||||||
* @param scenicId
|
* @param scenicId
|
||||||
*/
|
*/
|
||||||
void deleteConfigByscenicId(Long scenicId);
|
void deleteConfigByscenicId(Long scenicId);
|
||||||
|
|
||||||
|
List<ScenicAppVO> appList(ScenicReqQuery scenicReqQuery);
|
||||||
|
|
||||||
|
ApiResponse<ScenicRespVO> getAppById(Long id);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.ycwl.basic.model.mobile.scenic;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:longbinbin
|
||||||
|
* @Date:2024/12/6 10:25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("移动端景区响应参数")
|
||||||
|
public class ScenicAppVO {
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 景区名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("景区名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("联系电话")
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 景区介绍
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("景区介绍")
|
||||||
|
private String introduction;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("经度")
|
||||||
|
private BigDecimal longitude;
|
||||||
|
/***
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("纬度")
|
||||||
|
private BigDecimal latitude;
|
||||||
|
/**
|
||||||
|
* 半径(km)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("半径(km)")
|
||||||
|
private BigDecimal radius;
|
||||||
|
/**
|
||||||
|
* 省份
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("省份")
|
||||||
|
private String province;
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("城市")
|
||||||
|
private String city;
|
||||||
|
/**
|
||||||
|
* 区
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("区")
|
||||||
|
private String area;
|
||||||
|
/**
|
||||||
|
* 详细地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("详细地址")
|
||||||
|
private String address;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.ycwl.basic.model.mobile.scenic;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:longbinbin
|
||||||
|
* @Date:2024/12/6 10:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("移动端景区设备数量响应参数")
|
||||||
|
public class ScenicDeviceCountVO {
|
||||||
|
@ApiModelProperty("景区设备总数")
|
||||||
|
private Integer totalDeviceCount;
|
||||||
|
@ApiModelProperty("拍摄到用户的设备数量")
|
||||||
|
private Integer shotDeviceCount;
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package com.ycwl.basic.service;
|
package com.ycwl.basic.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.ycwl.basic.exception.BaseException;
|
||||||
import com.ycwl.basic.utils.OssUtil;
|
import com.ycwl.basic.utils.OssUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -20,7 +22,12 @@ public class FileService {
|
|||||||
private OssUtil ossUtil;
|
private OssUtil ossUtil;
|
||||||
|
|
||||||
public String uploadFile(MultipartFile file) throws IOException {
|
public String uploadFile(MultipartFile file) throws IOException {
|
||||||
return ossUtil.uploadFile(file.getInputStream(), Objects.requireNonNull(file.getOriginalFilename()));
|
String originalFilename = file.getOriginalFilename();
|
||||||
|
if (StrUtil.isBlank(originalFilename)) {
|
||||||
|
throw new BaseException("文件上传失败,文件名不能为空");
|
||||||
|
}
|
||||||
|
String fileName=System.currentTimeMillis() + originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||||
|
return ossUtil.uploadFile(file.getInputStream(), fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean delete(String fileName) {
|
public Boolean delete(String fileName) {
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.ycwl.basic.service.impl.mobile;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
|
import com.ycwl.basic.mapper.pc.DeviceMapper;
|
||||||
|
import com.ycwl.basic.mapper.pc.ScenicMapper;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:longbinbin
|
||||||
|
* @Date:2024/12/6 10:23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class AppScenicServiceImpl implements AppScenicService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScenicMapper scenicMapper;
|
||||||
|
@Autowired
|
||||||
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
||||||
|
PageHelper.startPage(scenicReqQuery.getPageNum(), scenicReqQuery.getPageSize());
|
||||||
|
List<ScenicAppVO> list = scenicMapper.appList(scenicReqQuery);
|
||||||
|
PageInfo<ScenicAppVO> pageInfo = new PageInfo<>(list);
|
||||||
|
return ApiResponse.success(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResponse<ScenicDeviceCountVO> deviceCountByScenicId(Long scenicId) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicDeviceCountVO scenicDeviceCountVO=deviceMapper.deviceCountByScenicId(scenicId,userId);
|
||||||
|
return ApiResponse.success(scenicDeviceCountVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResponse<ScenicRespVO> getDetails(Long id) {
|
||||||
|
return scenicMapper.getAppById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -2,16 +2,15 @@ package com.ycwl.basic.service.impl.pc;
|
|||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
import com.ycwl.basic.exception.BaseException;
|
import com.ycwl.basic.exception.BaseException;
|
||||||
import com.ycwl.basic.mapper.pc.FaceMapper;
|
import com.ycwl.basic.mapper.pc.FaceMapper;
|
||||||
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
import com.ycwl.basic.service.pc.FaceService;
|
import com.ycwl.basic.service.pc.FaceService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.*;
|
||||||
import com.ycwl.basic.utils.DateUtils;
|
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
|
||||||
import com.ycwl.basic.utils.oss.OssUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -92,7 +91,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
@Override
|
@Override
|
||||||
public ApiResponse faceUPload(MultipartFile file) {
|
public ApiResponse faceUPload(MultipartFile file) {
|
||||||
//TODO 获取用户信息
|
//TODO 获取用户信息
|
||||||
String userId="1";
|
String userId = BaseContextHandler.getUserId();
|
||||||
//1、上传人脸照片
|
//1、上传人脸照片
|
||||||
String facaeUrl = uploadFileALiOss(file, userId);
|
String facaeUrl = uploadFileALiOss(file, userId);
|
||||||
//TODO 2、人脸照片有效性校验
|
//TODO 2、人脸照片有效性校验
|
||||||
@ -104,13 +103,20 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
//校验成功,保存用户人脸信息,将访问人脸照片访问地址响应给前端
|
//校验成功,保存用户人脸信息,将访问人脸照片访问地址响应给前端
|
||||||
|
|
||||||
FaceEntity faceEntity = new FaceEntity();
|
FaceEntity faceEntity = new FaceEntity();
|
||||||
|
faceEntity.setId(SnowFlakeUtil.getLongId());
|
||||||
|
faceEntity.setMemberId(Long.parseLong(userId));
|
||||||
|
faceEntity.setFaceUrl(facaeUrl);
|
||||||
|
// faceEntity.setScore();
|
||||||
|
// faceEntity.setMatchSampleIds();
|
||||||
|
// faceEntity.setFirstMatchRate();
|
||||||
|
// faceEntity.setMatchResult();
|
||||||
//TODO 人脸数据存库
|
//TODO 人脸数据存库
|
||||||
faceMapper.add(faceEntity);
|
faceMapper.add(faceEntity);
|
||||||
|
|
||||||
return ApiResponse.success(facaeUrl);
|
return ApiResponse.success(facaeUrl);
|
||||||
}else {
|
}else {
|
||||||
//校验失败,删除,提示重新上传
|
//校验失败,删除,提示重新上传
|
||||||
|
ossUtil.deleteFile(facaeUrl);
|
||||||
|
|
||||||
throw new BaseException("人脸照片校验失败,请重新上传");
|
throw new BaseException("人脸照片校验失败,请重新上传");
|
||||||
}
|
}
|
||||||
@ -147,6 +153,6 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
log.error("文件上传失败!", e);
|
log.error("文件上传失败!", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ossUtil.uploadFile(inputStream,filePath,fileName) ;
|
return ossUtil.uploadFile(inputStream,filePath+fileName) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ycwl.basic.service.mobile;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||||
|
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:longbinbin
|
||||||
|
* @Date:2024/12/6 10:23
|
||||||
|
*/
|
||||||
|
public interface AppScenicService {
|
||||||
|
ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery);
|
||||||
|
|
||||||
|
ApiResponse<ScenicDeviceCountVO> deviceCountByScenicId(Long scenicId);
|
||||||
|
|
||||||
|
ApiResponse<ScenicRespVO> getDetails(Long id);
|
||||||
|
}
|
@ -20,8 +20,14 @@ public class OssUtil {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OssConfig ossConfig;
|
private OssConfig ossConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件到oss
|
||||||
|
* @param inputStream 文件数据流
|
||||||
|
* @param filename 文件全路径名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String uploadFile(InputStream inputStream, String filename) {
|
public String uploadFile(InputStream inputStream, String filename) {
|
||||||
String uploadFileName = ossConfig.getObjectName() + System.currentTimeMillis() + filename.substring(filename.lastIndexOf("."));
|
String uploadFileName = ossConfig.getObjectName() + filename;
|
||||||
OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndPoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
|
OSS ossClient = new OSSClientBuilder().build(ossConfig.getEndPoint(), ossConfig.getAccessKeyId(), ossConfig.getAccessKeySecret());
|
||||||
try {
|
try {
|
||||||
PutObjectRequest putObjectRequest = new PutObjectRequest(ossConfig.getBucketName(), uploadFileName, inputStream);
|
PutObjectRequest putObjectRequest = new PutObjectRequest(ossConfig.getBucketName(), uploadFileName, inputStream);
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
package com.ycwl.basic.utils.oss;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.aliyun.oss.ClientException;
|
|
||||||
import com.aliyun.oss.OSS;
|
|
||||||
import com.aliyun.oss.OSSClientBuilder;
|
|
||||||
import com.aliyun.oss.OSSException;
|
|
||||||
import com.aliyun.oss.model.PutObjectRequest;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:longbinbin
|
|
||||||
* @Date:2024/11/6 10:12
|
|
||||||
*
|
|
||||||
* 参考文档:https://help.aliyun.com/zh/oss/getting-started/sdk-quick-start?spm=a2c4g.11186623.help-menu-31815.d_1_5.7065a784pbkMck
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class OssUtil {
|
|
||||||
|
|
||||||
@Value("${aliyun.oss.endpoint}")
|
|
||||||
private String endPoint;
|
|
||||||
@Value("${aliyun.oss.accessKeyId}")
|
|
||||||
private String accessKeyId;
|
|
||||||
@Value("${aliyun.oss.accessKeySecret}")
|
|
||||||
private String accessKeySecret;
|
|
||||||
@Value("${aliyun.oss.bucketName}")
|
|
||||||
private String bucketName;
|
|
||||||
@Value("${aliyun.oss.url}")
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件到oss
|
|
||||||
* @param inputStream 文件数据输入流
|
|
||||||
* @param filepath 文件路径
|
|
||||||
* @param filename 文件名
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String uploadFile(InputStream inputStream, String filepath, String filename) {
|
|
||||||
String uploadFileName ;
|
|
||||||
if (StrUtil.isNotBlank(filepath)) {
|
|
||||||
uploadFileName = filepath+filename;
|
|
||||||
}else {
|
|
||||||
uploadFileName=filename;
|
|
||||||
}
|
|
||||||
OSS ossClient = new OSSClientBuilder().build(endPoint, accessKeyId, accessKeySecret);
|
|
||||||
try {
|
|
||||||
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName,uploadFileName, inputStream);
|
|
||||||
ossClient.putObject(putObjectRequest);
|
|
||||||
log.info("人脸照片上传成功");
|
|
||||||
String fileUrl = url+uploadFileName;
|
|
||||||
return fileUrl;
|
|
||||||
} catch (OSSException oe) {
|
|
||||||
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
|
||||||
+ "but was rejected with an error response for some reason.");
|
|
||||||
System.out.println("Error Message:" + oe.getErrorMessage());
|
|
||||||
System.out.println("Error Code:" + oe.getErrorCode());
|
|
||||||
System.out.println("Request ID:" + oe.getRequestId());
|
|
||||||
System.out.println("Host ID:" + oe.getHostId());
|
|
||||||
} catch (ClientException ce) {
|
|
||||||
System.out.println("Caught an ClientException, which means the client encountered "
|
|
||||||
+ "a serious internal problem while trying to communicate with OSS, "
|
|
||||||
+ "such as not being able to access the network.");
|
|
||||||
System.out.println("Error Message:" + ce.getMessage());
|
|
||||||
} finally {
|
|
||||||
if (ossClient != null) {
|
|
||||||
ossClient.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "上传失败";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除文件
|
|
||||||
* @param filePath 文件路径
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Boolean deleteFile(String filePath) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -58,4 +58,18 @@
|
|||||||
from device d
|
from device d
|
||||||
where d.scenic_id = #{scenicId}
|
where d.scenic_id = #{scenicId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="deviceCountByScenicId" resultType="com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO">
|
||||||
|
select ifnull(a.totalDeviceCount,0) as totalDeviceCount,ifnull(b.shotDeviceCount,0) as shotDeviceCount
|
||||||
|
from (
|
||||||
|
select count(1) totalDeviceCount,scenic_id
|
||||||
|
from device
|
||||||
|
where scenic_id = #{scenicId} and status = 1
|
||||||
|
)a
|
||||||
|
left join (
|
||||||
|
select count(1) shotDeviceCount,scenic_id
|
||||||
|
from source
|
||||||
|
where scenic_id = #{scenicId}
|
||||||
|
group by device_id
|
||||||
|
)b on a.scenic_id = b.scenic_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -117,12 +117,41 @@
|
|||||||
left join scenic_config c on s.id = c.id
|
left join scenic_config c on s.id = c.id
|
||||||
where s.id = #{id}
|
where s.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="appList" resultType="com.ycwl.basic.model.mobile.scenic.ScenicAppVO">
|
||||||
|
select s.id, `name`, `phone`, introduction, longitude, latitude, radius, province, city, area, address
|
||||||
|
from scenic s
|
||||||
|
where
|
||||||
|
`status` = 1
|
||||||
|
<if test="name!=null and name!=''">
|
||||||
|
and locate(#{name},`name`) > 0
|
||||||
|
</if>
|
||||||
|
<if test="province!=null and province!=''">
|
||||||
|
and locate(#{province},`province`) > 0
|
||||||
|
</if>
|
||||||
|
<if test="city!=null and city!=''">
|
||||||
|
and locate(#{city},`city`) > 0
|
||||||
|
</if>
|
||||||
|
<if test="area!=null and area!=''">
|
||||||
|
and locate(#{area},`area`) > 0
|
||||||
|
</if>
|
||||||
|
<if test="startTime!=null">
|
||||||
|
and s.create_time >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null">
|
||||||
|
and s.create_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="getAppById" resultType="com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO">
|
||||||
|
select s.id, `name`, `phone`, introduction, longitude, latitude, radius, province, city, area, address
|
||||||
|
from scenic s
|
||||||
|
where `status` = 1 and s.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<resultMap id="scenicAndConfig" type="com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO">
|
<resultMap id="scenicAndConfig" type="com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO">
|
||||||
<id property="id" column="id"/>
|
<id property="id" column="id"/>
|
||||||
<result property="name" column="name"/>
|
<result property="name" column="name"/>
|
||||||
<result property="account" column="account"/>
|
|
||||||
<result property="phone" column="phone"/>
|
<result property="phone" column="phone"/>
|
||||||
|
<result property="account" column="account"/>
|
||||||
<result property="introduction" column="introduction"/>
|
<result property="introduction" column="introduction"/>
|
||||||
<result property="longitude" column="longitude"/>
|
<result property="longitude" column="longitude"/>
|
||||||
<result property="latitude" column="latitude"/>
|
<result property="latitude" column="latitude"/>
|
||||||
|
Reference in New Issue
Block a user