瀏覽代碼

管理后台接口完成

wuweihao 4 年之前
父節點
當前提交
ba40790b2d
共有 35 個文件被更改,包括 1981 次插入421 次删除
  1. 1 5
      zhoushan-system-api/pom.xml
  2. 286 286
      zhoushan-system-api/src/main/java/com/fdage/controller/ExhibitionController.java
  3. 65 0
      zhoushan-system-api/src/main/java/com/fdage/controller/SceneController.java
  4. 120 120
      zhoushan-system-api/src/main/java/com/fdage/controller/SseController.java
  5. 65 0
      zhoushan-system-api/src/main/java/com/fdage/controller/VideoController.java
  6. 1 1
      zhoushan-system-api/src/main/java/com/fdage/shiro/ShiroConfig.java
  7. 77 0
      zhoushan-system-api/src/main/resources/application-sit.yml
  8. 15 1
      zhoushan-system-api/src/main/resources/application.yml
  9. 156 0
      zhoushan-system-api/src/main/resources/logback-spring.xml
  10. 38 0
      zhoushan-system-common/pom.xml
  11. 3 2
      zhoushan-system-common/src/main/java/com/fdage/constant/ConfigConstant.java
  12. 22 0
      zhoushan-system-common/src/main/java/com/fdage/constant/MsgCode.java
  13. 35 0
      zhoushan-system-common/src/main/java/com/fdage/util/BaseRuntimeException.java
  14. 83 0
      zhoushan-system-common/src/main/java/com/fdage/util/FileUtils.java
  15. 106 0
      zhoushan-system-common/src/main/java/com/fdage/util/Result.java
  16. 6 6
      zhoushan-system-dao/pom.xml
  17. 21 0
      zhoushan-system-dao/src/main/java/com/fdage/dao/base/SceneMapper.java
  18. 9 0
      zhoushan-system-dao/src/main/java/com/fdage/dao/base/TbMenuMapper.java
  19. 22 0
      zhoushan-system-dao/src/main/java/com/fdage/dao/base/VideoMapper.java
  20. 26 0
      zhoushan-system-dao/src/main/java/com/fdage/dto/PageDto.java
  21. 32 0
      zhoushan-system-dao/src/main/java/com/fdage/dto/SceneDto.java
  22. 33 0
      zhoushan-system-dao/src/main/java/com/fdage/dto/VideoDto.java
  23. 39 0
      zhoushan-system-dao/src/main/java/com/fdage/entity/BaseEntity.java
  24. 32 0
      zhoushan-system-dao/src/main/java/com/fdage/entity/SceneEntity.java
  25. 30 0
      zhoushan-system-dao/src/main/java/com/fdage/entity/VideoEntity.java
  26. 17 0
      zhoushan-system-dao/src/main/java/com/fdage/mapper/IBaseMapper.java
  27. 13 0
      zhoushan-system-dao/src/main/java/com/fdage/mapper/SceneMapper.java
  28. 43 0
      zhoushan-system-dao/src/main/resources/mapper/base/SceneMapper.xml
  29. 41 0
      zhoushan-system-dao/src/main/resources/mapper/base/VideoMapper.xml
  30. 47 0
      zhoushan-system-service/src/main/java/com/fdage/service/IBaseService.java
  31. 26 0
      zhoushan-system-service/src/main/java/com/fdage/service/SceneService.java
  32. 24 0
      zhoushan-system-service/src/main/java/com/fdage/service/VideoService.java
  33. 246 0
      zhoushan-system-service/src/main/java/com/fdage/service/impl/IBaseServiceImpl.java
  34. 99 0
      zhoushan-system-service/src/main/java/com/fdage/service/impl/SceneServiceImpl.java
  35. 102 0
      zhoushan-system-service/src/main/java/com/fdage/service/impl/VideoServiceImpl.java

+ 1 - 5
zhoushan-system-api/pom.xml

@@ -20,10 +20,6 @@
 	</properties>
 
 	<dependencies>
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-web</artifactId>
-		</dependency>
 
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
@@ -68,7 +64,7 @@
 				<artifactId>spring-boot-maven-plugin</artifactId>
 			</plugin>
 		</plugins>
-		<finalName>museum_zhuhai</finalName>
+		<finalName>museum_changshu</finalName>
 	</build>
 
 </project>

+ 286 - 286
zhoushan-system-api/src/main/java/com/fdage/controller/ExhibitionController.java

