已修改9个文件
已重命名15个文件
已删除14个文件
已添加21个文件
| | |
| | | import com.iailab.module.data.api.dto.IndexQueryDTO; |
| | | import com.iailab.module.data.api.dto.echarts.BarLineDTO; |
| | | import com.iailab.module.data.api.dto.echarts.SeriesItem; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.common.utils.Constant; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import com.iailab.module.data.api.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.data.point.collection.PointCollector; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | |
| | | @PostMapping("/point/history") |
| | | @Operation(summary = "point历史数据") |
| | | public R pointHistory(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, List<Map<String, Object>>>> pointHistory(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody ApiPointValueQueryDTO queryDto) { |
| | | try { |
| | | apiSecurityUtils.validate(request); |
| | | Map<String, List<Map<String, Object>>> data = new HashMap<>(); |
| | | if (CollectionUtils.isEmpty(queryDto.getPointNos())) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | if (queryDto.getStart() == null) { |
| | | queryDto.setStart(new Date()); |
| | |
| | | params.put("pointNos", queryDto.getPointNos()); |
| | | List<DaPointDTO> pointList = daPointService.list(params); |
| | | if (CollectionUtils.isEmpty(pointList)) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | List<InfluxPointValuePOJO> influxParams = pointList.stream().map(item -> { |
| | | InfluxPointValuePOJO pojo = new InfluxPointValuePOJO(); |
| | |
| | | return pojo; |
| | | }).collect(Collectors.toList()); |
| | | data = influxDBService.queryPointsValues(influxParams, queryDto.getStart(), queryDto.getEnd()); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, List<Map<String, Object>>>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/point/current") |
| | | @Operation(summary = "point当前实时数据") |
| | | public R pointCurrent(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, Object>> pointCurrent(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody List<String> pointNos) { |
| | | try { |
| | | // apiSecurityUtils.validate(request); |
| | | Map<String, Object> data = pointCollector.getCurrentValue(pointNos); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, Object>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/pointRelation/history") |
| | | @Operation(summary = "pointRelation历史数据") |
| | | public R pointRelationHistory(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, List<Map<String, Object>>>> pointRelationHistory(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody ApiPointValueQueryDTO queryDto) { |
| | | try { |
| | | Map<String, List<Map<String, Object>>> data = new HashMap<>(); |
| | | if (CollectionUtils.isEmpty(queryDto.getPointNos())) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | if (queryDto.getStart() == null) { |
| | | queryDto.setStart(new Date()); |
| | |
| | | } |
| | | data = daPointValueService.getHistoryList(queryDto); |
| | | if (CollectionUtils.isEmpty(data)) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, List<Map<String, Object>>>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/ind-item/values") |
| | | @Operation(summary = "point当前实时数据") |
| | | public R indItemValues(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, List<IndItemValueDTO>>> indItemValues(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody List<String> itemNos) { |
| | | try { |
| | | // apiSecurityUtils.validate(request); |
| | | Map<String, List<IndItemValueDTO>> data = indItemCollector.getValueList(itemNos); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, List<IndItemValueDTO>>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/ind-item/current-value") |
| | | @Operation(summary = "point当前实时数据") |
| | | public R indItemCurrentValue(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, BigDecimal>> indItemCurrentValue(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody List<String> itemNos) { |
| | | try { |
| | | Map<String, BigDecimal> data = new HashMap<>(); |
| | |
| | | dataList.forEach((k, v) -> { |
| | | data.put(k, CollectionUtils.isEmpty(v) ? null : v.get(0).getDataValue()); |
| | | }); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, BigDecimal>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | } |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/collector/HttpCollectorForZxzk.java 修改 |
| | |
| | | package com.iailab.module.data.http.collector; |
| | | package com.iailab.module.data.channel.http.collector; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.HttpsRequest; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import com.iailab.module.data.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | if (apiMap.containsKey(id)) { |
| | | return apiMap.get(id); |
| | | } |
| | | HttpApiEntity httpApi = httpApiService.get(id); |
| | | HttpApiEntity httpApi = httpApiService.info(id); |
| | | apiMap.put(id, httpApi); |
| | | return httpApi; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/http/api") |
| | | public class HttpApiController { |
| | | |
| | | @Resource |
| | | private HttpApiService httpApiService; |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<HttpApiRespVO>> page(@Valid HttpApiPageReqVO reqVO) { |
| | | PageResult<HttpApiEntity> page = httpApiService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, HttpApiRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<HttpApiEntity>> list() { |
| | | List<HttpApiEntity> list = httpApiService.list(); |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<HttpApiEntity> info(@PathVariable("id") String id){ |
| | | HttpApiEntity info= httpApiService.info(id); |
| | | return success(info); |
| | | } |
| | | /** |
| | | * 添加API |
| | | * |
| | | * @param httpApiEntity |
| | | */ |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody HttpApiEntity httpApiEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | httpApiEntity.setId(id); |
| | | httpApiService.add(httpApiEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改API |
| | | * |
| | | * @param httpApiEntity |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody HttpApiEntity httpApiEntity) { |
| | | httpApiService.update(httpApiEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除API |
| | | * |
| | | * @param id |
| | | * |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | httpApiService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpTagService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/http/tag") |
| | | public class HttpTagController { |
| | | |
| | | @Resource |
| | | private HttpTagService tagService; |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<HttpTagRespVO>> page(@Valid HttpTagPageReqVO reqVO) { |
| | | PageResult<HttpTagEntity> page = tagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, HttpTagRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<HttpTagEntity>> list(){ |
| | | List<HttpTagEntity> list = tagService.list(); |
| | | return new CommonResult<List<HttpTagEntity>>().setData(list); |
| | | } |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<HttpTagEntity> info(@PathVariable("id") String id){ |
| | | HttpTagEntity info= tagService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody HttpTagEntity httpTagEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | httpTagEntity.setId(id); |
| | | tagService.add(httpTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody HttpTagEntity httpTagEntity) { |
| | | tagService.update(httpTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | tagService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpTokenService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/http/token") |
| | | public class HttpTokenController { |
| | | |
| | | @Resource |
| | | private HttpTokenService httpTokenService; |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<HttpTokenRespVO>> page(@Valid HttpTokenPageReqVO reqVO) { |
| | | PageResult<HttpTokenEntity> page = httpTokenService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, HttpTokenRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<HttpTokenEntity>> list(){ |
| | | List<HttpTokenEntity> list = httpTokenService.list(); |
| | | return new CommonResult<List<HttpTokenEntity>>().setData(list); |
| | | } |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<HttpTokenEntity> info(@PathVariable("id") String id){ |
| | | HttpTokenEntity info= httpTokenService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody HttpTokenEntity HttpTokenEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | HttpTokenEntity.setId(id); |
| | | httpTokenService.add(HttpTokenEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody HttpTokenEntity HttpTokenEntity) { |
| | | httpTokenService.update(HttpTokenEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | httpTokenService.delete(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/api-id/{apiId}") |
| | | public CommonResult<HttpTokenEntity> apiId(@PathVariable("apiId") String apiId) { |
| | | HttpTokenEntity info = httpTokenService.getByApiId(apiId); |
| | | return success(info); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller; |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @TenantDS |
| | | @Mapper |
| | | public interface HttpApiDao extends BaseMapperX<HttpApiEntity> { |
| | | default PageResult<HttpApiEntity> selectPage(HttpApiPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HttpApiEntity>() |
| | | .likeIfPresent(HttpApiEntity::getCode, reqVO.getCode()) |
| | | .likeIfPresent(HttpApiEntity::getName, reqVO.getName()) |
| | | .orderByDesc(HttpApiEntity::getCreateTime)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @TenantDS |
| | | @Mapper |
| | | public interface HttpTagDao extends BaseMapperX<HttpTagEntity> { |
| | | default PageResult<HttpTagEntity> selectPage(HttpTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HttpTagEntity>() |
| | | .likeIfPresent(HttpTagEntity::getTagType, reqVO.getTagType()) |
| | | .likeIfPresent(HttpTagEntity::getTagCode, reqVO.getTagCode()) |
| | | .likeIfPresent(HttpTagEntity::getTagName, reqVO.getTagName()) |
| | | .orderByDesc(HttpTagEntity::getCreateTime)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @TenantDS |
| | | @Mapper |
| | | public interface HttpTokenDao extends BaseMapperX<HttpTokenEntity> { |
| | | default PageResult<HttpTokenEntity> selectPage(HttpTokenPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HttpTokenEntity>() |
| | | .likeIfPresent(HttpTokenEntity::getClientId, reqVO.getClientId()) |
| | | .orderByDesc(HttpTokenEntity::getExpireTime)); |
| | | } |
| | | } |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/HttpTagDTO.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagAffectDetailsJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCommonCurrentDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentPerformanceJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentSaleJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagPrdTimeDistJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagYearPeiJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/EleLowTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/FxjyTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpApiEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTokenEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/XSTTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface HttpApiService{ |
| | | PageResult<HttpApiEntity> queryPage(HttpApiPageReqVO reqVO); |
| | | |
| | | HttpApiEntity info(String id); |
| | | |
| | | void add(HttpApiEntity httpApiEntity); |
| | | |
| | | void update(HttpApiEntity httpApiEntity); |
| | | |
| | | void delete(String id); |
| | | |
| | | HttpApiEntity selectXstHttpTagApi(); |
| | | |
| | | HttpApiEntity getByCode(String code); |
| | | |
| | | List<HttpApiEntity> list(); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface HttpTagService{ |
| | | PageResult<HttpTagEntity> queryPage(HttpTagPageReqVO reqVO); |
| | | |
| | | HttpTagEntity info(String id); |
| | | |
| | | void add(HttpTagEntity httpTagEntity); |
| | | |
| | | void update(HttpTagEntity httpTagEntity); |
| | | |
| | | void delete(String id); |
| | | |
| | | List<HttpTagEntity> list(); |
| | | |
| | | List<HttpTagEntity> selectList(Map<String, Object> params); |
| | | |
| | | List<HttpTagEntity> getByCode(String code); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface HttpTokenService{ |
| | | PageResult<HttpTokenEntity> queryPage(HttpTokenPageReqVO reqVO); |
| | | |
| | | HttpTokenEntity info(String id); |
| | | |
| | | void add(HttpTokenEntity httpTokenEntity); |
| | | |
| | | void update(HttpTokenEntity httpTokenEntity); |
| | | |
| | | void delete(String id); |
| | | |
| | | List<HttpTokenEntity> list(); |
| | | |
| | | HttpTokenEntity getByApiId(String apiId); |
| | | |
| | | void updateToken(String clientId); |
| | | |
| | | String queryToken(String clientId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.dao.HttpApiDao; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class HttpApiServiceImpl extends ServiceImpl<HttpApiDao, HttpApiEntity> implements HttpApiService { |
| | | |
| | | @Resource |
| | | private HttpApiDao httpApiDao; |
| | | |
| | | @Override |
| | | public PageResult<HttpApiEntity> queryPage(HttpApiPageReqVO reqVO) { |
| | | return httpApiDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity info(String id) { |
| | | return httpApiDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(HttpApiEntity httpApiEntity) { |
| | | httpApiDao.insert(httpApiEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(HttpApiEntity httpApiEntity) { |
| | | httpApiDao.updateById(httpApiEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | httpApiDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity selectXstHttpTagApi() { |
| | | return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag")); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity getByCode(String code) { |
| | | return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code)); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpApiEntity> list() { |
| | | return httpApiDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.dao.HttpTagDao; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.service.HttpTagService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class HttpTagServiceImpl extends ServiceImpl<HttpTagDao, HttpTagEntity> implements HttpTagService { |
| | | |
| | | @Resource |
| | | private HttpApiService httpApiService; |
| | | |
| | | @Resource |
| | | private HttpTagDao httpTagDao; |
| | | |
| | | @Override |
| | | public PageResult<HttpTagEntity> queryPage(HttpTagPageReqVO reqVO) { |
| | | return httpTagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public HttpTagEntity info(String id) { |
| | | return httpTagDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(HttpTagEntity httpTagEntity) { |
| | | httpTagDao.insert(httpTagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(HttpTagEntity httpTagEntity) { |
| | | httpTagDao.updateById(httpTagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | httpTagDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpTagEntity> list() { |
| | | return httpTagDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<HttpTagEntity> selectList(Map<String, Object> params) { |
| | | String httpId = (String) params.get("httpId"); |
| | | HttpApiEntity httpApiEntity = httpApiService.info(httpId); |
| | | return httpTagDao.selectList(new QueryWrapper<HttpTagEntity>() |
| | | .eq("http_api_code", httpApiEntity.getCode()) |
| | | .orderByDesc("create_time")); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpTagEntity> getByCode(String code) { |
| | | return httpTagDao.selectList(new QueryWrapper<HttpTagEntity>() |
| | | .eq("http_api_code", code) |
| | | .orderByDesc("create_time")); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.dao.HttpTokenDao; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpTokenService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | import com.iailab.module.data.common.utils.HttpsRequest; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class HttpTokenServiceImpl extends ServiceImpl<HttpTokenDao, HttpTokenEntity> implements HttpTokenService { |
| | | |
| | | @Resource |
| | | private HttpsRequest httpsRequest; |
| | | |
| | | @Resource |
| | | private HttpTokenDao httpTokenDao; |
| | | |
| | | |
| | | @Override |
| | | public PageResult<HttpTokenEntity> queryPage(HttpTokenPageReqVO reqVO) { |
| | | return httpTokenDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public HttpTokenEntity info(String id) { |
| | | return httpTokenDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(HttpTokenEntity httpTokenEntity) { |
| | | httpTokenDao.insert(httpTokenEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(HttpTokenEntity httpTokenEntity) { |
| | | httpTokenDao.updateById(httpTokenEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | httpTokenDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpTokenEntity> list() { |
| | | return httpTokenDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | @Override |
| | | public HttpTokenEntity getByApiId(String apiId) { |
| | | QueryWrapper<HttpTokenEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(apiId), "api_id", apiId); |
| | | 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(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - HttpApi分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HttpApiPageReqVO extends PageParam { |
| | | |
| | | private String name; |
| | | |
| | | private String code; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - KioDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class HttpApiRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @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("") |
| | | private String code; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String url; |
| | | |
| | | @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("") |
| | | private String param; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String descp; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - HttpTag分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HttpTagPageReqVO extends PageParam { |
| | | |
| | | private String tagType; |
| | | |
| | | private String tagCode; |
| | | |
| | | private String tagName; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - KioDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class HttpTagRespVO { |
| | | |
| | | @Schema(description = "ID", 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 = "测点类型", 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("测点名称") |
| | | private String tagName; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - HttpToken分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HttpTokenPageReqVO extends PageParam { |
| | | |
| | | private String clientId; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - KioDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class HttpTokenRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String apiId; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String loginUrl; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String clientId; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String clientSecret; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String username; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String password; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String token; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String prvsetName; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String projectName; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String platform; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private Date expireTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/kio/tag") |
| | |
| | | package com.iailab.module.data.channel.modbus.controller.admin; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; |
| | | import javax.annotation.Resource; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * 操作modbus tag配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年04月25日 10:31:00 |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/modbus/tag") |
| | | public class ChannelModbusTagController { |
| | | @Resource |
| | | private ChannelModbusTagService channelModbusTagService; |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @GetMapping("/list") |
| | | public R tagList(@RequestParam Map<String, Object> params){ |
| | | PageUtils page = channelModbusTagService.queryPage(params); |
| | | |
| | | return R.ok().put("page", page); |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<ModBusTagRespVO>> list(@Valid ModBusTagPageReqVO reqVO) { |
| | | PageResult<ChannelModBusTagEntity> page = channelModbusTagService.queryPage(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, ModBusTagRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询tag详情 |
| | | * 根据id查询设备详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public R tagInfo(@PathVariable("id") String id){ |
| | | ChannelModBusTagEntity info= channelModbusTagService.info(Base64.decodeStr(id)); |
| | | return R.ok().put("data", info); |
| | | } |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param entity |
| | | */ |
| | | @PostMapping("/add") |
| | | public R tagAdd(@RequestBody ChannelModBusTagEntity entity){ |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | channelModbusTagService.add(entity); |
| | | return R.ok(); |
| | | public CommonResult<ChannelModBusTagEntity> info(@PathVariable("id") String id) { |
| | | ChannelModBusTagEntity info = channelModbusTagService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * 添加设备 |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @PostMapping("/update") |
| | | public R tagUpdate(@RequestBody ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModbusTagService.update(channelModBusTagEntity); |
| | | return R.ok(); |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelModBusTagEntity channelModBusTagEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelModBusTagEntity.setId(id); |
| | | channelModBusTagEntity.setCreateTime(new Date()); |
| | | channelModbusTagService.add(channelModBusTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * @param params |
| | | * 修改设备 |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @PostMapping("/delete") |
| | | public R tagDelete(@RequestBody Map<String, Object> params) { |
| | | String id = (String)params.get("id"); |
| | | channelModbusTagService.delete(id); |
| | | return R.ok(); |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModBusTagEntity.setUpdateTime(new Date()); |
| | | channelModbusTagService.update(channelModBusTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | // /** |
| | | // * 导入 |
| | | // * |
| | | // * @param device |
| | | // * @param file |
| | | // * @return |
| | | // */ |
| | | // @PostMapping("/import/{device}") |
| | | // public R importTag(@PathVariable("device") String device, @RequestParam("file") MultipartFile file) { |
| | | // try { |
| | | // if (file.isEmpty()) { |
| | | // throw new RRException("上传文件不能为空"); |
| | | // } |
| | | // channelModbusTagService.importTag(device, file); |
| | | // } catch (Exception ex) { |
| | | // return R.error(ex.getMessage()); |
| | | // } |
| | | // return R.ok(); |
| | | // } |
| | | /** |
| | | * 删除设备 |
| | | * |
| | | * @param id |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelModbusTagService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.modbus.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年04月25日 15:12:00 |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelModBusTagDao extends BaseMapper<ChannelModBusTagEntity> { |
| | | public interface ChannelModBusTagDao extends BaseMapperX<ChannelModBusTagEntity> { |
| | | |
| | | void insertList(List<ChannelModBusTagEntity> list); |
| | | |
| | | String selectIdByName(@Param("name") String name); |
| | | default PageResult<ChannelModBusTagEntity> selectPage(ModBusTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelModBusTagEntity>() |
| | | .likeIfPresent(ChannelModBusTagEntity::getTagName, reqVO.getTagName()) |
| | | .likeIfPresent(ChannelModBusTagEntity::getAddress, reqVO.getAddress()) |
| | | .likeIfPresent(ChannelModBusTagEntity::getTagDesc, reqVO.getTagDesc()) |
| | | .likeIfPresent(ChannelModBusTagEntity::getDevice, reqVO.getDevice()) |
| | | .orderByDesc(ChannelModBusTagEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.modbus.service; |
| | | |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | public interface ChannelModbusTagService { |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | * @param reqVO |
| | | */ |
| | | PageUtils queryPage(Map<String, Object> params); |
| | | PageResult queryPage(ModBusTagPageReqVO reqVO); |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | |
| | | package com.iailab.module.data.channel.modbus.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.Query; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
| | | import com.iailab.module.data.channel.modbus.dao.ChannelModBusTagDao; |
| | | import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Value("${iems.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @Override |
| | | public PageUtils queryPage(Map<String, Object> params) { |
| | | String tagName = (String) params.get("tagName"); |
| | | String address = (String) params.get("address"); |
| | | String tagDesc = (String) params.get("tagDesc"); |
| | | String device = (String) params.get("device"); |
| | | |
| | | IPage<ChannelModBusTagEntity> page = this.page( |
| | | new Query<ChannelModBusTagEntity>().getPage(params), |
| | | new QueryWrapper<ChannelModBusTagEntity>() |
| | | .like(StringUtils.isNotBlank(tagName), "tag_name", tagName) |
| | | .like(StringUtils.isNotBlank(address), "address", address) |
| | | .like(StringUtils.isNotBlank(tagDesc), "tag_desc", tagDesc) |
| | | .eq(StringUtils.isNotBlank(device), "device", device) |
| | | .orderByDesc("create_time") |
| | | ); |
| | | return new PageUtils(page); |
| | | public PageResult<ChannelModBusTagEntity> queryPage(ModBusTagPageReqVO reqVO) { |
| | | return channelModBusTagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public ChannelModBusTagEntity info(String id) { |
| | | return channelModBusTagDao.selectById(id); |
| | | } |
| | | |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @Override |
| | | public void add(ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModBusTagDao.insert(channelModBusTagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @Override |
| | | public void update(ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModBusTagDao.updateById(channelModBusTagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void delete(String id) { |
| | | channelModBusTagDao.deleteById(id); |
| | |
| | | return channelModBusTagDao.selectList(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * 查询全部 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChannelModbusTagDTO> selectAll() { |
| | | List<ChannelModBusTagEntity> entityList = baseMapper.selectList( |
| | |
| | | return ConvertUtils.sourceToTarget(entityList, ChannelModbusTagDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * listByIds |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChannelModBusTagEntity> listByIds(List<String> ids) { |
| | | return baseMapper.selectList(new QueryWrapper<ChannelModBusTagEntity>().in("id", ids)); |
| | | } |
| | | |
| | | /** |
| | | * deleteByDeviceName |
| | | * |
| | | * @param name |
| | | */ |
| | | @Override |
| | | public void deleteByDeviceName(String name) { |
| | | baseMapper.delete(new QueryWrapper<ChannelModBusTagEntity>().eq("device", name)); |
| | | } |
| | | |
| | | //TODO 使用easyExcel重写 |
| | | // /** |
| | | // * 导入Tag |
| | | // * |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.modbus.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月22日 |
| | | */ |
| | | @Schema(description = "数据平台 - ModeBus分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ModBusTagPageReqVO extends PageParam { |
| | | |
| | | private String tagName; |
| | | |
| | | private String address; |
| | | |
| | | private String tagDesc; |
| | | |
| | | private String device; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.modbus.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @Schema(description = "数据平台 - ModBusDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ModBusTagRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "tag名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("tag名称") |
| | | 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 Boolean enabled; |
| | | |
| | | @Schema(description = "大小端", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("大小端") |
| | | private String format; |
| | | |
| | | @Schema(description = "关联设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("关联设备") |
| | | private String device; |
| | | |
| | | @Schema(description = "Modbus地址 00001 ~49999", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("Modbus地址") |
| | | private String address; |
| | | |
| | | @Schema(description = "采集频率", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("采集频率") |
| | | private Integer samplingRate; |
| | | |
| | | @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("描述") |
| | | private String tagDesc; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioTagService; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity; |
| | |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUADeviceService; |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService; |
| | | import com.iailab.module.data.channel.tag.dto.TagOptionDTO; |
| | | import com.iailab.module.data.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioTagDTO; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.http.service.HttpTagService; |
| | | import com.iailab.module.data.channel.http.service.HttpTagService; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | 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.http.collector.HttpCollectorForZxzk; |
| | | 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; |
| | |
| | | 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.http.collector.HttpCollectorForZxzk; |
| | | 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; |