fangq 4 éve
szülő
commit
d04dccb5bb

+ 6 - 0
pom.xml

@@ -201,6 +201,12 @@
             <scope>provided</scope>
         </dependency>
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.6.5</version>
+        </dependency>
+
         <!--<dependency>-->
         <!--<groupId>org.springframework.boot</groupId>-->
         <!--<artifactId>spring-boot-starter-log4j2</artifactId>-->

+ 77 - 1
src/main/java/org/springblade/ship/HomeController.java

@@ -1,11 +1,13 @@
 package org.springblade.ship;
 
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.log.model.LogUsual;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -13,6 +15,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IDeptService;
+import org.springblade.modules.system.service.ILogUsualService;
 import org.springblade.modules.system.service.IUserService;
 import org.springblade.ship.cable.entity.Cable;
 import org.springblade.ship.cable.service.ICableService;
@@ -22,6 +25,10 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -35,6 +42,7 @@ public class HomeController extends BladeController {
 	private final IUserService userService;
 	private final ICableService cableService;
 	private final IDeviceService deviceService;
+	private final ILogUsualService usualService;
 
 
 	/**
@@ -70,7 +78,7 @@ public class HomeController extends BladeController {
 		return R.data(map);
 	}
 
-		/**
+	/**
 	 *
 	 */
 	@GetMapping("/getMonthData")
@@ -86,9 +94,77 @@ public class HomeController extends BladeController {
 		map.put("userList", userService.list(new QueryWrapper<>(new User()).lambda().like(User::getCreateTime, theMonth).orderByDesc(User::getCreateTime)));
 		map.put("cableList", cableService.list(new QueryWrapper<>(new Cable()).lambda().like(Cable::getCreateTime, theMonth).orderByDesc(Cable::getCreateTime)));
 		map.put("deviceList", deviceService.list(new QueryWrapper<>(new Device()).lambda().like(Device::getCreateTime, theMonth).orderByDesc(Device::getCreateTime)));
+		map.put("modifyList", usualService.list(new QueryWrapper<>(new LogUsual()).lambda().eq(LogUsual::getRequestUri, "/cable/update").eq(LogUsual::getMethodName, "update")));
+
 		return R.data(map);
 	}
 
 
+	/**
+	 *
+	 */
+	@GetMapping("/getUpdateData")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "更新信息", notes = "")
+	public HttpServletResponse  getUpdateData(HttpServletResponse response) {
+
+		QueryWrapper<User> userQueryWrapper = new QueryWrapper<>(new User());
+		QueryWrapper<Cable> cableQueryWrapper = new QueryWrapper<>(new Cable());
+		List<User> userList = userService.list(userQueryWrapper);
+		List<Cable> cableList = cableService.list(cableQueryWrapper);
+
+		Map<String, Object> map = new HashMap<>();
+		map.put("userList", userList);
+		map.put("cableList", cableList);
+		map.put("updateTime", DateUtil.format(DateUtil.now(), "yyyy-MM-dd HH:mm:ss"));
+
+		BufferedWriter out = null;
+		try {
+			File file = new File("datas.json");
+			if(!file.exists()){
+				file.createNewFile();
+			}
+
+			out = new BufferedWriter(new FileWriter(file, false));
+			out.write(JSONUtil.toJsonStr(map));
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		// 读到流中
+		InputStream inStream = null;// 文件的存放路径
+		try {
+			File f = new File("datas.json");
+			if (!f.exists()) {
+//				response.sendError(404, "File not found!");
+				return response;
+			}
+			BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
+			byte[] buf = new byte[1024];
+			int len = 0;
+
+			response.reset(); // 非常重要
+			URL u = new URL("file:///" + f.getAbsolutePath());
+			response.setContentType(u.openConnection().getContentType());
+			response.setContentType("application/x-msdownload");
+			response.setHeader("Content-Disposition", "inline; filename=" + f.getName());
+			// 文件名应该编码成UTF-8
+			OutputStream out2 = response.getOutputStream();
+			while ((len = br.read(buf)) > 0)
+				out2.write(buf, 0, len);
+			br.close();
+			out2.close();
+
+
+		} catch (FileNotFoundException | MalformedURLException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return response;
+
+	}
 
 }

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

@@ -38,4 +38,5 @@ public interface IAppVersionService extends BaseService<AppVersion> {
 	 */
 	IPage<AppVersionVO> selectAppVersionPage(IPage<AppVersionVO> page, AppVersionVO appVersion);
 
+    AppVersion getLastVersion();
 }

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

@@ -16,6 +16,7 @@
  */
 package org.springblade.ship.appversion.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.springblade.ship.appversion.entity.AppVersion;
 import org.springblade.ship.appversion.vo.AppVersionVO;
 import org.springblade.ship.appversion.mapper.AppVersionMapper;
@@ -24,6 +25,8 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
+import java.util.List;
+
 /**
  *  服务实现类
  *
@@ -38,4 +41,14 @@ public class AppVersionServiceImpl extends BaseServiceImpl<AppVersionMapper, App
 		return page.setRecords(baseMapper.selectAppVersionPage(page, appVersion));
 	}
 
+	@Override
+	public AppVersion getLastVersion() {
+		List<AppVersion> appVersions = baseMapper.selectList(new QueryWrapper<>(new AppVersion()).lambda().orderByDesc(AppVersion::getUpdateTime));
+		if (appVersions != null && appVersions.size() > 0){
+			return appVersions.get(0);
+		}else{
+			return null;
+		}
+	}
+
 }

+ 248 - 2
src/main/java/org/springblade/ship/cable/controller/CableController.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.ship.cable.controller;
 
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -27,12 +28,14 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
 import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.log.model.LogUsual;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.constant.BladeConstant;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.system.entity.User;
@@ -40,6 +43,9 @@ import org.springblade.modules.system.excel.CableExcel;
 import org.springblade.modules.system.excel.CableImporter;
 import org.springblade.modules.system.excel.UserExcel;
 import org.springblade.modules.system.excel.UserImporter;
+import org.springblade.modules.system.service.IDictService;
+import org.springblade.modules.system.service.ILogUsualService;
+import org.springblade.ship.cable.vo.Modify;
 import org.springframework.util.Assert;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -53,6 +59,7 @@ import org.springframework.web.multipart.MultipartFile;
 import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -69,6 +76,8 @@ import java.util.Map;
 public class CableController extends BladeController {
 
 	private final ICableService cableService;
+	private final ILogUsualService logUsualService;
+	private final IDictService dictService;
 
 	/**
 	 * 详情
@@ -116,8 +125,8 @@ public class CableController extends BladeController {
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "新增", notes = "传入cable")
 	public R save(@Valid @RequestBody Cable cable) {
-		Cable one = cableService.getByAlias(cable.getAlias());
-		Assert.isNull(one, "代号为(" + cable.getAlias() + ")的记录已存在!");
+//		Cable one = cableService.getByAlias(cable.getAlias());
+//		Assert.isNull(one, "代号为(" + cable.getAlias() + ")的记录已存在!");
 		return R.status(cableService.save(cable));
 	}
 
@@ -128,9 +137,25 @@ public class CableController extends BladeController {
 	@ApiOperationSupport(order = 5)
 	@ApiOperation(value = "修改", notes = "传入cable")
 	public R update(@Valid @RequestBody Cable cable) {
+
+		Cable old = cableService.getById(cable.getId());
+		List<Map<String, Object>> becompare = becompare(cable, old);
+		if (becompare.size() > 0){
+			String compareStr = JSONUtil.toJsonStr(becompare);
+			LogUsual logUsual = new LogUsual();
+			logUsual.setLogData(compareStr);
+			logUsual.setLogId(old.getId()+"");
+			logUsual.setRequestUri("/cable/update");
+			logUsual.setMethodName("update");
+			logUsual.setCreateBy(AuthUtil.getUser().getAccount());
+			logUsualService.save(logUsual);
+			cable.setIsModify(1);
+		}
+
 		return R.status(cableService.updateById(cable));
 	}
 
+
 	/**
 	 * 新增或修改
 	 */
@@ -201,4 +226,225 @@ public class CableController extends BladeController {
 		return R.data(list);
 	}
 
+	/**
+	 * 修改历史
+	 */
+	@GetMapping("/getCableEditHistory")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入cable")
+	public R getCableEditHistory(String cableId) {
+		List<LogUsual> list = logUsualService.list(new QueryWrapper<>(new LogUsual()).lambda().eq(LogUsual::getRequestUri, "/cable/update").eq(LogUsual::getLogId, cableId));
+		List<Modify> resList = new ArrayList<>();
+		String account = AuthUtil.getUser().getAccount();
+		list.forEach(item -> {
+			Modify modify = new Modify();
+			BeanUtil.copy(item, modify);
+			modify.setModifyUserName(account);
+			resList.add(modify);
+		});
+
+		return R.data(resList);
+	}
+
+
+
+
+
+
+	public List<Map<String, Object>> becompare(Cable newData, Cable oldData){
+		List list = new ArrayList();
+
+		if (!newData.getShipNo().equals(oldData.getShipNo())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getShipNo());
+			item.put("newValue", newData.getShipNo());
+			item.put("text", "产品编号");
+			list.add(item);
+		}
+		if (!newData.getLabel().equals(oldData.getLabel())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getLabel());
+			item.put("newValue", newData.getLabel());
+			item.put("text", "标签");
+			list.add(item);
+		}
+		if (!newData.getAlias().equals(oldData.getAlias())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getAlias());
+			item.put("newValue", newData.getAlias());
+			item.put("text", "电缆代号");
+			list.add(item);
+		}
+		if (!newData.getCategory().equals(oldData.getCategory())){
+			Map<String, Object> item = new HashMap<>();
+
+			String oldValue = dictService.getValue("cable_category", oldData.getCategory());
+			String newValue = dictService.getValue("cable_category", newData.getCategory());
+
+			item.put("oldValue", oldValue);
+			item.put("newValue", newValue);
+			item.put("text", "类别");
+			list.add(item);
+		}
+		if (!newData.getModel().equals(oldData.getModel())){
+			Map<String, Object> item = new HashMap<>();
+
+			String oldValue = dictService.getValue("cable_model", oldData.getModel());
+			String newValue = dictService.getValue("cable_model", newData.getModel());
+
+			item.put("oldValue", oldValue);
+			item.put("newValue", newValue);
+			item.put("text", "型号");
+			list.add(item);
+		}
+		if (!newData.getSpecs().equals(oldData.getSpecs())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getSpecs());
+			item.put("newValue", newData.getSpecs());
+			item.put("text", "规格");
+			list.add(item);
+		}
+		if (!newData.getDiameter().equals(oldData.getDiameter())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getDiameter());
+			item.put("newValue", newData.getDiameter());
+			item.put("text", "直径");
+			list.add(item);
+		}
+		if (!newData.getBeginCabin().equals(oldData.getBeginCabin())){
+			Map<String, Object> item = new HashMap<>();
+
+			String oldValue = dictService.getValue("ship_cabin", oldData.getBeginCabin());
+			String newValue = dictService.getValue("ship_cabin", newData.getBeginCabin());
+
+			item.put("oldValue", oldValue);
+			item.put("newValue", newValue);
+			item.put("text", "起点舱室");
+			list.add(item);
+		}
+		if (!newData.getBeginName().equals(oldData.getBeginName())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getBeginName());
+			item.put("newValue", newData.getBeginName());
+			item.put("text", "起点终端");
+			list.add(item);
+		}
+		if (!newData.getBeginDeck().equals(oldData.getBeginDeck())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getBeginDeck());
+			item.put("newValue", newData.getBeginDeck());
+			item.put("text", "起点甲板");
+			list.add(item);
+		}
+		if (!newData.getBeginShipSide().equals(oldData.getBeginShipSide())){
+			Map<String, Object> item = new HashMap<>();
+
+			String oldValue = dictService.getValue("ship_side", oldData.getBeginShipSide());
+			String newValue = dictService.getValue("ship_side", newData.getBeginShipSide());
+
+			item.put("oldValue", oldValue);
+			item.put("newValue", newValue);
+			item.put("text", "起点船舷");
+			list.add(item);
+		}
+		if (!newData.getBeginRibPosition().equals(oldData.getBeginRibPosition())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getBeginRibPosition());
+			item.put("newValue", newData.getBeginRibPosition());
+			item.put("text", "起点肋位");
+			list.add(item);
+		}
+		if (!newData.getPassNode().equals(oldData.getPassNode())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getPassNode());
+			item.put("newValue", newData.getPassNode());
+			item.put("text", "经过节点");
+			list.add(item);
+		}
+
+		if (!newData.getEndCabin().equals(oldData.getEndCabin())){
+			Map<String, Object> item = new HashMap<>();
+
+			String oldValue = dictService.getValue("ship_cabin", oldData.getEndCabin());
+			String newValue = dictService.getValue("ship_cabin", newData.getEndCabin());
+
+			item.put("oldValue", oldValue);
+			item.put("newValue", newValue);
+			item.put("text", "终点舱室");
+			list.add(item);
+		}
+		if (!newData.getEndName().equals(oldData.getEndName())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getEndName());
+			item.put("newValue", newData.getEndName());
+			item.put("text", "终点终端");
+			list.add(item);
+		}
+		if (!newData.getEndDeck().equals(oldData.getEndDeck())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getEndDeck());
+			item.put("newValue", newData.getEndDeck());
+			item.put("text", "终点甲板");
+			list.add(item);
+		}
+		if (!newData.getEndShipSide().equals(oldData.getEndShipSide())){
+			Map<String, Object> item = new HashMap<>();
+
+			String oldValue = dictService.getValue("ship_side", oldData.getEndShipSide());
+			String newValue = dictService.getValue("ship_side", newData.getEndShipSide());
+
+			item.put("oldValue", oldValue);
+			item.put("newValue", newValue);
+			item.put("text", "终点船舷");
+			list.add(item);
+		}
+		if (!newData.getEndRibPosition().equals(oldData.getEndRibPosition())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getEndRibPosition());
+			item.put("newValue", newData.getEndRibPosition());
+			item.put("text", "终点肋位");
+			list.add(item);
+		}
+
+		if (!newData.getStopPoint().equals(oldData.getStopPoint())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getStopPoint());
+			item.put("newValue", newData.getStopPoint());
+			item.put("text", "电缆停止点");
+			list.add(item);
+		}
+		if (!newData.getLen().equals(oldData.getLen())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getLen());
+			item.put("newValue", newData.getLen());
+			item.put("text", "电缆前长度");
+			list.add(item);
+		}
+		if (!newData.getFrontLen().equals(oldData.getFrontLen())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getFrontLen());
+			item.put("newValue", newData.getFrontLen());
+			item.put("text", "电缆总长");
+			list.add(item);
+		}
+		if (!newData.getDrawingNo().equals(oldData.getDrawingNo())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getDrawingNo());
+			item.put("newValue", newData.getDrawingNo());
+			item.put("text", "系统图号");
+			list.add(item);
+		}
+		if (!newData.getRemark().equals(oldData.getRemark())){
+			Map<String, Object> item = new HashMap<>();
+			item.put("oldValue", oldData.getRemark());
+			item.put("newValue", newData.getRemark());
+			item.put("text", "备注");
+			list.add(item);
+		}
+
+
+		return list;
+	}
+
+
 }

