diff --git a/lzbi-module/pom.xml b/lzbi-module/pom.xml
index 07151be..0fbb7b4 100644
--- a/lzbi-module/pom.xml
+++ b/lzbi-module/pom.xml
@@ -62,6 +62,14 @@
-
+
+ cn.hutool
+ hutool-poi
+
+
+ xerces
+ xercesImpl
+ 2.12.2
+
\ No newline at end of file
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
new file mode 100644
index 0000000..00c7344
--- /dev/null
+++ b/lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java
@@ -0,0 +1,306 @@
+package com.lzbi.bi.controller;
+
+
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.poi.excel.ExcelUtil;
+import cn.hutool.poi.excel.ExcelWriter;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+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 com.lzbi.code.service.LogTimesacleHistoryThreeService;
+import com.lzbi.common.core.controller.BaseController;
+import com.lzbi.common.core.domain.AjaxResult;
+import com.lzbi.common.core.page.TableDataInfo;
+import com.lzbi.common.utils.DateUtils;
+import com.lzbi.common.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotNull;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 生产设备参数统计明细表;
+ *
+ * @author : zhousq
+ * @date : 2024-02-5
+ */
+@Api(tags = "生产设备参数统计明细表功能接口")
+@RestController
+@RequestMapping("/dc/hisDetailReport")
+public class DcBusiHisReportController extends BaseController {
+ @Resource
+ private LogTimesacleHistoryThreeService logTimesacleHistoryThreeService;
+ /**
+ * 分页列表查询
+ *
+ * @return 分页数据
+ */
+ @GetMapping("/listReport")
+ public AjaxResult list(@NotNull @RequestBody LogTimeThreeQueryParamVo queryVo) {
+ String error = validatorator(queryVo);
+ if (error != null) {
+ return AjaxResult.error(error);
+ } else {
+ // 设置头部数据,
+ List tableColumns = new ArrayList();
+ JSONObject tableColum = new JSONObject();
+ tableColum.put("field", "totalTime");
+ tableColum.put("title", "统计时间");
+ tableColum.put("width", 100);
+ tableColumns.add(tableColum);
+ List tableDatas = new ArrayList();
+ DcDymicHeaderQueryVo dcDymicHeaderQueryVo = new DcDymicHeaderQueryVo();
+ dcDymicHeaderQueryVo.setParamModels(queryVo.getQueryParamClass());
+ dcDymicHeaderQueryVo.setDeviceUuids(queryVo.getDeviceUuids());
+ List dcDymicReportHeaderVos = logTimesacleHistoryThreeService.selectHeaderInfo(dcDymicHeaderQueryVo);
+ List collect = dcDymicReportHeaderVos.stream().map(DcDymicReportHeaderVo::getParamCode).collect(Collectors.toList());
+ queryVo.setQueryParamCodes(collect);
+ List list = logTimesacleHistoryThreeService.selectDetailByQuery(queryVo);
+ Map columnMap = new LinkedHashMap<>();
+ dcDymicReportHeaderVos.stream()
+ .sorted(Comparator.comparing(DcDymicReportHeaderVo::getDeviceUUID).thenComparing(DcDymicReportHeaderVo::getParamCode))
+ .forEach(dcDymicReportHeaderVo -> {
+ JSONObject ct = new JSONObject();
+ ct.put("field", "C"+dcDymicReportHeaderVo.getColCode());
+ ct.put("title", dcDymicReportHeaderVo.getColName1() + "[" + dcDymicReportHeaderVo.getColName2() + "]");
+ ct.put("width", 80);
+ columnMap.put(dcDymicReportHeaderVo.getColCode(), dcDymicReportHeaderVo.getParamCode());
+ tableColumns.add(ct);
+ });
+ Map> data = list.stream().sorted(Comparator.comparing((LogTimescaleHistoryThreeVo::getTimestampKey))).collect(Collectors.groupingBy(LogTimescaleHistoryThreeVo::getTimestampKey));
+ //生成talbecolum { field: 'id', title: 'ID', width: 80, fixed: 'left' },
+ //生成tabledata
+ //PageInfo pageInfo=new PageInfo(pageNum,pageSize);
+ data.entrySet().stream().forEach(entry -> {
+ JSONObject jdata = new JSONObject();
+ jdata.put("totalTime", entry.getKey());
+ entry.getValue().stream().sorted(Comparator.comparing(LogTimescaleHistoryThreeVo::getDeviceUuid).thenComparing(LogTimescaleHistoryThreeVo::getParamCode))
+ .forEach(tVo -> {
+ String ck = tVo.getDeviceUuid() + "_" + tVo.getParamCode();
+ if (StringUtils.isNotNull(columnMap.get(ck))) {
+ jdata.put("C"+ck, tVo.getParamValueNum());
+ }
+
+ });
+ tableDatas.add(jdata);
+ });
+ JSONObject dataInfo = new JSONObject();
+ dataInfo.put("header", tableColumns);
+ dataInfo.put("tableData", tableDatas);
+ return AjaxResult.success(dataInfo);
+ }
+
+ }
+
+ @PostMapping("/listDetail")
+ public AjaxResult listDetail(@NotNull @RequestBody LogTimeThreeQueryParamVo queryVo) {
+ String error = validatorator(queryVo);
+ if (error != null) {
+ return AjaxResult.error(error);
+ } else {
+ // 设置头部数据,
+ List tableColumns = new ArrayList();
+ JSONObject tableColum = new JSONObject();
+ tableColum.put("field", "deviceName");
+ tableColum.put("title", "设备名称");
+ tableColum.put("width", 100);
+ tableColumns.add(tableColum);
+ tableColum = new JSONObject();
+ tableColum.put("field", "paramName");
+ tableColum.put("title", "参数名称");
+ tableColum.put("width", 100);
+ tableColumns.add(tableColum);
+ List tableDatas = new ArrayList();
+ DcDymicHeaderQueryVo dcDymicHeaderQueryVo = new DcDymicHeaderQueryVo();
+ dcDymicHeaderQueryVo.setParamModels(queryVo.getQueryParamClass());
+ dcDymicHeaderQueryVo.setDeviceUuids(queryVo.getDeviceUuids());
+ List dcDymicReportHeaderVos = logTimesacleHistoryThreeService.selectHeaderInfo(dcDymicHeaderQueryVo);
+ List collect = dcDymicReportHeaderVos.stream().map(DcDymicReportHeaderVo::getParamCode).collect(Collectors.toList());
+ queryVo.setQueryParamCodes(collect);
+ List list = logTimesacleHistoryThreeService.selectDetailByQuery(queryVo);
+ Map columnMap = new LinkedHashMap<>();
+ dcDymicReportHeaderVos.stream()
+ .sorted(Comparator.comparing(DcDymicReportHeaderVo::getDeviceUUID).thenComparing(DcDymicReportHeaderVo::getParamCode))
+ .forEach(dcDymicReportHeaderVo -> {
+ JSONObject ct = new JSONObject();
+ ct.put("deviceName", "C"+dcDymicReportHeaderVo.getColCode());
+ ct.put("paramName", dcDymicReportHeaderVo.getColName1() + "[" + dcDymicReportHeaderVo.getColName2() + "]");
+ columnMap.put(dcDymicReportHeaderVo.getColCode(), ct);
+
+ });
+ Map> data = list.stream().sorted(Comparator.comparing((LogTimescaleHistoryThreeVo::getTimestampKey))).collect(Collectors.groupingBy(LogTimescaleHistoryThreeVo::getTimestampKey));
+ data.entrySet().stream().forEach(entry -> {
+ JSONObject tc = new JSONObject();
+ tc.put("field", entry.getKey().toString());
+ tc.put("title", entry.getKey());
+ tc.put("width", 100);
+ tableColumns.add(tc);
+ });
+ Map> data2 = list.stream().sorted(Comparator.comparing((LogTimescaleHistoryThreeVo::getDeviceUuid))).collect(Collectors.groupingBy(LogTimescaleHistoryThreeVo::getDeviceUuid));
+ data2.entrySet().stream().forEach(entry -> {
+ entry.getValue().stream().sorted(Comparator.comparing(LogTimescaleHistoryThreeVo::getParamCode)).forEach(vo -> {
+ JSONObject jsonObject = columnMap.get(vo.getDeviceUuid() + "_" + vo.getParamCode());
+ if(StringUtils.isNotNull(jsonObject)){
+ jsonObject.put(vo.getTimestampKey().toString(), vo.getParamValueNum());
+ }
+ tableDatas.add(jsonObject);
+ });
+ });
+ JSONObject dataInfo = new JSONObject();
+ dataInfo.put("header", tableColumns);
+ dataInfo.put("tableData", tableDatas);
+ return AjaxResult.success(dataInfo);
+ }
+ }
+ private String validatorator(LogTimeThreeQueryParamVo queryVo) {
+ if (StringUtils.isEmpty(queryVo.getBeginTime())) {
+ return "查询失败,开始时间不能为空!";
+ }
+ if (StringUtils.isEmpty(queryVo.getEndTime())) {
+ return "查询失败,结束时间不能为空!";
+ }
+ if (StringUtils.isEmpty(queryVo.getQueryParamClass())) {
+ return "查询失败,参数类型不能为空!";
+ }
+ return null;
+ }
+ ///按时间 设备+参数 形成数据--时间分组
+ private List