diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 872489f..27ab9cd 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -2,9 +2,11 @@ import com.newfiber.common.core.enums.EBoolean; +import com.newfiber.common.core.utils.poi.ExcelUtil; import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; import com.newfiber.common.core.web.page.PageResult; +import com.newfiber.common.security.annotation.RequiresPermissions; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.termite.domain.DeviceInfo; import com.newfiber.termite.domain.dto.PhotoIdentifyDto; @@ -28,6 +30,8 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -127,6 +131,16 @@ return result; } + + @PostMapping("/export") + @ApiOperation(value = "查询历史数据导出excel", position = 60) + public void export(HttpServletResponse response, TermiteHistoryQueryRequest request){ + startPage(); + PageResult> result =termiteService.queryhistoryData(request); + ExcelUtil util = new ExcelUtil(TermiteInfoResponse.class); + util.exportExcel(response, result.getData(), request.getSn()+"历史站点"); + } + /** * 新增站点 */ diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java index 872489f..27ab9cd 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/TermiteController.java @@ -2,9 +2,11 @@ import com.newfiber.common.core.enums.EBoolean; +import com.newfiber.common.core.utils.poi.ExcelUtil; import com.newfiber.common.core.web.controller.BaseController; import com.newfiber.common.core.web.domain.Result; import com.newfiber.common.core.web.page.PageResult; +import com.newfiber.common.security.annotation.RequiresPermissions; import com.newfiber.common.security.utils.SecurityUtils; import com.newfiber.termite.domain.DeviceInfo; import com.newfiber.termite.domain.dto.PhotoIdentifyDto; @@ -28,6 +30,8 @@ import io.swagger.annotations.ApiOperation; import java.util.List; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -127,6 +131,16 @@ return result; } + + @PostMapping("/export") + @ApiOperation(value = "查询历史数据导出excel", position = 60) + public void export(HttpServletResponse response, TermiteHistoryQueryRequest request){ + startPage(); + PageResult> result =termiteService.queryhistoryData(request); + ExcelUtil util = new ExcelUtil(TermiteInfoResponse.class); + util.exportExcel(response, result.getData(), request.getSn()+"历史站点"); + } + /** * 新增站点 */ diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/TermiteInfoResponse.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/TermiteInfoResponse.java index 049f7b2..640df90 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/TermiteInfoResponse.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/response/TermiteInfoResponse.java @@ -2,8 +2,11 @@ import com.fasterxml.jackson.annotation.JsonFormat; +import com.newfiber.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; + +import io.swagger.annotations.ApiOperation; import lombok.Data; @Data @@ -14,22 +17,29 @@ @ApiModelProperty(value = "数据id") private String deviceId; @ApiModelProperty(value = "设备编号") + @Excel(name = "sn设备号") private String sn; @ApiModelProperty(value = "地址") private String location; @ApiModelProperty(value = "经纬度") private String lonandlat; @ApiModelProperty(value = "数据时间") + @Excel(name = "时间") private String date; @ApiModelProperty(value = "有无白蚁 1有 2无") + @Excel(name = "有无白蚁",readConverterExp = "1=有,2=无") private String yesnoant; @ApiModelProperty(value = "原始照片") + @Excel(name="识别前照片",cellType = Excel.ColumnType.IMAGE) private String rtpitcu; @ApiModelProperty(value = "识别后照片") + @Excel(name="识别后照片",cellType = Excel.ColumnType.IMAGE) private String idenpitcu; @ApiModelProperty(value = "确认是否属实 1:有 2:无 ") + @Excel(name = "是否属实",readConverterExp = "1=有,2=无") private String idencolle; @ApiModelProperty(value = "是否投药 1:是 2否 3.准备投药 4.药剂不足 默认2") + @Excel(name = "投药情况",readConverterExp = "1=是,2=否,3=准备投药,4=药剂不足") private String druing; @ApiModelProperty(value = "投药时间")