+ 2 - 0
src/main/java/org/springblade/ship/cable/entity/Cable.java

@@ -160,5 +160,7 @@ public class Cable extends BaseEntity {
 		@ApiModelProperty(value = "备注")
 		private String remark;
 
+		@ApiModelProperty(value = "修改标识")
+		private Integer isModify;
 
 }

+ 6 - 0
src/main/java/org/springblade/ship/cable/service/impl/CableServiceImpl.java

@@ -66,6 +66,12 @@ public class CableServiceImpl extends BaseServiceImpl<CableMapper, Cable> implem
 			String ship_cabin1 = DictCache.getKey("ship_cabin", cableExcel.getEndCabin());
 			String ship_side1 = DictCache.getKey("ship_side", cableExcel.getEndShipSide());
 
+			if (cableExcel.getLabel() != null && cableExcel.getLabel().length() < 24){
+				String label = cableExcel.getLabel();
+				String str = "%0" + (24 - label.length()) + "d";
+				String format = String.format(str, 0);
+				cable.setLabel(format + label);
+			}
 			if (cable_category != null){
 				cable.setCategory(cable_category);
 			}

+ 47 - 0
src/main/java/org/springblade/ship/cable/vo/Modify.java

@@ -0,0 +1,47 @@
+/*
+ *      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.cable.vo;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.log.model.LogUsual;
+import org.springblade.core.mp.base.BaseEntity;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-11-15
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "修改对象", description = "修改对象")
+public class Modify extends LogUsual {
+
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private String modifyUserName;
+
+}

+ 112 - 4
src/main/java/org/springblade/ship/open/OpenController.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.ship.open;
 
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -29,6 +30,8 @@ import org.springblade.modules.system.entity.Dict;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IDictService;
 import org.springblade.modules.system.service.IUserService;
+import org.springblade.ship.appversion.entity.AppVersion;
+import org.springblade.ship.appversion.service.IAppVersionService;
 import org.springblade.ship.cable.entity.Cable;
 import org.springblade.ship.cable.service.ICableService;
 import org.springblade.ship.device.entity.Device;
@@ -39,6 +42,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -60,6 +67,7 @@ public class OpenController extends BladeController {
 	private final IUserService userService;
 	private final ICableService cableService;
 	private final IDictService dictService;
+	private final IAppVersionService appVersionService;
 
 	/**
 	 * 设备更新信息(用户、电缆、设备)
@@ -68,6 +76,7 @@ public class OpenController extends BladeController {
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "详情", notes = "传入device")
 	public R updateInfo(@RequestParam String deviceCode) {
+		System.out.println("/device/updateInfo");
 		Device device = deviceService.getOne(new QueryWrapper<>(new Device()).lambda().eq(Device::getCode, deviceCode));
 		Assert.notNull(device, "系统找不到编码为【" + deviceCode + "】的设备!");
 		QueryWrapper<User> userQueryWrapper = new QueryWrapper<>(new User());
@@ -95,6 +104,8 @@ public class OpenController extends BladeController {
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "详情", notes = "传入device")
 	public R updateTime(@RequestParam String deviceCode, Boolean reset) {
+		System.out.println("/device/updateTime");
+
 		Device device = deviceService.getOne(new QueryWrapper<>(new Device()).lambda().eq(Device::getCode, deviceCode));
 		Assert.notNull(device, "系统找不到编码为【" + deviceCode + "】的设备!");
 
@@ -114,21 +125,118 @@ public class OpenController extends BladeController {
 	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "获取字典", notes = "获取字典")
 	public R dictionary(@RequestParam String codes) {
-		List<Map<String, Object>> list = new ArrayList<>();
+		System.out.println("/system/dictionary");
+
+		codes = "yes_no,post_category,user_type,cable_category,cable_model,ship_cabin,ship_side";
+
+		List<Map<String, Object>> dictList = new ArrayList<>();
 		List<String> codeList = Func.toStrList(codes);
 		codeList.forEach(code -> {
 			List<Dict> tree = dictService.getList(code);
 			if (tree != null && tree.size() > 0){
 				Map<String, Object> map = new HashMap<>();
 				map.put(code, tree);
-				list.add(map);
+				dictList.add(map);
 			}
-
 		});
 
-		return R.data(list);
+		return R.data(dictList);
 	}
 
+/**
+ * 获取字典
+ */
+	@GetMapping("/app/version/update")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "获取字典", notes = "获取字典")
+	public R versionUpdate() {
+		System.out.println("/app/version/update");
+
+		AppVersion version = appVersionService.getLastVersion();
 
+		return R.data(version);
+	}
+
+	/**
+	 *
+	 */
+	@GetMapping("/getUpdateData")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "更新信息", notes = "")
+	public HttpServletResponse getUpdateData(HttpServletResponse response) {
+
+		QueryWrapper<User> userQueryWrapper = new QueryWrapper<>(new User());
+		QueryWrapper<Cable> cableQueryWrapper = new QueryWrapper<>(new Cable());
+		List<User> userList = userService.list(userQueryWrapper);
+		List<Cable> cableList = cableService.list(cableQueryWrapper);
+
+		String codes = "yes_no,post_category,user_type,cable_category,cable_model,ship_cabin,ship_side";
+
+		List<Map<String, Object>> dictList = new ArrayList<>();
+		List<String> codeList = Func.toStrList(codes);
+		codeList.forEach(code -> {
+			List<Dict> tree = dictService.getList(code);
+			if (tree != null && tree.size() > 0){
+				Map<String, Object> map = new HashMap<>();
+				map.put(code, tree);
+				dictList.add(map);
+			}
+		});
+
+		Map<String, Object> map = new HashMap<>();
+		map.put("userList", userList);
+		map.put("cableList", cableList);
+		map.put("updateTime", DateUtil.format(DateUtil.now(), "yyyy-MM-dd HH:mm:ss"));
+		map.put("dictList", dictList);
+
+		BufferedWriter out = null;
+		try {
+			File file = new File("datas.json");
+			if(!file.exists()){
+				file.createNewFile();
+			}
+
+			String path = file.getPath();
+
+			out = new BufferedWriter(new FileWriter(file, false));
+			out.write(JSONUtil.toJsonStr(map));
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		// 读到流中
+		InputStream inStream = null;// 文件的存放路径
+		try {
+			File f = new File("datas.json");
+			if (!f.exists()) {
+//				response.sendError(404, "File not found!");
+				return response;
+			}
+			BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
+			byte[] buf = new byte[1024];
+			int len = 0;
+
+			response.reset(); // 非常重要
+			URL u = new URL("file:///" + f.getAbsolutePath());
+			response.setContentType(u.openConnection().getContentType());
+			response.setContentType("application/x-msdownload");
+			response.setHeader("Content-Disposition", "inline; filename=" + f.getName());
+			// 文件名应该编码成UTF-8
+			OutputStream out2 = response.getOutputStream();
+			while ((len = br.read(buf)) > 0)
+				out2.write(buf, 0, len);
+			br.close();
+			out2.close();
+
+		} catch (FileNotFoundException | MalformedURLException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return response;
+
+	}
 
 }