del: 删除niec相关不用的
parent
aea209027e
commit
7778118603
@ -1,78 +0,0 @@
|
|||||||
package com.xydl.cac.controller;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.Modev;
|
|
||||||
import com.xydl.cac.entity.ModevType;
|
|
||||||
import com.xydl.cac.exception.BusinessException;
|
|
||||||
import com.xydl.cac.model.Response;
|
|
||||||
import com.xydl.cac.service.ModevService;
|
|
||||||
import com.xydl.cac.service.ModevTypeService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@Api(tags = {"旧监测设备相关接口"})
|
|
||||||
@RequestMapping("modev")
|
|
||||||
@Slf4j
|
|
||||||
public class ModevController extends BasicController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
ModevService service;
|
|
||||||
|
|
||||||
@GetMapping("listAll")
|
|
||||||
@ApiOperation("查询列表")
|
|
||||||
public Response<List<Modev>> listAll(@NotNull(message = "主设备编号不能缺少") @Param("zsbid") Integer zsbid) {
|
|
||||||
List<Modev> result = service.listAll(zsbid);
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("add")
|
|
||||||
@ApiOperation("新增")
|
|
||||||
public Response<Modev> add(@Validated @RequestBody Modev item) throws Exception {
|
|
||||||
Modev result = service.add(item);
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("update")
|
|
||||||
@ApiOperation("更新")
|
|
||||||
public Response<String> update(@Validated @RequestBody Modev item) throws Exception {
|
|
||||||
if (item.getId() == null) {
|
|
||||||
throw new BusinessException("ID不能为空!");
|
|
||||||
}
|
|
||||||
service.update(item);
|
|
||||||
return Response.success("OK");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("delete")
|
|
||||||
@ApiOperation("删除")
|
|
||||||
public Response<String> delete(@Validated @NotNull(message = "ID不能为空!") @Param("id") Integer id) {
|
|
||||||
service.delete(id);
|
|
||||||
return Response.success("OK");
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("detail")
|
|
||||||
@ApiOperation("详情")
|
|
||||||
public Response<Modev> detail(@Validated @NotNull(message = "ID不能为空!") Integer id) throws Exception {
|
|
||||||
Modev detail = service.detail(id);
|
|
||||||
return Response.success(detail);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("bindicd")
|
|
||||||
@ApiOperation("详情")
|
|
||||||
public Response<String> bindicd(@Validated @NotNull(message = "ID不能为空!") @Param("id") Integer id,@Validated @NotNull(message = "icdid不能为空!") @Param("icdid") Integer icdid) {
|
|
||||||
try {
|
|
||||||
service.bindicd(id,icdid);
|
|
||||||
return Response.success("OK");
|
|
||||||
} catch (Exception ex) {
|
|
||||||
return Response.fail(ex.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
package com.xydl.cac.controller;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecSensor;
|
|
||||||
import com.xydl.cac.model.ConditionModel;
|
|
||||||
import com.xydl.cac.model.Response;
|
|
||||||
import com.xydl.cac.model.SensorDetail;
|
|
||||||
import com.xydl.cac.service.NiecSensorService;
|
|
||||||
import com.xydl.cac.service.ReportService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@Api(tags = {"装置表相关接口"})
|
|
||||||
@RequestMapping("sensor")
|
|
||||||
@Slf4j
|
|
||||||
public class NiecSensorController extends BasicController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
NiecSensorService service;
|
|
||||||
@Resource
|
|
||||||
ReportService reportService;
|
|
||||||
|
|
||||||
@GetMapping("list")
|
|
||||||
@ApiOperation("查询列表")
|
|
||||||
public Response<Page<NiecSensor>> list(@ApiParam("页码") @RequestParam(value = "pageNum", required = false) Integer pageNum,
|
|
||||||
@ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
||||||
pageNum = this.initPageNum(pageNum);
|
|
||||||
pageSize = this.initPageSize(pageSize);
|
|
||||||
Page<NiecSensor> result = service.list(pageNum, pageSize);
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("listAll")
|
|
||||||
@ApiOperation("查询全部列表")
|
|
||||||
public Response<List<NiecSensor>> listAll() {
|
|
||||||
List<NiecSensor> result = service.listAll();
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("getTree")
|
|
||||||
@ApiOperation("查询树")
|
|
||||||
public Response<List<NiecSensor>> getTree() {
|
|
||||||
List<NiecSensor> result = service.getTree();
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("detail")
|
|
||||||
@ApiOperation("查询单个装置采集到的数据")
|
|
||||||
public Response<SensorDetail> getDetail(@Validated ConditionModel model) throws Exception {
|
|
||||||
if (model.getPageNum() != null || model.getPageSize() != null) {
|
|
||||||
model.setPageNum(this.initPageNum(model.getPageNum()));
|
|
||||||
model.setPageSize(this.initPageSize(model.getPageSize()));
|
|
||||||
}
|
|
||||||
SensorDetail result = service.getDetail(model);
|
|
||||||
return Response.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("export")
|
|
||||||
@ApiOperation("导出单个装置采集到的数据")
|
|
||||||
public void export(@Validated ConditionModel model, HttpServletResponse response) throws Exception {
|
|
||||||
if (model.getPageNum() != null || model.getPageSize() != null) {
|
|
||||||
model.setPageNum(this.initPageNum(model.getPageNum()));
|
|
||||||
model.setPageSize(this.initPageSize(model.getPageSize()));
|
|
||||||
}
|
|
||||||
SensorDetail<Map<String, Object>> detail = service.getDetail(model);
|
|
||||||
response.setHeader("Content-Disposition", "attachment; filename="
|
|
||||||
+ URLEncoder.encode(detail.getSensor().getName() + ".xlsx", "UTF-8"));
|
|
||||||
response.setContentType("application/vnd.ms-excel");
|
|
||||||
response.setCharacterEncoding("utf-8");
|
|
||||||
reportService.exportSensor(detail, response.getOutputStream());
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("importCac")
|
|
||||||
@ApiOperation("导入CAC")
|
|
||||||
public Response<String> importCac(@RequestParam("file") MultipartFile file) throws Exception {
|
|
||||||
if (file != null && file.getInputStream() != null) {
|
|
||||||
reportService.importCac(file.getInputStream());
|
|
||||||
return Response.success("OK");
|
|
||||||
} else {
|
|
||||||
return Response.fail("缺少上传文件");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
package com.xydl.cac.entity;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author huangfeng
|
|
||||||
* @date 2023-11-24
|
|
||||||
**/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Entity
|
|
||||||
@Table(name = "niec_points")
|
|
||||||
@ApiModel("IEC104-业务点表配置表")
|
|
||||||
public class NiecPoint {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "id")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@Column(name = "sadr")
|
|
||||||
private Integer sadr;
|
|
||||||
|
|
||||||
@Column(name = "site_id")
|
|
||||||
private Integer siteId;
|
|
||||||
|
|
||||||
@Column(name = "sensor_id")
|
|
||||||
private Integer sensorId;
|
|
||||||
|
|
||||||
@Column(name = "stype")
|
|
||||||
private Integer stype;
|
|
||||||
|
|
||||||
@Column(name = "main_equipment_type")
|
|
||||||
private String mainEquipmentType;
|
|
||||||
|
|
||||||
@Column(name = "name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column(name = "sub_tree_id")
|
|
||||||
private String subTreeId;
|
|
||||||
|
|
||||||
@Column(name = "sub_equipment_type")
|
|
||||||
private String subEquipmentType;
|
|
||||||
|
|
||||||
@Column(name = "gtype")
|
|
||||||
private String gtype;
|
|
||||||
|
|
||||||
@Column(name = "item_no")
|
|
||||||
private Integer itemNo;
|
|
||||||
|
|
||||||
@Column(name = "yx_bit")
|
|
||||||
private Integer yxBit;
|
|
||||||
|
|
||||||
@Column(name = "field")
|
|
||||||
private String field;
|
|
||||||
|
|
||||||
@Column(name = "filed_desc")
|
|
||||||
private String filedDesc;
|
|
||||||
|
|
||||||
@Column(name = "sno")
|
|
||||||
private Integer sno;
|
|
||||||
|
|
||||||
@Column(name = "isget")
|
|
||||||
private String isget;
|
|
||||||
|
|
||||||
@Column(name = "status")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Column(name = "unit")
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
@Column(name = "warnflag")
|
|
||||||
private String warnflag;
|
|
||||||
|
|
||||||
@Column(name = "thresholdfield")
|
|
||||||
private String thresholdfield;
|
|
||||||
|
|
||||||
@Column(name = "descr")
|
|
||||||
private String descr;
|
|
||||||
|
|
||||||
@Column(name = "d_time")
|
|
||||||
private Date dTime;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private List<Object> data;
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
package com.xydl.cac.entity;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author huangfeng
|
|
||||||
* @date 2023-11-23
|
|
||||||
**/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Entity
|
|
||||||
@Table(name = "niec_sensors")
|
|
||||||
@ApiModel("装置表")
|
|
||||||
public class NiecSensor {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
@Column(name = "id")
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@Column(name = "parent_id")
|
|
||||||
private Integer parentId;
|
|
||||||
|
|
||||||
@Column(name = "site_id")
|
|
||||||
private Integer siteId;
|
|
||||||
|
|
||||||
@Column(name = "sensor_code")
|
|
||||||
private String sensorCode;
|
|
||||||
|
|
||||||
@Column(name = "equipment_id")
|
|
||||||
private String equipmentId;
|
|
||||||
|
|
||||||
@Column(name = "system_code")
|
|
||||||
private String systemCode;
|
|
||||||
|
|
||||||
@Column(name = "name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column(name = "dev_id")
|
|
||||||
private Integer devId;
|
|
||||||
|
|
||||||
@Column(name = "grp_no")
|
|
||||||
private Integer grpNo;
|
|
||||||
|
|
||||||
@Column(name = "phase")
|
|
||||||
private String phase;
|
|
||||||
|
|
||||||
@Column(name = "status")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Column(name = "equipment_type")
|
|
||||||
private String equipmentType;
|
|
||||||
|
|
||||||
@Column(name = "table_name")
|
|
||||||
private String tableName;
|
|
||||||
|
|
||||||
@Column(name = "devid_field_name")
|
|
||||||
private String devidFieldName;
|
|
||||||
|
|
||||||
@Column(name = "dtime_field_name")
|
|
||||||
private String dtimeFieldName;
|
|
||||||
|
|
||||||
@Column(name = "one_dtime")
|
|
||||||
private Integer oneDtime;
|
|
||||||
|
|
||||||
@Column(name = "create_time")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
@Transient
|
|
||||||
private List<NiecSensor> children;
|
|
||||||
|
|
||||||
public void addChild(NiecSensor item) {
|
|
||||||
if (children == null) {
|
|
||||||
children = new ArrayList<>();
|
|
||||||
}
|
|
||||||
children.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
package com.xydl.cac.repository;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecPoint;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface NiecPointRepository extends JpaRepository<NiecPoint, Integer>, JpaSpecificationExecutor<NiecPoint> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.xydl.cac.repository;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecSensor;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public interface NiecSensorRepository extends JpaRepository<NiecSensor, Integer>, JpaSpecificationExecutor<NiecSensor> {
|
|
||||||
|
|
||||||
Page<NiecSensor> findByPhase(String keyword, Pageable pageable);
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package com.xydl.cac.service;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecPoint;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface NiecPointService {
|
|
||||||
List<NiecPoint> getList(Integer sensorId, Integer stype);
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.xydl.cac.service;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecSensor;
|
|
||||||
import com.xydl.cac.model.ConditionModel;
|
|
||||||
import com.xydl.cac.model.SensorDetail;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface NiecSensorService {
|
|
||||||
List<NiecSensor> listAll();
|
|
||||||
|
|
||||||
Page<NiecSensor> list(int pageNum, int pageSize);
|
|
||||||
|
|
||||||
List<NiecSensor> getTree();
|
|
||||||
|
|
||||||
SensorDetail<Map<String, Object>> getDetail(ConditionModel model) throws Exception;
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package com.xydl.cac.service.impl;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecPoint;
|
|
||||||
import com.xydl.cac.repository.NiecPointRepository;
|
|
||||||
import com.xydl.cac.service.NiecPointService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public class NiecPointServiceImpl implements NiecPointService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
NiecPointRepository repository;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<NiecPoint> getList(Integer sensorId, Integer stype) {
|
|
||||||
Specification<NiecPoint> specification = (root, query, builder) -> {
|
|
||||||
Predicate predicate = builder.conjunction();
|
|
||||||
predicate.getExpressions().add(builder.equal(root.get("sensorId"), sensorId));
|
|
||||||
predicate.getExpressions().add(builder.equal(root.get("stype"), stype));
|
|
||||||
return predicate;
|
|
||||||
};
|
|
||||||
List<NiecPoint> list = repository.findAll(specification, Sort.by("field"));
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
package com.xydl.cac.service.impl;
|
|
||||||
|
|
||||||
import com.xydl.cac.entity.NiecPoint;
|
|
||||||
import com.xydl.cac.entity.NiecSensor;
|
|
||||||
import com.xydl.cac.exception.BusinessException;
|
|
||||||
import com.xydl.cac.model.ConditionModel;
|
|
||||||
import com.xydl.cac.model.OnePage;
|
|
||||||
import com.xydl.cac.model.SensorDetail;
|
|
||||||
import com.xydl.cac.repository.NiecSensorRepository;
|
|
||||||
import com.xydl.cac.service.DataService;
|
|
||||||
import com.xydl.cac.service.NiecPointService;
|
|
||||||
import com.xydl.cac.service.NiecSensorService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public class NiecSensorServiceImpl implements NiecSensorService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
NiecSensorRepository repository;
|
|
||||||
@Resource
|
|
||||||
NiecPointService pointService;
|
|
||||||
@Resource
|
|
||||||
DataService dataService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<NiecSensor> listAll() {
|
|
||||||
List<NiecSensor> list = repository.findAll();
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<NiecSensor> list(int pageNum, int pageSize) {
|
|
||||||
PageRequest request = PageRequest.of(pageNum, pageSize);
|
|
||||||
Page<NiecSensor> result = repository.findAll(request);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<NiecSensor> getTree() {
|
|
||||||
List<NiecSensor> list = this.listAll();
|
|
||||||
List<NiecSensor> result = new ArrayList<>();
|
|
||||||
for (NiecSensor item : list) {
|
|
||||||
boolean done = false;
|
|
||||||
if (item.getParentId() != null) {
|
|
||||||
for (NiecSensor parent : list) {
|
|
||||||
if (parent.getId().intValue() == item.getParentId().intValue()) {
|
|
||||||
if (StringUtils.isNotBlank(item.getTableName())) {
|
|
||||||
parent.addChild(item);
|
|
||||||
}
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!done) {
|
|
||||||
result.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SensorDetail<Map<String, Object>> getDetail(ConditionModel model) throws Exception {
|
|
||||||
Optional<NiecSensor> optional = repository.findById(model.getId());
|
|
||||||
if (!optional.isPresent()) {
|
|
||||||
throw new BusinessException("未找到该装置");
|
|
||||||
}
|
|
||||||
NiecSensor sensor = optional.get();
|
|
||||||
if (StringUtils.isBlank(sensor.getDtimeFieldName())) {
|
|
||||||
throw new BusinessException("该装置缺少采样时间字段名信息");
|
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(sensor.getTableName())) {
|
|
||||||
throw new BusinessException("该装置缺少table_name信息");
|
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(sensor.getDevidFieldName())) {
|
|
||||||
throw new BusinessException("该装置缺少sensor_id的字段名信息");
|
|
||||||
}
|
|
||||||
if (sensor.getDevId() == null) {
|
|
||||||
throw new BusinessException("该装置缺少dev_id信息");
|
|
||||||
}
|
|
||||||
List<NiecPoint> points = pointService.getList(sensor.getId(), 2);
|
|
||||||
if (CollectionUtils.isEmpty(points)) {
|
|
||||||
throw new BusinessException("该装置缺少业务点表配置信息");
|
|
||||||
}
|
|
||||||
|
|
||||||
SensorDetail<Map<String, Object>> result = this.getData(sensor, points, model);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SensorDetail<Map<String, Object>> getData(NiecSensor sensor, List<NiecPoint> points, ConditionModel model) {
|
|
||||||
List<NiecPoint> pointList = new ArrayList<>();
|
|
||||||
for (NiecPoint point : points) {
|
|
||||||
if (StringUtils.isNotBlank(point.getField())) {
|
|
||||||
pointList.add(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SensorDetail<Map<String, Object>> result = new SensorDetail();
|
|
||||||
// result.setSensor(sensor);
|
|
||||||
OnePage<Map<String, Object>> page = dataService.getDate(sensor, pointList, model);
|
|
||||||
result.initFrom(page);
|
|
||||||
|
|
||||||
for (NiecPoint point : pointList) {
|
|
||||||
List<Object> dataList = new ArrayList<>();
|
|
||||||
for (Map<String, Object> item : result.getContent()) {
|
|
||||||
Object value = item.get(point.getField());
|
|
||||||
dataList.add(value);
|
|
||||||
}
|
|
||||||
point.setData(dataList);
|
|
||||||
}
|
|
||||||
// result.setPoints(pointList);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue