Commit 4fd1ea08 by zzrdark

1.修改导出数据

2.设备信息导出下载后删除
3.设备信息页面增加更新数据
parent 3d5fdafa
......@@ -370,3 +370,10 @@ CREATE TABLE `device_info_export` (
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`device_info_export_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2020-07-31
ALTER TABLE `cneeds_server`.`device_info_export`
ADD UNIQUE INDEX `Name_Unique`(`name`) USING HASH;
ALTER TABLE `cneeds_server`.`device_info`
ADD COLUMN `update_time` datetime(0) COMMENT '更新时间状态' AFTER `ca_certificate_status`;
\ No newline at end of file
......@@ -62,6 +62,11 @@ public class DeviceInfoEntity implements Serializable {
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 激活时间
*/
private Date activeTime;
......
......@@ -13,6 +13,7 @@
<result property="deviceVersion" column="device_version"/>
<result property="seriesId" column="series_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="activeTime" column="active_time"/>
<result property="channelNumsMessage" column="channel_nums_message"/>
<result property="channelRules" column="channel_rules"/>
......
......@@ -55,6 +55,11 @@ public class DeviceInfoDto {
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 激活时间
*/
private Date activeTime;
......
......@@ -56,6 +56,11 @@ public class DeviceInfoVo {
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 激活时间
*/
private String activeTime;
......
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-authorization
server:
......
......@@ -134,5 +134,10 @@ public interface DeviceClient {
@PostMapping("device/info/addDeviceInfoExport")
void addDeviceInfoExport(@RequestBody DeviceInfoExportDto deviceInfoExportDto);
@PostMapping("device/info/deleteDeviceInfoExport")
void deleteDeviceInfoExport(@RequestBody Long deviceInfoExportId);
@PostMapping("device/info/deleteDeviceInfoExportByName")
void deleteDeviceInfoExportByName(@RequestBody String fileName);
}
......@@ -426,7 +426,9 @@ public class DeviceController {
@RequestMapping("/device/uploadNewDeviceInfo")
public R uploadNewDeviceInfo(DeviceInfoVo vo){
if (vo.getImei() == null || vo.getImei().isEmpty()){
return R.error(ResultCode.PARAMERROR,"没有传入imei");
String message = "没有传入imei";
log.info(message);
return R.error(ResultCode.PARAMERROR,message);
}
DeviceInfoDto dto = new DeviceInfoDto();
......@@ -447,9 +449,12 @@ public class DeviceController {
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(vo.getImei());
if (deviceInfoDto == null){
String message = "系统没有该设备imei: " + vo.getImei();
log.info(message);
return R.error(ResultCode.NOTFOUND_IMEI,"系统没有该设备");
}
dto.setUpdateTime(new Date());
// 再进行设置
deviceClient.updateDevice(dto);
return R.ok();
......
package com.mx.cneeds.server.datashow.web.device;
import com.mx.cneeds.common.constant.FilePath;
import com.mx.cneeds.server.datashow.client.DeviceClient;
import com.mx.hbasefile.hadoop.hdfs.api.HdfsTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,6 +26,9 @@ import java.io.InputStream;
public class DeviceFileController {
@Autowired
private DeviceClient deviceClient;
@Autowired
private HdfsTemplate hdfsTemplate;
@RequestMapping("/deviceFileDownload/{fileSize}/{fileName}")
......@@ -49,5 +53,7 @@ public class DeviceFileController {
total-=1024;
}
outputStream.close();
hdfsTemplate.deleteFile(dirPath.toString(), fileName);
deviceClient.deleteDeviceInfoExportByName(fileName);
}
}
......@@ -454,6 +454,13 @@ public class DeviceInfoController {
deviceInfoExportService.removeById(deviceInfoExportId);
}
@RequestMapping("/deleteDeviceInfoExportByName")
public void deleteDeviceInfoExportByName(@RequestBody String fileName){
Map<String,Object> map = new HashMap<>();
map.put("name",fileName);
deviceInfoExportService.removeByMap(map);
}
@RequestMapping("updateDeviceInfoExport")
public void updateDeviceInfoExport(@RequestBody DeviceInfoExportDto deviceInfoExportDto){
DeviceInfoExportEntity entity = new DeviceInfoExportEntity();
......
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-logupload
......
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment