From c7f70933adf89a163d0049c907492a6df60cb45f Mon Sep 17 00:00:00 2001 From: liriming <1343021927@qq.com> Date: 星期二, 27 八月 2024 17:29:14 +0800 Subject: [PATCH] http modbus data服务代码升级 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java | 27 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java | 25 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java | 74 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusTagService.java | 12 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagYearPeiJsonDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java | 26 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagPageReqVO.java | 25 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCommonCurrentDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTokenService.java | 27 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java | 4 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java | 113 ++-- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java | 61 ++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/HttpCollectorForZxzk.java | 8 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java | 76 +++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java | 21 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiPageReqVO.java | 23 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiRespVO.java | 63 ++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTokenServiceImpl.java | 98 ++++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagPrdTimeDistJsonDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpApiEntity.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagAffectDetailsJsonDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java | 10 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTokenDao.java | 19 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/package-info.java | 1 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpApiDao.java | 20 /dev/null | 15 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java | 88 ++++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagJsonDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusTagDao.java | 22 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenPageReqVO.java | 22 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentPerformanceJsonDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java | 69 +++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java | 47 ++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java | 74 +++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java | 63 ++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/DataController.java | 43 + iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenRespVO.java | 71 +++ iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/HttpTagDTO.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentSaleJsonDto.java | 2 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTokenEntity.java | 2 46 files changed, 1,073 insertions(+), 206 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/DataController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/DataController.java index 01273df..b2da9e3 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/DataController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/controller/DataController.java @@ -5,6 +5,8 @@ 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; @@ -30,6 +32,9 @@ 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 @@ -62,13 +67,13 @@ @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()); @@ -80,7 +85,7 @@ 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(); @@ -89,23 +94,23 @@ 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()); } } @@ -166,12 +171,12 @@ @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()); @@ -181,11 +186,11 @@ } 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()); } } @@ -210,20 +215,20 @@ @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<>(); @@ -232,9 +237,9 @@ 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()); } } } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/collector/HttpCollectorForZxzk.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/HttpCollectorForZxzk.java similarity index 95% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/collector/HttpCollectorForZxzk.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/HttpCollectorForZxzk.java index a0afa18..1828401 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/collector/HttpCollectorForZxzk.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/HttpCollectorForZxzk.java @@ -1,4 +1,4 @@ -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; @@ -7,8 +7,8 @@ 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; @@ -57,7 +57,7 @@ if (apiMap.containsKey(id)) { return apiMap.get(id); } - HttpApiEntity httpApi = httpApiService.get(id); + HttpApiEntity httpApi = httpApiService.info(id); apiMap.put(id, httpApi); return httpApi; } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java new file mode 100644 index 0000000..a29448d --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java @@ -0,0 +1,88 @@ +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); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java new file mode 100644 index 0000000..66a8a54 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java @@ -0,0 +1,69 @@ +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); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java new file mode 100644 index 0000000..31bd57c --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTokenController.java @@ -0,0 +1,74 @@ +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); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/package-info.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/package-info.java new file mode 100644 index 0000000..9c7a5ad --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/package-info.java @@ -0,0 +1 @@ +package com.iailab.module.data.channel.http.controller; \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpApiDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpApiDao.java new file mode 100644 index 0000000..f25a548 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpApiDao.java @@ -0,0 +1,20 @@ +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)); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java new file mode 100644 index 0000000..d693d62 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTagDao.java @@ -0,0 +1,21 @@ +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)); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTokenDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTokenDao.java new file mode 100644 index 0000000..6d0ba36 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dao/HttpTokenDao.java @@ -0,0 +1,19 @@ +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)); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/HttpTagDTO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/HttpTagDTO.java similarity index 84% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/HttpTagDTO.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/HttpTagDTO.java index 229e3c5..e300594 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/HttpTagDTO.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/HttpTagDTO.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagAffectDetailsJsonDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagAffectDetailsJsonDto.java similarity index 93% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagAffectDetailsJsonDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagAffectDetailsJsonDto.java index 1c286c6..754e4ad 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagAffectDetailsJsonDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagAffectDetailsJsonDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCommonCurrentDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCommonCurrentDto.java similarity index 84% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCommonCurrentDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCommonCurrentDto.java index 870eae4..ccf55b2 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCommonCurrentDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCommonCurrentDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentPerformanceJsonDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentPerformanceJsonDto.java similarity index 95% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentPerformanceJsonDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentPerformanceJsonDto.java index 08f5b29..62bd9e7 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentPerformanceJsonDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentPerformanceJsonDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentSaleJsonDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentSaleJsonDto.java similarity index 97% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentSaleJsonDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentSaleJsonDto.java index ababe23..c3f6915 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentSaleJsonDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagCurrentSaleJsonDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagJsonDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagJsonDto.java similarity index 94% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagJsonDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagJsonDto.java index 3da5686..44a5679 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagJsonDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagJsonDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagPrdTimeDistJsonDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagPrdTimeDistJsonDto.java similarity index 95% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagPrdTimeDistJsonDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagPrdTimeDistJsonDto.java index 489cf5e..855d123 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagPrdTimeDistJsonDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagPrdTimeDistJsonDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagYearPeiJsonDto.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagYearPeiJsonDto.java similarity index 95% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagYearPeiJsonDto.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagYearPeiJsonDto.java index 9e33ccc..005b4dc 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagYearPeiJsonDto.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/dto/TagYearPeiJsonDto.java @@ -1,4 +1,4 @@ -package com.iailab.module.data.http.dto; +package com.iailab.module.data.channel.http.dto; import lombok.Data; import org.springframework.stereotype.Component; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/EleLowTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java similarity index 94% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/EleLowTagEntity.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java index 511411b..b3016e0 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/EleLowTagEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/EleLowTagEntity.java @@ -1,4 +1,4 @@ -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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/FxjyTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java similarity index 94% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/FxjyTagEntity.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java index d3d637a..456e9cb 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/FxjyTagEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/FxjyTagEntity.java @@ -1,4 +1,4 @@ -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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpApiEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpApiEntity.java similarity index 93% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpApiEntity.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpApiEntity.java index a01a9eb..de52968 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpApiEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpApiEntity.java @@ -1,4 +1,4 @@ -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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java similarity index 95% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTagEntity.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java index c11f713..fba20f9 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTagEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTagEntity.java @@ -1,4 +1,4 @@ -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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTokenEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTokenEntity.java similarity index 94% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTokenEntity.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTokenEntity.java index c9054c0..d6cdf22 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTokenEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTokenEntity.java @@ -1,4 +1,4 @@ -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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/XSTTagEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java similarity index 95% rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/XSTTagEntity.java rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java index 358b85e..009e565 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/XSTTagEntity.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/XSTTagEntity.java @@ -1,4 +1,4 @@ -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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java new file mode 100644 index 0000000..658a20a --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java @@ -0,0 +1,25 @@ +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(); +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java new file mode 100644 index 0000000..766b21c --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java @@ -0,0 +1,26 @@ +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); +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTokenService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTokenService.java new file mode 100644 index 0000000..07c2e0e --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTokenService.java @@ -0,0 +1,27 @@ +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); +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java new file mode 100644 index 0000000..d92d201 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java @@ -0,0 +1,61 @@ +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<>()); + } + +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java new file mode 100644 index 0000000..adf69c8 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java @@ -0,0 +1,76 @@ +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")); + } + +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTokenServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTokenServiceImpl.java new file mode 100644 index 0000000..48f459c --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTokenServiceImpl.java @@ -0,0 +1,98 @@ +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(); + } +} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiPageReqVO.java new file mode 100644 index 0000000..e58377b --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiPageReqVO.java @@ -0,0 +1,23 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiRespVO.java new file mode 100644 index 0000000..ac6570f --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpApiRespVO.java @@ -0,0 +1,63 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagPageReqVO.java new file mode 100644 index 0000000..11bfab8 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagPageReqVO.java @@ -0,0 +1,25 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java new file mode 100644 index 0000000..f196604 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java @@ -0,0 +1,47 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenPageReqVO.java new file mode 100644 index 0000000..e7e9f05 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenPageReqVO.java @@ -0,0 +1,22 @@ +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; + +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenRespVO.java new file mode 100644 index 0000000..5208b18 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenRespVO.java @@ -0,0 +1,71 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java index 2073532..df61b27 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java @@ -18,9 +18,7 @@ import static com.iailab.framework.common.pojo.CommonResult.success; /** - * @author lirm - * @Description - * @createTime 2024年08月26日 + */ @RestController @RequestMapping("/data/channel/kio/tag") diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java index bdde24f..cf82388 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java @@ -1,100 +1,85 @@ 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); + } } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusTagDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusTagDao.java index 21826ea..250e613 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusTagDao.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/dao/ChannelModBusTagDao.java @@ -1,23 +1,31 @@ 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)); + } } diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusTagService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusTagService.java index e2abf72..6ec084c 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusTagService.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/ChannelModbusTagService.java @@ -1,24 +1,24 @@ 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详情 diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java index 824196d..17c6c64 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java @@ -1,28 +1,26 @@ 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 @@ -33,65 +31,26 @@ @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); @@ -105,11 +64,6 @@ return channelModBusTagDao.selectList(queryWrapper); } - /** - * 查询全部 - * - * @return - */ @Override public List<ChannelModbusTagDTO> selectAll() { List<ChannelModBusTagEntity> entityList = baseMapper.selectList( @@ -118,28 +72,16 @@ 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 // * diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java new file mode 100644 index 0000000..fc5ca7f --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java @@ -0,0 +1,27 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java new file mode 100644 index 0000000..2486441 --- /dev/null +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java @@ -0,0 +1,63 @@ +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; +} \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java index 5bb4e71..7813746 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/TagController.java @@ -4,7 +4,6 @@ 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; @@ -15,12 +14,11 @@ 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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpApiController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpApiController.java deleted file mode 100644 index a620386..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpApiController.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.iailab.module.data.http.controller.admin; - -import com.iailab.framework.common.page.PageData; -import com.iailab.module.data.common.utils.R; -import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.module.data.http.entity.HttpApiEntity; -import com.iailab.module.data.http.service.HttpApiService; -import javax.annotation.Resource; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.iailab.framework.common.pojo.CommonResult.success; - -@RestController -@RequestMapping("/data/http/api") -public class HttpApiController { - - @Resource - private HttpApiService httpApiService; - - @GetMapping("page") - public CommonResult<PageData<HttpApiEntity>> page(@RequestParam Map<String, Object> params) { - PageData<HttpApiEntity> page = httpApiService.page(params); - return success(page); - } - - @GetMapping("list") - public CommonResult<List<HttpApiEntity>> list() { - List<HttpApiEntity> list = httpApiService.list(); - return new CommonResult<List<HttpApiEntity>>().setData(list); - } - - /** - * 根据id查询详情 - * - * @param id - */ - @GetMapping("/info/{id}") - public R info(@PathVariable("id") String id){ - HttpApiEntity info= httpApiService.selectById(id); - return R.ok().put("data", info); - } - /** - * 添加API - * - * @param httpApiEntity - */ - @PostMapping("/add") - public R add(@RequestBody HttpApiEntity httpApiEntity){ - String id = UUID.randomUUID().toString(); - httpApiEntity.setId(id); - httpApiService.insert(httpApiEntity); - return R.ok(); - } - - /** - * 修改API - * - * @param httpApiEntity - */ - @PostMapping("/update") - public R update(@RequestBody HttpApiEntity httpApiEntity) { - httpApiService.updateById(httpApiEntity); - return R.ok(); - } - - /** - * 删除API - * - * @param params - * - */ - @PostMapping("/delete") - public R delete(@RequestBody Map<String, Object> params) { - String id = (String)params.get("id"); - httpApiService.deleteById(id); - return R.ok(); - } -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpTagController.java deleted file mode 100644 index 1a7d48f..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpTagController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.iailab.module.data.http.controller.admin; - -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.module.data.http.dto.HttpTagDTO; -import com.iailab.module.data.http.entity.HttpTagEntity; -import com.iailab.module.data.http.service.HttpTagService; -import javax.annotation.Resource; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; -import java.util.UUID; - -/** - * @author Houzhongjian - * @Description - * @createTime 2024年04月10日 17:37:00 - */ -@RestController -@RequestMapping("/data/http/tag") -public class HttpTagController { - - @Resource - private HttpTagService tagService; - - /** - * 分页 - * - * @param params - */ - @GetMapping("/page") - public R tagPageList(@RequestParam Map<String, Object> params) { - PageUtils page = tagService.queryPage(params); - - return R.ok().put("page", page); - } - - /** - * 查询tagList - * - */ - @GetMapping("/list") - public R tagList(@RequestParam Map<String, Object> params){ - List<HttpTagEntity> data = tagService.selectList(params); - - return R.ok().put("data", data); - } - - /** - * 详情 - * - * @param id - */ - @GetMapping("/info/{id}") - public R tagInfo(@PathVariable("id") String id) { - HttpTagEntity info = tagService.selectById(id); - return R.ok().put("data", info); - } - - /** - * 添加 - * - * @param entity - */ - @PostMapping("/add") - public R tagAdd(@RequestBody HttpTagEntity entity) { - entity.setId(UUID.randomUUID().toString()); - tagService.insert(entity); - return R.ok(); - } - - /** - * 修改 - * - * @param entity - */ - @PostMapping("/update") - public R tagUpdate(@RequestBody HttpTagEntity entity) { - tagService.updateById(entity); - return R.ok(); - } - - /** - * 删除 - * - * @param params - */ - @PostMapping("/delete") - public R tagDelete(@RequestBody Map<String, Object> params) { - String id = (String) params.get("id"); - tagService.deleteById(id); - return R.ok(); - } - - - @GetMapping("tagNo") - public CommonResult<List<HttpTagDTO>> list(@RequestParam Map<String, Object> params){ - List<HttpTagDTO> list = tagService.list(params); - return new CommonResult<List<HttpTagDTO>>().setData(list); - } -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpTokenController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpTokenController.java deleted file mode 100644 index 108a401..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/admin/HttpTokenController.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.iailab.module.data.http.controller.admin; - -import com.iailab.framework.common.page.PageData; -import com.iailab.module.data.common.utils.R; -import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.module.data.http.entity.HttpTokenEntity; -import com.iailab.module.data.http.service.HttpTokenService; -import javax.annotation.Resource; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; -import java.util.UUID; - -/** - * @author PanZhibao - * @Description - * @createTime 2023年12月22日 10:52:00 - */ -@RestController -@RequestMapping("/data/http/token") -public class HttpTokenController { - - @Resource - private HttpTokenService httpTokenService; - - /** - * 分页 - * - * @param params - * @return - */ - @GetMapping("page") - public CommonResult<PageData<HttpTokenEntity>> page(@RequestParam Map<String, Object> params) { - PageData<HttpTokenEntity> page = httpTokenService.page(params); - - return new CommonResult<PageData<HttpTokenEntity>>().setData(page); - } - - /** - * 详情 - * - * @param id - */ - @GetMapping("/info/{id}") - public R info(@PathVariable("id") String id) { - HttpTokenEntity info = httpTokenService.selectById(id); - return R.ok().put("data", info); - } - - /** - * 详情 - * - * @param apiId - */ - @GetMapping("/api-id/{apiId}") - public R apiId(@PathVariable("apiId") String apiId) { - HttpTokenEntity info = httpTokenService.getByApiId(apiId); - return R.ok().put("data", info); - } - - /** - * 添加 - * - * @param httpApiEntity - */ - @PostMapping("/add") - public R add(@RequestBody HttpTokenEntity httpApiEntity) { - String id = UUID.randomUUID().toString(); - httpApiEntity.setId(id); - httpTokenService.insert(httpApiEntity); - return R.ok(); - } - - /** - * 修改 - * - * @param httpApiEntity - */ - @PostMapping("/update") - public R update(@RequestBody HttpTokenEntity httpApiEntity) { - httpTokenService.updateById(httpApiEntity); - return R.ok(); - } - - /** - * 删除 - * - * @param params - */ - @PostMapping("/delete") - public R delete(@RequestBody Map<String, Object> params) { - String id = (String) params.get("id"); - httpTokenService.deleteById(id); - return R.ok(); - } -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/package-info.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/package-info.java deleted file mode 100644 index 49239c6..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/controller/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.iailab.module.data.http.controller; \ No newline at end of file diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpApiDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpApiDao.java deleted file mode 100644 index a308bc3..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpApiDao.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.iailab.module.data.http.dao; - -import com.iailab.framework.common.dao.BaseDao; -import com.iailab.framework.tenant.core.db.dynamic.TenantDS; -import com.iailab.module.data.http.entity.HttpApiEntity; -import org.apache.ibatis.annotations.Mapper; - -@TenantDS -@Mapper -public interface HttpApiDao extends BaseDao<HttpApiEntity> { -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpTagDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpTagDao.java deleted file mode 100644 index 2c9934f..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpTagDao.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.iailab.module.data.http.dao; - -import com.iailab.framework.common.dao.BaseDao; -import com.iailab.framework.tenant.core.db.dynamic.TenantDS; -import com.iailab.module.data.http.dto.HttpTagDTO; -import com.iailab.module.data.http.entity.HttpTagEntity; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; -import java.util.Map; - -/** - * @author Houzhongjian - * @Description - * @createTime 2024年04月10日 17:35:00 - */ -@TenantDS -@Mapper -public interface HttpTagDao extends BaseDao<HttpTagEntity> { - List<HttpTagDTO> getList(Map<String, Object> params); -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpTokenDao.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpTokenDao.java deleted file mode 100644 index a6015f7..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dao/HttpTokenDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.iailab.module.data.http.dao; - -import com.iailab.framework.common.dao.BaseDao; -import com.iailab.framework.tenant.core.db.dynamic.TenantDS; -import com.iailab.module.data.http.entity.HttpTokenEntity; -import org.apache.ibatis.annotations.Mapper; - -@TenantDS -@Mapper -public interface HttpTokenDao extends BaseDao<HttpTokenEntity> { - -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpApiService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpApiService.java deleted file mode 100644 index e0abeda..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpApiService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.iailab.module.data.http.service; - -import com.iailab.framework.common.page.PageData; -import com.iailab.framework.common.service.BaseService; -import com.iailab.module.data.http.entity.HttpApiEntity; -import com.iailab.module.data.http.entity.HttpApiEntity; - -import java.util.List; -import java.util.Map; - -public interface HttpApiService extends BaseService<HttpApiEntity> { - HttpApiEntity selectXstHttpTagApi(); - - HttpApiEntity get(String id); - - HttpApiEntity getByCode(String code); - - PageData<HttpApiEntity> page(Map<String, Object> params); - - List<HttpApiEntity> list(); -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpTagService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpTagService.java deleted file mode 100644 index e3bec59..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpTagService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.iailab.module.data.http.service; - - -import com.iailab.module.data.common.utils.PageUtils; -import com.iailab.framework.common.service.BaseService; -import com.iailab.module.data.http.dto.HttpTagDTO; -import com.iailab.module.data.http.dto.TagCommonCurrentDto; -import com.iailab.module.data.http.entity.HttpTagEntity; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -/** - * @author Houzhongjian - * @Description - * @createTime 2024年04月10日 17:35:00 - */ -public interface HttpTagService extends BaseService<HttpTagEntity> { - - PageUtils queryPage(Map<String, Object> params); - - List<HttpTagEntity> selectList(Map<String, Object> params); - - List<HttpTagEntity> getByCode(String code); - - List<HttpTagDTO> list(Map<String, Object> params); -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpTokenService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpTokenService.java deleted file mode 100644 index a238c88..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/HttpTokenService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.iailab.module.data.http.service; - - -import com.iailab.framework.common.page.PageData; -import com.iailab.framework.common.service.BaseService; -import com.iailab.module.data.http.entity.HttpTokenEntity; -import com.iailab.module.data.http.entity.HttpTokenEntity; - -import java.util.Map; - -public interface HttpTokenService extends BaseService<HttpTokenEntity> { - - PageData<HttpTokenEntity> page(Map<String, Object> params); - - HttpTokenEntity getByApiId(String apiId); - - void updateToken (String clientId); - - String queryToken (String clientId); - -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpApiServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpApiServiceImpl.java deleted file mode 100644 index 5daf382..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpApiServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.iailab.module.data.http.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.iailab.framework.common.page.PageData; -import com.iailab.framework.common.service.impl.BaseServiceImpl; -import com.iailab.module.data.http.entity.HttpApiEntity; -import com.iailab.module.data.http.entity.HttpApiEntity; -import com.iailab.module.data.http.dao.HttpApiDao; -import com.iailab.module.data.http.service.HttpApiService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -@Service -public class HttpApiServiceImpl extends BaseServiceImpl<HttpApiDao, HttpApiEntity> implements HttpApiService { - @Override - public HttpApiEntity selectXstHttpTagApi() { - return baseDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag")); - } - - @Override - public HttpApiEntity get(String id) { - return baseDao.selectById(id); - } - - - @Override - public HttpApiEntity getByCode(String code) { - return baseDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code)); - } - - @Override - public PageData<HttpApiEntity> page(Map<String, Object> params) { - IPage<HttpApiEntity> page = baseDao.selectPage( - getPage(params, "create_time", false), - getWrapper(params) - ); - - return getPageData(page, HttpApiEntity.class); - } - - @Override - public List<HttpApiEntity> list() { - List<HttpApiEntity> page = baseDao.selectList(new QueryWrapper<>()); - return page; - } - - private QueryWrapper<HttpApiEntity> getWrapper(Map<String, Object> params){ - String name = (String)params.get("name"); - QueryWrapper<HttpApiEntity> wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(name), "name", name); - return wrapper; - } -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java deleted file mode 100644 index 461e014..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTagServiceImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.iailab.module.data.http.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; -import com.iailab.module.data.common.enums.CommonConstant; -import com.iailab.framework.common.service.impl.BaseServiceImpl; -import com.iailab.module.data.common.utils.HttpsRequest; -import com.iailab.module.data.common.utils.PageUtils; -import com.iailab.module.data.common.utils.Query; -import com.iailab.module.data.http.dao.HttpTagDao; -import com.iailab.module.data.http.dto.*; -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.http.service.HttpTagService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.ObjectUtils; -import javax.annotation.Resource; -import org.springframework.stereotype.Service; - -import java.lang.reflect.Field; -import java.math.BigDecimal; -import java.util.*; - -/** - * @author Houzhongjian - * @Description - * @createTime 2024年04月10日 17:35:00 - */ -@Slf4j -@Service -public class HttpTagServiceImpl extends BaseServiceImpl<HttpTagDao, HttpTagEntity> implements HttpTagService { - - @Resource - private HttpsRequest httpsRequest; - - @Resource - private HttpApiService httpApiService; - - - /** - * 分页查询tag - * - * @param params - */ - @Override - public PageUtils queryPage(Map<String, Object> params) { - String httpApiCode = (String) params.get("httpApiCode"); - String tagType = (String) params.get("tagType"); - String tagCode = (String) params.get("tagCode"); - String tagName = (String) params.get("tagName"); - - IPage<HttpTagEntity> page = baseDao.selectPage( - new Query<HttpTagEntity>().getPage(params), - new QueryWrapper<HttpTagEntity>() - .like(StringUtils.isNotBlank(httpApiCode), "http_api_code", httpApiCode) - .like(StringUtils.isNotBlank(tagType), "tag_type", tagType) - .like(StringUtils.isNotBlank(tagCode), "tag_code", tagCode) - .like(StringUtils.isNotBlank(tagName), "tag_name", tagName) - .orderByDesc("create_time") - ); - return new PageUtils(page); - } - - @Override - public List<HttpTagEntity> selectList(Map<String, Object> params) { - String httpId = (String) params.get("httpId"); - HttpApiEntity httpApiEntity = httpApiService.selectById(httpId); - return baseDao.selectList(new QueryWrapper<HttpTagEntity>() - .eq("http_api_code", httpApiEntity.getCode()) - .orderByDesc("create_time")); - } - - @Override - public List<HttpTagEntity> getByCode(String code) { - return baseDao.selectList(new QueryWrapper<HttpTagEntity>() - .eq("http_api_code", code) - .orderByDesc("create_time")); - } - - @Override - public List<HttpTagDTO> list(Map<String, Object> params) { - List<HttpTagDTO> list = baseDao.getList(params); - return list; - } -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTokenServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTokenServiceImpl.java deleted file mode 100644 index 497b49f..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/service/impl/HttpTokenServiceImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.iailab.module.data.http.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.iailab.module.data.common.utils.HttpsRequest; -import com.iailab.framework.common.page.PageData; -import com.iailab.framework.common.service.impl.BaseServiceImpl; -import com.iailab.module.data.http.dao.HttpTokenDao; -import com.iailab.module.data.http.entity.HttpTokenEntity; -import com.iailab.module.data.http.service.HttpTokenService; -import org.apache.commons.lang3.StringUtils; -import javax.annotation.Resource; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -@Service -public class HttpTokenServiceImpl extends BaseServiceImpl<HttpTokenDao, HttpTokenEntity> implements HttpTokenService { - - @Resource - private HttpsRequest httpsRequest; - - @Override - public PageData<HttpTokenEntity> page(Map<String, Object> params) { - IPage<HttpTokenEntity> page = baseDao.selectPage( - getPage(params, "client_id", false), - getWrapper(params) - ); - return getPageData(page, HttpTokenEntity.class); - } - - private QueryWrapper<HttpTokenEntity> getWrapper(Map<String, Object> params){ - String clientId = (String)params.get("clientId"); - QueryWrapper<HttpTokenEntity> wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(clientId), "client_id", clientId); - return wrapper; - } - - @Override - public HttpTokenEntity getByApiId(String apiId) { - QueryWrapper<HttpTokenEntity> wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(apiId), "api_id", apiId); - return baseDao.selectOne(wrapper); - } - - - @Override - public void updateToken(String clientId) { - Map<String, String> params = new HashMap<>(1); - params.put("timeout", "30000"); - HttpTokenEntity entity = baseDao.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()); - baseDao.update(entity, new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); - } - - @Override - public String queryToken(String clientId) { - return baseDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)).getToken(); - } -} diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java index 3723dd0..7bd34be 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/PointCollector.java @@ -7,7 +7,7 @@ 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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java index c9af776..a5d084e 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java @@ -12,7 +12,7 @@ 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; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/http/HttpTagDao.xml b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/http/HttpTagDao.xml deleted file mode 100644 index fa227d7..0000000 --- a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/http/HttpTagDao.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="com.iailab.module.data.http.dao.HttpTagDao"> - - <select id="getList" resultType="com.iailab.module.data.http.dto.HttpTagDTO"> - select * from t_http_tag - <where> - <if test="deviceId != null and deviceId != ''"> - tag_type = #{deviceId} - </if> - </where> - </select> - -</mapper> \ No newline at end of file -- Gitblit v1.9.3