diff --git a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java index 00c7344..2440855 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java @@ -52,8 +52,8 @@ public class DcBusiHisReportController extends BaseController { * * @return 分页数据 */ - @GetMapping("/listReport") - public AjaxResult list(@NotNull @RequestBody LogTimeThreeQueryParamVo queryVo) { + @PostMapping("/listReport") + public AjaxResult list(@RequestBody LogTimeThreeQueryParamVo queryVo) { String error = validatorator(queryVo); if (error != null) { return AjaxResult.error(error); @@ -170,13 +170,13 @@ public class DcBusiHisReportController extends BaseController { } } private String validatorator(LogTimeThreeQueryParamVo queryVo) { - if (StringUtils.isEmpty(queryVo.getBeginTime())) { + if (StringUtils.isNull(queryVo.getBeginTime())||StringUtils.isEmpty(queryVo.getBeginTime())) { return "查询失败,开始时间不能为空!"; } - if (StringUtils.isEmpty(queryVo.getEndTime())) { + if (StringUtils.isNull(queryVo.getEndTime())||StringUtils.isEmpty(queryVo.getEndTime())) { return "查询失败,结束时间不能为空!"; } - if (StringUtils.isEmpty(queryVo.getQueryParamClass())) { + if (StringUtils.isNull(queryVo.getQueryParamClass())||StringUtils.isEmpty(queryVo.getQueryParamClass())) { return "查询失败,参数类型不能为空!"; } return null; @@ -280,8 +280,9 @@ public class DcBusiHisReportController extends BaseController { } private void toExcel(HttpServletResponse response,List> mapList) throws IOException { - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setCharacterEncoding("utf-8"); + String fileName ="report"+DateUtil.now() + ".xls"; + //response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + //response.setCharacterEncoding("utf-8"); ExcelWriter writer = ExcelUtil.getWriter(); // 一次性写出内容,使用默认样式,强制输出标题 //writer.write(mapList, true); @@ -294,7 +295,7 @@ public class DcBusiHisReportController extends BaseController { //response为HttpServletResponse对象 response.setContentType("application/vnd.ms-excel;charset=utf-8"); //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 - response.setHeader("Content-Disposition", "attachment;filename=换热站数据明细表.xls"); + response.setHeader("Content-Disposition", "attachment;filename="+fileName); ServletOutputStream out = response.getOutputStream(); writer.flush(out, true); // 关闭writer,释放内存 @@ -302,5 +303,17 @@ public class DcBusiHisReportController extends BaseController { //此处记得关闭输出Servlet流 IoUtil.close(out); } - + @ApiOperation("获取生产IOT系统参数模版列表") + @GetMapping("/getParamClass") + public AjaxResult getParamClass(){ + return AjaxResult.success(logTimesacleHistoryThreeService.selectParamModels()) ; + } + @ApiOperation("获取生产IOT系统设备列表") + @GetMapping("/getDevicie/{orgCode}") + public AjaxResult selectDevices(@PathVariable Long orgCode) { + if(orgCode==0){ + return AjaxResult.success(logTimesacleHistoryThreeService.selectDevices(null)) ; + } + return AjaxResult.success(logTimesacleHistoryThreeService.selectDevices(orgCode)) ; + } } \ No newline at end of file diff --git a/lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java b/lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java index 93c85f3..bef6453 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java @@ -26,11 +26,19 @@ public class LogTimeThreeQueryParamVo { private String endTime; /** 中台设备UUID */ @ApiModelProperty(name = "中台设备UUID",notes = "") - private List deviceUuids ; + private List deviceUuids ; /** 参数列表 */ @ApiModelProperty(name = "参数列表",notes = "") private List queryParamCodes ; /** 参数模版列表 */ @ApiModelProperty(name = "参数模版列表",notes = "") private List queryParamClass ; + private Integer pageNum; + private Integer pageSize; + public String getBeginTime() { + return beginTime+" 00:00:00"; + } + public String getEndTime() { + return endTime+" 23:59:59"; + } } diff --git a/lzbi-module/src/main/java/com/lzbi/bi/mapper/LogTimeScaleThreeMapper.java b/lzbi-module/src/main/java/com/lzbi/bi/mapper/LogTimeScaleThreeMapper.java index eedd4ca..c983379 100644 --- a/lzbi-module/src/main/java/com/lzbi/bi/mapper/LogTimeScaleThreeMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/bi/mapper/LogTimeScaleThreeMapper.java @@ -5,9 +5,11 @@ import com.lzbi.bi.domain.DcDymicHeaderQueryVo; import com.lzbi.bi.domain.DcDymicReportHeaderVo; import com.lzbi.bi.domain.LogTimeThreeQueryParamVo; import com.lzbi.bi.domain.LogTimescaleHistoryThreeVo; +import org.apache.ibatis.annotations.MapKey; import java.util.List; +import java.util.Map; @InterceptorIgnore(tenantLine = "true") @@ -18,6 +20,10 @@ public interface LogTimeScaleThreeMapper extends BaseMapper selectVo(DeviceHistoryQueryVo queryVo); List selectDetailByQuery(LogTimeThreeQueryParamVo queryVo); List selectHeaderInfo(DcDymicHeaderQueryVo queryVo); + @MapKey("code") + List> selectParamModels(); + @MapKey("code") + List> selectDevices(Long orgCode); } diff --git a/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java b/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java index 4ac3028..e66ca0a 100644 --- a/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java +++ b/lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java @@ -10,9 +10,12 @@ import com.lzbi.bi.domain.LogTimeThreeQueryParamVo; import com.lzbi.bi.domain.LogTimescaleHistoryThreeVo; import com.lzbi.bi.mapper.LogTimeScaleThreeMapper; import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.annotations.MapKey; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; + @DS("workDB") @Slf4j @Service @@ -30,4 +33,11 @@ public class LogTimesacleHistoryThreeService extends ServiceImpl selectHeaderInfo(DcDymicHeaderQueryVo queryVo){ return baseMapper.selectHeaderInfo(queryVo); } + public List> selectParamModels(){ + return baseMapper.selectParamModels(); + } + + public List> selectDevices(Long orgCode){ + return baseMapper.selectDevices(orgCode); + } } diff --git a/lzbi-module/src/main/resources/mapper/LogTimeScaleThreeMapper.xml b/lzbi-module/src/main/resources/mapper/LogTimeScaleThreeMapper.xml index 47b9a4a..a63425a 100644 --- a/lzbi-module/src/main/resources/mapper/LogTimeScaleThreeMapper.xml +++ b/lzbi-module/src/main/resources/mapper/LogTimeScaleThreeMapper.xml @@ -85,4 +85,18 @@ ORDER BY a.center_device_code,b.param_code,b.partion + + \ No newline at end of file