@@ -1,287 +1,287 @@
-//package com.fdage.controller;
-//
-//import com.alibaba.fastjson.JSONObject;
-//import com.fdage.aop.WebControllerLog;
-//import com.fdage.enums.ResponEnum;
-//import com.fdage.pojo.TbExhibition;
-//import com.fdage.pojo.TbExhibitionCollection;
-//import com.fdage.request.RequestCollection;
-//import com.fdage.request.RequestExhibition;
-//import com.fdage.respon.ResponExhibition;
-//import com.fdage.respon.ResponInformation;
-//import com.fdage.service.IExhibitionService;
-//import com.fdage.util.AjaxJson;
-//import com.fdage.util.DateUtil;
-//import com.fdage.util.FileUtil;
-//import com.github.pagehelper.PageInfo;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiImplicitParam;
-//import io.swagger.annotations.ApiImplicitParams;
-//import io.swagger.annotations.ApiOperation;
-//import lombok.extern.slf4j.Slf4j;
-//import org.springframework.beans.BeanUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Controller;
-//import org.springframework.util.StringUtils;
-//import org.springframework.web.bind.annotation.*;
-//import org.springframework.web.multipart.MultipartFile;
-//
-//import java.util.Date;
-//import java.util.List;
-//
-///**
-// * Created by Hb_zzZ on 2019/9/12.
-// */
-//@Controller
-//@RequestMapping("/zhoushan/exhibition")
-//@Slf4j
-//@Api(tags = "展示管理模块")
-//public class ExhibitionController {
-//
-//    @Value("${upload.exhibition}")
-//    private String uploadPath;
-//
-//    @Autowired
-//    private IExhibitionService service;
-//
-//    @PostMapping("insertExhibitionCollection")
-//    @ResponseBody
-//    @ApiOperation("新增展览方案-推送给文通")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
-//            @ApiImplicitParam(name = "collectionId", value = "文物id", dataType = "String")})
-//    public AjaxJson insertExhibitionCollection(@RequestBody RequestExhibition bo){
-//        if(bo == null || bo.getExhibitionId() == null || StringUtils.isEmpty(bo.getCollectionId())){
-//
-////        if(bo == null || bo.getExhibitionId() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//        String[] ids = bo.getCollectionId().split(",");
-//
-//        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
-//        for(int i = 0, len = ids.length; i < len; i++){
-//            exhibitionCollection.setExhibitionId(bo.getExhibitionId());
-//            // 2021-08-16 by owen
-////            if (ids.length > 1) {
-////                exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
-////            }
-//            exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
-//            service.insertExhibitionCollection(exhibitionCollection);
-//        }
-//
-//        //发送sse消息
-//        SseController.send("data:" + "0\r\n");
-//        return AjaxJson.success();
-//    }
-//
-//    @PostMapping("updateExhibitionCollection")
-//    @ResponseBody
-//    @ApiOperation("修改展览方案-推送给文通")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
-//            @ApiImplicitParam(name = "collectionId", value = "文物id", dataType = "String")})
-//    public AjaxJson updateExhibitionCollection(@RequestBody RequestExhibition bo){
-//        if(bo == null || bo.getExhibitionId() == null || StringUtils.isEmpty(bo.getCollectionId())){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        service.deleteExhibitionCollection(bo.getExhibitionId());
-//
-//
-//        String[] ids = bo.getCollectionId().split(",");
-//        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
-//        for(int i = 0, len = ids.length; i < len; i++){
-//            exhibitionCollection.setExhibitionId(bo.getExhibitionId());
-//            exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
-//            service.insertExhibitionCollection(exhibitionCollection);
-//        }
-//
-//        //发送sse消息
-//        SseController.send("data:" + "0\r\n");
-//        return AjaxJson.success();
-//    }
-//
-//    @PostMapping("addExhibition")
-//    @ResponseBody
-//    @WebControllerLog(description = "展示管理-新增展览方案")
-//    @ApiOperation("新增展览方案")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "name", value = "展览方案名称", dataType = "String"),
-//            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
-//            @ApiImplicitParam(name = "equipmentId", value = "关联设备id", dataType = "String"),
-//            @ApiImplicitParam(name = "webUrl", value = "展示封面", dataType = "String"),
-//            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
-//    public AjaxJson addExhibition(@RequestBody RequestExhibition bo){
-//        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getTypeId() == null || bo.getState() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        TbExhibition exhibition = new TbExhibition();
-//        BeanUtils.copyProperties(bo, exhibition);
-//        service.insert(exhibition);
-//        return AjaxJson.success(exhibition);
-//    }
-//
-//    @PostMapping("updateExhibition")
-//    @ResponseBody
-//    @WebControllerLog(description = "展示管理-修改展览方案")
-//    @ApiOperation("修改展览方案")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "isSend", value = "是否推送给问题,1推送", dataType = "String"),
-//            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String"),
-//            @ApiImplicitParam(name = "name", value = "展览方案名称", dataType = "String"),
-//            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
-//            @ApiImplicitParam(name = "equipmentId", value = "关联设备id", dataType = "String"),
-//            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
-//    public AjaxJson updateExhibition(@RequestBody RequestExhibition bo){
-//        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getTypeId() == null || bo.getState() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        TbExhibition exhibition = new TbExhibition();
-//        BeanUtils.copyProperties(bo, exhibition);
-//        exhibition.setCreateTime(new Date());
-//        service.update(exhibition);
-//        if(bo.getIsSend() != null && bo.getIsSend() == 1){
-//            //发送sse消息
-//            SseController.send("data:" + "0\r\n");
-//        }
-//        return AjaxJson.success(exhibition);
-//    }
-//
-//    @PostMapping("deleteExhibition")
-//    @ResponseBody
-//    @WebControllerLog(description = "展示管理-删除展览方案")
-//    @ApiOperation("删除展览方案")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String")})
-//    public AjaxJson deleteExhibition(@RequestBody RequestExhibition bo){
-//        if(bo == null || bo.getId() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        service.delete(bo.getId());
-//        return AjaxJson.success();
-//    }
-//
-//    @PostMapping("copyExhibition")
-//    @ResponseBody
-//    @WebControllerLog(description = "展示管理-复制展览方案")
-//    @ApiOperation("复制展览方案")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String")})
-//    public AjaxJson copyExhibition(@RequestBody RequestExhibition bo){
-//        if(bo == null || bo.getId() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        TbExhibition exhibition = service.findById(bo.getId());
-//        exhibition.setId(null);
-//        exhibition.setState(1);
-//        service.insert(exhibition);
-//
-//        List<ResponExhibition> list = service.findExhibitionCollection(bo.getId());
-//        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
-//        for(ResponExhibition responExhibition : list){
-//            exhibitionCollection.setExhibitionId(exhibition.getId());
-//            exhibitionCollection.setCollectionId(responExhibition.getCollectionId());
-//            service.insertExhibitionCollection(exhibitionCollection);
-//        }
-//        return AjaxJson.success();
-//    }
-//
-//    @PostMapping("findCollectionByExhibition")
-//    @ResponseBody
-//    @ApiOperation("通过展示方案找文物")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "exhibitionId", value = "展览方案id", dataType = "String")})
-//    public AjaxJson findCollectionByExhibition(@RequestBody RequestExhibition bo){
+package com.fdage.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdage.aop.WebControllerLog;
+import com.fdage.enums.ResponEnum;
+import com.fdage.pojo.TbExhibition;
+import com.fdage.pojo.TbExhibitionCollection;
+import com.fdage.request.RequestCollection;
+import com.fdage.request.RequestExhibition;
+import com.fdage.respon.ResponExhibition;
+import com.fdage.respon.ResponInformation;
+import com.fdage.service.IExhibitionService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.DateUtil;
+import com.fdage.util.FileUtil;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/12.
+ */
+@Controller
+@RequestMapping("/zhoushan/exhibition")
+@Slf4j
+@Api(tags = "展示管理模块")
+public class ExhibitionController {
+
+    @Value("${upload.exhibition}")
+    private String uploadPath;
+
+    @Autowired
+    private IExhibitionService service;
+
+    @PostMapping("insertExhibitionCollection")
+    @ResponseBody
+    @ApiOperation("新增展览方案-推送给文通")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "collectionId", value = "文物id", dataType = "String")})
+    public AjaxJson insertExhibitionCollection(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getExhibitionId() == null || StringUtils.isEmpty(bo.getCollectionId())){
+
 //        if(bo == null || bo.getExhibitionId() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        return AjaxJson.success(service.findCollectionByExhibition(bo.getExhibitionId()));
-//    }
-//
-//    @PostMapping("list")
-//    @ResponseBody
-//    @WebControllerLog(description = "展示管理-获取展览方案列表")
-//    @ApiOperation("获取展览方案列表")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "name", value = "方案名称", dataType = "String"),
-//            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
-//            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
-//    public AjaxJson list(@RequestBody RequestExhibition bo){
-//        List<ResponExhibition> list = service.findList(bo);
-//        for(ResponExhibition exhibition : list){
-//            exhibition.setCreateTime(String.valueOf(DateUtil.convert2CST(exhibition.getCreateTime())));
-//        }
-//        PageInfo<ResponExhibition> pageInfo = new PageInfo<>(list);
-//        return AjaxJson.success(pageInfo);
-//    }
-//
-//    @PostMapping("getExhibitionByEquipmentId")
-//    @ResponseBody
-//    @ApiOperation("通过设备id获取展示方案")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "equipmentId", value = "设备id", dataType = "String")})
-//    public AjaxJson getExhibitionByEquipmentId(@RequestBody RequestExhibition bo){
-//        if(bo == null || bo.getEquipmentId() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        ResponExhibition responExhibition = service.getExhibitionByEquipmentId(bo.getEquipmentId());
-//        return AjaxJson.success(responExhibition);
-//    }
-//
-//    @PostMapping("getExhibitionById")
-//    @ResponseBody
-//    @ApiOperation("通过id获取展示方案")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
-//    public AjaxJson getExhibitionById(@RequestBody RequestExhibition bo){
-//        if(bo == null || bo.getId() == null){
-//            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
-//        }
-//
-//        ResponExhibition responExhibition = service.getExhibitionById(bo.getId());
-//        return AjaxJson.success(responExhibition);
-//    }
-//
-//    @PostMapping("/upload")
-//    @ResponseBody
-//    @ApiOperation("上传展示方案图片")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
-//    public AjaxJson upload(@RequestParam(value = "filename", defaultValue = "") String name, @RequestParam("file") MultipartFile file){
-//        if(file == null){
-//            return AjaxJson.failure("参数不能为空");
-//        }
-//        String fileName = System.currentTimeMillis() + "_";
-//        if(org.apache.commons.lang3.StringUtils.isNotEmpty(name)){
-//            fileName = fileName + name;
-//        }else {
-//            fileName = fileName + file.getOriginalFilename();
-//        }
-//        log.info("图片地址:" + fileName);
-//        boolean flag = FileUtil.upload(file, uploadPath, fileName);
-//
-//        if(!flag){
-//            return AjaxJson.failure("上传图片失败");
-//        }
-//
-////        Map<String, String> map = new HashMap<>();
-////        map.put(path + "/" + fileName, "company/" + fileName);
-////        uploadToAlibabaService.upload(map);
-//
-//        return AjaxJson.success((Object) ("/exhibition/" + fileName));
-//    }
-//
-//    @PostMapping("typeList")
-//    @ResponseBody
-//    @ApiOperation("获取展示类别列表")
-//    public AjaxJson typeList(){
-//        return AjaxJson.success(service.typeList());
-//    }
-//}
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+        String[] ids = bo.getCollectionId().split(",");
+
+        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
+        for(int i = 0, len = ids.length; i < len; i++){
+            exhibitionCollection.setExhibitionId(bo.getExhibitionId());
+            // 2021-08-16 by owen
+//            if (ids.length > 1) {
+//                exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
+//            }
+            exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
+            service.insertExhibitionCollection(exhibitionCollection);
+        }
+
+        //发送sse消息
+        SseController.send("data:" + "0\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("updateExhibitionCollection")
+    @ResponseBody
+    @ApiOperation("修改展览方案-推送给文通")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "collectionId", value = "文物id", dataType = "String")})
+    public AjaxJson updateExhibitionCollection(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getExhibitionId() == null || StringUtils.isEmpty(bo.getCollectionId())){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        service.deleteExhibitionCollection(bo.getExhibitionId());
+
+
+        String[] ids = bo.getCollectionId().split(",");
+        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
+        for(int i = 0, len = ids.length; i < len; i++){
+            exhibitionCollection.setExhibitionId(bo.getExhibitionId());
+            exhibitionCollection.setCollectionId(Long.valueOf(ids[i]));
+            service.insertExhibitionCollection(exhibitionCollection);
+        }
+
+        //发送sse消息
+        SseController.send("data:" + "0\r\n");
+        return AjaxJson.success();
+    }
+
+    @PostMapping("addExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-新增展览方案")
+    @ApiOperation("新增展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "展览方案名称", dataType = "String"),
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "equipmentId", value = "关联设备id", dataType = "String"),
+            @ApiImplicitParam(name = "webUrl", value = "展示封面", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson addExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getTypeId() == null || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbExhibition exhibition = new TbExhibition();
+        BeanUtils.copyProperties(bo, exhibition);
+        service.insert(exhibition);
+        return AjaxJson.success(exhibition);
+    }
+
+    @PostMapping("updateExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-修改展览方案")
+    @ApiOperation("修改展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "isSend", value = "是否推送给问题,1推送", dataType = "String"),
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String"),
+            @ApiImplicitParam(name = "name", value = "展览方案名称", dataType = "String"),
+            @ApiImplicitParam(name = "exhibitionId", value = "展览id", dataType = "String"),
+            @ApiImplicitParam(name = "equipmentId", value = "关联设备id", dataType = "String"),
+            @ApiImplicitParam(name = "state", value = "状态,0:启用,1:禁用", dataType = "String")})
+    public AjaxJson updateExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || StringUtils.isEmpty(bo.getName()) || bo.getTypeId() == null || bo.getState() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbExhibition exhibition = new TbExhibition();
+        BeanUtils.copyProperties(bo, exhibition);
+        exhibition.setCreateTime(new Date());
+        service.update(exhibition);
+        if(bo.getIsSend() != null && bo.getIsSend() == 1){
+            //发送sse消息
+            SseController.send("data:" + "0\r\n");
+        }
+        return AjaxJson.success(exhibition);
+    }
+
+    @PostMapping("deleteExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-删除展览方案")
+    @ApiOperation("删除展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String")})
+    public AjaxJson deleteExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        service.delete(bo.getId());
+        return AjaxJson.success();
+    }
+
+    @PostMapping("copyExhibition")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-复制展览方案")
+    @ApiOperation("复制展览方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "展览方案id", dataType = "String")})
+    public AjaxJson copyExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        TbExhibition exhibition = service.findById(bo.getId());
+        exhibition.setId(null);
+        exhibition.setState(1);
+        service.insert(exhibition);
+
+        List<ResponExhibition> list = service.findExhibitionCollection(bo.getId());
+        TbExhibitionCollection exhibitionCollection = new TbExhibitionCollection();
+        for(ResponExhibition responExhibition : list){
+            exhibitionCollection.setExhibitionId(exhibition.getId());
+            exhibitionCollection.setCollectionId(responExhibition.getCollectionId());
+            service.insertExhibitionCollection(exhibitionCollection);
+        }
+        return AjaxJson.success();
+    }
+
+    @PostMapping("findCollectionByExhibition")
+    @ResponseBody
+    @ApiOperation("通过展示方案找文物")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "exhibitionId", value = "展览方案id", dataType = "String")})
+    public AjaxJson findCollectionByExhibition(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getExhibitionId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        return AjaxJson.success(service.findCollectionByExhibition(bo.getExhibitionId()));
+    }
+
+    @PostMapping("list")
+    @ResponseBody
+    @WebControllerLog(description = "展示管理-获取展览方案列表")
+    @ApiOperation("获取展览方案列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "name", value = "方案名称", dataType = "String"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
+            @ApiImplicitParam(name = "pageSize", value = "每页数量", dataType = "String")})
+    public AjaxJson list(@RequestBody RequestExhibition bo){
+        List<ResponExhibition> list = service.findList(bo);
+        for(ResponExhibition exhibition : list){
+            exhibition.setCreateTime(String.valueOf(DateUtil.convert2CST(exhibition.getCreateTime())));
+        }
+        PageInfo<ResponExhibition> pageInfo = new PageInfo<>(list);
+        return AjaxJson.success(pageInfo);
+    }
+
+    @PostMapping("getExhibitionByEquipmentId")
+    @ResponseBody
+    @ApiOperation("通过设备id获取展示方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "equipmentId", value = "设备id", dataType = "String")})
+    public AjaxJson getExhibitionByEquipmentId(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getEquipmentId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        ResponExhibition responExhibition = service.getExhibitionByEquipmentId(bo.getEquipmentId());
+        return AjaxJson.success(responExhibition);
+    }
+
+    @PostMapping("getExhibitionById")
+    @ResponseBody
+    @ApiOperation("通过id获取展示方案")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "String")})
+    public AjaxJson getExhibitionById(@RequestBody RequestExhibition bo){
+        if(bo == null || bo.getId() == null){
+            return AjaxJson.failure(ResponEnum.NOT_NULL.getCode(), ResponEnum.NOT_NULL.getMessage());
+        }
+
+        ResponExhibition responExhibition = service.getExhibitionById(bo.getId());
+        return AjaxJson.success(responExhibition);
+    }
+
+    @PostMapping("/upload")
+    @ResponseBody
+    @ApiOperation("上传展示方案图片")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "文件流", dataType = "String")})
+    public AjaxJson upload(@RequestParam(value = "filename", defaultValue = "") String name, @RequestParam("file") MultipartFile file){
+        if(file == null){
+            return AjaxJson.failure("参数不能为空");
+        }
+        String fileName = System.currentTimeMillis() + "_";
+        if(org.apache.commons.lang3.StringUtils.isNotEmpty(name)){
+            fileName = fileName + name;
+        }else {
+            fileName = fileName + file.getOriginalFilename();
+        }
+        log.info("图片地址:" + fileName);
+        boolean flag = FileUtil.upload(file, uploadPath, fileName);
+
+        if(!flag){
+            return AjaxJson.failure("上传图片失败");
+        }
+
+//        Map<String, String> map = new HashMap<>();
+//        map.put(path + "/" + fileName, "company/" + fileName);
+//        uploadToAlibabaService.upload(map);
+
+        return AjaxJson.success((Object) ("/exhibition/" + fileName));
+    }
+
+    @PostMapping("typeList")
+    @ResponseBody
+    @ApiOperation("获取展示类别列表")
+    public AjaxJson typeList(){
+        return AjaxJson.success(service.typeList());
+    }
+}

