假期作业
parent
cf22c33ca9
commit
5735695aaa
|
@ -40,9 +40,6 @@ public class SysLoginService
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录
|
|
||||||
*/
|
|
||||||
public LoginUser login(String username, String password)
|
public LoginUser login(String username, String password)
|
||||||
{
|
{
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
|
|
|
@ -12,6 +12,25 @@
|
||||||
<artifactId>HomeWork-modules-MedicalTreatment</artifactId>
|
<artifactId>HomeWork-modules-MedicalTreatment</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/io.minio/minio -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>8.5.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish</groupId>
|
||||||
|
<artifactId>javax.json</artifactId>
|
||||||
|
<version>1.0.4</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.srt</groupId>
|
||||||
|
<artifactId>flink-app-1.14</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
|
|
|
@ -7,11 +7,13 @@ import HomeWork.domain.vo.TreeVo;
|
||||||
import HomeWork.service.TreeService;
|
import HomeWork.service.TreeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class TreeController {
|
public class TreeController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TreeService treeService;
|
private TreeService treeService;
|
||||||
|
|
||||||
|
@ -20,13 +22,27 @@ public class TreeController {
|
||||||
List<TreeVo> treeVos= treeService.treeList();
|
List<TreeVo> treeVos= treeService.treeList();
|
||||||
return R.ok(treeVos);
|
return R.ok(treeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/treeByParentId")
|
||||||
|
public R<List<TreeVo>> treeByParentId(@RequestParam("parentId") Integer parentId) {
|
||||||
|
List<TreeVo> treeVos= treeService.treeListByTreeParentId(parentId);
|
||||||
|
return R.ok(treeVos);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/plot/{id}")
|
@PostMapping("/plot/{id}")
|
||||||
public R<List<PlotVo>> plot(@PathVariable Integer id) {
|
public R<List<PlotVo>> plot(@PathVariable Integer id) {
|
||||||
List<PlotVo> plotVos= treeService.plotList(id);
|
List<PlotVo> plotVos= treeService.plotList(id);
|
||||||
return R.ok(plotVos);
|
return R.ok(plotVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public R add(@RequestBody PlotDto plotDto) {
|
public R add(@RequestBody PlotDto plotDto) {
|
||||||
return R.ok(treeService.add(plotDto));
|
return R.ok(treeService.add(plotDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/file")
|
||||||
|
public R file(@RequestParam("file") MultipartFile file) {
|
||||||
|
return R.ok(treeService.file(file));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,33 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class PlotEntity {
|
public class PlotEntity {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String villageCode;
|
||||||
private Integer parentId;
|
private String villageName;
|
||||||
|
private String provinceCode;
|
||||||
|
private String cityCode;
|
||||||
|
private String districtCode;
|
||||||
|
private String streetCode;
|
||||||
private String address;
|
private String address;
|
||||||
private String img;
|
private Double lon;
|
||||||
private Integer building;
|
private Double lat;
|
||||||
private Integer tenement;
|
private String picUrl;
|
||||||
private String num;
|
private Integer buildingNum;
|
||||||
|
private Integer houseNum;
|
||||||
|
private long mrowTime;
|
||||||
|
private Integer parentId;
|
||||||
|
private String pinyin;
|
||||||
|
private String initial;
|
||||||
|
private String geometry;
|
||||||
|
private String mapCenter;
|
||||||
|
private String parentName;
|
||||||
|
private String cameraList;
|
||||||
|
private String checkStatus;
|
||||||
|
private Integer sceneCount;
|
||||||
|
private Integer sceneType;
|
||||||
|
private String deviceList;
|
||||||
|
private String buildList;
|
||||||
|
private String entranceExitList;
|
||||||
|
private String imgBase64Str;
|
||||||
|
private Integer isDevice;
|
||||||
|
private String imgs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,17 @@ package HomeWork.domain;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TreeEntity {
|
public class TreeEntity {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String name;
|
||||||
private Integer parentId;
|
private Integer parentId;
|
||||||
|
private String parentName;
|
||||||
|
private String type;
|
||||||
|
private Integer deleteFlag;
|
||||||
|
private Date mrowTime;
|
||||||
|
private String villageCode;
|
||||||
|
private String code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,33 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class PlotVo {
|
public class PlotVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String villageCode;
|
||||||
private Integer parentId;
|
private String villageName;
|
||||||
|
private String provinceCode;
|
||||||
|
private String cityCode;
|
||||||
|
private String districtCode;
|
||||||
|
private String streetCode;
|
||||||
private String address;
|
private String address;
|
||||||
private String img;
|
private Double lon;
|
||||||
private Integer building;
|
private Double lat;
|
||||||
private Integer tenement;
|
private String picUrl;
|
||||||
private String num;
|
private Integer buildingNum;
|
||||||
|
private Integer houseNum;
|
||||||
|
private long mrowTime;
|
||||||
|
private Integer parentId;
|
||||||
|
private String pinyin;
|
||||||
|
private String initial;
|
||||||
|
private String geometry;
|
||||||
|
private String mapCenter;
|
||||||
|
private String parentName;
|
||||||
|
private String cameraList;
|
||||||
|
private String checkStatus;
|
||||||
|
private Integer sceneCount;
|
||||||
|
private Integer sceneType;
|
||||||
|
private String deviceList;
|
||||||
|
private String buildList;
|
||||||
|
private String entranceExitList;
|
||||||
|
private String imgBase64Str;
|
||||||
|
private Integer isDevice;
|
||||||
|
private String imgs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package HomeWork.domain.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -9,5 +10,11 @@ public class TreeVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String name;
|
||||||
private Integer parentId;
|
private Integer parentId;
|
||||||
|
private String parentName;
|
||||||
|
private String type;
|
||||||
|
private Integer deleteFlag;
|
||||||
|
private Date mrowTime;
|
||||||
|
private String villageCode;
|
||||||
|
private String code;
|
||||||
private List<TreeVo> children;
|
private List<TreeVo> children;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,10 @@ public interface TreeMapper {
|
||||||
|
|
||||||
int add(PlotDto plotDto);
|
int add(PlotDto plotDto);
|
||||||
|
|
||||||
|
List<TreeEntity> treeListByParentId(Integer parentId);
|
||||||
|
|
||||||
|
List<TreeEntity> treeListByTreeParentIds(@Param("split") String[] split);
|
||||||
|
|
||||||
|
List<TreeEntity> treeByParentId(Integer parentId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package HomeWork.minio;
|
||||||
|
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName MinioConfig
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableConfigurationProperties(MinioProperties.class)
|
||||||
|
public class MinioConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MinioProperties minioProperties;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MinioClient minioClient(){
|
||||||
|
return MinioClient.builder()
|
||||||
|
.endpoint(minioProperties.getEndpoint())
|
||||||
|
.credentials(minioProperties.getAccessKey(),minioProperties.getSecretKey())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package HomeWork.minio;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName MinioProperties
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@ConfigurationProperties(prefix = "minio")
|
||||||
|
@Component
|
||||||
|
@Data
|
||||||
|
public class MinioProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接地址
|
||||||
|
*/
|
||||||
|
private String endpoint;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String accessKey;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
/**
|
||||||
|
* 域名
|
||||||
|
*/
|
||||||
|
private String nginxHost;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,221 @@
|
||||||
|
//package HomeWork.minio;
|
||||||
|
//
|
||||||
|
//import cn.hutool.core.date.DateUtil;
|
||||||
|
//import io.minio.*;
|
||||||
|
//
|
||||||
|
//import io.minio.messages.Bucket;
|
||||||
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.apache.commons.fileupload.FileItem;
|
||||||
|
//import org.apache.commons.fileupload.FileItemFactory;
|
||||||
|
//import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//import org.springframework.web.multipart.MultipartFile;
|
||||||
|
//import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||||
|
//
|
||||||
|
//import java.io.InputStream;
|
||||||
|
//import java.io.OutputStream;
|
||||||
|
//
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Random;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @ClassName MinioUtil
|
||||||
|
// * @Description 描述
|
||||||
|
// * @Author 栗永斌
|
||||||
|
// */
|
||||||
|
//@Component
|
||||||
|
//@Slf4j
|
||||||
|
//public class MinioUtil {
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private MinioProperties minioProperties;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private MinioClient minioClient;
|
||||||
|
//
|
||||||
|
// private final Long maxSize = (long) (1024 * 1024);
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 创建bucket
|
||||||
|
// */
|
||||||
|
// public void createBucket(String bucketName) throws Exception {
|
||||||
|
// if (!minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {
|
||||||
|
// minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 上传文件
|
||||||
|
// */
|
||||||
|
// public UploadResponse uploadFile(MultipartFile file, String bucketName) throws Exception {
|
||||||
|
// //判断文件是否为空
|
||||||
|
// if (null == file || 0 == file.getSize()) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// //判断存储桶是否存在 不存在则创建
|
||||||
|
// createBucket(bucketName);
|
||||||
|
// //文件名
|
||||||
|
// String originalFilename = file.getOriginalFilename();
|
||||||
|
// //新的文件名 = 时间戳_随机数.后缀名
|
||||||
|
// assert originalFilename != null;
|
||||||
|
// long now = System.currentTimeMillis() / 1000;
|
||||||
|
// String fileName = DateUtil.format(DateUtil.date(),"yyyyMMdd")+"_"+ now + "_" + new Random().nextInt(1000) +
|
||||||
|
// originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||||
|
// //开始上传
|
||||||
|
// log.info("file压缩前大小:{}",file.getSize());
|
||||||
|
// if (file.getSize() > maxSize) {
|
||||||
|
// FileItemFactory fileItemFactory = new DiskFileItemFactory();
|
||||||
|
// FileItem fileItem = fileItemFactory.createItem(fileName, "text/plain", true, fileName);
|
||||||
|
// OutputStream outputStream = fileItem.getOutputStream();
|
||||||
|
// Thumbnails.of(file.getInputStream()).scale(1f).outputFormat(originalFilename.substring(originalFilename.lastIndexOf(".")+1)).outputQuality(0.25f).toOutputStream(outputStream);
|
||||||
|
// file = new CommonsMultipartFile(fileItem);
|
||||||
|
// }
|
||||||
|
// log.info("file压缩后大小:{}",file.getSize());
|
||||||
|
// minioClient.putObject(
|
||||||
|
// PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(
|
||||||
|
// file.getInputStream(), file.getSize(), -1)
|
||||||
|
// .contentType(file.getContentType())
|
||||||
|
// .build());
|
||||||
|
// String url = minioProperties.getEndpoint() + "/" + bucketName + "/" + fileName;
|
||||||
|
// String urlHost = minioProperties.getNginxHost() + "/" + bucketName + "/" + fileName;
|
||||||
|
// return new UploadResponse(url, urlHost);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取全部bucket
|
||||||
|
// *
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public List<Bucket> getAllBuckets() throws Exception {
|
||||||
|
// return minioClient.listBuckets();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据bucketName获取信息
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// */
|
||||||
|
//// public Optional<Bucket> getBucket(String bucketName) throws IOException, InvalidKeyException, NoSuchAlgorithmException, InsufficientDataException, InvalidResponseException, InternalException, ErrorResponseException, ServerException, XmlParserException, ServerException {
|
||||||
|
//// return minioClient.listBuckets().stream().filter(b -> b.name().equals(bucketName)).findFirst();
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 根据bucketName删除信息
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// */
|
||||||
|
// public void removeBucket(String bucketName) throws Exception {
|
||||||
|
// minioClient.removeBucket(RemoveBucketArgs.builder().bucket(bucketName).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取⽂件外链
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// * @param objectName ⽂件名称
|
||||||
|
// * @param expires 过期时间 <=7
|
||||||
|
// * @return url
|
||||||
|
// */
|
||||||
|
// public String getObjectURL(String bucketName, String objectName, Integer expires) throws Exception {
|
||||||
|
// return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(objectName).expiry(expires).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取⽂件
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// * @param objectName ⽂件名称
|
||||||
|
// * @return ⼆进制流
|
||||||
|
// */
|
||||||
|
// public InputStream getObject(String bucketName, String objectName) throws Exception {
|
||||||
|
// return minioClient.getObject(GetObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 上传⽂件
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// * @param objectName ⽂件名称
|
||||||
|
// * @param stream ⽂件流
|
||||||
|
// * @throws Exception https://docs.minio.io/cn/java-minioClient-api-reference.html#putObject
|
||||||
|
// */
|
||||||
|
// public void putObject(String bucketName, String objectName, InputStream stream) throws
|
||||||
|
// Exception {
|
||||||
|
// minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(stream, stream.available(), -1).contentType(objectName.substring(objectName.lastIndexOf("."))).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 上传⽂件
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// * @param objectName ⽂件名称
|
||||||
|
// * @param stream ⽂件流
|
||||||
|
// * @param size ⼤⼩
|
||||||
|
// * @param contextType 类型
|
||||||
|
// * @throws Exception https://docs.minio.io/cn/java-minioClient-api-reference.html#putObject
|
||||||
|
// */
|
||||||
|
// public void putObject(String bucketName, String objectName, InputStream stream, long
|
||||||
|
// size, String contextType) throws Exception {
|
||||||
|
// minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(stream, size, -1).contentType(contextType).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取⽂件信息
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// * @param objectName ⽂件名称
|
||||||
|
// * @throws Exception https://docs.minio.io/cn/java-minioClient-api-reference.html#statObject
|
||||||
|
// */
|
||||||
|
// public StatObjectResponse getObjectInfo(String bucketName, String objectName) throws Exception {
|
||||||
|
// return minioClient.statObject(StatObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除⽂件
|
||||||
|
// *
|
||||||
|
// * @param bucketName bucket名称
|
||||||
|
// * @param objectName ⽂件名称
|
||||||
|
// * @throws Exception https://docs.minio.io/cn/java-minioClient-apireference.html#removeObject
|
||||||
|
// */
|
||||||
|
// public void removeObject(String bucketName, String objectName) throws Exception {
|
||||||
|
// minioClient.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /***
|
||||||
|
// * 上传视频
|
||||||
|
// * @param file
|
||||||
|
// * @param bucketName
|
||||||
|
// * @return
|
||||||
|
// * @throws Exception
|
||||||
|
// */
|
||||||
|
// public UploadResponse uploadVideo(MultipartFile file, String bucketName) throws Exception {
|
||||||
|
// //判断文件是否为空
|
||||||
|
// if (null == file || 0 == file.getSize()) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// //判断存储桶是否存在 不存在则创建
|
||||||
|
// createBucket(bucketName);
|
||||||
|
// //文件名
|
||||||
|
// String originalFilename = file.getOriginalFilename();
|
||||||
|
// //新的文件名 = 时间戳_随机数.后缀名
|
||||||
|
// assert originalFilename != null;
|
||||||
|
// long now = System.currentTimeMillis() / 1000;
|
||||||
|
// String fileName = DateUtil.format(DateUtil.date(),"yyyyMMdd")+"_"+ now + "_" + new Random().nextInt(1000) +
|
||||||
|
// originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||||
|
// //开始上传
|
||||||
|
// log.info("file大小:{}",file.getSize());
|
||||||
|
// minioClient.putObject(
|
||||||
|
// PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(
|
||||||
|
// file.getInputStream(), file.getSize(), -1)
|
||||||
|
// .contentType("video/mp4")
|
||||||
|
// .build());
|
||||||
|
// String url = minioProperties.getEndpoint() + "/" + bucketName + "/" + fileName;
|
||||||
|
// String urlHost = minioProperties.getNginxHost() + "/" + bucketName + "/" + fileName;
|
||||||
|
// return new UploadResponse(url, urlHost);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//
|
|
@ -0,0 +1,21 @@
|
||||||
|
package HomeWork.minio;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName UploadResponse
|
||||||
|
* @Description 描述
|
||||||
|
* @Author 栗永斌
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class UploadResponse {
|
||||||
|
|
||||||
|
private String minIoUrl;
|
||||||
|
|
||||||
|
private String nginxUrl;
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import HomeWork.common.core.domain.R;
|
||||||
import HomeWork.domain.dto.PlotDto;
|
import HomeWork.domain.dto.PlotDto;
|
||||||
import HomeWork.domain.vo.PlotVo;
|
import HomeWork.domain.vo.PlotVo;
|
||||||
import HomeWork.domain.vo.TreeVo;
|
import HomeWork.domain.vo.TreeVo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -15,4 +16,7 @@ public interface TreeService {
|
||||||
|
|
||||||
R add(PlotDto plotDto);
|
R add(PlotDto plotDto);
|
||||||
|
|
||||||
|
List<TreeVo> treeListByTreeParentId(Integer parentId);
|
||||||
|
|
||||||
|
R file(MultipartFile file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,73 @@ import HomeWork.service.TreeService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TreeServiceImpl implements TreeService {
|
public class TreeServiceImpl implements TreeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TreeMapper treeMapper;
|
private TreeMapper treeMapper;
|
||||||
|
|
||||||
|
private final static String PARENT_NAME="根节点";
|
||||||
|
@Override
|
||||||
|
public List<PlotVo> plotList(Integer id) {
|
||||||
|
return treeMapper.plotList(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R add(PlotDto plotDto) {
|
||||||
|
if (treeMapper.add(plotDto)==0){
|
||||||
|
return R.fail("添加失败");
|
||||||
|
}
|
||||||
|
return R.ok("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeVo> treeListByTreeParentId(Integer parentId) {
|
||||||
|
if (parentId!=0){
|
||||||
|
//返回体
|
||||||
|
ArrayList<TreeVo> treeVos = new ArrayList<>();
|
||||||
|
//通过父级id查询所有的对象用所有的对象的id查询所有的子节点
|
||||||
|
List<TreeEntity> treeEntities = treeMapper.treeByParentId(parentId);
|
||||||
|
//将所有的id拼接成字符串
|
||||||
|
String ids="";
|
||||||
|
//循环拼接
|
||||||
|
for (TreeEntity treeEntity : treeEntities) {
|
||||||
|
TreeVo treeVo = new TreeVo();
|
||||||
|
BeanUtils.copyProperties(treeEntity,treeVo);
|
||||||
|
treeVos.add(treeVo);
|
||||||
|
ids+=","+treeEntity.getId();
|
||||||
|
}
|
||||||
|
//切割字符循环查找
|
||||||
|
String[] split = Arrays.stream(ids.split(","))
|
||||||
|
.filter(s -> !s.isEmpty())
|
||||||
|
.toArray(String[]::new);
|
||||||
|
|
||||||
|
//将集合转型返回
|
||||||
|
List<TreeEntity> treeVos1 = treeMapper.treeListByTreeParentIds(split);
|
||||||
|
for (TreeEntity tree : treeVos1) {
|
||||||
|
|
||||||
|
TreeVo treeVo = new TreeVo();
|
||||||
|
BeanUtils.copyProperties(tree,treeVo);
|
||||||
|
treeVos.add(treeVo);
|
||||||
|
}
|
||||||
|
return treeVos;
|
||||||
|
}else {
|
||||||
|
//返回体
|
||||||
|
List<TreeVo> treeVos = treeList();
|
||||||
|
return treeVos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R file(MultipartFile file) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TreeVo> treeList() {
|
public List<TreeVo> treeList() {
|
||||||
ArrayList<TreeVo> treeVos = new ArrayList<>();
|
ArrayList<TreeVo> treeVos = new ArrayList<>();
|
||||||
|
@ -34,19 +93,6 @@ public class TreeServiceImpl implements TreeService {
|
||||||
return treeVos;
|
return treeVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlotVo> plotList(Integer id) {
|
|
||||||
return treeMapper.plotList(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public R add(PlotDto plotDto) {
|
|
||||||
if (treeMapper.add(plotDto)==0){
|
|
||||||
return R.fail("添加失败");
|
|
||||||
}
|
|
||||||
return R.ok("添加成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<TreeVo> findChildren(Integer id) {
|
private List<TreeVo> findChildren(Integer id) {
|
||||||
ArrayList<TreeVo> treeVos = new ArrayList<>();
|
ArrayList<TreeVo> treeVos = new ArrayList<>();
|
||||||
List<TreeEntity> treeEntities = treeMapper.findChildren(id);
|
List<TreeEntity> treeEntities = treeMapper.findChildren(id);
|
||||||
|
@ -67,4 +113,6 @@ public class TreeServiceImpl implements TreeService {
|
||||||
}
|
}
|
||||||
return treeVos;
|
return treeVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,3 +25,9 @@ spring:
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
propertiesCopy code:
|
||||||
|
# MinIO连接信息
|
||||||
|
minio:
|
||||||
|
endpoint: http://124.223.48.209:9000
|
||||||
|
accessKey: tx1KGeduF9ftLvTOSKJC
|
||||||
|
secretKey: ue7VHniF1ONRMMaLZU3qodSV5NIhkFsYaUvvNzrJ
|
||||||
|
|
|
@ -27,4 +27,20 @@
|
||||||
<select id="plotList" resultType="HomeWork.domain.vo.PlotVo">
|
<select id="plotList" resultType="HomeWork.domain.vo.PlotVo">
|
||||||
select * from plot where parent_id=#{id}
|
select * from plot where parent_id=#{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="treeListByParentId" resultType="HomeWork.domain.TreeEntity">
|
||||||
|
select * from tree where parent_id!=#{parentId}
|
||||||
|
</select>
|
||||||
|
<select id="treeListByTreeParentIds" resultType="HomeWork.domain.TreeEntity">
|
||||||
|
select * from tree
|
||||||
|
<if test="split != null and split.length > 0">
|
||||||
|
where parent_id in
|
||||||
|
<foreach collection="split" item="treeId" open="(" separator="," close=")">
|
||||||
|
#{treeId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="treeByParentId" resultType="HomeWork.domain.TreeEntity">
|
||||||
|
select * from tree where parent_id = #{parentId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.List;
|
||||||
public class FaceDetect {
|
public class FaceDetect {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper sysUserMapper;
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
public SysUser faceDetect(String face) throws Exception {
|
public SysUser faceDetect(String face) throws Exception {
|
||||||
/**
|
/**
|
||||||
* 传入appId、apiKey、secretkey。创建Java代码和百度云交互的Client对象
|
* 传入appId、apiKey、secretkey。创建Java代码和百度云交互的Client对象
|
||||||
|
|
Loading…
Reference in New Issue