| | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("T_HTTP_TOKEN") |
| | | @TableName("t_http_token") |
| | | public class HttpTokenEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @Schema(description = "主键") |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 接口ID |
| | | */ |
| | | private String apiId; |
| | | |
| | | /** |
| | | * 登录地址 |
| | | */ |
| | | private String loginUrl; |
| | | |
| | | /** |
| | | * ClientId |
| | | */ |
| | | private String clientId; |
| | | |
| | | /** |
| | | * ClientSecret |
| | | */ |
| | | private String clientSecret; |
| | | |
| | | /** |
| | | * 用户名 |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * token |
| | | */ |
| | | private String token; |
| | | private String prvsetName; |
| | | private String projectName; |
| | | private String platform; |
| | | |
| | | /** |
| | | * 过期时间 |
| | | */ |
| | | private Date expireTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | } |
| | |
| | | |
| | | HttpTokenEntity getByApiId(String apiId); |
| | | |
| | | void updateToken(String clientId); |
| | | |
| | | String queryToken(String clientId); |
| | | } |
| | |
| | | return httpTokenDao.selectOne(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateToken(String clientId) { |
| | | Map<String, String> params = new HashMap<>(1); |
| | | params.put("timeout", "30000"); |
| | | HttpTokenEntity entity = httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); |
| | | Map<String, String> dataJson = new HashMap<>(2); |
| | | String url = entity.getLoginUrl(); |
| | | String userName = entity.getUsername(); |
| | | String password = entity.getPassword(); |
| | | String prvsetName = entity.getPrvsetName(); |
| | | String projectName = entity.getProjectName(); |
| | | String platform = entity.getPlatform(); |
| | | dataJson.put("username", userName); |
| | | dataJson.put("password", password); |
| | | dataJson.put("prvset_name", prvsetName); |
| | | dataJson.put("project_name", projectName); |
| | | dataJson.put("platform", platform); |
| | | //查询token的请求 |
| | | String responseStr = httpsRequest.doPostToken(url, params, JSONObject.toJSONString(dataJson), "utf-8"); |
| | | //插入token和更新时间 |
| | | entity.setToken(responseStr); |
| | | entity.setUpdateTime(new Date()); |
| | | httpTokenDao.update(entity, new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); |
| | | } |
| | | |
| | | @Override |
| | | public String queryToken(String clientId) { |
| | | return httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)).getToken(); |
| | |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String name; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | @Schema(description = "编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("编码") |
| | | private String code; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | @Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("名称") |
| | | private String name; |
| | | |
| | | @Schema(description = "URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("URL") |
| | | private String url; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | @Schema(description = "请求方法", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("请求方法") |
| | | private String method; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String collectType; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | @Schema(description = "参数", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("参数") |
| | | private String param; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("描述") |
| | | private String descp; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("状态") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "api编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("api编码") |
| | | private String httpApiCode; |
| | | @Schema(description = "接口ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("接口ID") |
| | | private String apiId; |
| | | |
| | | @Schema(description = "测点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点类型") |
| | | private String tagType; |
| | | |
| | | @Schema(description = "测点编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点编码") |
| | | private String tagCode; |
| | | |
| | | @Schema(description = "测点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点名称") |
| | | @Schema(description = "标签名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("标签名称") |
| | | private String tagName; |
| | | |
| | | @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("数据类型") |
| | | private String dataType; |
| | | |
| | | @Schema(description = "标签描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("标签描述") |
| | | private String tagDesc; |
| | | |
| | | @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("是否启用") |
| | | private Boolean enabled; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | |
| | | import com.iailab.module.data.point.common.PointTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.channel.http.collector.HttpCollectorForZxzk; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; |
| | | import com.iailab.module.data.channel.modbus.collector.ModBusCollector; |
| | | import com.iailab.module.data.channel.opcua.collector.OpcUaCollector; |
| | |
| | | |
| | | @Resource |
| | | private OpcUaCollector opcUaCollector; |
| | | |
| | | @Resource |
| | | private HttpCollectorForZxzk httpCollectorForZxzk; |
| | | |
| | | /** |
| | | * 采集 |
| | |
| | | import com.iailab.module.data.point.common.PointDataTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.channel.http.collector.HttpCollectorForZxzk; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Autowired |
| | | private OpcDACollector opcDACollector; |
| | | |
| | | @Resource |
| | | private HttpCollectorForZxzk httpCollectorForZxzk; |
| | | |
| | | @Resource |
| | | private DaPointService daPointService; |
| | |
| | | } |
| | | if (!CollectionUtils.isEmpty(kioTagIds)) { |
| | | tagValues.putAll(kingIOCollector.getTagValues(kioTagIds)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(httpTagZxzk)) { |
| | | tagValues.putAll(httpCollectorForZxzk.getTagValues(httpTagZxzk)); |
| | | |
| | | } |
| | | this.toCommonResult(collectTime, dtos, tagValues, dataMap, result); |
| | | log.info("测量点处理结束"); |
| | |
| | | } else if (DataSourceType.KIO.getCode().equals(item.getSourceType())) { |
| | | value = kingIOCollector.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } else if (DataSourceType.HTTP.getCode().equals(item.getSourceType())) { |
| | | if (CommonConstant.HTTP_API_ZXZK_IH.equals(item.getSourceName())) { |
| | | value = httpCollectorForZxzk.getTagValue(item.getSourceId(), item.getTagNo()); |
| | | } |
| | | |
| | | } else { |
| | | log.info("没有匹配的TagNo=" + item.getTagNo()); |
| | | } |