+ 65 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/SceneController.java

@@ -0,0 +1,65 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.dto.SceneDto;
+import com.fdage.entity.SceneEntity;
+import com.fdage.service.SceneService;
+import com.fdage.util.AjaxJson;
+import com.fdage.util.Result;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+
+/**
+ * Created by owen on 2021/8/23 0023 15:35
+ */
+@Api(tags = "场景管理")
+@RestController
+@RequestMapping("/zhoushan/scene")
+public class SceneController {
+    @Autowired
+    SceneService sceneService;
+
+    @ApiOperation("列表")
+    @PostMapping("list")
+    public Result list() {
+        return sceneService.findAll();
+    }
+
+    @WebControllerLog(description = "场景管理-新增/编辑")
+    @ApiOperation("新增/编辑")
+    @PostMapping("save")
+    public Result<SceneEntity> save(@Valid @RequestBody SceneDto param) {
+        return sceneService.saveEntity(param);
+    }
+
+
+    @WebControllerLog(description = "场景管理-删除")
+    @ApiOperation(value = "删除", notes = "db数据软删除, 物理数据真删除")
+    @GetMapping("remove/{id}")
+    public Result remove(@PathVariable Long id) {
+        return sceneService.remove(id);
+    }
+
+    @WebControllerLog(description = "场景管理-详情")
+    @ApiOperation(value = "详情")
+    @GetMapping("detail/{id}")
+    public Result detail(@PathVariable Long id) {
+
+        return sceneService.detail(id);
+    }
+
+
+    @ApiOperation(value = "上传", notes = "重命名文件")
+    @PostMapping("upload")
+    public Result upload(MultipartFile file) {
+
+        return sceneService.upload(file, null, false);
+    }
+}

+ 120 - 120
zhoushan-system-api/src/main/java/com/fdage/controller/SseController.java

