|
@@ -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
|
|
@@ -288,9 +295,22 @@ public class DevicePointController extends JeecgController<DevicePoint, IDeviceP
|
|
|
}
|
|
|
|
|
|
|
|
|
- @ApiOperation(value="设备采集点测试", notes="设备采集点-test")
|
|
|
- @RequestMapping(value = "/device/test", method = RequestMethod.POST)
|
|
|
- public Result<?> deviceTest(@RequestParam Map<String,Object> params) throws Exception {
|
|
|
+ @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);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="设备采集点测试", notes="设备采集点-test")
|
|
|
+ @RequestMapping(value = "/device/test", method = RequestMethod.POST)
|
|
|
+ public Result<?> deviceTest(@RequestParam Map<String,Object> params) throws Exception {
|
|
|
// 获取所有的key
|
|
|
Set<String> keys = params.keySet();
|
|
|
// 遍历key并根据key执行不同的业务逻辑
|