bug修复

This commit is contained in:
Administrator 2023-05-19 17:27:19 +08:00
parent 22e8e60533
commit 451128c355
10 changed files with 250 additions and 308 deletions

View File

@ -1,217 +1,298 @@
package com.zhgd.xmgl.modules.bigdevice.entity;
import java.io.Serializable;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 升降机基本信息
* @author pds
* @date 2020-12-16
* @date 2020-12-16
* @version V1.0
*/
@Data
@TableName("lifter")
@ApiModel(value="Lifter实体类",description="Lifter")
@ApiModel(value = "Lifter实体类", description = "Lifter")
public class Lifter implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="id")
private java.lang.Long id ;
/**设备名称*/
@ApiModelProperty(value = "id")
private java.lang.Long id;
/**
* 设备名称
*/
@Excel(name = "设备名称", width = 15)
@ApiModelProperty(value="设备名称")
private java.lang.String devName ;
/**设备编号*/
@ApiModelProperty(value = "设备名称")
private java.lang.String devName;
/**
* 设备编号
*/
@Excel(name = "设备编号", width = 15)
@ApiModelProperty(value="设备编号")
private java.lang.String devSn ;
/**升降机类型,0:单笼 1:多笼*/
@ApiModelProperty(value = "设备编号")
private java.lang.String devSn;
/**
* 升降机类型,0:单笼 1:多笼
*/
@Excel(name = "升降机类型,0:单笼 1:多笼", width = 15)
@ApiModelProperty(value="升降机类型,0:单笼 1:多笼")
private java.lang.Integer elevatorType ;
/**多笼设备另一个设备编号*/
@ApiModelProperty(value = "升降机类型,0:单笼 1:多笼")
private java.lang.Integer elevatorType;
/**
* 多笼设备另一个设备编号
*/
@Excel(name = "多笼设备另一个设备编号", width = 15)
@ApiModelProperty(value="多笼设备另一个设备编号")
private java.lang.String otherDevSn ;
/**升降机备案号*/
@ApiModelProperty(value = "多笼设备另一个设备编号")
private java.lang.String otherDevSn;
/**
* 升降机备案号
*/
@Excel(name = "升降机备案号", width = 15)
@ApiModelProperty(value="升降机备案号")
private java.lang.String registNo ;
/**设备型号*/
@ApiModelProperty(value = "升降机备案号")
private java.lang.String registNo;
/**
* 设备型号
*/
@Excel(name = "设备型号", width = 15)
@ApiModelProperty(value="设备型号")
private java.lang.String devModel ;
/**产权单位*/
@ApiModelProperty(value = "设备型号")
private java.lang.String devModel;
/**
* 产权单位
*/
@Excel(name = "产权单位", width = 15)
@ApiModelProperty(value="产权单位")
private java.lang.String propertyUnit ;
/**产权编号*/
@ApiModelProperty(value = "产权单位")
private java.lang.String propertyUnit;
/**
* 产权编号
*/
@Excel(name = "产权编号", width = 15)
@ApiModelProperty(value="产权编号")
private java.lang.String propertyNumber ;
/**安装单位*/
@ApiModelProperty(value = "产权编号")
private java.lang.String propertyNumber;
/**
* 安装单位
*/
@Excel(name = "安装单位", width = 15)
@ApiModelProperty(value="安装单位")
private java.lang.String installationUnit ;
/**安装单位代码*/
@ApiModelProperty(value = "安装单位")
private java.lang.String installationUnit;
/**
* 安装单位代码
*/
@Excel(name = "安装单位代码", width = 15)
@ApiModelProperty(value="安装单位代码")
private java.lang.String installationUnitCode ;
/**安装时间*/
@ApiModelProperty(value = "安装单位代码")
private java.lang.String installationUnitCode;
/**
* 安装时间
*/
@Excel(name = "安装时间", width = 15)
@ApiModelProperty(value="安装时间")
private java.lang.String installationTime ;
/**安装图片*/
@ApiModelProperty(value = "安装时间")
private java.lang.String installationTime;
/**
* 安装图片
*/
@Excel(name = "安装图片", width = 15)
@ApiModelProperty(value="安装图片")
private java.lang.String installationImage ;
/**制造单位*/
@ApiModelProperty(value = "安装图片")
private java.lang.String installationImage;
/**
* 制造单位
*/
@Excel(name = "制造单位", width = 15)
@ApiModelProperty(value="制造单位")
private java.lang.String factoryName ;
/**出产日期*/
@ApiModelProperty(value = "制造单位")
private java.lang.String factoryName;
/**
* 出产日期
*/
@Excel(name = "出产日期", width = 15)
@ApiModelProperty(value="出产日期")
private java.lang.String factoryTime ;
/**拆除单位*/
@ApiModelProperty(value = "出产日期")
private java.lang.String factoryTime;
/**
* 拆除单位
*/
@Excel(name = "拆除单位", width = 15)
@ApiModelProperty(value="拆除单位")
private java.lang.String demolitionUnit ;
/**设备状态1设备进场2设备安装3设备验收4设备使用5设备拆除6设备退场*/
@ApiModelProperty(value = "拆除单位")
private java.lang.String demolitionUnit;
/**
* 设备状态1设备进场2设备安装3设备验收4设备使用5设备拆除6设备退场
*/
@Excel(name = "设备状态1设备进场2设备安装3设备验收4设备使用5设备拆除6设备退场", width = 15)
@ApiModelProperty(value="设备状态1设备进场2设备安装3设备验收4设备使用5设备拆除6设备退场")
private java.lang.Integer devState ;
/**检测单位*/
@ApiModelProperty(value = "设备状态1设备进场2设备安装3设备验收4设备使用5设备拆除6设备退场")
private java.lang.Integer devState;
/**
* 检测单位
*/
@Excel(name = "检测单位", width = 15)
@ApiModelProperty(value="检测单位")
private java.lang.String testingOrganization ;
/**检测合格时间*/
@ApiModelProperty(value = "检测单位")
private java.lang.String testingOrganization;
/**
* 检测合格时间
*/
@Excel(name = "检测合格时间", width = 15)
@ApiModelProperty(value="检测合格时间")
private java.lang.String testQualifiedTime ;
/**检测编号*/
@ApiModelProperty(value = "检测合格时间")
private java.lang.String testQualifiedTime;
/**
* 检测编号
*/
@Excel(name = "检测编号", width = 15)
@ApiModelProperty(value="检测编号")
private java.lang.String testNumber ;
/**检测证书照片*/
@ApiModelProperty(value = "检测编号")
private java.lang.String testNumber;
/**
* 检测证书照片
*/
@Excel(name = "检测证书照片", width = 15)
@ApiModelProperty(value="检测证书照片")
private java.lang.String testCertificate ;
/**使用登记办理时间*/
@ApiModelProperty(value = "检测证书照片")
private java.lang.String testCertificate;
/**
* 使用登记办理时间
*/
@Excel(name = "使用登记办理时间", width = 15)
@ApiModelProperty(value="使用登记办理时间")
private java.lang.String useRegistrationTime ;
/**使用登记办理编号*/
@ApiModelProperty(value = "使用登记办理时间")
private java.lang.String useRegistrationTime;
/**
* 使用登记办理编号
*/
@Excel(name = "使用登记办理编号", width = 15)
@ApiModelProperty(value="使用登记办理编号")
private java.lang.String useRegistrationNumber ;
/**登记证书照片*/
@ApiModelProperty(value = "使用登记办理编号")
private java.lang.String useRegistrationNumber;
/**
* 登记证书照片
*/
@Excel(name = "登记证书照片", width = 15)
@ApiModelProperty(value="登记证书照片")
private java.lang.String registrationCertificate ;
/**最大载重*/
@ApiModelProperty(value = "登记证书照片")
private java.lang.String registrationCertificate;
/**
* 最大载重
*/
@Excel(name = "最大载重", width = 15)
@ApiModelProperty(value="最大载重")
private java.lang.String maxLoad ;
/**额定人数*/
@ApiModelProperty(value = "最大载重")
private java.lang.String maxLoad;
/**
* 额定人数
*/
@Excel(name = "额定人数", width = 15)
@ApiModelProperty(value="额定人数")
private java.lang.Integer ratedPeopleNum ;
/**最大高度*/
@ApiModelProperty(value = "额定人数")
private java.lang.Integer ratedPeopleNum;
/**
* 最大高度
*/
@Excel(name = "最大高度", width = 15)
@ApiModelProperty(value="最大高度")
private java.lang.String maxHeight ;
/**齿轮模数*/
@ApiModelProperty(value = "最大高度")
private java.lang.String maxHeight;
/**
* 齿轮模数
*/
@Excel(name = "齿轮模数", width = 15)
@ApiModelProperty(value="齿轮模数")
private java.lang.String gearModule ;
/**创建时间*/
@ApiModelProperty(value = "齿轮模数")
private java.lang.String gearModule;
/**
* 创建时间
*/
@Excel(name = "创建时间", width = 15)
@ApiModelProperty(value="创建时间")
private java.lang.String addTime ;
/**备案编号*/
@ApiModelProperty(value = "创建时间")
private java.lang.String addTime;
/**
* 备案编号
*/
@Excel(name = "备案编号", width = 15)
@ApiModelProperty(value="备案编号")
private java.lang.String filingNo ;
/**设备标识码*/
@ApiModelProperty(value = "备案编号")
private java.lang.String filingNo;
/**
* 设备标识码
*/
@Excel(name = "设备标识码", width = 15)
@ApiModelProperty(value="设备标识码")
private java.lang.String verifyCode ;
/**项目sn*/
@ApiModelProperty(value = "设备标识码")
private java.lang.String verifyCode;
/**
* 项目sn
*/
@Excel(name = "项目sn", width = 15)
@ApiModelProperty(value="项目sn")
private java.lang.String projectSn ;
/**地图X坐标*/
@ApiModelProperty(value = "项目sn")
private java.lang.String projectSn;
/**
* 地图X坐标
*/
@Excel(name = "地图X坐标", width = 15)
@ApiModelProperty(value="地图X坐标")
private java.lang.String mapX ;
/**地图Y坐标*/
@ApiModelProperty(value = "地图X坐标")
private java.lang.String mapX;
/**
* 地图Y坐标
*/
@Excel(name = "地图Y坐标", width = 15)
@ApiModelProperty(value="地图Y坐标")
private java.lang.String mapY ;
/**是否启用视频url,1不启用2启用*/
@ApiModelProperty(value = "地图Y坐标")
private java.lang.String mapY;
/**
* 是否启用视频url,1不启用2启用
*/
@Excel(name = "是否启用视频url,1不启用2启用", width = 15)
@ApiModelProperty(value="是否启用视频url,1不启用2启用")
private java.lang.Integer enableVideoUrl ;
/**视频Url*/
@ApiModelProperty(value = "是否启用视频url,1不启用2启用")
private java.lang.Integer enableVideoUrl;
/**
* 视频Url
*/
@Excel(name = "视频Url", width = 15)
@ApiModelProperty(value="视频Url")
private java.lang.String videoUrl ;
/**纬度*/
@ApiModelProperty(value = "视频Url")
private java.lang.String videoUrl;
/**
* 纬度
*/
@Excel(name = "纬度", width = 15)
@ApiModelProperty(value="纬度")
private java.lang.String latitude ;
/**经度*/
@ApiModelProperty(value = "纬度")
private java.lang.String latitude;
/**
* 经度
*/
@Excel(name = "经度", width = 15)
@ApiModelProperty(value="经度")
private java.lang.String longitude ;
/**接收实时数据时间30分钟没接收到实时数据表示设备离线*/
@ApiModelProperty(value = "经度")
private java.lang.String longitude;
/**
* 接收实时数据时间30分钟没接收到实时数据表示设备离线
*/
@Excel(name = "接收实时数据时间30分钟没接收到实时数据表示设备离线", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="接收实时数据时间30分钟没接收到实时数据表示设备离线")
private java.util.Date realTime ;
/**是否创建数据0否1是*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "接收实时数据时间30分钟没接收到实时数据表示设备离线")
private java.util.Date realTime;
/**
* 是否创建数据0否1是
*/
@Excel(name = "是否创建数据0否1是", width = 15)
@ApiModelProperty(value="是否创建数据0否1是")
private java.lang.Integer createDataType ;
@ApiModelProperty(value = "是否创建数据0否1是")
private java.lang.Integer createDataType;
@ApiModelProperty(value="升级机所在楼层总层数")
@ApiModelProperty(value = "升级机所在楼层总层数")
private java.lang.Integer totalFloor;
@ApiModelProperty(value="报警推送人")
@ApiModelProperty(value = "报警推送人")
private java.lang.String alarmPushWorkerId;
@ApiModelProperty(value="总承包单位企业ID")
private java.lang.Integer generalContractorsId ;
@ApiModelProperty(value = "总承包单位企业ID")
private java.lang.Integer generalContractorsId;
@ApiModelProperty(value = "品牌")
private java.lang.String brand;
@TableField(exist = false)
@ApiModelProperty(value="总承包单位企业名称")
private java.lang.String generalContractorsName ;
@ApiModelProperty(value = "总承包单位企业名称")
private java.lang.String generalContractorsName;
@TableField(exist = false)
@ApiModelProperty(value="设置是否在线1在线0离线")
@ApiModelProperty(value = "设置是否在线1在线0离线")
private java.lang.Integer devOnline;
@TableField(exist = false)
@ApiModelProperty(value="视频列表")
@ApiModelProperty(value = "视频列表")
private List<BigDeviceVideo> videoList;
@TableField(exist = false)
@ApiModelProperty(value="司机列表")
@ApiModelProperty(value = "司机列表")
private List<BigDeviceDriverRecord> driverList;
}

