Ver Fonte

版本管理、安装包上传下载,更新接口

fangq há 4 anos atrás
pai
commit
7b5962174a

+ 57 - 1
pom.xml

@@ -10,7 +10,7 @@
     <version>2.8.1.RELEASE</version>
 
     <properties>
-        <bladex.project.id>blade-api</bladex.project.id>
+        <bladex.project.id>ship-cable-server</bladex.project.id>
         <bladex.project.version>2.8.1.RELEASE</bladex.project.version>
 
         <java.version>1.8</java.version>
@@ -200,6 +200,31 @@
             <artifactId>lombok</artifactId>
             <scope>provided</scope>
         </dependency>
+
+        <!--<dependency>-->
+        <!--<groupId>org.springframework.boot</groupId>-->
+        <!--<artifactId>spring-boot-starter-log4j2</artifactId>-->
+        <!--</dependency>-->
+
+        <!-- log4j 新版本依赖 start-->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>2.15.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <version>2.15.0</version>
+        </dependency>
+        <!--不加下面这个依赖mybatis sql日志打印有问题-->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <version>2.15.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- log4j 新版本依赖 end-->
     </dependencies>
 
     <build>
@@ -223,6 +248,15 @@
                     <version>${spring.boot.version}</version>
                     <configuration>
                         <finalName>${project.build.finalName}</finalName>
+                        <!-- 分包 -->
+                        <layout>ZIP</layout>
+                        <includes>
+                            <include>
+                                <groupId>non-exists</groupId>
+                                <artifactId>non-exists</artifactId>
+                            </include>
+                        </includes>
+                        <!-- 分包 -->
                     </configuration>
                     <executions>
                         <execution>
@@ -276,6 +310,28 @@
                     </compilerArgs>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <!--target/lib是依赖jar包的输出目录,根据自己喜好配置-->
+                            <outputDirectory>target/lib</outputDirectory>
+                            <excludeTransitive>false</excludeTransitive>
+                            <stripVersion>false</stripVersion>
+                            <includeScope>runtime</includeScope>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
         </plugins>
     </build>
 

+ 2 - 0
src/main/java/org/springblade/common/config/BladeConfiguration.java

@@ -51,6 +51,8 @@ public class BladeConfiguration implements WebMvcConfigurer {
 		secureRegistry.excludePathPatterns("/webjars/**");
 		secureRegistry.excludePathPatterns("/swagger-resources/**");
 		secureRegistry.excludePathPatterns("/druid/**");
+		secureRegistry.excludePathPatterns("/open/**");
+		secureRegistry.excludePathPatterns("/file/**");
 		return secureRegistry;
 	}
 

+ 106 - 0
src/main/java/org/springblade/ship/FileController.java

