|
@@ -15,6 +15,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.modules.dataRepository.entity.PointData;
|
|
|
import org.jeecg.modules.deviceConn.modbus.service.ModbusTcp;
|
|
|
import org.jeecg.modules.deviceConn.opc.utils.OpcConn;
|
|
|
import org.jeecg.modules.deviceConn.opc.utils.OpcUaServerUtils;
|
|
@@ -28,6 +29,10 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
@@ -58,9 +63,11 @@ public class DevicePointController extends JeecgController<DevicePoint, IDeviceP
|
|
|
String[] s7Fileds = {"pointName","pointCode","pointAddr","dateType","dateLength"};
|
|
|
|
|
|
String[] modbisFileds = {"pointName","pointCode","pointAddr","registerType","pointBit","pointScale","dateType","dateLength"};
|
|
|
+ @Autowired
|
|
|
+ private MongoTemplate mongoTemplate;
|
|
|
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 分页列表查询
|
|
|
*
|
|
|
* @param devicePoint
|
|
@@ -333,6 +340,19 @@ public class DevicePointController extends JeecgController<DevicePoint, IDeviceP
|
|
|
return Result.OK(null);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="s7采集点-testAllS7", notes="s7采集点-testAllS7")
|
|
|
+ @GetMapping(value = "/testAllS7")
|
|
|
+ public Result<?> testAll(@RequestParam(name="id") String id) {
|
|
|
+ List<DevicePoint> devicePointList = devicePointService.list(new LambdaQueryWrapper<DevicePoint>().eq(DevicePoint::getDeviceId, id));
|
|
|
+ for (DevicePoint devicePoint : devicePointList) {
|
|
|
+ Query query = Query.query(Criteria.where("pointId").is(devicePoint.getId()))
|
|
|
+ .with(Sort.by(Sort.Order.desc("time"))).limit(1);
|
|
|
+ PointData pointData = mongoTemplate.findOne(query, PointData.class, devicePoint.getId() + "_500");
|
|
|
+ if(pointData!=null) devicePoint.setRemarks(pointData.getDataText());
|
|
|
+ }
|
|
|
+ return Result.OK(devicePointList);
|
|
|
+ }
|
|
|
+
|
|
|
private String testReadData(OpcConnPageParam opcConnPage) throws Exception {
|
|
|
OpcUaClient opcUaClient = null;
|
|
|
OpcConnParam opcConnParam = new OpcConnParam(opcConnPage);
|