View File

@ -34,8 +34,8 @@
notice_user_ids,
frequency_num,
frequency_type,
standArea,
remark,
stand_area,
remark,
start_time,
end_time,
create_date,
@ -60,7 +60,7 @@
notice_user_ids,
frequency_num,
frequency_type,
standArea,
stand_area,
remark,
start_time,
end_time,
@ -70,4 +70,4 @@
where end_time = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
and frequency_num is not null
</select>
</mapper>
</mapper>

View File

@ -143,6 +143,7 @@ public class DischargingPlatformAlarmServiceImpl extends ServiceImpl<Discharging
pList.add(map);
}
}
Collections.reverse(pList);
}
@Override

View File

@ -179,9 +179,9 @@ public class DeepExcavationCurrentDataServiceImpl extends ServiceImpl<DeepExcava
@Override
public List<EntityMap> getAlarmCycleTrendGraph(Map<String, Object> map) {
//eg:[{time:2020-11-11,num:11}]
List<EntityMap> p = deepExcavationCurrentDataMapper.getAlarmCycleTrendGraph(map);
dischargingPlatformAlarmService.fillEmptyDateData(p);
return p;
List<EntityMap> list = deepExcavationCurrentDataMapper.getAlarmCycleTrendGraph(map);
dischargingPlatformAlarmService.fillEmptyDateData(list);
return list;
}
@Override

View File

@ -162,16 +162,6 @@ public class HighFormworkAlarmDataController {
return result;
}
@ApiOperation(value = "查询报警类型雷达图(近一月不同类型报警数量)", notes = "查询报警类型雷达图(近一月不同类型报警数量)", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "measurePointId", value = "监测点ID", paramType = "query", required = true, dataType = "LONG"),
})
@GetMapping(value = "/recent/month/radar")
public Result<List<NumberDifferentTypesAlarmsRadarChartOneMonthVo>> getNumberDifferentTypesAlarmsRadarChartOneMonth(@RequestParam Map<String, Object> map) {
return Result.success(highFormworkAlarmDataService.getNumberDifferentTypesAlarmsRadarChartOneMonth(map));
}
@ApiOperation(value = "查询报警周期趋势图(近一月不同类型报警数量)", notes = "查询报警周期趋势图(近一月不同类型报警数量)", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@ -181,4 +171,14 @@ public class HighFormworkAlarmDataController {
public Result<List<EntityMap>> getAlarmCycleTrendGraph(@RequestParam Map<String, Object> map) {
return Result.success(highFormworkAlarmDataService.getAlarmCycleTrendGraph(map));
}
@ApiOperation(value = "查询报警类型雷达图(近一月不同类型报警数量)", notes = "查询报警类型雷达图(近一月不同类型报警数量)", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "measurePointId", value = "监测点ID", paramType = "query", required = true, dataType = "LONG"),
})
@GetMapping(value = "/recent/month/radar")
public Result<List<NumberDifferentTypesAlarmsRadarChartOneMonthVo>> getNumberDifferentTypesAlarmsRadarChartOneMonth(@RequestParam Map<String, Object> map) {
return Result.success(highFormworkAlarmDataService.getNumberDifferentTypesAlarmsRadarChartOneMonth(map));
}
}