@@ -0,0 +1,106 @@
+package org.springblade.ship;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.SneakyThrows;
+import org.apache.commons.io.FilenameUtils;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.boot.props.BladeFileProperties;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("file")
+@Api(value = "", tags = "接口")
+public class FileController  extends BladeController {
+
+	private final BladeFileProperties bladeFileProperties;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/download/{filePath}")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入device")
+	public R download(@PathVariable("filePath") String filePath, HttpServletRequest request, HttpServletResponse response){
+		/*String fileUrl = bladeFileProperties.getRemotePath() + filePath;
+		File dest = new File(fileUrl);*/
+//		String filePath = "";
+		String fileUrl = bladeFileProperties.getRemotePath() + "\\" + filePath;
+		File file = new File(fileUrl);
+		String fileName = file.getName();
+		fileName.substring(fileName.lastIndexOf(".") + 1).toUpperCase();
+
+		try{
+			BufferedInputStream fis = new BufferedInputStream(new FileInputStream(fileUrl));
+			byte[] buffer = new byte[fis.available()];
+			fis.read(buffer);
+			fis.close();
+			response.reset();
+			response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes()));
+
+			response.addHeader("Content-Length", "" + file.length());
+			OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+			response.setContentType("application/octet-stream");
+			toClient.write(buffer);
+			toClient.flush();
+			toClient.close();
+
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+
+		return R.data(file);
+	}
+
+	/**
+	 * 上传文件
+	 *
+	 * @param file 文件
+	 * @return ObjectStat
+	 */
+	@SneakyThrows
+	@PostMapping("/upload")
+	public R putFile(HttpServletRequest request, @RequestParam MultipartFile file) {
+		//获取文件名
+		String name = file.getOriginalFilename();
+		//获取文件后缀名,如果需要重新命名就需用拼接,原样保存直接用name
+		String ext = FilenameUtils.getExtension(file.getOriginalFilename());
+		String filename = System.currentTimeMillis() + "." + ext;
+		//设置文件上传路径
+
+		//以绝对路径保存文件
+		String remotePath = bladeFileProperties.getRemotePath();
+//		String url = request.getSession().getServletContext().getRealPath("/file");
+		File dest = new File(remotePath);
+		// 检测是否存在目录,没有就创建
+		if (!dest.exists()) {
+			dest.mkdirs();
+		}
+
+		String upStr = remotePath + "/" + filename;
+		file.transferTo(new File(upStr));
+		//把保存的url存放到对应的实体类的字段中
+		//entity.setUrl("file/"+name )
+		//页面调用下载或者展示的时候就拼上127.0.0.1:8080/项目名/实体类的url
+		//一般直接是ctx/实体类的url
+
+		Map<String, Object> map = new HashMap<>();
+		map.put("name", filename);
+		map.put("link", bladeFileProperties.getUploadDomain() + filename);
+
+		return R.data(map);
+
+	}
+
+}

+ 139 - 0
src/main/java/org/springblade/ship/appversion/controller/AppVersionController.java

@@ -0,0 +1,139 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
+
+import lombok.SneakyThrows;
+import org.springblade.core.boot.props.BladeFileProperties;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.oss.model.BladeFile;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.ship.appversion.entity.AppVersion;
+import org.springblade.ship.appversion.vo.AppVersionVO;
+import org.springblade.ship.appversion.wrapper.AppVersionWrapper;
+import org.springblade.ship.appversion.service.IAppVersionService;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("ship/appversion")
+@Api(value = "", tags = "接口")
+public class AppVersionController extends BladeController {
+
+	private final IAppVersionService appVersionService;
+	private final BladeFileProperties bladeFileProperties;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入appVersion")
+	public R<AppVersionVO> detail(AppVersion appVersion) {
+		AppVersion detail = appVersionService.getOne(Condition.getQueryWrapper(appVersion));
+		return R.data(AppVersionWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入appVersion")
+	public R<IPage<AppVersionVO>> list(AppVersion appVersion, Query query) {
+		IPage<AppVersion> pages = appVersionService.page(Condition.getPage(query), Condition.getQueryWrapper(appVersion));
+		return R.data(AppVersionWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入appVersion")
+	public R<IPage<AppVersionVO>> page(AppVersionVO appVersion, Query query) {
+		IPage<AppVersionVO> pages = appVersionService.selectAppVersionPage(Condition.getPage(query), appVersion);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入appVersion")
+	public R save(@Valid @RequestBody AppVersion appVersion) {
+		return R.status(appVersionService.save(appVersion));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入appVersion")
+	public R update(@Valid @RequestBody AppVersion appVersion) {
+		return R.status(appVersionService.updateById(appVersion));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入appVersion")
+	public R submit(@Valid @RequestBody AppVersion appVersion) {
+		return R.status(appVersionService.saveOrUpdate(appVersion));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(appVersionService.deleteLogic(Func.toLongList(ids)));
+	}
+
+
+
+}

+ 34 - 0
src/main/java/org/springblade/ship/appversion/dto/AppVersionDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.dto;
+
+import org.springblade.ship.appversion.entity.AppVersion;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AppVersionDTO extends AppVersion {
+	private static final long serialVersionUID = 1L;
+
+}

+ 69 - 0
src/main/java/org/springblade/ship/appversion/entity/AppVersion.java

@@ -0,0 +1,69 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+@Data
+@TableName("sc_app_version")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AppVersion对象", description = "AppVersion对象")
+public class AppVersion extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+
+
+	/**
+	* 版本名称
+	*/
+		@ApiModelProperty(value = "版本名称")
+		private String versionName;
+	/**
+	* 版本号
+	*/
+		@ApiModelProperty(value = "版本号")
+		private String versionNo;
+	/**
+	* 更新内容
+	*/
+		@ApiModelProperty(value = "更新内容")
+		private String updateContent;
+	/**
+	* 是否强制更新
+	*/
+		@ApiModelProperty(value = "是否强制更新")
+		private Integer isForceUpdate;
+	/**
+	* 下载地址
+	*/
+		@ApiModelProperty(value = "下载地址")
+		private String downloadUrl;
+
+
+}

+ 42 - 0
src/main/java/org/springblade/ship/appversion/mapper/AppVersionMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.mapper;
+
+import org.springblade.ship.appversion.entity.AppVersion;
+import org.springblade.ship.appversion.vo.AppVersionVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+public interface AppVersionMapper extends BaseMapper<AppVersion> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param appVersion
+	 * @return
+	 */
+	List<AppVersionVO> selectAppVersionPage(IPage page, AppVersionVO appVersion);
+
+}

+ 27 - 0
src/main/java/org/springblade/ship/appversion/mapper/AppVersionMapper.xml

@@ -0,0 +1,27 @@
+<?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="org.springblade.ship.appversion.mapper.AppVersionMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="appVersionResultMap" type="org.springblade.ship.appversion.entity.AppVersion">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="version_name" property="versionName"/>
+        <result column="version_no" property="versionNo"/>
+        <result column="update_content" property="updateContent"/>
+        <result column="is_force_update" property="isForceUpdate"/>
+        <result column="download_url" property="downloadUrl"/>
+    </resultMap>
+
+
+    <select id="selectAppVersionPage" resultMap="appVersionResultMap">
+        select * from sc_app_version where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
src/main/java/org/springblade/ship/appversion/service/IAppVersionService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.service;
+
+import org.springblade.ship.appversion.entity.AppVersion;
+import org.springblade.ship.appversion.vo.AppVersionVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+public interface IAppVersionService extends BaseService<AppVersion> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param appVersion
+	 * @return
+	 */
+	IPage<AppVersionVO> selectAppVersionPage(IPage<AppVersionVO> page, AppVersionVO appVersion);
+
+}

+ 41 - 0
src/main/java/org/springblade/ship/appversion/service/impl/AppVersionServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.service.impl;
+
+import org.springblade.ship.appversion.entity.AppVersion;
+import org.springblade.ship.appversion.vo.AppVersionVO;
+import org.springblade.ship.appversion.mapper.AppVersionMapper;
+import org.springblade.ship.appversion.service.IAppVersionService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+@Service
+public class AppVersionServiceImpl extends BaseServiceImpl<AppVersionMapper, AppVersion> implements IAppVersionService {
+
+	@Override
+	public IPage<AppVersionVO> selectAppVersionPage(IPage<AppVersionVO> page, AppVersionVO appVersion) {
+		return page.setRecords(baseMapper.selectAppVersionPage(page, appVersion));
+	}
+
+}

+ 36 - 0
src/main/java/org/springblade/ship/appversion/vo/AppVersionVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.vo;
+
+import org.springblade.ship.appversion.entity.AppVersion;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AppVersionVO对象", description = "AppVersionVO对象")
+public class AppVersionVO extends AppVersion {
+	private static final long serialVersionUID = 1L;
+
+}

+ 49 - 0
src/main/java/org/springblade/ship/appversion/wrapper/AppVersionWrapper.java

@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.appversion.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.ship.appversion.entity.AppVersion;
+import org.springblade.ship.appversion.vo.AppVersionVO;
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2022-01-05
+ */
+public class AppVersionWrapper extends BaseEntityWrapper<AppVersion, AppVersionVO>  {
+
+	public static AppVersionWrapper build() {
+		return new AppVersionWrapper();
+ 	}
+
+	@Override
+	public AppVersionVO entityVO(AppVersion appVersion) {
+		AppVersionVO appVersionVO = Objects.requireNonNull(BeanUtil.copy(appVersion, AppVersionVO.class));
+
+		//User createUser = UserCache.getUser(appVersion.getCreateUser());
+		//User updateUser = UserCache.getUser(appVersion.getUpdateUser());
+		//appVersionVO.setCreateUserName(createUser.getName());
+		//appVersionVO.setUpdateUserName(updateUser.getName());
+
+		return appVersionVO;
+	}
+
+}

+ 12 - 0
src/main/java/org/springblade/ship/device/entity/Device.java

@@ -17,11 +17,15 @@
 package org.springblade.ship.device.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springblade.core.mp.base.BaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * 实体类
@@ -58,5 +62,13 @@ public class Device extends BaseEntity {
 		@ApiModelProperty(value = "权限者")
 		private String personIds;
 
+	@DateTimeFormat(
+		pattern = "yyyy-MM-dd HH:mm:ss"
+	)
+	@JsonFormat(
+		pattern = "yyyy-MM-dd HH:mm:ss"
+	)
+	@ApiModelProperty("最后更新时间")
+	private Date lastUpdateTime;
 
 }

+ 97 - 0
src/main/java/org/springblade/ship/open/OpenController.java

@@ -0,0 +1,97 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ship.open;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.system.entity.User;
+import org.springblade.modules.system.service.IUserService;
+import org.springblade.ship.cable.entity.Cable;
+import org.springblade.ship.cable.service.ICableService;
+import org.springblade.ship.device.entity.Device;
+import org.springblade.ship.device.service.IDeviceService;
+import org.springblade.ship.device.vo.DeviceVO;
+import org.springblade.ship.device.wrapper.DeviceWrapper;
+import org.springframework.util.Assert;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-11-15
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("open")
+@Api(value = "", tags = "接口")
+public class OpenController extends BladeController {
+
+	private final IDeviceService deviceService;
+	private final IUserService userService;
+	private final ICableService cableService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/updateInfo")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入device")
+	public R updateInfo(@RequestParam String deviceCode) {
+
+		Device device = deviceService.getOne(new QueryWrapper<>(new Device()).lambda().eq(Device::getCode, deviceCode));
+		Assert.notNull(device, "系统找不到编码为【" + deviceCode + "】的设备!");
+		QueryWrapper<User> userQueryWrapper = new QueryWrapper<>(new User());
+		QueryWrapper<Cable> cableQueryWrapper = new QueryWrapper<>(new Cable());
+		if (device.getLastUpdateTime() != null){
+			userQueryWrapper.lambda().gt(User::getUpdateTime, device.getLastUpdateTime());
+			cableQueryWrapper.lambda().gt(Cable::getUpdateTime, device.getLastUpdateTime());
+		}
+		List<User> userList = userService.list(userQueryWrapper);
+		List<Cable> cableList = cableService.list(cableQueryWrapper);
+		device.setLastUpdateTime(DateUtil.now());
+
+		if (deviceService.updateById(device)){
+			Map<String, Object> map = new HashMap<>();
+			map.put("userList", userList);
+			map.put("cableList", cableList);
+			map.put("device", device);
+			return R.data(map);
+		}
+		return R.status(false);
+	}
+
+
+
+
+}

+ 2 - 2
src/main/resources/application-dev.yml

@@ -45,6 +45,6 @@ blade:
   #本地文件上传
   file:
     remote-mode: true
-    upload-domain: http://localhost:8999
-    remote-path: /usr/share/nginx/html
+    upload-domain: http://localhost:1890/file/download/
+    remote-path: D:\test\upload