From e4d09ac7c848b604c272c684eabc3db3fc8c1493 Mon Sep 17 00:00:00 2001
From: zhangbaojian <1065122561@qq.com>
Date: Thu, 25 May 2023 16:23:50 +0800
Subject: [PATCH] =?UTF-8?q?zbj//1.=E8=B5=84=E6=BA=90=E7=AE=A1=E7=90=86(?=
=?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=B5=84=E6=BA=90)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/njcn/oss/constant/OssPath.java | 5 +
.../njcn/device/pq/pojo/po/ResourceData.java | 70 ++++++++
pqs-device/pq-device/pq-device-boot/pom.xml | 6 +
.../pq/controller/ResourceController.java | 124 ++++++++++++++
.../njcn/device/pq/mapper/ResourceMapper.java | 16 ++
.../pq/mapper/mapping/ResourceMapper.xml | 9 +
.../device/pq/service/ResourceService.java | 33 ++++
.../pq/service/impl/ResourceServiceImpl.java | 160 ++++++++++++++++++
8 files changed, 423 insertions(+)
create mode 100644 pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/ResourceData.java
create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/ResourceController.java
create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/ResourceMapper.java
create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/ResourceMapper.xml
create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ResourceService.java
create mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/ResourceServiceImpl.java
diff --git a/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/OssPath.java b/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/OssPath.java
index b438e8b07..a3a3108b1 100644
--- a/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/OssPath.java
+++ b/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/OssPath.java
@@ -72,4 +72,9 @@ public interface OssPath {
* 资源管理文件
*/
String RESOURCEADMINISTRATION = "resourceAdministration/";
+
+ /***
+ * 资源文件
+ */
+ String RESOURCEDATA = "resourceData/";
}
diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/ResourceData.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/ResourceData.java
new file mode 100644
index 000000000..7bbb16691
--- /dev/null
+++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/ResourceData.java
@@ -0,0 +1,70 @@
+package com.njcn.device.pq.pojo.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ *
+ *
+ *
+ *
+ * @author zbj
+ * @since 2023-05-25
+ */
+@Data
+@TableName("pqs_resourcedata")
+public class ResourceData {
+
+ /**
+ * 资源序号
+ */
+ @TableId(value = "id")
+ private String id;
+
+ /**
+ * 资源名称
+ */
+ @TableField(value = "resource_name")
+ private String resourceName;
+
+ /**
+ * 资源路径
+ */
+ @TableField(value = "res_url")
+ private String resUrl;
+
+ /**
+ * 图片路径
+ */
+ @TableField(value = "pic_url")
+ private String picUrl;
+
+ /**
+ * 数据上传时间
+ */
+ @TableField(value = "upload_time")
+ private LocalDateTime uploadTime;
+
+ /**
+ * 数据修改时间
+ */
+ @TableField(value = "update_time")
+ private LocalDateTime updateTime;
+
+ /**
+ * 数据状态(0: 展示; 1: 不展示)
+ */
+ @TableField(value = "state")
+ private Integer state;
+
+ /**
+ * 数据类型(0: 文件; 1: 视频)
+ */
+ @TableField(value = "type")
+ private Integer type;
+
+}
diff --git a/pqs-device/pq-device/pq-device-boot/pom.xml b/pqs-device/pq-device/pq-device-boot/pom.xml
index 63bbe2463..ee127bc0c 100644
--- a/pqs-device/pq-device/pq-device-boot/pom.xml
+++ b/pqs-device/pq-device/pq-device-boot/pom.xml
@@ -45,6 +45,12 @@
${project.version}
compile
+
+ com.njcn
+ common-oss
+ 1.0.0
+ compile
+
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/ResourceController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/ResourceController.java
new file mode 100644
index 000000000..cf333ba3e
--- /dev/null
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/ResourceController.java
@@ -0,0 +1,124 @@
+package com.njcn.device.pq.controller;
+
+import com.njcn.common.pojo.annotation.OperateInfo;
+import com.njcn.common.pojo.enums.common.LogEnum;
+import com.njcn.common.pojo.enums.response.CommonResponseEnum;
+import com.njcn.common.pojo.response.HttpResult;
+import com.njcn.common.utils.HttpResultUtil;
+import com.njcn.device.pq.pojo.param.LargeScreenParam;
+import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
+import com.njcn.device.pq.service.LargeScreenService;
+import com.njcn.device.pq.service.ResourceService;
+import com.njcn.system.pojo.po.Resinformation;
+import com.njcn.web.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @version 1.0.0
+ * @author: zbj
+ * @date: 2023/05/25
+ */
+@Slf4j
+@Api(tags = "资源管理")
+@RestController
+@RequestMapping("/resource")
+@RequiredArgsConstructor
+public class ResourceController extends BaseController {
+
+ private final ResourceService iResourceAdministrationService;
+
+ /**
+ * 上传资源
+ */
+ @OperateInfo(info = LogEnum.BUSINESS_COMMON)
+ @PostMapping("/uploadFile")
+ @ApiOperation("上传资源")
+ public HttpResult uploadFile(@ApiParam(value = "文件", required = true) @RequestPart("multipartFile") MultipartFile multipartFile,
+ @ApiParam(value = "文件", required = false) @RequestPart("picture") MultipartFile picture,
+ @ApiParam(value = "资源名称", required = true) String name,
+ @ApiParam(value = "资源类型", required = true) Integer type) {
+ String methodDescribe = getMethodDescribe("uploadFile");
+ Boolean flag = iResourceAdministrationService.uploadFile(multipartFile, picture, name, type);
+ return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
+ }
+ /*
+ *//**
+ * 查询数据
+ *//*
+ @OperateInfo(info = LogEnum.BUSINESS_COMMON)
+ @PostMapping("/queryData")
+ @ApiOperation("查询数据")
+ @ApiImplicitParam(name = "resinformation", value = "查询数据", required = true)
+ public HttpResult> queryData(@RequestBody Resinformation resinformation) {
+ String methodDescribe = getMethodDescribe("queryData");
+ List result = iResourceAdministrationService.queryData(resinformation);
+ return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
+ }
+
+ *//**
+ * 修改资源
+ *//*
+ @OperateInfo(info = LogEnum.BUSINESS_COMMON)
+ @PostMapping("/updateFile")
+ @ApiOperation("修改资源")
+ public HttpResult updateFile(@ApiParam(value = "文件", required = false) MultipartFile multipartFile,
+ @ApiParam(value = "id", required = true) String id,
+ @ApiParam(value = "资源名称", required = true) String name,
+ @ApiParam(value = "资源类型", required = true) String type,
+ @ApiParam(value = "资源描述", required = true) String description,
+ @ApiParam(value = "系统类型Guid", required = false) String systemType) {
+ String methodDescribe = getMethodDescribe("updateFile");
+ Boolean flag = iResourceAdministrationService.updateFile(multipartFile, id, name, type, description, systemType);
+ return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
+ }
+
+ *//**
+ * 删除资源
+ *//*
+ @OperateInfo(info = LogEnum.BUSINESS_COMMON)
+ @GetMapping("/deleteFile")
+ @ApiOperation("删除资源")
+ @ApiImplicitParam(name = "id",value = "id",required = true)
+ public HttpResult deleteFile(@RequestParam("id") String id) {
+ String methodDescribe = getMethodDescribe("deleteFile");
+ Boolean flag = iResourceAdministrationService.deleteFile(id);
+ return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
+ }
+
+ *//**
+ * 下载资源
+ *//*
+ @OperateInfo(info = LogEnum.BUSINESS_COMMON)
+ @GetMapping("/downloadFile")
+ @ApiOperation("下载资源")
+ @ApiImplicitParam(name = "id",value = "id",required = true)
+ public HttpResult