View File

@ -52,9 +52,9 @@ public class HighFormworkAlarmDataServiceImpl extends ServiceImpl<HighFormworkAl
@Override
public List<EntityMap> getAlarmCycleTrendGraph(Map<String, Object> map) {
//eg:[{time:2020-11-11,num:11}]
List<EntityMap> p = highFormworkAlarmDataMapper.getAlarmCycleTrendGraph(map);
dischargingPlatformAlarmService.fillEmptyDateData(p);
return p;
List<EntityMap> list = highFormworkAlarmDataMapper.getAlarmCycleTrendGraph(map);
dischargingPlatformAlarmService.fillEmptyDateData(list);
return list;
}
/**

View File

@ -22,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -187,5 +184,6 @@ public class HighFormworkMeasureCurrentDataServiceImpl extends ServiceImpl<HighF
list.add(v);
}
}
Collections.reverse(list);
}
}

View File

@ -208,75 +208,4 @@ public class SjDeepFoundationEquipmentInformationController {
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@ApiOperation(value = "导出excel三江-深基坑设备信息信息", notes = "导出excel三江-深基坑设备信息信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SjDeepFoundationEquipmentInformation> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SjDeepFoundationEquipmentInformation sjDeepFoundationEquipmentInformation = JSON.parseObject(deString, SjDeepFoundationEquipmentInformation.class);
queryWrapper = QueryGenerator.initQueryWrapper(sjDeepFoundationEquipmentInformation, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SjDeepFoundationEquipmentInformation> pageList = sjDeepFoundationEquipmentInformationService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "三江-深基坑设备信息列表");
mv.addObject(NormalExcelConstants.CLASS, SjDeepFoundationEquipmentInformation.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("三江-深基坑设备信息列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@ApiOperation(value = "通过excel导入三江-深基坑设备信息信息", notes = "通过excel导入三江-深基坑设备信息信息", httpMethod = "POST")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<SjDeepFoundationEquipmentInformation> listSjDeepFoundationEquipmentInformations = ExcelImportUtil.importExcel(file.getInputStream(), SjDeepFoundationEquipmentInformation.class, params);
for (SjDeepFoundationEquipmentInformation sjDeepFoundationEquipmentInformationExcel : listSjDeepFoundationEquipmentInformations) {
sjDeepFoundationEquipmentInformationService.save(sjDeepFoundationEquipmentInformationExcel);
}
return Result.ok("文件导入成功!数据行数:" + listSjDeepFoundationEquipmentInformations.size());
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("文件导入失败!");
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}

View File

@ -207,75 +207,4 @@ public class SjHighSupportMoldEquipmentInformationController {
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@ApiOperation(value = "导出excel三江-高支模设备信息信息", notes = "导出excel三江-高支模设备信息信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SjHighSupportMoldEquipmentInformation> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SjHighSupportMoldEquipmentInformation sjHighSupportMoldEquipmentInformation = JSON.parseObject(deString, SjHighSupportMoldEquipmentInformation.class);
queryWrapper = QueryGenerator.initQueryWrapper(sjHighSupportMoldEquipmentInformation, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SjHighSupportMoldEquipmentInformation> pageList = sjHighSupportMoldEquipmentInformationService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "三江-高支模设备信息列表");
mv.addObject(NormalExcelConstants.CLASS, SjHighSupportMoldEquipmentInformation.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("三江-高支模设备信息列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@ApiOperation(value = "通过excel导入三江-高支模设备信息信息", notes = "通过excel导入三江-高支模设备信息信息", httpMethod = "POST")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<SjHighSupportMoldEquipmentInformation> listSjHighSupportMoldEquipmentInformations = ExcelImportUtil.importExcel(file.getInputStream(), SjHighSupportMoldEquipmentInformation.class, params);
for (SjHighSupportMoldEquipmentInformation sjHighSupportMoldEquipmentInformationExcel : listSjHighSupportMoldEquipmentInformations) {
sjHighSupportMoldEquipmentInformationService.save(sjHighSupportMoldEquipmentInformationExcel);
}
return Result.ok("文件导入成功!数据行数:" + listSjHighSupportMoldEquipmentInformations.size());
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("文件导入失败!");
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}

View File

@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -74,7 +75,10 @@ public class WeighInfoController {
*/
@ApiOperation(value = " 添加称重记录表信息", notes = "添加称重记录表信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<WeighInfo> add(@RequestBody WeighInfo weighInfo) {
public Result add(@RequestBody WeighInfo weighInfo) {
if (StringUtils.isBlank(weighInfo.getProjectSn())) {
return Result.error("projectSn不能为空");
}
Result<WeighInfo> result = new Result<WeighInfo>();
try {
weighInfoService.save(weighInfo);