|
@@ -1,5 +1,7 @@
|
|
|
package com.platform.rest.controller.remote;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.platform.common.util.BeanConverterUtil;
|
|
|
import com.platform.common.util.R;
|
|
@@ -8,6 +10,7 @@ import com.platform.common.validation.group.UpdateGroup;
|
|
|
import com.platform.dao.dto.remote.RemoteOpcLogDTO;
|
|
|
import com.platform.dao.entity.remote.RemoteOpcLog;
|
|
|
import com.platform.dao.util.ExcelUtil;
|
|
|
+import com.platform.dao.vo.export.remote.ExportRemoteOpcLogOneDayVO;
|
|
|
import com.platform.dao.vo.export.remote.ExportRemoteOpcLogVO;
|
|
|
import com.platform.dao.vo.query.remote.RemoteOpcLogVO;
|
|
|
import com.platform.rest.log.annotation.SysLog;
|
|
@@ -18,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -44,6 +48,17 @@ public class RemoteOpcLogController {
|
|
|
return new R(remoteOpcLogService.getVOById(id));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 通过点位,日期查询单条记录
|
|
|
+ *
|
|
|
+ * @param remoteOpcLogDTO 主键
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/dto")
|
|
|
+ public R getByDTO(RemoteOpcLogDTO remoteOpcLogDTO) {
|
|
|
+ return new R(remoteOpcLogService.getVOByDTO(remoteOpcLogDTO));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增记录
|
|
|
*
|
|
@@ -137,6 +152,30 @@ public class RemoteOpcLogController {
|
|
|
ExcelUtil.exportResponseDict(response, ExportRemoteOpcLogVO.class, BeanConverterUtil.copyListProperties(list, ExportRemoteOpcLogVO.class), "opc记录表");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * opc记录表导出-导出某个点位的某天数据
|
|
|
+ *
|
|
|
+ * @param remoteOpcLogDTO opc记录表DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @GetMapping("/export/oneDay")
|
|
|
+ @SysLog("opc导出某个点位的某天数据")
|
|
|
+ @PreAuthorize("@pms.hasPermission('remote-opc-logs-export')")
|
|
|
+ public void exportOneDay(HttpServletResponse response, RemoteOpcLogDTO remoteOpcLogDTO) {
|
|
|
+ RemoteOpcLogVO vo = remoteOpcLogService.getVOById(remoteOpcLogDTO.getId().toString());
|
|
|
+ String str = vo.getDataJsonStr();
|
|
|
+ JSONArray array = JSONArray.parseArray(str);
|
|
|
+ List<ExportRemoteOpcLogOneDayVO> list = new ArrayList<>();
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ JSONObject jsonObject = array.getJSONObject(i);
|
|
|
+ ExportRemoteOpcLogOneDayVO data = new ExportRemoteOpcLogOneDayVO();
|
|
|
+ data.setTime(jsonObject.getString("time"));
|
|
|
+ data.setValue(jsonObject.getString("value"));
|
|
|
+ list.add(data);
|
|
|
+ }
|
|
|
+ ExcelUtil.exportResponseDict(response, ExportRemoteOpcLogOneDayVO.class, list, vo.getSbName() + "-" + vo.getYear() + "年" + vo.getMonth() + "月" +vo.getDay() + "日");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询某个点位当日的实时数据,最多300多个点
|
|
|
* @param RemoteOpcLogDTO opc记录表DTO
|