Commit d9cd3586 by zzrdark

1.add 设备导出表

2.add 设备导出模块查询
parent 9ff2da9c
......@@ -361,3 +361,12 @@ MODIFY COLUMN `active_status` varchar(50) CHARACTER SET utf8 COLLATE utf8_genera
MODIFY COLUMN `channel_rules` int(255) DEFAULT 1 COMMENT '0:白名单,1:黑名单' AFTER `channel_nums_message`,
MODIFY COLUMN `ca_certificate_status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT -1 COMMENT 'ca证书状态 -1 未下载,0 已下载 类型:非量产 1 已下载 类型:量产,2 已下载 类型:非量产,未验证 3 已下载 类型:量产,未验证' AFTER `sn`;
-- 2020-07-27
CREATE TABLE `device_info_export` (
`device_info_export_id` bigint(20) NOT NULL COMMENT '主键',
`name` varchar(255) DEFAULT NULL COMMENT '名字',
`filepath` varchar(255) DEFAULT NULL COMMENT '路径',
`status` int(10) DEFAULT NULL COMMENT '状态:0未完成,1完成',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`device_info_export_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.DeviceInfoExportEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author zzrdark
*/
@Mapper
public interface DeviceInfoExportDao extends BaseMapper<DeviceInfoExportEntity> {
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @ClassName DeviceInfoExport
* @Author zzrdark
* @Date 2020-07-27 15:59
* @Description TODO
**/
@Data
@TableName("device_info_export")
public class DeviceInfoExportEntity {
@TableId
private Long deviceInfoExportId;
private String name;
private String filepath;
private Integer status;
private Date updateTime;
}
<?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.mx.cneeds.server.dao.DeviceInfoExportDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.DeviceInfoExportEntity" id="deviceInfoExportMap">
<result property="deviceInfoExportId" column="device_info_export_id"/>
<result property="name" column="name"/>
<result property="filepath" column="filepath"/>
<result property="updateTime" column="status"/>
<result property="updateTime" column="update_time"/>
</resultMap>
</mapper>
\ No newline at end of file
package com.mx.cneeds.common.dto;
import lombok.Data;
import java.util.Date;
/**
* @ClassName DeviceInfoExportDto
* @Author zzrdark
* @Date 2020-07-27 16:42
* @Description TODO
**/
@Data
public class DeviceInfoExportDto {
private Long deviceInfoExportId;
private String name;
private String filepath;
private Integer status;
private Date updateTime;
}
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-authorization
server:
......
......@@ -63,7 +63,6 @@ public class LogFlieController {
@PostMapping("/logfile/wechatDeviceLogUpload")
@ResponseBody
public R wechatUploadLog(@RequestBody WechatDeviceLogVo vo) throws IOException {
log.debug(vo.toString());
WechatDeviceLogDto dto = new WechatDeviceLogDto();
BeanUtils.copyProperties(vo, dto);
......@@ -96,7 +95,6 @@ public class LogFlieController {
@PostMapping("/logfile/wechatUploadLogFile")
@ResponseBody
public R wechatUploadLogFile(String logAcceptId, MultipartFile file) throws IOException {
log.debug("wechatUploadLogFile: "+logAcceptId+" file : "+ (file==null ? "空":"不为空"));
StringBuffer dir = new StringBuffer(FilePath.LogFilePath);
dir.append(logAcceptId);
if (logAcceptId == null || file == null ) {
......@@ -110,28 +108,24 @@ public class LogFlieController {
.locationUrl(locationUrl)
.logAcceptId(logAcceptId).build();
log.debug(dto.toString());
logFileClient.wechatUploadAloneFile(dto);
return R.ok();
}
@PostMapping("/logfile/proDeviceUploadLogFile")
@ResponseBody
public R proDeviceUploadLogFile(DeviceLogFileVo vo){
public R proDeviceUploadLogFile(DeviceLogFileVo vo) {
DeviceLogFileDto dto = new DeviceLogFileDto();
BeanUtils.copyProperties(vo, dto);
log.debug(vo.toString());
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei());
if (deviceInfoDto == null){
// log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei");
}
DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId());
if ( deviceLogDto == null ){
// log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG);
return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息");
}
return R.ok();
......@@ -147,13 +141,11 @@ public class LogFlieController {
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei());
if (deviceInfoDto == null){
// log.debug("ResultCode: "+ResultCode.NOTFOUND_IMEI);
return R.error(ResultCode.NOTFOUND_IMEI,"没有该imei");
}
DeviceLogDto deviceLogDto = logFileClient.queryLogFileByLogAcceptId(vo.getLogAcceptId());
if ( deviceLogDto == null ){
// log.debug("ResultCode: "+ResultCode.NOTFOUNDLOG);
return R.error(ResultCode.NOTFOUNDLOG,"没找到对应的Log日志信息");
}
......
......@@ -21,8 +21,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public R exceptionHandler(HttpServletRequest req, Exception e){
log.error("Exception Message: "+ e.toString());
e.printStackTrace();
log.error("Exception Message: "+ e.getMessage(),e);
return R.error(ResultCode.NOTFOUND_EEROR,"系统未知异常");
}
......
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-datashow
server:
......
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.DeviceInfoExportEntity;
import java.util.Map;
/**
* @ClassName DeviceInfoExportService
* @Author zzrdark
* @Date 2020-07-27 16:54
* @Description TODO
**/
public interface DeviceInfoExportService extends IService<DeviceInfoExportEntity> {
/**
* 查询
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.device.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceInfoExportDao;
import com.mx.cneeds.server.device.service.DeviceInfoExportService;
import com.mx.cneeds.server.entity.DeviceChannelEntity;
import com.mx.cneeds.server.entity.DeviceInfoExportEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @ClassName DeviceInfoExportServiceImpl
* @Author zzrdark
* @Date 2020-07-27 16:59
* @Description TODO
**/
@Service("deviceInfoExportService")
public class DeviceInfoExportServiceImpl extends ServiceImpl<DeviceInfoExportDao, DeviceInfoExportEntity> implements DeviceInfoExportService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper<DeviceInfoExportEntity> queryWrapper = new QueryWrapper<>();
/*String channelNum = (String) params.get("channelNum");
if (channelNum != null && !"".equals(channelNum)){
queryWrapper.eq("channel_num",channelNum);
}*/
IPage<DeviceInfoExportEntity> page = this.page(
new Query<DeviceInfoExportEntity>().getPage(params),
queryWrapper
);
return new PageUtils(page);
}
}
......@@ -2,21 +2,12 @@ package com.mx.cneeds.server.device.web;
import java.util.*;
import com.mx.cneeds.common.dto.DeviceChannelDto;
import com.mx.cneeds.common.dto.DeviceInfoDto;
import com.mx.cneeds.common.dto.DevicesDto;
import com.mx.cneeds.common.dto.UploadDeviceChannelExcelDto;
import com.mx.cneeds.common.dto.*;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.device.service.DeviceChannelService;
import com.mx.cneeds.server.device.service.DeviceInfoChannelService;
import com.mx.cneeds.server.device.service.DeviceInfoService;
import com.mx.cneeds.server.device.service.ProductSeriesService;
import com.mx.cneeds.server.entity.DeviceChannelEntity;
import com.mx.cneeds.server.entity.DeviceInfoChannelEntity;
import com.mx.cneeds.server.entity.DeviceInfoEntity;
import com.mx.cneeds.server.entity.ProductSeriesEntity;
import com.mx.cneeds.server.device.service.*;
import com.mx.cneeds.server.entity.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
......@@ -50,6 +41,9 @@ public class DeviceInfoController {
@Autowired
private ProductSeriesService productSeriesService;
@Autowired
private DeviceInfoExportService deviceInfoExportService;
/**
* 列表
*/
......@@ -272,6 +266,7 @@ public class DeviceInfoController {
}
/**
* 批量保存渠道号
* 保存
*/
@RequestMapping("/updateDeviceChannelBatch")
......@@ -319,6 +314,10 @@ public class DeviceInfoController {
return R.ok();
}
/**
* 批量上传 渠道号和设备
* @param dto
*/
@RequestMapping("/uploadDeivceChannelExcel")
@Transactional(rollbackFor = Exception.class)
public void uploadDeivceChannelExcel(@RequestBody UploadDeviceChannelExcelDto dto){
......@@ -369,6 +368,10 @@ public class DeviceInfoController {
deviceInfoChannelService.saveBatch(deviceInfoChannelEntityList);
}
/**
* 批量上传设备
* @param dto
*/
@RequestMapping("/uploadDeivceExcel")
public void uploadDeivceExcel(@RequestBody UploadDeviceChannelExcelDto dto){
......@@ -398,5 +401,22 @@ public class DeviceInfoController {
deviceInfoService.saveBatch(list);
}
/**
* 设备信息导出表的查询
* @param params
* @return
*/
@RequestMapping("/deviceInfoExportList")
public PageUtils deviceInfoExportList(@RequestParam Map<String, Object> params){
PageUtils page = deviceInfoExportService.queryPage(params);
List<DeviceInfoExportDto> list = new ArrayList<DeviceInfoExportDto>();
for (Object entity : page.getList()){
DeviceInfoExportDto dto = new DeviceInfoExportDto();
DeviceInfoExportEntity deviceChannelEntity = (DeviceInfoExportEntity) entity;
BeanUtils.copyProperties(deviceChannelEntity,dto);
list.add(dto);
}
page.setList(list);
return page;
}
}
spring:
profiles:
active: prod
active: dev
application:
name: cneeds-server-device
......
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