@@ -1,127 +1,127 @@
-//package com.fdage.controller;
+package com.fdage.controller;
+
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.AsyncEvent;
+import javax.servlet.AsyncListener;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by Hb_zzZ on 2019/9/16.
+ */
+@ApiIgnore
+@WebServlet(urlPatterns = { "/sendMessage" }, asyncSupported = true)
+@Controller
+public class SseController extends HttpServlet {
+
+    private static final long serialVersionUID = 1L;
+    private final static int DEFAULT_TIME_OUT = 10 * 60 * 1000;
+    public static List<AsyncContext> actxList =new ArrayList<AsyncContext>();
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+        // TODO Auto-generated method stub
+        resp.setContentType("text/event-stream");
+        resp.setCharacterEncoding("UTF-8");
+        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);//注意这里
+
+        AsyncContext actx = req.startAsync(req, resp);
+        actx.setTimeout(DEFAULT_TIME_OUT);
+        actx.addListener(new AsyncListener() {
+            @Override
+            public void onComplete(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event complete:" + arg0.getSuppliedRequest().getRemoteAddr());
+            }
+
+            @Override
+            public void onError(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event has error");
+            }
+
+            @Override
+            public void onStartAsync(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event start:" + arg0.getSuppliedRequest().getRemoteAddr());
+            }
+
+            @Override
+            public void onTimeout(AsyncEvent arg0) throws IOException {
+                // TODO Auto-generated method stub
+                System.out.println("[echo]event time lost");
+            }
+        });
+
+        actxList.add(actx);
+
+//        PrintWriter out = actx.getResponse().getWriter();
+//        out.println("data:" + new Date().getTime());  //js页面EventSource接收数据格式:data:数据 + "\r\n"
+//        out.flush();
+//        new Thread(new AsyncWebService(actx)).start();
+    }
+
+    @GetMapping("send")
+    @ResponseBody
+    public static String send(String msg){
+        //打印当前AsyncContext
+        System.out.println(actxList.size());
+        if(actxList.size()>0){
+            for(int i = 0;i<actxList.size();i++){
+                AsyncContext obj = actxList.get(i);
+                PrintWriter out;
+
+                try {
+                    if (obj.getTimeout()>0){
+                        out = obj.getResponse().getWriter();
+                        out.println(msg);  //js页面EventSource接收数据格式:data:数据 + "\r\n"
+                        out.flush();
+                    }
+                } catch (Exception e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        }
+        return "发送消息";
+    }
+
+//    class AsyncWebService implements Runnable {
+//        AsyncContext ctx;
 //
-//import io.swagger.annotations.ApiOperation;
-//import org.springframework.stereotype.Controller;
-//import org.springframework.web.bind.annotation.GetMapping;
-//import org.springframework.web.bind.annotation.PostMapping;
-//import org.springframework.web.bind.annotation.ResponseBody;
-//import springfox.documentation.annotations.ApiIgnore;
-//
-//import javax.servlet.AsyncContext;
-//import javax.servlet.AsyncEvent;
-//import javax.servlet.AsyncListener;
-//import javax.servlet.ServletException;
-//import javax.servlet.annotation.WebServlet;
-//import javax.servlet.http.HttpServlet;
-//import javax.servlet.http.HttpServletRequest;
-//import javax.servlet.http.HttpServletResponse;
-//import java.io.IOException;
-//import java.io.PrintWriter;
-//import java.util.ArrayList;
-//import java.util.Date;
-//import java.util.List;
-//
-///**
-// * Created by Hb_zzZ on 2019/9/16.
-// */
-//@ApiIgnore
-//@WebServlet(urlPatterns = { "/sendMessage" }, asyncSupported = true)
-//@Controller
-//public class SseController extends HttpServlet {
-//
-//    private static final long serialVersionUID = 1L;
-//    private final static int DEFAULT_TIME_OUT = 10 * 60 * 1000;
-//    public static List<AsyncContext> actxList =new ArrayList<AsyncContext>();
-//
-//    @Override
-//    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-//        // TODO Auto-generated method stub
-//        resp.setContentType("text/event-stream");
-//        resp.setCharacterEncoding("UTF-8");
-//        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);//注意这里
-//
-//        AsyncContext actx = req.startAsync(req, resp);
-//        actx.setTimeout(DEFAULT_TIME_OUT);
-//        actx.addListener(new AsyncListener() {
-//            @Override
-//            public void onComplete(AsyncEvent arg0) throws IOException {
-//                // TODO Auto-generated method stub
-//                System.out.println("[echo]event complete:" + arg0.getSuppliedRequest().getRemoteAddr());
-//            }
+//        public AsyncWebService(AsyncContext ctx) {
+//            this.ctx = ctx;
+//        }
 //
-//            @Override
-//            public void onError(AsyncEvent arg0) throws IOException {
-//                // TODO Auto-generated method stub
-//                System.out.println("[echo]event has error");
-//            }
+//        public void run() {
+//            try {
+//                //等待十秒钟,以模拟业务方法的执行
+//                Thread.sleep(10000);
+//                PrintWriter out = ctx.getResponse().getWriter();
+//                out.println("data:中文" + new Date() + "\r\n");  //js页面EventSource接收数据格式:data:数据 + "\r\n"
 //
-//            @Override
-//            public void onStartAsync(AsyncEvent arg0) throws IOException {
-//                // TODO Auto-generated method stub
-//                System.out.println("[echo]event start:" + arg0.getSuppliedRequest().getRemoteAddr());
+//                out.flush();
+//                ctx.complete();
+//            } catch (Exception e) {
+//                e.printStackTrace();
 //            }
 //
-//            @Override
-//            public void onTimeout(AsyncEvent arg0) throws IOException {
-//                // TODO Auto-generated method stub
-//                System.out.println("[echo]event time lost");
-//            }
-//        });
-//
-//        actxList.add(actx);
-//
-////        PrintWriter out = actx.getResponse().getWriter();
-////        out.println("data:" + new Date().getTime());  //js页面EventSource接收数据格式:data:数据 + "\r\n"
-////        out.flush();
-////        new Thread(new AsyncWebService(actx)).start();
-//    }
-//
-//    @GetMapping("send")
-//    @ResponseBody
-//    public static String send(String msg){
-//        //打印当前AsyncContext
-//        System.out.println(actxList.size());
-//        if(actxList.size()>0){
-//            for(int i = 0;i<actxList.size();i++){
-//                AsyncContext obj = actxList.get(i);
-//                PrintWriter out;
-//
-//                try {
-//                    if (obj.getTimeout()>0){
-//                        out = obj.getResponse().getWriter();
-//                        out.println(msg);  //js页面EventSource接收数据格式:data:数据 + "\r\n"
-//                        out.flush();
-//                    }
-//                } catch (Exception e) {
-//                    // TODO Auto-generated catch block
-//                    e.printStackTrace();
-//                }
-//            }
 //        }
-//        return "发送消息";
-//    }
 //
-////    class AsyncWebService implements Runnable {
-////        AsyncContext ctx;
-////
-////        public AsyncWebService(AsyncContext ctx) {
-////            this.ctx = ctx;
-////        }
-////
-////        public void run() {
-////            try {
-////                //等待十秒钟,以模拟业务方法的执行
-////                Thread.sleep(10000);
-////                PrintWriter out = ctx.getResponse().getWriter();
-////                out.println("data:中文" + new Date() + "\r\n");  //js页面EventSource接收数据格式:data:数据 + "\r\n"
-////
-////                out.flush();
-////                ctx.complete();
-////            } catch (Exception e) {
-////                e.printStackTrace();
-////            }
-////
-////        }
-////
-////    }
-//}
+//    }
+}

+ 65 - 0
zhoushan-system-api/src/main/java/com/fdage/controller/VideoController.java

@@ -0,0 +1,65 @@
+package com.fdage.controller;
+
+import com.fdage.aop.WebControllerLog;
+import com.fdage.dto.SceneDto;
+import com.fdage.dto.VideoDto;
+import com.fdage.entity.SceneEntity;
+import com.fdage.entity.VideoEntity;
+import com.fdage.service.SceneService;
+import com.fdage.service.VideoService;
+import com.fdage.util.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+
+/**
+ * Created by owen on 2021/8/30 0023 15:35
+ */
+@Api(tags = "视频管理")
+@RestController
+@RequestMapping("/zhoushan/video")
+public class VideoController {
+    @Autowired
+    VideoService videoService;
+
+    @ApiOperation("列表")
+    @PostMapping("list")
+    public Result list() {
+        return videoService.findAll();
+    }
+
+    @WebControllerLog(description = "视频管理-新增/编辑")
+    @ApiOperation("新增/编辑")
+    @PostMapping("save")
+    public Result<VideoEntity> save(@Valid @RequestBody VideoDto param) {
+        return videoService.saveEntity(param);
+    }
+
+
+    @WebControllerLog(description = "视频管理-删除")
+    @ApiOperation(value = "删除", notes = "db数据软删除, 物理数据真删除")
+    @GetMapping("remove/{id}")
+    public Result remove(@PathVariable Long id) {
+        return videoService.remove(id);
+    }
+
+    @WebControllerLog(description = "视频管理-详情")
+    @ApiOperation(value = "详情")
+    @GetMapping("detail/{id}")
+    public Result detail(@PathVariable Long id) {
+
+        return videoService.detail(id);
+    }
+
+
+    @ApiOperation(value = "上传", notes = "重命名文件")
+    @PostMapping("upload")
+    public Result upload(MultipartFile file) {
+
+        return videoService.upload(file, null, false);
+    }
+}

+ 1 - 1
zhoushan-system-api/src/main/java/com/fdage/shiro/ShiroConfig.java

@@ -79,7 +79,7 @@ public class ShiroConfig {
 
 
         // 所有请求通过我们自己的JWT Filter
-        filterRuleMap.put("/zhoushan/**", "jwt");
+//        filterRuleMap.put("/zhoushan/**", "jwt");
 
 
         // 访问401和404页面不通过我们的Filter

+ 77 - 0
zhoushan-system-api/src/main/resources/application-sit.yml

@@ -0,0 +1,77 @@
+
+
+
+spring:
+  jmx:
+    default-domain: zhoushan_system
+    enabled: false
+  application:
+    name: zhoushan_system
+  servlet:
+    multipart:
+      maxFileSize: 1000MB
+      maxRequestSize: 1000MB
+  datasource:
+#    url: jdbc:mysql://47.107.253.212:3306/zhoushan_system?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true
+#    username: root
+#    password: 4dagecui2019
+    # db 项目测试服务器
+    url: jdbc:mysql://8.135.106.227:3306/${project.en}?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true
+    username: root
+    password: 4dkk2021testproject%
+    driver-class-name: com.mysql.jdbc.Driver
+# Redis数据库索引(默认为0)
+  redis:
+    database: 0
+    host: 127.0.0.1
+    port: 6379
+    password:
+# 连接超时时间 单位 ms(毫秒)
+    timeout: 3000ms
+# 连接池中的最大空闲连接,默认值也是8。
+    jedis:
+      pool:
+        max-idle: 8
+#连接池中的最小空闲连接,默认值也是0。
+        min-idle: 0
+# 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。
+        max-active: 8
+# 等待可用连接的最大时间,单位毫秒,默认值为-1,表示永不超时。如果超过等待时间,则直接抛出JedisConnectionException
+        max-wait: -1ms
+# 配置静态资源跟目录
+  mvc:
+    static-path-pattern: /**
+  resources:
+    static-locations: file:${my.file.path}
+
+upload:
+  head: ${my.file.path}\head
+  information: ${my.file.path}\information
+  collection: ${my.file.path}\collection
+  exhibition: ${my.file.path}\exhibition
+
+
+
+swagger:
+  package: com.fdage.controller
+  title: ${project.sc}-sit
+  description: ${swagger.title}
+  version: 1.0
+
+
+# 服务器存放地址
+my:
+  file:
+    path: /root/data/${project.en}_data
+
+
+logging:
+  path: /root/log/${project.en}_log
+  config: classpath:logback-spring.xml
+  level:
+    com:
+      fdage: debug
+
+
+
+

+ 15 - 1
zhoushan-system-api/src/main/resources/application.yml

@@ -8,8 +8,10 @@ server:
 mybatis:
   mapperLocations: classpath*:mapper/*/*.xml
   typeAliasesPackage: com.fdage.pojo
+  configuration:
+    map-underscore-to-camel-case: true
 
-
+# page分页
 pagehelper:
   helperDialect: mysql
   reasonable: true
@@ -20,3 +22,15 @@ pagehelper:
 project:
   sc: 常熟博物馆
   en: museum_changshu
+
+
+# tk.mybatis 配置自动识别字段转换
+#mapper:
+#  identity: MYSQL
+#  mappers: tk.mybatis.mapper.common.Mapper
+
+# 允许上传文件后缀
+my:
+  file:
+    allow: .jpg,.gif,.png,.ico,.bmp,.jpeg,.zip,.zp,.rar,.mp3,.mp4,.avi,.mov,.4dage,.wav,.wma,.m4a,.obj
+

+ 156 - 0
zhoushan-system-api/src/main/resources/logback-spring.xml

@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <property name="LOG_MAX_HISTORY" value="180"/>
+    <springProperty scope="context" name="LOG_PATH" source="logging.path"/>
+
+    <!-- 控制台输出 -->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
+            <pattern>${LOG_PATH}/%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+    </appender>
+    <!-- 按照每天生成日志文件:主项目日志 -->
+    <appender name="file.all" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 追加日志到原文件结尾 -->
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 -->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{500} - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+    </appender>
+
+    <!--info日志统一输出到这里-->
+    <appender name="file.info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 每小时生成日志文件 -->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/info/console-info.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录info级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>INFO</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--错误日志统一输出到这里-->
+    <appender name="file.error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名-->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/error/console-error.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录error级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>ERROR</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--warn日志统一输出到这里-->
+    <appender name="file.warn" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 按小时生成日志-->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/warn/console-warn.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <!-- 除按日志记录之外,还配置了日志文件不能超过10M(默认),若超过10M,日志文件会以索引0开始, -->
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录warn级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>WARN</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!--debug级别日志统一输出到这里-->
+    <appender name="file.debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!--日志文件输出的文件名 按小时生成日志-->
+            <FileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd}/debug/console-debug.%d{yyyy-MM-dd-HH}.%i.log</FileNamePattern>
+            <!--日志文件保留天数-->
+            <MaxHistory>${LOG_MAX_HISTORY}</MaxHistory>
+            <!-- 除按日志记录之外,还配置了日志文件不能超过5M,若超过5M,日志文件会以索引0开始,命名日志文件,例如console-debug.2018-08-24-09.1.log -->
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>10MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %method 方法名  %L 行数 %msg:日志消息,%n是换行符-->
+            <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
+            <!--<charset>utf-8</charset>-->
+        </encoder>
+        <!-- 此日志文件只记录debug级别的 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>DEBUG</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY </onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
+    <appender name="file.async" class="ch.qos.logback.classic.AsyncAppender">
+        <discardingThreshold>0</discardingThreshold>
+        <queueSize>256</queueSize>
+        <includeCallerData>true</includeCallerData>
+        <appender-ref ref="file.all" />
+    </appender>
+
+    <!--  日志输出级别 -->
+    <!-- TRACE\DEBUG\INFO\WARN\ERROR\FATAL\OFF -->
+    <root level="INFO">
+        <appender-ref ref="console" />
+        <appender-ref ref="file.async"/>
+        <appender-ref ref="file.error" />
+        <appender-ref ref="file.info" />
+        <appender-ref ref="file.debug" />
+        <appender-ref ref="file.warn" />
+    </root>
+
+</configuration>

+ 38 - 0
zhoushan-system-common/pom.xml

@@ -21,9 +21,17 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <java.version>1.8</java.version>
+        <tk.mybatis.version>2.0.2</tk.mybatis.version>
+        <pagehelper.version>1.2.5</pagehelper.version>
     </properties>
 
     <dependencies>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-actuator</artifactId>
@@ -154,6 +162,36 @@
             <version>5.3.3</version>
         </dependency>
 
+
+        <!--tk.mybatis 依赖-->
+        <dependency>
+            <groupId>tk.mybatis</groupId>
+            <artifactId>mapper-spring-boot-starter</artifactId>
+            <version>${tk.mybatis.version}</version>
+            <!-- tk.mybatis 跟springboot jap 包冲突-->
+            <!--<exclusions>-->
+                <!--<exclusion>-->
+                    <!--<groupId>javax.persistence</groupId>-->
+                    <!--<artifactId>persistence-api</artifactId>-->
+                <!--</exclusion>-->
+            <!--</exclusions>-->
+
+        </dependency>
+
+        <!--分页插件-->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>${pagehelper.version}</version>
+        </dependency>
+
+        <!-- 字段校验 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
+
+
     </dependencies>
 
     <build>

+ 3 - 2
zhoushan-system-common/src/main/java/com/fdage/constant/ConfigConstant.java

@@ -15,8 +15,9 @@ public class ConfigConstant {
     @Value("${my.file.path}")
     public  String serverBasePath;
 
-//    @Value("${server.file.allow}")
-//    public String serverFileFallow;
+
+    @Value("${my.file.allow}")
+    public String serverFileFallow;
 
     /**redis token前缀*/
 //    @Value("${redis.prefix}")

+ 22 - 0
zhoushan-system-common/src/main/java/com/fdage/constant/MsgCode.java

@@ -0,0 +1,22 @@
+package com.fdage.constant;
+
+/**
+ * Created by owen on 2021/6/1 0001 16:45
+ */
+public class MsgCode {
+
+    /** 对象不存在*/
+    public static final Integer e3001 = 3001;
+
+    /** 长传文件非法*/
+    public static final Integer e3002 = 3002;
+
+    /** 空目录*/
+    public static final Integer e3003 = 3003;
+
+    /** 状态非法*/
+    public static final Integer e3004 = 3004;
+
+    /** 验证码失效*/
+    public static final Integer e3005 = 3005;
+}

+ 35 - 0
zhoushan-system-common/src/main/java/com/fdage/util/BaseRuntimeException.java

@@ -0,0 +1,35 @@
+package com.fdage.util;
+
+public class BaseRuntimeException extends RuntimeException{
+
+    private static final long serialVersionUID = -1518945670203783450L;
+    private Integer code;
+    private String msg;
+
+    public BaseRuntimeException(String msg){
+        super(msg);
+        this.msg = msg;
+    }
+
+    public BaseRuntimeException(Integer code, String msg){
+        super(msg);
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 83 - 0
zhoushan-system-common/src/main/java/com/fdage/util/FileUtils.java

@@ -0,0 +1,83 @@
+package com.fdage.util;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
+import com.fdage.constant.ConfigConstant;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Created by owen on 2020/5/12 0012 17:21
+ */
+@Slf4j
+@Component
+public class FileUtils {
+
+    @Autowired
+    ConfigConstant configConstant;
+
+    public boolean checkFile(MultipartFile file) {
+        //设置允许上传文件类型
+//        String suffixList = ".jpg,.gif,.png,.ico,.bmp,.jpeg,.zip,.zp,.rar,.mp3,.mp4,.avi,.mov,.4dage,.wav,.wma,.m4a";
+        String suffixList = configConstant.serverFileFallow;
+        // 获取文件后缀
+        if(file == null){
+            log.info("文件流为空不可上传");
+            return false;
+        }
+        String fileName = file.getOriginalFilename();
+        String suffix = fileName.substring(fileName.lastIndexOf(".")
+                + 1, fileName.length());
+        if (suffixList.contains(suffix.trim().toLowerCase())) {
+            log.info("无非法参数可以放行!!!");
+            return true;
+        }
+        log.info("存在非法参数不能放行!请核对上传文件格式,重新刷新页面再次上传!");
+        return false;
+    }
+
+
+    /**
+     *
+     * @param file
+     * @param urlBasePath 目前传入需要/ , 结尾不要/ , 保存的中间目录, 文件名后加
+     * @return
+     */
+    public Map<String, Object> upload(MultipartFile file, String urlBasePath) {
+
+        // 检查非法文件上传
+        boolean checkFile = this.checkFile(file);
+        if (!checkFile) {
+            throw new BaseRuntimeException("非法文件, 请重新上传");
+        }
+
+        // 文件目录
+        String fileName = file.getOriginalFilename();
+        String suffix = StringUtils.substringAfterLast(fileName, ".");
+
+        String newName = DateUtil.format(LocalDateTime.now(), "yyyyMMdd_HHmmssSSS") + "." + suffix;
+        String resUrl =  urlBasePath + "/" + newName;
+        String savePath = configConstant.serverBasePath + resUrl;
+        log.info("保存文件地址:{}", savePath);
+
+        try {
+            FileUtil.writeFromStream(file.getInputStream(), savePath);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        HashMap<String, Object> result = new HashMap<>();
+        result.put("fileName", fileName);
+        result.put("filePath", resUrl);
+        return result;
+    }
+
+}

+ 106 - 0
zhoushan-system-common/src/main/java/com/fdage/util/Result.java

@@ -0,0 +1,106 @@
+package com.fdage.util;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * 通用返回类
+ *
+ * @author
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Result<T> implements Serializable {
+    private static final long serialVersionUID = -1491499610244557029L;
+    public static final String SUCCESS_MSG = "操作成功";
+    public static int CODE_SUCCESS = 0;
+    public static int CODE_FAILURE = -1;
+    public static String[] NOOP = new String[]{};
+    public static LocalDateTime dataTime = LocalDateTime.now();
+
+    /**
+     * 处理状态:0: 成功, 1: 失败
+     */
+    @ApiModelProperty(value = "处理状态:0: 成功, -1: 失败", name = "code")
+    private int code;
+    /**
+     * 消息
+     */
+    @ApiModelProperty(value = "消息", name = "msg")
+    private String msg;
+    /**
+     * 返回数据
+     */
+    @ApiModelProperty(value = "返回数据", name = "data")
+    private T data;
+
+    @ApiModelProperty(value = "时间戳", name = "timestamp")
+    private LocalDateTime timestamp;
+    /**
+     * 处理成功,并返回数据
+     *
+     * @param data 数据对象
+     * @return data
+     */
+    public static Result success(Object data) {
+        return new Result(CODE_SUCCESS, SUCCESS_MSG, data, dataTime);
+    }
+    /**
+     * 处理成功
+     *
+     * @return data
+     */
+    public static Result success() {
+        return new Result(CODE_SUCCESS, SUCCESS_MSG, NOOP, dataTime);
+    }
+    /**
+     * 处理成功
+     *
+     * @param msg 消息
+     * @return data
+     */
+    public static Result success(String msg) {
+        return new Result(CODE_SUCCESS, msg, NOOP, dataTime);
+    }
+    /**
+     * 处理成功
+     *
+     * @param msg  消息
+     * @param data 数据对象
+     * @return data
+     */
+    public static Result success(String msg, Object data) {
+        return new Result(CODE_SUCCESS, msg, data, dataTime);
+    }
+    /**
+     * 处理失败,并返回数据(一般为错误信息)
+     *
+     * @param code 错误代码
+     * @param msg  消息
+     * @return data
+     */
+    public static Result failure(int code, String msg) {
+        return new Result(code, msg, NOOP , dataTime);
+    }
+    /**
+     * 处理失败
+     *
+     * @param msg 消息
+     * @return data
+     */
+    public static Result failure(String msg) {
+        return failure(CODE_FAILURE, msg);
+    }
+
+    @Override
+    public String toString() {
+        return "JsonResult [code=" + code + ", msg=" + msg + ", data="
+                + data + ", timestamp="+ dataTime + "]";
+    }
+}

+ 6 - 6
zhoushan-system-dao/pom.xml

@@ -66,12 +66,12 @@
             <!--<version>5.1.21</version>-->
         <!--</dependency>-->
 
-        <!-- 分页插件 -->
-        <dependency>
-            <groupId>com.github.pagehelper</groupId>
-            <artifactId>pagehelper-spring-boot-starter</artifactId>
-            <version>1.1.2</version>
-        </dependency>
+        <!--&lt;!&ndash; 分页插件 &ndash;&gt;-->
+        <!--<dependency>-->
+            <!--<groupId>com.github.pagehelper</groupId>-->
+            <!--<artifactId>pagehelper-spring-boot-starter</artifactId>-->
+            <!--<version>1.1.2</version>-->
+        <!--</dependency>-->
 
     </dependencies>
 

+ 21 - 0
zhoushan-system-dao/src/main/java/com/fdage/dao/base/SceneMapper.java

@@ -0,0 +1,21 @@
+package com.fdage.dao.base;
+
+import com.fdage.entity.SceneEntity;
+
+import java.util.List;
+
+/**
+ * Created by owen on 2021/8/23 0023 17:56
+ */
+public interface SceneMapper {
+
+    List<SceneEntity> findAll();
+
+    SceneEntity findById(Long id);
+
+    int insert(SceneEntity entity);
+
+    int update(SceneEntity entity);
+
+    int remove(Long id);
+}

+ 9 - 0
zhoushan-system-dao/src/main/java/com/fdage/dao/base/TbMenuMapper.java

@@ -1,6 +1,8 @@
 package com.fdage.dao.base;
 
 import com.fdage.pojo.TbMenu;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Component;
 
 public interface TbMenuMapper {
     int deleteByPrimaryKey(Long id);
@@ -14,4 +16,11 @@ public interface TbMenuMapper {
     int updateByPrimaryKeySelective(TbMenu record);
 
     int updateByPrimaryKey(TbMenu record);
+
+    @Component
+    @Mapper
+    interface SceneMapper  {
+
+
+    }
 }

+ 22 - 0
zhoushan-system-dao/src/main/java/com/fdage/dao/base/VideoMapper.java

@@ -0,0 +1,22 @@
+package com.fdage.dao.base;
+
+import com.fdage.entity.SceneEntity;
+import com.fdage.entity.VideoEntity;
+
+import java.util.List;
+
+/**
+ * Created by owen on 2021/8/23 0023 17:56
+ */
+public interface VideoMapper {
+
+    List<VideoEntity> findAll();
+
+    VideoEntity findById(Long id);
+
+    int insert(VideoEntity entity);
+
+    int update(VideoEntity entity);
+
+    int remove(Long id);
+}

+ 26 - 0
zhoushan-system-dao/src/main/java/com/fdage/dto/PageDto.java

@@ -0,0 +1,26 @@
+package com.fdage.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * Created by Owen on 2019/10/28 0028 12:24
+ */
+@Data
+public class PageDto {
+
+
+    @ApiModelProperty(value = "起始页码,默认1为第一页", name = "pageNum")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "每页数量", name = "pageSize")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "搜索条件", name = "searchKey")
+    private String searchKey;
+
+
+
+
+}

+ 32 - 0
zhoushan-system-dao/src/main/java/com/fdage/dto/SceneDto.java

@@ -0,0 +1,32 @@
+package com.fdage.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * Created by owen on 2021/8/24 0024 9:46
+ */
+@Data
+public class SceneDto {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @NotBlank(message = "名称不能为空")
+    @ApiModelProperty(value = "名称", required = true)
+    private String name;
+
+    @NotBlank(message = "名称不能为空")
+    @ApiModelProperty(value = "场景url", required = true)
+    private String urlScene;
+
+    @ApiModelProperty(value = "缩略图url", required = true)
+    private String thumb;
+
+    @ApiModelProperty(value = "文件名称", required = true)
+    private String fileName;
+
+
+}

+ 33 - 0
zhoushan-system-dao/src/main/java/com/fdage/dto/VideoDto.java

@@ -0,0 +1,33 @@
+package com.fdage.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * Created by owen on 2021/8/24 0024 9:46
+ */
+@Data
+public class VideoDto {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @NotBlank(message = "名称不能为空")
+    @ApiModelProperty(value = "名称", required = true)
+    private String name;
+
+    @NotBlank(message = "视频url不能为空")
+    @ApiModelProperty(value = "视频url", required = true)
+    private String urlVideo;
+
+    @NotBlank(message = "缩略图url不能为空")
+    @ApiModelProperty(value = "缩略图url", required = true)
+    private String thumb;
+
+    @ApiModelProperty(value = "文件名称", required = true)
+    private String fileName;
+
+
+}

+ 39 - 0
zhoushan-system-dao/src/main/java/com/fdage/entity/BaseEntity.java

@@ -0,0 +1,39 @@
+package com.fdage.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.time.LocalDateTime;
+
+@Data
+@MappedSuperclass
+public abstract class BaseEntity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    @ApiModelProperty(value = "对象ID")
+    private Long id;
+
+    @ApiModelProperty(value = "创建时间")
+//    @Temporal(TemporalType.TIMESTAMP)
+//    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "修改时间")
+//    @Temporal(TemporalType.TIMESTAMP)
+//    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime updateTime;
+
+    /**
+     * 用来批量操作的
+     * 0代表未删除 , 1代表已经删除,默认写0
+     * 需要使用对象类型
+     */
+    @JsonIgnore
+    @JSONField(serialize = false)
+    private Integer isDelete;
+}

+ 32 - 0
zhoushan-system-dao/src/main/java/com/fdage/entity/SceneEntity.java

@@ -0,0 +1,32 @@
+package com.fdage.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2021/8/23 0023 15:40
+ */
+@Data
+@Table(name = "tb_scene")
+public class SceneEntity extends BaseEntity implements Serializable {
+
+    private static final long serialVersionUID = 5520004524498372572L;
+
+    @NotBlank(message = "名称不能为空")
+    @ApiModelProperty(value = "名称", required = true)
+    private String name;
+
+    @NotBlank(message = "名称不能为空")
+    @ApiModelProperty(value = "场景rul", required = true)
+    private String urlScene;
+
+    @ApiModelProperty(value = "缩略图rul", required = true)
+    private String thumb;
+
+    @ApiModelProperty(value = "文件名称", required = true)
+    private String fileName;
+}

+ 30 - 0
zhoushan-system-dao/src/main/java/com/fdage/entity/VideoEntity.java

@@ -0,0 +1,30 @@
+package com.fdage.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2021/8/30 0023 15:40
+ */
+@Data
+@Table(name = "tb_video")
+public class VideoEntity extends BaseEntity implements Serializable {
+
+
+    private static final long serialVersionUID = -3529554982029054383L;
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "视频rul")
+    private String urlVideo;
+
+    @ApiModelProperty(value = "缩略图rul")
+    private String thumb;
+
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+}

+ 17 - 0
zhoushan-system-dao/src/main/java/com/fdage/mapper/IBaseMapper.java

@@ -0,0 +1,17 @@
+package com.fdage.mapper;
+
+import com.fdage.entity.BaseEntity;
+import tk.mybatis.mapper.common.BaseMapper;
+import tk.mybatis.mapper.common.ConditionMapper;
+import tk.mybatis.mapper.common.IdsMapper;
+import tk.mybatis.mapper.common.special.InsertListMapper;
+
+import java.io.Serializable;
+
+/**
+ * Created by owen on 2020/2/18 0018 11:27
+ */
+
+public interface IBaseMapper<T extends BaseEntity, ID extends Serializable> extends BaseMapper<T>,
+        ConditionMapper<T>, IdsMapper<T>, InsertListMapper<T> {
+}

+ 13 - 0
zhoushan-system-dao/src/main/java/com/fdage/mapper/SceneMapper.java

@@ -0,0 +1,13 @@
+//package com.fdage.mapper;
+//
+//import com.fdage.entity.SceneEntity;
+//import org.apache.ibatis.annotations.Mapper;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * Created by owen on 2021/8/23 0023 17:56
+// */
+//@Component
+//@Mapper
+//public interface SceneMapper extends IBaseMapper<SceneEntity, Long> {
+//}

+ 43 - 0
zhoushan-system-dao/src/main/resources/mapper/base/SceneMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdage.dao.base.SceneMapper">
+  <resultMap id="BaseResultMap" type="com.fdage.entity.SceneEntity">
+    <!--<id column="id" jdbcType="BIGINT" property="id" />-->
+    <!--<result column="name" jdbcType="VARCHAR" property="name" />-->
+  </resultMap>
+
+  <select id="findAll" parameterType="java.lang.Long" resultMap="BaseResultMap">
+   select * from tb_scene where is_delete=0 order by create_time desc;
+  </select>
+
+  <select id="findById" parameterType="java.lang.Long" resultMap="BaseResultMap">
+   select * from tb_scene where is_delete=0 and id=#{id};
+  </select>
+
+
+    <insert id="insert" parameterType="com.fdage.entity.SceneEntity">
+    insert into tb_scene (
+    name, url_scene, thumb, file_name
+    )
+    values (
+    #{name} ,#{urlScene} ,#{thumb} ,#{fileName}
+    )
+  </insert>
+
+
+    <update id="update" parameterType="com.fdage.entity.SceneEntity">
+    update tb_scene set
+    name=#{name},
+    url_scene=#{urlScene},
+    thumb=#{thumb},
+    file_name=#{fileName},
+    update_time=#{updateTime}
+   where id=#{id} and is_delete=0;
+  </update>
+
+
+    <update id="remove" parameterType="com.fdage.entity.SceneEntity">
+      update tb_scene set is_delete=1, update_time=NOW() where id=#{id} and is_delete=0;
+  </update>
+
+</mapper>

+ 41 - 0
zhoushan-system-dao/src/main/resources/mapper/base/VideoMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdage.dao.base.VideoMapper">
+  <resultMap id="BaseResultMap" type="com.fdage.entity.VideoEntity">
+  </resultMap>
+
+  <select id="findAll" parameterType="java.lang.Long" resultMap="BaseResultMap">
+   select * from tb_video where is_delete=0 order by create_time desc;
+  </select>
+
+  <select id="findById" parameterType="java.lang.Long" resultMap="BaseResultMap">
+   select * from tb_video where is_delete=0 and id=#{id};
+  </select>
+
+
+    <insert id="insert" parameterType="com.fdage.entity.VideoEntity">
+    insert into tb_video (
+    name, url_video, thumb, file_name
+    )
+    values (
+    #{name} ,#{urlVideo} ,#{thumb} ,#{fileName}
+    )
+  </insert>
+
+
+    <update id="update" parameterType="com.fdage.entity.VideoEntity">
+    update tb_video set
+    name=#{name},
+    url_video=#{urlVideo},
+    thumb=#{thumb},
+    file_name=#{fileName},
+    update_time=#{updateTime}
+   where id=#{id} and is_delete=0;
+  </update>
+
+
+    <update id="remove" parameterType="com.fdage.entity.VideoEntity">
+      update tb_video set is_delete=1, update_time=NOW() where id=#{id} and is_delete=0;
+  </update>
+
+</mapper>

+ 47 - 0
zhoushan-system-service/src/main/java/com/fdage/service/IBaseService.java

@@ -0,0 +1,47 @@
+package com.fdage.service;
+
+import com.github.pagehelper.PageInfo;
+import tk.mybatis.mapper.entity.Condition;
+
+import java.io.Serializable;
+import java.util.List;
+
+public interface IBaseService<T, ID extends Serializable> {
+
+    public abstract T findById(ID id);
+
+    public abstract T findOne(T entity);
+
+    public abstract List<T> findByIds(String ids);
+
+    public abstract long count();
+
+    public abstract boolean exists(ID id);
+
+    public abstract int save(T entity);
+
+    public abstract int update(T entity);
+
+    public abstract int updateAll(T entity);
+
+    public abstract int deleteById(ID id);
+
+    public abstract int deleteByIds(String ids);
+
+    public abstract int delete(T entity);
+
+    public abstract List<T> findAll(Condition condition, String orderBy);
+
+    public abstract List<T> findAll(Condition condition);
+
+    public abstract List<T> findAll();
+
+    public abstract PageInfo<T> findAll(int pageNum, int pageSize);
+
+    public abstract PageInfo<T> findAll(int pageNum, int pageSize, String orderBy);
+
+    public abstract PageInfo<T> findAll(Condition condition, int pageNum, int pageSize);
+
+    public abstract PageInfo<T> findAll(Condition condition, int pageNum, int pageSize, String orderBy);
+
+}

+ 26 - 0
zhoushan-system-service/src/main/java/com/fdage/service/SceneService.java

@@ -0,0 +1,26 @@
+package com.fdage.service;
+
+import com.fdage.dto.SceneDto;
+import com.fdage.entity.SceneEntity;
+import com.fdage.util.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * Created by owen on 2021/8/23 0023 17:13
+ */
+//public interface SceneService extends IBaseService<SceneEntity, Long> {
+public interface SceneService {
+
+    Result<SceneEntity> findAll();
+
+
+    Result<SceneEntity> saveEntity(SceneDto param);
+
+    Result upload(MultipartFile file, String dirCode, boolean useCode);
+
+    Result detail(Long id);
+
+    Result remove(Long id);
+}

+ 24 - 0
zhoushan-system-service/src/main/java/com/fdage/service/VideoService.java

@@ -0,0 +1,24 @@
+package com.fdage.service;
+
+import com.fdage.dto.SceneDto;
+import com.fdage.dto.VideoDto;
+import com.fdage.entity.SceneEntity;
+import com.fdage.entity.VideoEntity;
+import com.fdage.util.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * Created by owen on 2021/8/30 0023 17:13
+ */
+public interface VideoService {
+
+    Result<VideoEntity> findAll();
+
+    Result<VideoEntity> saveEntity(VideoDto param);
+
+    Result upload(MultipartFile file, String dirCode, boolean useCode);
+
+    Result detail(Long id);
+
+    Result remove(Long id);
+}

+ 246 - 0
zhoushan-system-service/src/main/java/com/fdage/service/impl/IBaseServiceImpl.java

@@ -0,0 +1,246 @@
+package com.fdage.service.impl;
+
+import com.fdage.constant.ConfigConstant;
+import com.fdage.dto.PageDto;
+import com.fdage.mapper.IBaseMapper;
+import com.fdage.entity.BaseEntity;
+import com.fdage.service.IBaseService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+import tk.mybatis.mapper.entity.Condition;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.Serializable;
+import java.lang.reflect.ParameterizedType;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * Created by owen on 2020/2/18 0018 11:22
+ */
+@Transactional
+public abstract class IBaseServiceImpl<T extends BaseEntity, ID extends Serializable> implements IBaseService<T, ID> {
+
+
+    @Autowired
+    ConfigConstant configConstant;
+
+    /**
+     * 2021-04-20
+     * 这里不能使用 @Autowired 注入HttpServletRequest 会报已注入的错误
+     */
+//    @Autowired
+//    HttpServletRequest request;
+
+    public abstract IBaseMapper<T, ID> getBaseMapper();
+
+    private Class<T> entityClass;
+
+    public IBaseServiceImpl(){
+        ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
+        entityClass = (Class<T>) pt.getActualTypeArguments()[0];
+    }
+
+    @Override
+    public T findById(ID id){
+        Condition condition = new Condition(entityClass);
+        condition.createCriteria().andEqualTo("id", id);
+        condition.and().andEqualTo("isDelete", 0);
+        List<T> ts = getBaseMapper().selectByCondition(condition);
+        if (ts != null && ts.size() > 0){
+            return ts.get(0);
+        }else{
+            return null;
+        }
+    }
+
+    @Override
+    public T findOne(T entity){
+        entity.setIsDelete(0);
+        return getBaseMapper().selectOne(entity);
+    }
+
+    @Override
+    public List<T> findAll(){
+        Condition condition = new Condition(entityClass);
+        condition.and().andEqualTo("isDelete", 0);
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+//    public List<T> findAllDesc(){
+//        Condition condition = new Condition(entityClass);
+//        condition.and().andEqualTo("isDelete", 0);
+//        condition.orderBy("createTime").desc();
+//        return getBaseMapper().selectByCondition(condition);
+//    }
+
+
+    /**
+     * 根据主键字符串进行查询,类中只有存在一个带有@Id注解的字段
+     *
+     * @param ids 如 "1,2,3,4"
+     * @return
+     */
+    @Override
+    public List<T> findByIds(String ids){
+        return getBaseMapper().selectByIds(ids);
+    }
+
+    @Override
+    public long count(){
+        List<T> all = this.findAll();
+        if (all != null && all.size() > 0){
+            return all.size();
+        }
+        return 0;
+    }
+
+    @Override
+    public boolean exists(ID id){
+        return getBaseMapper().existsWithPrimaryKey(id);
+    }
+
+    @Override
+    public int save(T entity) {
+        //migration之后要删掉判断
+        if (entity.getCreateTime() == null){
+            entity.setCreateTime(LocalDateTime.now());
+        }
+        if (entity.getUpdateTime() == null){
+            entity.setUpdateTime(LocalDateTime.now());
+        }
+        entity.setIsDelete(0);
+        return getBaseMapper().insertSelective(entity);
+    }
+
+    @Override
+    public int update(T entity) {
+        //migration之后要删掉判断
+        if (entity.getUpdateTime() == null){
+            entity.setUpdateTime(LocalDateTime.now());
+        }
+        return getBaseMapper().updateByPrimaryKeySelective(entity);
+    }
+
+    @Override
+    public int updateAll(T entity) {
+        //migration之后要删掉判断
+        if (entity.getUpdateTime() == null){
+            entity.setUpdateTime(LocalDateTime.now());
+        }
+        return getBaseMapper().updateByPrimaryKey(entity);
+    }
+
+    @Override
+    public int deleteById(ID id) {
+        return getBaseMapper().deleteByPrimaryKey(id);
+    }
+
+    @Override
+    public int deleteByIds(String ids){
+        return getBaseMapper().deleteByIds(ids);
+    }
+
+    @Override
+    public int delete(T entity){
+        return getBaseMapper().delete(entity);
+    }
+
+    @Override
+    public List<T> findAll(Condition condition){
+        condition.and().andEqualTo("isDelete", 0);
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    public List<T> findAll(Condition condition, String orderBy){
+        condition.and().andEqualTo("isDelete", 0);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return getBaseMapper().selectByCondition(condition);
+    }
+
+    public PageInfo<T> findAll(int pageNum, int pageSize){
+        if (pageNum <= 0) {
+            pageNum = 0;
+        }
+        if (pageSize <= 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        return new PageInfo<>(this.findAll());
+    }
+
+    public PageInfo<T> findAll(int pageNum, int pageSize, String orderBy){
+        if (pageNum <= 0) {
+            pageNum = 0;
+        }
+        if (pageSize <= 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return new PageInfo<>(this.findAll());
+    }
+
+    public PageInfo<T> findAll(Condition condition, int pageNum, int pageSize){
+        if (pageNum <= 0) {
+            pageNum = 0;
+        }
+        if (pageSize <= 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        return new PageInfo<>(this.findAll(condition));
+    }
+
+    public PageInfo<T> findAll(Condition condition, int pageNum, int pageSize, String orderBy){
+
+        if (pageNum <= 0) {
+            pageNum = 0;
+        }
+        if (pageSize <= 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        if (!StringUtils.isEmpty(orderBy)){
+            PageHelper.orderBy(orderBy);
+        }
+        return new PageInfo<>(this.findAll(condition));
+    }
+
+
+    /**
+     * 设置请求分页数据
+     */
+    public void startPage(PageDto param){
+        Integer pageNum = param.getPageNum();
+        Integer pageSize = param.getPageSize();
+        if (pageNum == null || pageNum <= 0) {
+            pageNum = 0;
+        }
+        if (pageSize == null || pageSize <= 0) {
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNum, pageSize);
+    }
+
+    /** 获取用户id*/
+//    Long getTokenUserId(HttpServletRequest request){
+//        return JwtUtil.getUserId(getToken(request));
+//    }
+//
+//    String getTokenUserName(HttpServletRequest request){
+//        return JwtUtil.getUsername(getToken(request));
+//    }
+
+    /** 获取header token */
+    String getToken(HttpServletRequest request){
+        return request.getHeader("token");
+    }
+}

+ 99 - 0
zhoushan-system-service/src/main/java/com/fdage/service/impl/SceneServiceImpl.java

@@ -0,0 +1,99 @@
+package com.fdage.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.fdage.constant.MsgCode;
+import com.fdage.dao.base.SceneMapper;
+import com.fdage.dto.SceneDto;
+import com.fdage.entity.SceneEntity;
+import com.fdage.service.SceneService;
+import com.fdage.util.BaseRuntimeException;
+import com.fdage.util.FileUtils;
+import com.fdage.util.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by owen on 2021/8/23 0023 17:16
+ */
+@Service
+public class SceneServiceImpl  implements SceneService {
+
+    @Resource
+    SceneMapper sceneMapper;
+
+    @Autowired
+    FileUtils fileUtils;
+
+    @Override
+    public Result<SceneEntity> findAll() {
+        return Result.success(sceneMapper.findAll());
+    }
+
+    @Override
+    public Result<SceneEntity> saveEntity(SceneDto param) {
+
+        Long id = param.getId();
+        SceneEntity entity = null;
+        if (id == null) {
+            entity = new SceneEntity();
+            BeanUtils.copyProperties(param, entity);
+            sceneMapper.insert(entity);
+        } else {
+            entity = sceneMapper.findById(id);
+            if (entity == null) {
+                return Result.failure("对象不存在: " + id);
+            }
+            BeanUtils.copyProperties(param, entity);
+            entity.setUpdateTime(LocalDateTime.now());
+            sceneMapper.update(entity);
+        }
+
+        return Result.success();
+    }
+
+
+
+    @Override
+    public Result upload(MultipartFile file, String dirCode , boolean useCode) {
+        if (!fileUtils.checkFile(file)) {
+            throw new BaseRuntimeException("非法文件, 请重新上传");
+        }
+
+        String resUrl = "/scene";
+        if (useCode) {
+            if ("null".equals(dirCode) || StringUtils.isBlank(dirCode)) {
+                dirCode = DateUtil.format(LocalDateTime.now(), "yyyyMMdd_HHmmssSSS");
+            }
+            resUrl = resUrl + "/" + dirCode;
+        }
+
+        Map<String, Object> result = fileUtils.upload(file, resUrl );
+
+        return Result.success(result);
+    }
+
+    @Override
+    public Result detail(Long id) {
+        SceneEntity entity = sceneMapper.findById(id);
+        if (entity == null) {
+            return Result.failure(MsgCode.e3001,"对象不存在,id: " + id);
+        }
+
+        return Result.success(entity);
+    }
+
+    @Override
+    public Result remove(Long id) {
+        sceneMapper.remove(id);
+        return Result.success();
+    }
+
+}

+ 102 - 0
zhoushan-system-service/src/main/java/com/fdage/service/impl/VideoServiceImpl.java

@@ -0,0 +1,102 @@
+package com.fdage.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.fdage.constant.MsgCode;
+import com.fdage.dao.base.SceneMapper;
+import com.fdage.dao.base.VideoMapper;
+import com.fdage.dto.SceneDto;
+import com.fdage.dto.VideoDto;
+import com.fdage.entity.SceneEntity;
+import com.fdage.entity.VideoEntity;
+import com.fdage.service.SceneService;
+import com.fdage.service.VideoService;
+import com.fdage.util.BaseRuntimeException;
+import com.fdage.util.FileUtils;
+import com.fdage.util.Result;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.Map;
+
+/**
+ * Created by owen on 2021/8/23 0023 17:16
+ */
+@Service
+public class VideoServiceImpl implements VideoService {
+
+    @Resource
+    VideoMapper videoMapper;
+
+    @Autowired
+    FileUtils fileUtils;
+
+    @Override
+    public Result<VideoEntity> findAll() {
+        return Result.success(videoMapper.findAll());
+    }
+
+    @Override
+    public Result<VideoEntity> saveEntity(VideoDto param) {
+
+        Long id = param.getId();
+        VideoEntity entity = null;
+        if (id == null) {
+            entity = new VideoEntity();
+            BeanUtils.copyProperties(param, entity);
+            videoMapper.insert(entity);
+        } else {
+            entity = videoMapper.findById(id);
+            if (entity == null) {
+                return Result.failure("对象不存在: " + id);
+            }
+            BeanUtils.copyProperties(param, entity);
+            entity.setUpdateTime(LocalDateTime.now());
+            videoMapper.update(entity);
+        }
+
+        return Result.success();
+    }
+
+
+
+    @Override
+    public Result upload(MultipartFile file, String dirCode , boolean useCode) {
+        if (!fileUtils.checkFile(file)) {
+            throw new BaseRuntimeException("非法文件, 请重新上传");
+        }
+
+        String resUrl = "/video";
+        if (useCode) {
+            if ("null".equals(dirCode) || StringUtils.isBlank(dirCode)) {
+                dirCode = DateUtil.format(LocalDateTime.now(), "yyyyMMdd_HHmmssSSS");
+            }
+            resUrl = resUrl + "/" + dirCode;
+        }
+
+        Map<String, Object> result = fileUtils.upload(file, resUrl );
+
+        return Result.success(result);
+    }
+
+    @Override
+    public Result detail(Long id) {
+        VideoEntity entity = videoMapper.findById(id);
+        if (entity == null) {
+            return Result.failure(MsgCode.e3001,"对象不存在,id: " + id);
+        }
+
+        return Result.success(entity);
+    }
+
+    @Override
+    public Result remove(Long id) {
+        videoMapper.remove(id);
+        return Result.success();
+    }
+
+}