Merge remote-tracking branch 'origin/master'
已修改38个文件
已重命名15个文件
已删除14个文件
已添加35个文件
| | |
| | | import com.iailab.module.data.api.dto.IndexQueryDTO; |
| | | import com.iailab.module.data.api.dto.echarts.BarLineDTO; |
| | | import com.iailab.module.data.api.dto.echarts.SeriesItem; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.common.utils.Constant; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import com.iailab.module.data.api.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.data.point.collection.PointCollector; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | |
| | | @PostMapping("/point/history") |
| | | @Operation(summary = "point历史数据") |
| | | public R pointHistory(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, List<Map<String, Object>>>> pointHistory(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody ApiPointValueQueryDTO queryDto) { |
| | | try { |
| | | apiSecurityUtils.validate(request); |
| | | Map<String, List<Map<String, Object>>> data = new HashMap<>(); |
| | | if (CollectionUtils.isEmpty(queryDto.getPointNos())) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | if (queryDto.getStart() == null) { |
| | | queryDto.setStart(new Date()); |
| | |
| | | params.put("pointNos", queryDto.getPointNos()); |
| | | List<DaPointDTO> pointList = daPointService.list(params); |
| | | if (CollectionUtils.isEmpty(pointList)) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | List<InfluxPointValuePOJO> influxParams = pointList.stream().map(item -> { |
| | | InfluxPointValuePOJO pojo = new InfluxPointValuePOJO(); |
| | |
| | | return pojo; |
| | | }).collect(Collectors.toList()); |
| | | data = influxDBService.queryPointsValues(influxParams, queryDto.getStart(), queryDto.getEnd()); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, List<Map<String, Object>>>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/point/current") |
| | | @Operation(summary = "point当前实时数据") |
| | | public R pointCurrent(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, Object>> pointCurrent(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody List<String> pointNos) { |
| | | try { |
| | | // apiSecurityUtils.validate(request); |
| | | Map<String, Object> data = pointCollector.getCurrentValue(pointNos); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, Object>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/pointRelation/history") |
| | | @Operation(summary = "pointRelation历史数据") |
| | | public R pointRelationHistory(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, List<Map<String, Object>>>> pointRelationHistory(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody ApiPointValueQueryDTO queryDto) { |
| | | try { |
| | | Map<String, List<Map<String, Object>>> data = new HashMap<>(); |
| | | if (CollectionUtils.isEmpty(queryDto.getPointNos())) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | if (queryDto.getStart() == null) { |
| | | queryDto.setStart(new Date()); |
| | |
| | | } |
| | | data = daPointValueService.getHistoryList(queryDto); |
| | | if (CollectionUtils.isEmpty(data)) { |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, List<Map<String, Object>>>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/ind-item/values") |
| | | @Operation(summary = "point当前实时数据") |
| | | public R indItemValues(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, List<IndItemValueDTO>>> indItemValues(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody List<String> itemNos) { |
| | | try { |
| | | // apiSecurityUtils.validate(request); |
| | | Map<String, List<IndItemValueDTO>> data = indItemCollector.getValueList(itemNos); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, List<IndItemValueDTO>>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/ind-item/current-value") |
| | | @Operation(summary = "point当前实时数据") |
| | | public R indItemCurrentValue(HttpServletResponse response, HttpServletRequest |
| | | public CommonResult<Map<String, BigDecimal>> indItemCurrentValue(HttpServletResponse response, HttpServletRequest |
| | | request, @RequestBody List<String> itemNos) { |
| | | try { |
| | | Map<String, BigDecimal> data = new HashMap<>(); |
| | |
| | | dataList.forEach((k, v) -> { |
| | | data.put(k, CollectionUtils.isEmpty(v) ? null : v.get(0).getDataValue()); |
| | | }); |
| | | return R.ok().put("data", data); |
| | | return success(data); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | return new CommonResult<Map<String, BigDecimal>>().setMsg(ex.getMessage()); |
| | | } |
| | | } |
| | | } |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/collector/HttpCollectorForZxzk.java 修改 |
| | |
| | | package com.iailab.module.data.http.collector; |
| | | package com.iailab.module.data.channel.http.collector; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.HttpsRequest; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import com.iailab.module.data.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | if (apiMap.containsKey(id)) { |
| | | return apiMap.get(id); |
| | | } |
| | | HttpApiEntity httpApi = httpApiService.get(id); |
| | | HttpApiEntity httpApi = httpApiService.info(id); |
| | | apiMap.put(id, httpApi); |
| | | return httpApi; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/http/api") |
| | | public class HttpApiController { |
| | | |
| | | @Resource |
| | | private HttpApiService httpApiService; |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<HttpApiRespVO>> page(@Valid HttpApiPageReqVO reqVO) { |
| | | PageResult<HttpApiEntity> page = httpApiService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, HttpApiRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<HttpApiEntity>> list() { |
| | | List<HttpApiEntity> list = httpApiService.list(); |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<HttpApiEntity> info(@PathVariable("id") String id){ |
| | | HttpApiEntity info= httpApiService.info(id); |
| | | return success(info); |
| | | } |
| | | /** |
| | | * 添加API |
| | | * |
| | | * @param httpApiEntity |
| | | */ |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody HttpApiEntity httpApiEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | httpApiEntity.setId(id); |
| | | httpApiService.add(httpApiEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改API |
| | | * |
| | | * @param httpApiEntity |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody HttpApiEntity httpApiEntity) { |
| | | httpApiService.update(httpApiEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除API |
| | | * |
| | | * @param id |
| | | * |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | httpApiService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpTagService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/http/tag") |
| | | public class HttpTagController { |
| | | |
| | | @Resource |
| | | private HttpTagService tagService; |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<HttpTagRespVO>> page(@Valid HttpTagPageReqVO reqVO) { |
| | | PageResult<HttpTagEntity> page = tagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, HttpTagRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<HttpTagEntity>> list(){ |
| | | List<HttpTagEntity> list = tagService.list(); |
| | | return new CommonResult<List<HttpTagEntity>>().setData(list); |
| | | } |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<HttpTagEntity> info(@PathVariable("id") String id){ |
| | | HttpTagEntity info= tagService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody HttpTagEntity httpTagEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | httpTagEntity.setId(id); |
| | | tagService.add(httpTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody HttpTagEntity httpTagEntity) { |
| | | tagService.update(httpTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | tagService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpTokenService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/http/token") |
| | | public class HttpTokenController { |
| | | |
| | | @Resource |
| | | private HttpTokenService httpTokenService; |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<HttpTokenRespVO>> page(@Valid HttpTokenPageReqVO reqVO) { |
| | | PageResult<HttpTokenEntity> page = httpTokenService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, HttpTokenRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | public CommonResult<List<HttpTokenEntity>> list(){ |
| | | List<HttpTokenEntity> list = httpTokenService.list(); |
| | | return new CommonResult<List<HttpTokenEntity>>().setData(list); |
| | | } |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<HttpTokenEntity> info(@PathVariable("id") String id){ |
| | | HttpTokenEntity info= httpTokenService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody HttpTokenEntity HttpTokenEntity){ |
| | | String id = UUID.randomUUID().toString(); |
| | | HttpTokenEntity.setId(id); |
| | | httpTokenService.add(HttpTokenEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody HttpTokenEntity HttpTokenEntity) { |
| | | httpTokenService.update(HttpTokenEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | httpTokenService.delete(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/api-id/{apiId}") |
| | | public CommonResult<HttpTokenEntity> apiId(@PathVariable("apiId") String apiId) { |
| | | HttpTokenEntity info = httpTokenService.getByApiId(apiId); |
| | | return success(info); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.controller; |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @TenantDS |
| | | @Mapper |
| | | public interface HttpApiDao extends BaseMapperX<HttpApiEntity> { |
| | | default PageResult<HttpApiEntity> selectPage(HttpApiPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HttpApiEntity>() |
| | | .likeIfPresent(HttpApiEntity::getCode, reqVO.getCode()) |
| | | .likeIfPresent(HttpApiEntity::getName, reqVO.getName()) |
| | | .orderByDesc(HttpApiEntity::getCreateTime)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @TenantDS |
| | | @Mapper |
| | | public interface HttpTagDao extends BaseMapperX<HttpTagEntity> { |
| | | default PageResult<HttpTagEntity> selectPage(HttpTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HttpTagEntity>() |
| | | .likeIfPresent(HttpTagEntity::getTagType, reqVO.getTagType()) |
| | | .likeIfPresent(HttpTagEntity::getTagCode, reqVO.getTagCode()) |
| | | .likeIfPresent(HttpTagEntity::getTagName, reqVO.getTagName()) |
| | | .orderByDesc(HttpTagEntity::getCreateTime)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @TenantDS |
| | | @Mapper |
| | | public interface HttpTokenDao extends BaseMapperX<HttpTokenEntity> { |
| | | default PageResult<HttpTokenEntity> selectPage(HttpTokenPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HttpTokenEntity>() |
| | | .likeIfPresent(HttpTokenEntity::getClientId, reqVO.getClientId()) |
| | | .orderByDesc(HttpTokenEntity::getExpireTime)); |
| | | } |
| | | } |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/HttpTagDTO.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagAffectDetailsJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCommonCurrentDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentPerformanceJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagCurrentSaleJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagPrdTimeDistJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/dto/TagYearPeiJsonDto.java 修改 |
| | |
| | | package com.iailab.module.data.http.dto; |
| | | package com.iailab.module.data.channel.http.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.stereotype.Component; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/EleLowTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/FxjyTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpApiEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/HttpTokenEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
文件名从 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/http/entity/XSTTagEntity.java 修改 |
| | |
| | | package com.iailab.module.data.http.entity; |
| | | package com.iailab.module.data.channel.http.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface HttpApiService{ |
| | | PageResult<HttpApiEntity> queryPage(HttpApiPageReqVO reqVO); |
| | | |
| | | HttpApiEntity info(String id); |
| | | |
| | | void add(HttpApiEntity httpApiEntity); |
| | | |
| | | void update(HttpApiEntity httpApiEntity); |
| | | |
| | | void delete(String id); |
| | | |
| | | HttpApiEntity selectXstHttpTagApi(); |
| | | |
| | | HttpApiEntity getByCode(String code); |
| | | |
| | | List<HttpApiEntity> list(); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface HttpTagService{ |
| | | PageResult<HttpTagEntity> queryPage(HttpTagPageReqVO reqVO); |
| | | |
| | | HttpTagEntity info(String id); |
| | | |
| | | void add(HttpTagEntity httpTagEntity); |
| | | |
| | | void update(HttpTagEntity httpTagEntity); |
| | | |
| | | void delete(String id); |
| | | |
| | | List<HttpTagEntity> list(); |
| | | |
| | | List<HttpTagEntity> selectList(Map<String, Object> params); |
| | | |
| | | List<HttpTagEntity> getByCode(String code); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface HttpTokenService{ |
| | | PageResult<HttpTokenEntity> queryPage(HttpTokenPageReqVO reqVO); |
| | | |
| | | HttpTokenEntity info(String id); |
| | | |
| | | void add(HttpTokenEntity httpTokenEntity); |
| | | |
| | | void update(HttpTokenEntity httpTokenEntity); |
| | | |
| | | void delete(String id); |
| | | |
| | | List<HttpTokenEntity> list(); |
| | | |
| | | HttpTokenEntity getByApiId(String apiId); |
| | | |
| | | void updateToken(String clientId); |
| | | |
| | | String queryToken(String clientId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.dao.HttpApiDao; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class HttpApiServiceImpl extends ServiceImpl<HttpApiDao, HttpApiEntity> implements HttpApiService { |
| | | |
| | | @Resource |
| | | private HttpApiDao httpApiDao; |
| | | |
| | | @Override |
| | | public PageResult<HttpApiEntity> queryPage(HttpApiPageReqVO reqVO) { |
| | | return httpApiDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity info(String id) { |
| | | return httpApiDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(HttpApiEntity httpApiEntity) { |
| | | httpApiDao.insert(httpApiEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(HttpApiEntity httpApiEntity) { |
| | | httpApiDao.updateById(httpApiEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | httpApiDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity selectXstHttpTagApi() { |
| | | return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag")); |
| | | } |
| | | |
| | | @Override |
| | | public HttpApiEntity getByCode(String code) { |
| | | return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code)); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpApiEntity> list() { |
| | | return httpApiDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.dao.HttpTagDao; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.http.service.HttpTagService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class HttpTagServiceImpl extends ServiceImpl<HttpTagDao, HttpTagEntity> implements HttpTagService { |
| | | |
| | | @Resource |
| | | private HttpApiService httpApiService; |
| | | |
| | | @Resource |
| | | private HttpTagDao httpTagDao; |
| | | |
| | | @Override |
| | | public PageResult<HttpTagEntity> queryPage(HttpTagPageReqVO reqVO) { |
| | | return httpTagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public HttpTagEntity info(String id) { |
| | | return httpTagDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(HttpTagEntity httpTagEntity) { |
| | | httpTagDao.insert(httpTagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(HttpTagEntity httpTagEntity) { |
| | | httpTagDao.updateById(httpTagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | httpTagDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpTagEntity> list() { |
| | | return httpTagDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<HttpTagEntity> selectList(Map<String, Object> params) { |
| | | String httpId = (String) params.get("httpId"); |
| | | HttpApiEntity httpApiEntity = httpApiService.info(httpId); |
| | | return httpTagDao.selectList(new QueryWrapper<HttpTagEntity>() |
| | | .eq("http_api_code", httpApiEntity.getCode()) |
| | | .orderByDesc("create_time")); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpTagEntity> getByCode(String code) { |
| | | return httpTagDao.selectList(new QueryWrapper<HttpTagEntity>() |
| | | .eq("http_api_code", code) |
| | | .orderByDesc("create_time")); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.http.dao.HttpTokenDao; |
| | | import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpTokenService; |
| | | import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
| | | import com.iailab.module.data.common.utils.HttpsRequest; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class HttpTokenServiceImpl extends ServiceImpl<HttpTokenDao, HttpTokenEntity> implements HttpTokenService { |
| | | |
| | | @Resource |
| | | private HttpsRequest httpsRequest; |
| | | |
| | | @Resource |
| | | private HttpTokenDao httpTokenDao; |
| | | |
| | | |
| | | @Override |
| | | public PageResult<HttpTokenEntity> queryPage(HttpTokenPageReqVO reqVO) { |
| | | return httpTokenDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public HttpTokenEntity info(String id) { |
| | | return httpTokenDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(HttpTokenEntity httpTokenEntity) { |
| | | httpTokenDao.insert(httpTokenEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(HttpTokenEntity httpTokenEntity) { |
| | | httpTokenDao.updateById(httpTokenEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | httpTokenDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<HttpTokenEntity> list() { |
| | | return httpTokenDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | @Override |
| | | public HttpTokenEntity getByApiId(String apiId) { |
| | | QueryWrapper<HttpTokenEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(apiId), "api_id", apiId); |
| | | return httpTokenDao.selectOne(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateToken(String clientId) { |
| | | Map<String, String> params = new HashMap<>(1); |
| | | params.put("timeout", "30000"); |
| | | HttpTokenEntity entity = httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); |
| | | Map<String, String> dataJson = new HashMap<>(2); |
| | | String url = entity.getLoginUrl(); |
| | | String userName = entity.getUsername(); |
| | | String password = entity.getPassword(); |
| | | String prvsetName = entity.getPrvsetName(); |
| | | String projectName = entity.getProjectName(); |
| | | String platform = entity.getPlatform(); |
| | | dataJson.put("username", userName); |
| | | dataJson.put("password", password); |
| | | dataJson.put("prvset_name", prvsetName); |
| | | dataJson.put("project_name", projectName); |
| | | dataJson.put("platform", platform); |
| | | //查询token的请求 |
| | | String responseStr = httpsRequest.doPostToken(url, params, JSONObject.toJSONString(dataJson), "utf-8"); |
| | | //插入token和更新时间 |
| | | entity.setToken(responseStr); |
| | | entity.setUpdateTime(new Date()); |
| | | httpTokenDao.update(entity, new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)); |
| | | } |
| | | |
| | | @Override |
| | | public String queryToken(String clientId) { |
| | | return httpTokenDao.selectOne(new QueryWrapper<HttpTokenEntity>().eq("client_id", clientId)).getToken(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - HttpApi分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HttpApiPageReqVO extends PageParam { |
| | | |
| | | private String name; |
| | | |
| | | private String code; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - KioDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class HttpApiRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String name; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String code; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String url; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String method; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String collectType; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String param; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String descp; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - HttpTag分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HttpTagPageReqVO extends PageParam { |
| | | |
| | | private String tagType; |
| | | |
| | | private String tagCode; |
| | | |
| | | private String tagName; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - KioDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class HttpTagRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "api编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("api编码") |
| | | private String httpApiCode; |
| | | |
| | | @Schema(description = "测点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点类型") |
| | | private String tagType; |
| | | |
| | | @Schema(description = "测点编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点编码") |
| | | private String tagCode; |
| | | |
| | | @Schema(description = "测点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点名称") |
| | | private String tagName; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - HttpToken分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HttpTokenPageReqVO extends PageParam { |
| | | |
| | | private String clientId; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.http.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "数据平台 - KioDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class HttpTokenRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String apiId; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String loginUrl; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String clientId; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String clientSecret; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String username; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String password; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String token; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String prvsetName; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String projectName; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private String platform; |
| | | |
| | | @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("") |
| | | private Date expireTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.collector; |
| | | |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.module.data.common.utils.TagUtils; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | private Map<String, KingIOClient> clientMap = new ConcurrentHashMap<>(); |
| | | |
| | | private Map<String, ChannelKioDeviceDTO> deviceMap = new HashMap<>(); |
| | | private Map<String, ChannelKioDeviceEntity> deviceMap = new HashMap<>(); |
| | | |
| | | public synchronized KingIOClient getClient(String sourceId) throws Exception { |
| | | if (!clientMap.containsKey(sourceId)) { |
| | | ChannelKioDeviceDTO deviceDto = channelKioDeviceService.get(sourceId); |
| | | deviceMap.put(sourceId, deviceDto); |
| | | KingIOClient kingIOClient = new KingIOClient(deviceDto.getInstanceName()); |
| | | ChannelKioDeviceEntity deviceEntity = channelKioDeviceService.info(sourceId); |
| | | deviceMap.put(sourceId, deviceEntity); |
| | | KingIOClient kingIOClient = new KingIOClient(deviceEntity.getInstanceName()); |
| | | clientMap.put(sourceId, kingIOClient); |
| | | if (!kingIOClient.login(deviceDto.getAddress(), deviceDto.getPort(), deviceDto.getUsername(), deviceDto.getPassword())) { |
| | | if (!kingIOClient.login(deviceEntity.getAddress(), deviceEntity.getPort(), deviceEntity.getUsername(), deviceEntity.getPassword())) { |
| | | throw new Exception("登录异常"); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.controller.admin; |
| | | |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.validation.ValidationUtils; |
| | | import com.iailab.framework.common.validation.group.AddGroup; |
| | | import com.iailab.framework.common.validation.group.DefaultGroup; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.module.data.channel.kio.vo.KioDevicePageReqVO; |
| | | import com.iailab.module.data.channel.kio.vo.KioDeviceRespVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import javax.annotation.Resource; |
| | | 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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月04日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/kio/device") |
| | |
| | | private ChannelKioDeviceService channelKioDeviceService; |
| | | |
| | | @GetMapping("page") |
| | | @Operation(summary = "分页") |
| | | @Parameters({ |
| | | @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
| | | @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
| | | @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
| | | @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
| | | }) |
| | | public CommonResult<PageData<ChannelKioDeviceDTO>> list(@RequestParam Map<String, Object> params) { |
| | | PageData<ChannelKioDeviceDTO> page = channelKioDeviceService.page(params); |
| | | return success(page); |
| | | public CommonResult<PageResult<KioDeviceRespVO>> list(@Valid KioDevicePageReqVO reqVO) { |
| | | PageResult<ChannelKioDeviceEntity> page = channelKioDeviceService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, KioDeviceRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | @GetMapping("/info/{id}") |
| | | @Operation(summary = "信息") |
| | | public CommonResult<ChannelKioDeviceDTO> get(@PathVariable("id") String id) { |
| | | ChannelKioDeviceDTO data = channelKioDeviceService.get(id); |
| | | return success(data); |
| | | public CommonResult<ChannelKioDeviceEntity> info(@PathVariable("id") String id) { |
| | | ChannelKioDeviceEntity info = channelKioDeviceService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Operation(summary = "保存") |
| | | public CommonResult save(@RequestBody ChannelKioDeviceDTO dto) { |
| | | //效验数据 |
| | | ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class); |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelKioDeviceEntity channelKioDeviceEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | dto.setId(id); |
| | | channelKioDeviceService.save(dto); |
| | | return new CommonResult(); |
| | | channelKioDeviceEntity.setId(id); |
| | | channelKioDeviceEntity.setCreateTime(new Date()); |
| | | channelKioDeviceService.add(channelKioDeviceEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改kio配置 |
| | | * |
| | | */ |
| | | @PutMapping |
| | | @Operation(summary = "修改") |
| | | public CommonResult update(@RequestBody ChannelKioDeviceDTO dto) { |
| | | //效验数据 |
| | | ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class); |
| | | channelKioDeviceService.update(dto); |
| | | return new CommonResult(); |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelKioDeviceEntity channelKioDeviceEntity) { |
| | | channelKioDeviceEntity.setUpdateTime(new Date()); |
| | | channelKioDeviceService.update(channelKioDeviceEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Operation(summary = "删除") |
| | | public CommonResult delete(@RequestBody String[] ids){ |
| | | channelKioDeviceService.delete(ids); |
| | | return new CommonResult(); |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelKioDeviceService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.controller.admin; |
| | | |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.validation.ValidationUtils; |
| | | import com.iailab.framework.common.validation.group.AddGroup; |
| | | import com.iailab.framework.common.validation.group.DefaultGroup; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioTagDTO; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioTagService; |
| | | import com.iailab.module.data.channel.kio.vo.KioTagPageReqVO; |
| | | import com.iailab.module.data.channel.kio.vo.KioTagRespVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import javax.annotation.Resource; |
| | | 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; |
| | | |
| | | /** |
| | | * 操作opcua tag配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年05月6日 17:44:00 |
| | | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/kio/tag") |
| | |
| | | * 分页查询tag |
| | | * */ |
| | | @GetMapping("page") |
| | | @Operation(summary = "分页") |
| | | @Parameters({ |
| | | @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
| | | @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
| | | @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
| | | @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
| | | }) |
| | | public CommonResult<PageData<ChannelKioTagDTO>> page(@RequestParam Map<String, Object> params){ |
| | | PageData<ChannelKioTagDTO> page = channelKioTagService.page(params); |
| | | return new CommonResult<PageData<ChannelKioTagDTO>>().setData(page); |
| | | public CommonResult<PageResult<KioTagRespVO>> page(@Valid KioTagPageReqVO reqVO){ |
| | | PageResult<ChannelKioTagEntity> page = channelKioTagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, KioTagRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | @GetMapping("/info/{id}") |
| | | @Operation(summary = "信息") |
| | | public CommonResult<ChannelKioTagDTO> get(@PathVariable("id") String id){ |
| | | ChannelKioTagDTO data= channelKioTagService.get(id); |
| | | return new CommonResult<ChannelKioTagDTO>().setData(data); |
| | | public CommonResult<ChannelKioTagEntity> info(@PathVariable("id") String id) { |
| | | ChannelKioTagEntity info = channelKioTagService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Operation(summary = "保存") |
| | | public CommonResult save(@RequestBody ChannelKioTagDTO entity){ |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | channelKioTagService.save(entity); |
| | | return new CommonResult(); |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelKioTagEntity channelKioTagEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelKioTagEntity.setId(id); |
| | | channelKioTagEntity.setCreateTime(new Date()); |
| | | channelKioTagService.add(channelKioTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | */ |
| | | @PutMapping |
| | | @Operation(summary = "修改") |
| | | public CommonResult update(@RequestBody ChannelKioTagDTO dto) { |
| | | //效验数据 |
| | | ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class); |
| | | channelKioTagService.update(dto); |
| | | return new CommonResult(); |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelKioTagEntity channelKioTagEntity) { |
| | | channelKioTagEntity.setUpdateTime(new Date()); |
| | | channelKioTagService.update(channelKioTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Operation(summary = "删除") |
| | | public CommonResult tagDelete(@RequestBody String[] ids) { |
| | | channelKioTagService.delete(ids); |
| | | return new CommonResult(); |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelKioTagService.delete(id); |
| | | return success(true); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | 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.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.vo.KioDevicePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月04日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelKioDeviceDao extends BaseDao<ChannelKioDeviceEntity> { |
| | | public interface ChannelKioDeviceDao extends BaseMapperX<ChannelKioDeviceEntity> { |
| | | |
| | | default PageResult<ChannelKioDeviceEntity> selectPage(KioDevicePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelKioDeviceEntity>() |
| | | .likeIfPresent(ChannelKioDeviceEntity::getInstanceName, reqVO.getInstanceName()) |
| | | .orderByDesc(ChannelKioDeviceEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | 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.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.channel.kio.vo.KioDevicePageReqVO; |
| | | import com.iailab.module.data.channel.kio.vo.KioTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月05日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelKioTagDao extends BaseDao<ChannelKioTagEntity> { |
| | | public interface ChannelKioTagDao extends BaseMapperX<ChannelKioTagEntity> { |
| | | default PageResult<ChannelKioTagEntity> selectPage(KioTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelKioTagEntity>() |
| | | .likeIfPresent(ChannelKioTagEntity::getTagName, reqVO.getTagName()) |
| | | .likeIfPresent(ChannelKioTagEntity::getDevice, reqVO.getDevice()) |
| | | .orderByDesc(ChannelKioTagEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.vo.KioDevicePageReqVO; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月04日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public interface ChannelKioDeviceService extends BaseService<ChannelKioDeviceEntity> { |
| | | public interface ChannelKioDeviceService{ |
| | | |
| | | PageData<ChannelKioDeviceDTO> page(Map<String, Object> params); |
| | | PageResult<ChannelKioDeviceEntity> queryPage(KioDevicePageReqVO reqVO); |
| | | |
| | | List<ChannelKioDeviceDTO> list(Map<String, Object> params); |
| | | ChannelKioDeviceEntity info(String id); |
| | | |
| | | ChannelKioDeviceDTO get(String id); |
| | | void add(ChannelKioDeviceEntity channelKioDeviceEntity); |
| | | |
| | | void save(ChannelKioDeviceDTO dto); |
| | | void update(ChannelKioDeviceEntity channelKioDeviceEntity); |
| | | |
| | | void update(ChannelKioDeviceDTO dto); |
| | | void delete(String id); |
| | | |
| | | void delete(String[] ids); |
| | | List<ChannelKioDeviceEntity> list(Map<String, Object> params); |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioTagDTO; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.channel.kio.vo.KioTagPageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月05日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public interface ChannelKioTagService extends BaseService<ChannelKioTagEntity> { |
| | | public interface ChannelKioTagService { |
| | | |
| | | PageData<ChannelKioTagDTO> page(Map<String, Object> params); |
| | | PageResult<ChannelKioTagEntity> queryPage(KioTagPageReqVO reqVO); |
| | | |
| | | ChannelKioTagDTO get(String id); |
| | | ChannelKioTagEntity info(String id); |
| | | |
| | | void save(ChannelKioTagDTO dto); |
| | | void add(ChannelKioTagEntity channelKioTagEntity); |
| | | |
| | | void update(ChannelKioTagDTO dto); |
| | | void update(ChannelKioTagEntity channelKioTagEntity); |
| | | |
| | | void delete(String[] ids); |
| | | List<ChannelKioTagDTO> getByDevice(String instanceName); |
| | | void delete(String id); |
| | | |
| | | ChannelKioTagDTO getByTagName(String tagName); |
| | | List<ChannelKioTagEntity> getByDevice(String device); |
| | | |
| | | ChannelKioTagEntity getByTagName(String tagName); |
| | | |
| | | void deleteByDeviceName(String name); |
| | | |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioTagService; |
| | | import com.iailab.module.data.channel.kio.dao.ChannelKioDeviceDao; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioTagService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.iailab.module.data.channel.kio.vo.KioDevicePageReqVO; |
| | | |
| | | import java.util.Arrays; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月04日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Service |
| | | public class ChannelKioDeviceServiceImpl extends BaseServiceImpl<ChannelKioDeviceDao, ChannelKioDeviceEntity> implements ChannelKioDeviceService { |
| | | public class ChannelKioDeviceServiceImpl extends ServiceImpl<ChannelKioDeviceDao, ChannelKioDeviceEntity> implements ChannelKioDeviceService { |
| | | |
| | | @Resource |
| | | private ChannelKioDeviceDao channelKioDeviceDao; |
| | | |
| | | @Resource |
| | | ChannelKioTagService channelKioTagService; |
| | | |
| | | |
| | | @Override |
| | | public PageData<ChannelKioDeviceDTO> page(Map<String, Object> params) { |
| | | IPage<ChannelKioDeviceEntity> page = baseDao.selectPage( |
| | | getPage(params, Constant.CREATE_TIME, false), |
| | | getWrapper(params) |
| | | ); |
| | | return getPageData(page, ChannelKioDeviceDTO.class); |
| | | public PageResult<ChannelKioDeviceEntity> queryPage(KioDevicePageReqVO reqVO) { |
| | | return channelKioDeviceDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelKioDeviceDTO> list(Map<String, Object> params) { |
| | | List<ChannelKioDeviceEntity> list = baseDao.selectList(getWrapper(params)); |
| | | return ConvertUtils.sourceToTarget(list, ChannelKioDeviceDTO.class); |
| | | } |
| | | |
| | | private QueryWrapper<ChannelKioDeviceEntity> getWrapper(Map<String, Object> params){ |
| | | String instanceName = (String)params.get("instanceName"); |
| | | QueryWrapper<ChannelKioDeviceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(instanceName), "instance_name", instanceName); |
| | | return wrapper; |
| | | public ChannelKioDeviceEntity info(String id) { |
| | | return channelKioDeviceDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ChannelKioDeviceDTO get(String id) { |
| | | ChannelKioDeviceEntity entity = baseDao.selectById(id); |
| | | return ConvertUtils.sourceToTarget(entity, ChannelKioDeviceDTO.class); |
| | | public void add(ChannelKioDeviceEntity channelKioDeviceEntity) { |
| | | channelKioDeviceDao.insert(channelKioDeviceEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void save(ChannelKioDeviceDTO dto) { |
| | | ChannelKioDeviceEntity entity = ConvertUtils.sourceToTarget(dto, ChannelKioDeviceEntity.class); |
| | | insert(entity); |
| | | public void update(ChannelKioDeviceEntity channelKioDeviceEntity) { |
| | | channelKioDeviceDao.updateById(channelKioDeviceEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(ChannelKioDeviceDTO dto) { |
| | | ChannelKioDeviceEntity entity = ConvertUtils.sourceToTarget(dto, ChannelKioDeviceEntity.class); |
| | | updateById(entity); |
| | | public void delete(String id) { |
| | | //先删除device下的tag |
| | | channelKioTagService.deleteByDeviceName(info(id).getInstanceName()); |
| | | |
| | | channelKioDeviceDao.deleteById(id); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delete(String[] ids) { |
| | | Arrays.asList(ids).forEach(id -> { |
| | | channelKioTagService.deleteByDeviceName(get(id).getInstanceName()); |
| | | }); |
| | | baseDao.deleteBatchIds(Arrays.asList(ids)); |
| | | public List<ChannelKioDeviceEntity> list(Map<String, Object> params) { |
| | | return channelKioDeviceDao.selectList(new QueryWrapper<ChannelKioDeviceEntity>().orderByAsc("instance_name")); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.kio.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.kio.dao.ChannelKioTagDao; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioTagDTO; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioTagService; |
| | | import com.iailab.module.data.channel.kio.vo.KioTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年06月05日 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ChannelKioTagServiceImpl extends BaseServiceImpl<ChannelKioTagDao, ChannelKioTagEntity> implements ChannelKioTagService { |
| | | public class ChannelKioTagServiceImpl extends ServiceImpl<ChannelKioTagDao, ChannelKioTagEntity> implements ChannelKioTagService { |
| | | @Resource |
| | | private ChannelKioTagDao channelKioTagDao; |
| | | |
| | | @Value("${iems.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Override |
| | | public PageData<ChannelKioTagDTO> page(Map<String, Object> params) { |
| | | IPage<ChannelKioTagEntity> page = baseDao.selectPage( |
| | | getPage(params, Constant.CREATE_TIME, false), |
| | | getWrapper(params) |
| | | ); |
| | | return getPageData(page, ChannelKioTagDTO.class); |
| | | public PageResult<ChannelKioTagEntity> queryPage(KioTagPageReqVO reqVO) { |
| | | return channelKioTagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public ChannelKioTagDTO get(String id) { |
| | | ChannelKioTagEntity entity = baseDao.selectById(id); |
| | | return ConvertUtils.sourceToTarget(entity, ChannelKioTagDTO.class); |
| | | public ChannelKioTagEntity info(String id) { |
| | | return channelKioTagDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void save(ChannelKioTagDTO dto) { |
| | | ChannelKioTagEntity entity = ConvertUtils.sourceToTarget(dto, ChannelKioTagEntity.class); |
| | | entity.setCreateTime(new Date()); |
| | | entity.setUpdateTime(new Date()); |
| | | insert(entity); |
| | | public void add(ChannelKioTagEntity channelKioTagEntity) { |
| | | channelKioTagDao.insert(channelKioTagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(ChannelKioTagDTO dto) { |
| | | ChannelKioTagEntity entity = ConvertUtils.sourceToTarget(dto, ChannelKioTagEntity.class); |
| | | entity.setUpdateTime(new Date()); |
| | | updateById(entity); |
| | | public void update(ChannelKioTagEntity channelKioTagEntity) { |
| | | channelKioTagDao.updateById(channelKioTagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String[] ids) { |
| | | baseDao.deleteBatchIds(Arrays.asList(ids)); |
| | | public void delete(String id) { |
| | | channelKioTagDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelKioTagDTO> getByDevice(String device) { |
| | | public List<ChannelKioTagEntity> getByDevice(String device) { |
| | | QueryWrapper<ChannelKioTagEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(device), "device", device) |
| | | .orderByAsc("tag_id"); |
| | | List<ChannelKioTagEntity> list = baseDao.selectList(wrapper); |
| | | return ConvertUtils.sourceToTarget(list, ChannelKioTagDTO.class); |
| | | wrapper.like("device", device); |
| | | wrapper.orderByAsc("tag_id"); |
| | | List<ChannelKioTagEntity> list = channelKioTagDao.selectList(wrapper); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public ChannelKioTagDTO getByTagName(String tagName) { |
| | | public ChannelKioTagEntity getByTagName(String tagName) { |
| | | QueryWrapper<ChannelKioTagEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("tag_name", tagName); |
| | | ChannelKioTagEntity entity = baseDao.selectOne(wrapper); |
| | | return ConvertUtils.sourceToTarget(entity, ChannelKioTagDTO.class); |
| | | ChannelKioTagEntity entity = channelKioTagDao.selectOne(wrapper); |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByDeviceName(String name) { |
| | | baseDao.delete(new QueryWrapper<ChannelKioTagEntity>().eq("device",name)); |
| | | channelKioTagDao.delete(new QueryWrapper<ChannelKioTagEntity>().eq("device",name)); |
| | | } |
| | | |
| | | private QueryWrapper<ChannelKioTagEntity> getWrapper(Map<String, Object> params){ |
| | | String tagName = (String) params.get("tagName"); |
| | | String device = (String) params.get("device"); |
| | | QueryWrapper<ChannelKioTagEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq(StringUtils.isNotBlank(device), "device", device); |
| | | wrapper.like(StringUtils.isNotBlank(tagName), "tag_name", tagName); |
| | | wrapper.orderByDesc("create_time"); |
| | | return wrapper; |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.kio.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 = "数据平台 - Kio分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class KioDevicePageReqVO extends PageParam { |
| | | |
| | | private String instanceName; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.kio.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 KioDeviceRespVO { |
| | | |
| | | @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 instanceName; |
| | | |
| | | @Schema(description = "IP地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("IP地址") |
| | | private String address; |
| | | |
| | | @Schema(description = "端口", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("端口") |
| | | private Integer port; |
| | | |
| | | @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 Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.kio.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 = "数据平台 - Kio分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class KioTagPageReqVO extends PageParam { |
| | | |
| | | private String tagName; |
| | | |
| | | private String device; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.kio.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 KioTagRespVO { |
| | | |
| | | @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 tagName; |
| | | |
| | | @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("数据类型") |
| | | private String dataType; |
| | | |
| | | @Schema(description = "顺序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("顺序号") |
| | | private Integer tagId; |
| | | |
| | | @Schema(description = "测点描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点描述") |
| | | private String tagDesc; |
| | | |
| | | @Schema(description = "是否可以tag", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("是否可以tag") |
| | | private Boolean enabled; |
| | | |
| | | @Schema(description = "关联设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("关联设备") |
| | | private String device; |
| | | |
| | | @Schema(description = "采集频率", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("采集频率") |
| | | private Integer samplingRate; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | package com.iailab.module.data.channel.modbus.controller.admin; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; |
| | | import javax.annotation.Resource; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * 操作modbus tag配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年04月25日 10:31:00 |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/modbus/tag") |
| | | public class ChannelModbusTagController { |
| | | @Resource |
| | | private ChannelModbusTagService channelModbusTagService; |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @GetMapping("/list") |
| | | public R tagList(@RequestParam Map<String, Object> params){ |
| | | PageUtils page = channelModbusTagService.queryPage(params); |
| | | |
| | | return R.ok().put("page", page); |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<ModBusTagRespVO>> list(@Valid ModBusTagPageReqVO reqVO) { |
| | | PageResult<ChannelModBusTagEntity> page = channelModbusTagService.queryPage(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, ModBusTagRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询tag详情 |
| | | * 根据id查询设备详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public R tagInfo(@PathVariable("id") String id){ |
| | | ChannelModBusTagEntity info= channelModbusTagService.info(Base64.decodeStr(id)); |
| | | return R.ok().put("data", info); |
| | | } |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param entity |
| | | */ |
| | | @PostMapping("/add") |
| | | public R tagAdd(@RequestBody ChannelModBusTagEntity entity){ |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | channelModbusTagService.add(entity); |
| | | return R.ok(); |
| | | public CommonResult<ChannelModBusTagEntity> info(@PathVariable("id") String id) { |
| | | ChannelModBusTagEntity info = channelModbusTagService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * 添加设备 |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @PostMapping("/update") |
| | | public R tagUpdate(@RequestBody ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModbusTagService.update(channelModBusTagEntity); |
| | | return R.ok(); |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody ChannelModBusTagEntity channelModBusTagEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelModBusTagEntity.setId(id); |
| | | channelModBusTagEntity.setCreateTime(new Date()); |
| | | channelModbusTagService.add(channelModBusTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * @param params |
| | | * 修改设备 |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @PostMapping("/delete") |
| | | public R tagDelete(@RequestBody Map<String, Object> params) { |
| | | String id = (String)params.get("id"); |
| | | channelModbusTagService.delete(id); |
| | | return R.ok(); |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModBusTagEntity.setUpdateTime(new Date()); |
| | | channelModbusTagService.update(channelModBusTagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | // /** |
| | | // * 导入 |
| | | // * |
| | | // * @param device |
| | | // * @param file |
| | | // * @return |
| | | // */ |
| | | // @PostMapping("/import/{device}") |
| | | // public R importTag(@PathVariable("device") String device, @RequestParam("file") MultipartFile file) { |
| | | // try { |
| | | // if (file.isEmpty()) { |
| | | // throw new RRException("上传文件不能为空"); |
| | | // } |
| | | // channelModbusTagService.importTag(device, file); |
| | | // } catch (Exception ex) { |
| | | // return R.error(ex.getMessage()); |
| | | // } |
| | | // return R.ok(); |
| | | // } |
| | | /** |
| | | * 删除设备 |
| | | * |
| | | * @param id |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelModbusTagService.delete(id); |
| | | return success(true); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.modbus.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.framework.tenant.core.db.dynamic.TenantDS; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年04月25日 15:12:00 |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelModBusTagDao extends BaseMapper<ChannelModBusTagEntity> { |
| | | public interface ChannelModBusTagDao extends BaseMapperX<ChannelModBusTagEntity> { |
| | | |
| | | void insertList(List<ChannelModBusTagEntity> list); |
| | | |
| | | String selectIdByName(@Param("name") String name); |
| | | default PageResult<ChannelModBusTagEntity> selectPage(ModBusTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelModBusTagEntity>() |
| | | .likeIfPresent(ChannelModBusTagEntity::getTagName, reqVO.getTagName()) |
| | | .likeIfPresent(ChannelModBusTagEntity::getAddress, reqVO.getAddress()) |
| | | .likeIfPresent(ChannelModBusTagEntity::getTagDesc, reqVO.getTagDesc()) |
| | | .likeIfPresent(ChannelModBusTagEntity::getDevice, reqVO.getDevice()) |
| | | .orderByDesc(ChannelModBusTagEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.modbus.service; |
| | | |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | public interface ChannelModbusTagService { |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | * @param reqVO |
| | | */ |
| | | PageUtils queryPage(Map<String, Object> params); |
| | | PageResult queryPage(ModBusTagPageReqVO reqVO); |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | |
| | | package com.iailab.module.data.channel.modbus.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.Query; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
| | | import com.iailab.module.data.channel.modbus.dao.ChannelModBusTagDao; |
| | | import com.iailab.module.data.channel.modbus.dto.ChannelModbusTagDTO; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity; |
| | | import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService; |
| | | import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Value("${iems.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @Override |
| | | public PageUtils queryPage(Map<String, Object> params) { |
| | | String tagName = (String) params.get("tagName"); |
| | | String address = (String) params.get("address"); |
| | | String tagDesc = (String) params.get("tagDesc"); |
| | | String device = (String) params.get("device"); |
| | | |
| | | IPage<ChannelModBusTagEntity> page = this.page( |
| | | new Query<ChannelModBusTagEntity>().getPage(params), |
| | | new QueryWrapper<ChannelModBusTagEntity>() |
| | | .like(StringUtils.isNotBlank(tagName), "tag_name", tagName) |
| | | .like(StringUtils.isNotBlank(address), "address", address) |
| | | .like(StringUtils.isNotBlank(tagDesc), "tag_desc", tagDesc) |
| | | .eq(StringUtils.isNotBlank(device), "device", device) |
| | | .orderByDesc("create_time") |
| | | ); |
| | | return new PageUtils(page); |
| | | public PageResult<ChannelModBusTagEntity> queryPage(ModBusTagPageReqVO reqVO) { |
| | | return channelModBusTagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public ChannelModBusTagEntity info(String id) { |
| | | return channelModBusTagDao.selectById(id); |
| | | } |
| | | |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @Override |
| | | public void add(ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModBusTagDao.insert(channelModBusTagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelModBusTagEntity |
| | | */ |
| | | @Override |
| | | public void update(ChannelModBusTagEntity channelModBusTagEntity) { |
| | | channelModBusTagDao.updateById(channelModBusTagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void delete(String id) { |
| | | channelModBusTagDao.deleteById(id); |
| | |
| | | return channelModBusTagDao.selectList(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * 查询全部 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChannelModbusTagDTO> selectAll() { |
| | | List<ChannelModBusTagEntity> entityList = baseMapper.selectList( |
| | |
| | | return ConvertUtils.sourceToTarget(entityList, ChannelModbusTagDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * listByIds |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChannelModBusTagEntity> listByIds(List<String> ids) { |
| | | return baseMapper.selectList(new QueryWrapper<ChannelModBusTagEntity>().in("id", ids)); |
| | | } |
| | | |
| | | /** |
| | | * deleteByDeviceName |
| | | * |
| | | * @param name |
| | | */ |
| | | @Override |
| | | public void deleteByDeviceName(String name) { |
| | | baseMapper.delete(new QueryWrapper<ChannelModBusTagEntity>().eq("device", name)); |
| | | } |
| | | |
| | | //TODO 使用easyExcel重写 |
| | | // /** |
| | | // * 导入Tag |
| | | // * |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.modbus.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月22日 |
| | | */ |
| | | @Schema(description = "数据平台 - ModeBus分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ModBusTagPageReqVO extends PageParam { |
| | | |
| | | private String tagName; |
| | | |
| | | private String address; |
| | | |
| | | private String tagDesc; |
| | | |
| | | private String device; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.modbus.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月27日 |
| | | */ |
| | | @Schema(description = "数据平台 - ModBusDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ModBusTagRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "tag名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("tag名称") |
| | | private String tagName; |
| | | |
| | | @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("数据类型") |
| | | private String dataType; |
| | | |
| | | @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("是否启用") |
| | | private Boolean enabled; |
| | | |
| | | @Schema(description = "大小端", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("大小端") |
| | | private String format; |
| | | |
| | | @Schema(description = "关联设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("关联设备") |
| | | private String device; |
| | | |
| | | @Schema(description = "Modbus地址 00001 ~49999", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("Modbus地址") |
| | | private String address; |
| | | |
| | | @Schema(description = "采集频率", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("采集频率") |
| | | private Integer samplingRate; |
| | | |
| | | @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("描述") |
| | | private String tagDesc; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcda.controller; |
| | | |
| | | 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.opcda.entity.ChannelOPCDADeviceEntity; |
| | | import com.iailab.module.data.channel.opcda.service.ChannelOPCDADeviceService; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDeviceRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * 操作opc ua配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年04月26日 10:33:00 |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/channel/opcda/device") |
| | | @RequestMapping("/data/channel/opcda/device") |
| | | public class ChannelOPCDADeviceController { |
| | | @Autowired |
| | | private ChannelOPCDADeviceService channelOPCDADeviceService; |
| | | |
| | | /** |
| | | * 分页查询opc da 配置 |
| | | * |
| | | * @param params |
| | | */ |
| | | @GetMapping("/list") |
| | | public R list(@RequestParam Map<String, Object> params) { |
| | | PageUtils page = channelOPCDADeviceService.queryPage(params); |
| | | |
| | | return R.ok().put("page", page); |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcDaDeviceRespVO>> list(@Valid OpcDaDevicePageReqVO reqVO) { |
| | | PageResult<ChannelOPCDADeviceEntity> page = channelOPCDADeviceService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcDaDeviceRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询opc da配置详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public R info(@PathVariable("id") String id) { |
| | | public CommonResult<ChannelOPCDADeviceEntity> info(@PathVariable("id") String id) { |
| | | ChannelOPCDADeviceEntity info = channelOPCDADeviceService.info(id); |
| | | return R.ok().put("data", info); |
| | | return success(info); |
| | | } |
| | | |
| | | /** |
| | | * 添加opc ua配置 |
| | | * |
| | | * @param channelOPCDADeviceEntity |
| | | */ |
| | | @PostMapping("/add") |
| | | public R add(@RequestBody ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
| | | public CommonResult<Boolean> add(@RequestBody ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelOPCDADeviceEntity.setId(id); |
| | | channelOPCDADeviceEntity.setCreateTime(new Date()); |
| | | channelOPCDADeviceService.add(channelOPCDADeviceEntity); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改opc ua配置 |
| | | * |
| | | * @param channelOPCDADeviceEntity |
| | | */ |
| | | @PostMapping("/update") |
| | | public R update(@RequestBody ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
| | | channelOPCDADeviceEntity.setUpdateTime(new Date()); |
| | | channelOPCDADeviceService.update(channelOPCDADeviceEntity); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除opc ua配置 |
| | | * |
| | | * @param params |
| | | */ |
| | | @PostMapping("/delete") |
| | | public R delete(@RequestBody Map<String, Object> params) { |
| | | String id = (String) params.get("id"); |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelOPCDADeviceService.delete(id); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcda.controller; |
| | | |
| | | 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.opcda.entity.ChannelOPCDATagEntity; |
| | | import com.iailab.module.data.channel.opcda.service.ChannelOPCDATagService; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaTagRespVO; |
| | | import com.iailab.module.data.common.exception.RRException; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.R; |
| | | import jodd.util.Base64; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Map; |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * 操作OPCDA tag配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年05月6日 17:44:00 |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/channel/opcda/tag") |
| | | @RequestMapping("/data/channel/opcda/tag") |
| | | public class ChannelOPCDATagController { |
| | | @Autowired |
| | | private ChannelOPCDATagService channelOPCDATagService; |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @GetMapping("/list") |
| | | public R tagList(@RequestParam Map<String, Object> params){ |
| | | PageUtils page = channelOPCDATagService.queryPage(params); |
| | | |
| | | return R.ok().put("page", page); |
| | | |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcDaTagRespVO>> list(@Valid OpcDaTagPageReqVO reqVO) { |
| | | PageResult<ChannelOPCDATagEntity> page = channelOPCDATagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcDaTagRespVO.class)); |
| | | } |
| | | /** |
| | | * 根据id查询tag详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public R tagInfo(@PathVariable("id") String id){ |
| | | ChannelOPCDATagEntity info= channelOPCDATagService.info(Base64.decodeToString(id)); |
| | | return R.ok().put("data", info); |
| | | public CommonResult<ChannelOPCDATagEntity> info(@PathVariable("id") String id) { |
| | | ChannelOPCDATagEntity info = channelOPCDATagService.info(id); |
| | | return success(info); |
| | | } |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param entity |
| | | */ |
| | | |
| | | @PostMapping("/add") |
| | | public R tagAdd(@RequestBody ChannelOPCDATagEntity entity){ |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | channelOPCDATagService.add(entity); |
| | | return R.ok(); |
| | | public CommonResult<Boolean> add(@RequestBody ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelOPCDATagEntity.setId(id); |
| | | channelOPCDATagEntity.setCreateTime(new Date()); |
| | | channelOPCDATagService.add(channelOPCDATagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelOPCDATagEntity |
| | | */ |
| | | @PostMapping("/update") |
| | | public R tagUpdate(@RequestBody ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | channelOPCDATagEntity.setUpdateTime(new Date()); |
| | | channelOPCDATagService.update(channelOPCDATagEntity); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * @param params |
| | | * |
| | | */ |
| | | @PostMapping("/delete") |
| | | public R tagDelete(@RequestBody Map<String, Object> params) { |
| | | String id = (String)params.get("id"); |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelOPCDATagService.delete(id); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 导入 |
| | | * |
| | | * @param serverId |
| | | * @param file |
| | | * @return |
| | | */ |
| | | @PostMapping("/import/{serverId}") |
| | | public R importTag(@PathVariable("serverId") String serverId, @RequestParam("file") MultipartFile file) { |
| | | public CommonResult<String> importTag(@PathVariable("serverId") String serverId, @RequestParam("file") MultipartFile file) { |
| | | try { |
| | | if (file.isEmpty()) { |
| | | throw new RRException("上传文件不能为空"); |
| | | } |
| | | channelOPCDATagService.importTag(serverId, file); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | ex.getMessage(); |
| | | } |
| | | return R.ok(); |
| | | return success("上传成功"); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcda.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.opcda.entity.ChannelOPCDADeviceEntity; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年04月26日 11:31:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelOPCDADeviceDao extends BaseMapper<ChannelOPCDADeviceEntity> { |
| | | public interface ChannelOPCDADeviceDao extends BaseMapperX<ChannelOPCDADeviceEntity> { |
| | | |
| | | default PageResult<ChannelOPCDADeviceEntity> selectPage(OpcDaDevicePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelOPCDADeviceEntity>() |
| | | .likeIfPresent(ChannelOPCDADeviceEntity::getServerName, reqVO.getServerName()) |
| | | .orderByDesc(ChannelOPCDADeviceEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcda.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.opcda.entity.ChannelOPCDATagEntity; |
| | | import com.iailab.module.data.channel.opcda.entity.ChannelOPCDATagEntity; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月8日 15:01:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelOPCDATagDao extends BaseMapper<ChannelOPCDATagEntity> { |
| | | public interface ChannelOPCDATagDao extends BaseMapperX<ChannelOPCDATagEntity> { |
| | | |
| | | default PageResult<ChannelOPCDATagEntity> selectPage(OpcDaTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelOPCDATagEntity>() |
| | | .likeIfPresent(ChannelOPCDATagEntity::getTagName, reqVO.getTagName()) |
| | | .likeIfPresent(ChannelOPCDATagEntity::getServerId, reqVO.getServerId()) |
| | | .orderByDesc(ChannelOPCDATagEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcda.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.opcda.dto.ChannelOPCDADeviceDTO; |
| | | import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public interface ChannelOPCDADeviceService { |
| | | /** |
| | | * 分页查询设备 |
| | | * |
| | | * @param params |
| | | */ |
| | | PageUtils queryPage(Map<String, Object> params); |
| | | /** |
| | | * 查询设备详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | |
| | | List<ChannelOPCDADeviceDTO> selectAll(); |
| | | |
| | | PageResult<ChannelOPCDADeviceEntity> queryPage(OpcDaDevicePageReqVO reqVO); |
| | | |
| | | ChannelOPCDADeviceEntity info(String id); |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<ChannelOPCDADeviceEntity> list(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 添加设备 |
| | | * |
| | | * @param channelOPCDADeviceEntity |
| | | */ |
| | | void add(ChannelOPCDADeviceEntity channelOPCDADeviceEntity); |
| | | /** |
| | | * 修改设备 |
| | | * |
| | | * @param channelOPCDADeviceEntity |
| | | */ |
| | | |
| | | void update(ChannelOPCDADeviceEntity channelOPCDADeviceEntity); |
| | | /** |
| | | * 删除设备 |
| | | * |
| | | * @param id |
| | | */ |
| | | |
| | | void delete(String id); |
| | | /** |
| | | * 查询全部设备 |
| | | * |
| | | */ |
| | | List<ChannelOPCDADeviceDTO> selectAll(); |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcda.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.opcda.dto.ChannelOPCDATagDTO; |
| | | import com.iailab.module.data.channel.opcda.entity.ChannelOPCDATagEntity; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public interface ChannelOPCDATagService { |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | PageUtils queryPage(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | | * @param id |
| | | * |
| | | */ |
| | | ChannelOPCDATagEntity info(String id); |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param channelOPCDATagEntity |
| | | */ |
| | | void add(ChannelOPCDATagEntity channelOPCDATagEntity); |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelOPCDATagEntity |
| | | */ |
| | | void update(ChannelOPCDATagEntity channelOPCDATagEntity); |
| | | /** |
| | | * 删除tag |
| | | * @param id |
| | | * |
| | | */ |
| | | void delete(String id); |
| | | |
| | | List<ChannelOPCDATagEntity> getByserverId(String serverId); |
| | | |
| | | |
| | | List<ChannelOPCDATagDTO> selectAll(); |
| | | |
| | | List<ChannelOPCDATagEntity> listByIds(List<String> ids); |
| | | |
| | | /** |
| | | * 通过serverId删除 |
| | | * |
| | | */ |
| | | void deleteByServerId(String serverId); |
| | | |
| | | /** |
| | | * 导入Tag |
| | | * |
| | | * @param serverId |
| | | * @param file |
| | | * @throws Exception |
| | | */ |
| | | void importTag(String serverId, MultipartFile file) throws Exception; |
| | | |
| | | PageResult<ChannelOPCDATagEntity> queryPage(OpcDaTagPageReqVO reqVO); |
| | | |
| | | ChannelOPCDATagEntity info(String id); |
| | | |
| | | void add(ChannelOPCDATagEntity channelOPCDATagEntity); |
| | | |
| | | void update(ChannelOPCDATagEntity channelOPCDATagEntity); |
| | | |
| | | void delete(String id); |
| | | } |
| | |
| | | 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.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.channel.opcda.dao.ChannelOPCDADeviceDao; |
| | | import com.iailab.module.data.channel.opcda.dto.ChannelOPCDADeviceDTO; |
| | | import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity; |
| | | import com.iailab.module.data.channel.opcda.service.ChannelOPCDADeviceService; |
| | | import com.iailab.module.data.channel.opcda.service.ChannelOPCDATagService; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.Query; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Service |
| | | public class ChannelOPCDADeviceServiceImpl extends ServiceImpl<ChannelOPCDADeviceDao, ChannelOPCDADeviceEntity> implements ChannelOPCDADeviceService { |
| | |
| | | |
| | | @Autowired |
| | | private ChannelOPCDATagService channelOPCDATagService; |
| | | /** |
| | | * 分页查询opc ua配置 |
| | | * |
| | | * @param params |
| | | */ |
| | | @Override |
| | | public PageUtils queryPage(Map<String, Object> params) { |
| | | String serverName = (String) params.get("serverName"); |
| | | |
| | | IPage<ChannelOPCDADeviceEntity> page = this.page( |
| | | new Query<ChannelOPCDADeviceEntity>().getPage(params), |
| | | new QueryWrapper<ChannelOPCDADeviceEntity>() |
| | | .like(StringUtils.isNotBlank(serverName), "server_name", serverName) |
| | | .orderByDesc("create_time") |
| | | ); |
| | | return new PageUtils(page); |
| | | @Override |
| | | public PageResult<ChannelOPCDADeviceEntity> queryPage(OpcDaDevicePageReqVO reqVO) { |
| | | return channelOPCDADeviceDao.selectPage(reqVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询opc ua配置详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public ChannelOPCDADeviceEntity info(String id) { |
| | | return channelOPCDADeviceDao.selectById(id); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChannelOPCDADeviceEntity> list(Map<String, Object> params) { |
| | | return channelOPCDADeviceDao.selectList(new QueryWrapper<ChannelOPCDADeviceEntity>().orderByAsc("server_name")); |
| | | } |
| | | |
| | | /** |
| | | * 添加opc ua配置 |
| | | * |
| | | * @param channelOPCDADeviceEntity |
| | | */ |
| | | @Override |
| | | public void add(ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
| | | channelOPCDADeviceDao.insert(channelOPCDADeviceEntity); |
| | | } |
| | | |
| | | /** |
| | | * 修改opc ua配置 |
| | | * |
| | | * @param channelOPCDADeviceEntity |
| | | */ |
| | | @Override |
| | | public void update(ChannelOPCDADeviceEntity channelOPCDADeviceEntity) { |
| | | channelOPCDADeviceDao.updateById(channelOPCDADeviceEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除opc ua配置 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void delete(String id) { |
| | | |
| | |
| | | package com.iailab.module.data.channel.opcda.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.channel.opcda.dao.ChannelOPCDATagDao; |
| | | import com.iailab.module.data.channel.opcda.dto.ChannelOPCDATagDTO; |
| | | import com.iailab.module.data.channel.opcda.entity.ChannelOPCDATagEntity; |
| | | import com.iailab.module.data.channel.opcda.service.ChannelOPCDATagService; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.Query; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.CellType; |
| | | import org.apache.poi.xssf.usermodel.XSSFRow; |
| | |
| | | import java.io.FileInputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Value("${iems.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @Override |
| | | public PageUtils queryPage(Map<String, Object> params) { |
| | | String tagName = (String) params.get("tagName"); |
| | | String serverId = (String) params.get("serverId"); |
| | | |
| | | IPage<ChannelOPCDATagEntity> page = this.page( |
| | | new Query<ChannelOPCDATagEntity>().getPage(params), |
| | | new QueryWrapper<ChannelOPCDATagEntity>() |
| | | .like(StringUtils.isNotBlank(tagName), "tag_name", tagName) |
| | | .eq(StringUtils.isNotBlank(serverId), "server_id", serverId) |
| | | .orderByDesc("create_time") |
| | | ); |
| | | return new PageUtils(page); |
| | | @Override |
| | | public PageResult<ChannelOPCDATagEntity> queryPage(OpcDaTagPageReqVO reqVO) { |
| | | return channelOPCDATagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public ChannelOPCDATagEntity info(String id) { |
| | | return channelOPCDATagDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void add(ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | channelOPCDATagDao.insert(channelOPCDATagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | channelOPCDATagDao.updateById(channelOPCDATagEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | channelOPCDATagDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCDATagDTO> selectAll() { |
| | | List<ChannelOPCDATagEntity> entityList = channelOPCDATagDao.selectList(null); |
| | | return ConvertUtils.sourceToTarget(entityList, ChannelOPCDATagDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCDATagEntity> listByIds(List<String> ids) { |
| | | return channelOPCDATagDao.selectList(new QueryWrapper<ChannelOPCDATagEntity>().in("id", ids)); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByServerId(String serverId) { |
| | | channelOPCDATagDao.delete(new QueryWrapper<ChannelOPCDATagEntity>().eq("server_id",serverId)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param channelOPCDATagEntity |
| | | */ |
| | | @Override |
| | | public void add(ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | channelOPCDATagDao.insert(channelOPCDATagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelOPCDATagEntity |
| | | */ |
| | | @Override |
| | | public void update(ChannelOPCDATagEntity channelOPCDATagEntity) { |
| | | channelOPCDATagDao.updateById(channelOPCDATagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void delete(String id) { |
| | | channelOPCDATagDao.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCDATagDTO> selectAll() { |
| | | |
| | | List<ChannelOPCDATagEntity> entityList = baseMapper.selectList( |
| | | null |
| | | ); |
| | | return ConvertUtils.sourceToTarget(entityList, ChannelOPCDATagDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCDATagEntity> listByIds(List<String> ids) { |
| | | return baseMapper.selectList(new QueryWrapper<ChannelOPCDATagEntity>().in("id", ids)); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByServerId(String serverId) { |
| | | baseMapper.delete(new QueryWrapper<ChannelOPCDATagEntity>().eq("server_id",serverId)); |
| | | } |
| | | |
| | | /** |
| | | * 导入Tag |
| | | * |
| | | * @param serverId |
| | | * @param file |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importTag(String serverId, MultipartFile file) throws Exception { |
| | |
| | | //getBaseMapper().insertList(dangerList); |
| | | dangerList.forEach(item -> { |
| | | try { |
| | | getBaseMapper().insert(item); |
| | | channelOPCDATagDao.insert(item); |
| | | } catch (Exception ex) { |
| | | log.warn("插入异常:" + item.getTagName()); |
| | | } |
| | |
| | | throw ex; |
| | | } |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcda.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 = "数据平台 - opcda分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class OpcDaDevicePageReqVO extends PageParam { |
| | | |
| | | private String serverName; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcda.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 = "数据平台 - opcdaDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class OpcDaDeviceRespVO { |
| | | |
| | | @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 serverName; |
| | | |
| | | @Schema(description = "IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("IP") |
| | | private String host; |
| | | |
| | | @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("用户名") |
| | | private String user; |
| | | |
| | | @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("密码") |
| | | private String password; |
| | | |
| | | @Schema(description = "设备名", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("设备名") |
| | | private String progId; |
| | | |
| | | @Schema(description = "设备注册表ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("设备注册表ID") |
| | | private String clsId; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcda.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 = "数据平台 - opcda分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class OpcDaTagPageReqVO extends PageParam { |
| | | |
| | | private String tagName; |
| | | |
| | | private String serverId; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcda.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 = "数据平台 - opcdaTag Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class OpcDaTagRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "服务ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("服务ID") |
| | | private String serverId; |
| | | |
| | | @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 = "itemID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("itemID") |
| | | private String itemId; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.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.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUADeviceService; |
| | | import javax.annotation.Resource; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDevicePageReqVO; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDeviceRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * 操作opc ua配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年04月26日 10:33:00 |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/opcua/device") |
| | |
| | | @Resource |
| | | private ChannelOPCUADeviceService channelOPCUADeviceService; |
| | | |
| | | /** |
| | | * 分页查询opc ua 配置 |
| | | * |
| | | * @param params |
| | | */ |
| | | @GetMapping("/list") |
| | | public R list(@RequestParam Map<String, Object> params) { |
| | | PageUtils page = channelOPCUADeviceService.queryPage(params); |
| | | |
| | | return R.ok().put("page", page); |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcUaDeviceRespVO>> list(@Valid OpcUaDevicePageReqVO reqVO) { |
| | | PageResult<ChannelOPCUADeviceEntity> page = channelOPCUADeviceService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcUaDeviceRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查询opc ua配置详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public R info(@PathVariable("id") String id) { |
| | | public CommonResult<ChannelOPCUADeviceEntity> info(@PathVariable("id") String id) { |
| | | ChannelOPCUADeviceEntity info = channelOPCUADeviceService.info(id); |
| | | return R.ok().put("data", info); |
| | | return success(info); |
| | | } |
| | | |
| | | /** |
| | | * 添加opc ua配置 |
| | | * |
| | | * @param channelOPCUADeviceEntity |
| | | */ |
| | | @PostMapping("/add") |
| | | public R add(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | public CommonResult<Boolean> add(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelOPCUADeviceEntity.setId(id); |
| | | channelOPCUADeviceService.add(channelOPCUADeviceEntity); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改opc ua配置 |
| | | * |
| | | * @param channelOPCUADeviceEntity |
| | | */ |
| | | @PostMapping("/update") |
| | | public R update(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | channelOPCUADeviceService.update(channelOPCUADeviceEntity); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除opc ua配置 |
| | | * |
| | | * @param params |
| | | */ |
| | | @PostMapping("/delete") |
| | | public R delete(@RequestBody Map<String, Object> params) { |
| | | String id = (String) params.get("id"); |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelOPCUADeviceService.delete(id); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | /** |
| | | * 上传安全证书 |
| | | * |
| | | * @param file |
| | | */ |
| | | @PostMapping("/upload") |
| | | public R uploadFile(@RequestParam("file") MultipartFile file) { |
| | | String fileName = file.getOriginalFilename(); |
| | | String filePath = ""; |
| | | try { |
| | | File dir = new File(filePath); |
| | | if (!dir.exists()) { |
| | | dir.mkdirs(); |
| | | } |
| | | File saveFile = new File(filePath + fileName); |
| | | file.transferTo(saveFile); |
| | | return R.ok().put("data",saveFile.getAbsolutePath()); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return R.error(); |
| | | } |
| | | } |
| | | // @PostMapping("/upload") |
| | | // public R uploadFile(@RequestParam("file") MultipartFile file) { |
| | | // String fileName = file.getOriginalFilename(); |
| | | // String filePath = ""; |
| | | // try { |
| | | // File dir = new File(filePath); |
| | | // if (!dir.exists()) { |
| | | // dir.mkdirs(); |
| | | // } |
| | | // File saveFile = new File(filePath + fileName); |
| | | // file.transferTo(saveFile); |
| | | // return R.ok().put("data",saveFile.getAbsolutePath()); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // return R.error(); |
| | | // } |
| | | // } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.controller.admin; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import com.iailab.module.data.common.exception.RRException; |
| | | 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.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService; |
| | | import javax.annotation.Resource; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagRespVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * 操作opcua tag配置 |
| | | * |
| | | * @author DongYukun |
| | | * @createTime 2023年05月6日 17:44:00 |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/data/channel/opcua/tag") |
| | | public class ChannelOPCUATagController { |
| | | @Resource |
| | | private ChannelOPCUATagService channelOpcuaTagService; |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @GetMapping("/list") |
| | | public R tagList(@RequestParam Map<String, Object> params){ |
| | | PageUtils page = channelOpcuaTagService.queryPage(params); |
| | | |
| | | return R.ok().put("page", page); |
| | | @GetMapping("page") |
| | | public CommonResult<PageResult<OpcUaTagRespVO>> list(@Valid OpcUaTagPageReqVO reqVO) { |
| | | PageResult<ChannelOPCUATagEntity> page = channelOpcuaTagService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, OpcUaTagRespVO.class)); |
| | | } |
| | | /** |
| | | * 根据id查询tag详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public R tagInfo(@PathVariable("id") String id){ |
| | | ChannelOPCUATagEntity info= channelOpcuaTagService.info(Base64.decodeStr(id)); |
| | | return R.ok().put("data", info); |
| | | public CommonResult<ChannelOPCUATagEntity> info(@PathVariable("id") String id) { |
| | | ChannelOPCUATagEntity info = channelOpcuaTagService.info(id); |
| | | return success(info); |
| | | } |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param entity |
| | | */ |
| | | |
| | | @PostMapping("/add") |
| | | public R tagAdd(@RequestBody ChannelOPCUATagEntity entity){ |
| | | entity.setId(UUID.randomUUID().toString()); |
| | | channelOpcuaTagService.add(entity); |
| | | return R.ok(); |
| | | public CommonResult<Boolean> add(@RequestBody ChannelOPCUATagEntity channelOPCUATagEntity) { |
| | | String id = UUID.randomUUID().toString(); |
| | | channelOPCUATagEntity.setId(id); |
| | | channelOPCUATagEntity.setCreateTime(new Date()); |
| | | channelOpcuaTagService.add(channelOPCUATagEntity); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelOPCUATagEntity |
| | | */ |
| | | @PostMapping("/update") |
| | | public R tagUpdate(@RequestBody ChannelOPCUATagEntity channelOPCUATagEntity) { |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody ChannelOPCUATagEntity channelOPCUATagEntity) { |
| | | channelOPCUATagEntity.setUpdateTime(new Date()); |
| | | channelOpcuaTagService.update(channelOPCUATagEntity); |
| | | return R.ok(); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * @param params |
| | | * |
| | | */ |
| | | @PostMapping("/delete") |
| | | public R tagDelete(@RequestBody Map<String, Object> params) { |
| | | String id = (String)params.get("id"); |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | channelOpcuaTagService.delete(id); |
| | | return R.ok(); |
| | | 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("上传文件不能为空"); |
| | | } |
| | | channelOpcuaTagService.importTag(device, file); |
| | | } catch (Exception ex) { |
| | | return R.error(ex.getMessage()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | // @PostMapping("/import/{device}") |
| | | // public R importTag(@PathVariable("device") String device, @RequestParam("file") MultipartFile file) { |
| | | // try { |
| | | // if (file.isEmpty()) { |
| | | // throw new RRException("上传文件不能为空"); |
| | | // } |
| | | // channelOpcuaTagService.importTag(device, file); |
| | | // } catch (Exception ex) { |
| | | // return R.error(ex.getMessage()); |
| | | // } |
| | | // return R.ok(); |
| | | // } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.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.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDevicePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年04月26日 11:31:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelOPCUADeviceDao extends BaseMapper<ChannelOPCUADeviceEntity> { |
| | | public interface ChannelOPCUADeviceDao extends BaseMapperX<ChannelOPCUADeviceEntity> { |
| | | |
| | | default PageResult<ChannelOPCUADeviceEntity> selectPage(OpcUaDevicePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelOPCUADeviceEntity>() |
| | | .likeIfPresent(ChannelOPCUADeviceEntity::getServerName, reqVO.getServerName())); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.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.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月8日 15:01:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface ChannelOPCUATagDao extends BaseMapper<ChannelOPCUATagEntity> { |
| | | public interface ChannelOPCUATagDao extends BaseMapperX<ChannelOPCUATagEntity> { |
| | | default PageResult<ChannelOPCUATagEntity> selectPage(OpcUaTagPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ChannelOPCUATagEntity>() |
| | | .likeIfPresent(ChannelOPCUATagEntity::getTagName, reqVO.getTagName()) |
| | | .likeIfPresent(ChannelOPCUATagEntity::getDevice, reqVO.getDevice()) |
| | | .orderByDesc(ChannelOPCUATagEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.service; |
| | | |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.opcua.dto.ChannelOPCUADeviceDTO; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUADeviceEntity; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDevicePageReqVO; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public interface ChannelOPCUADeviceService { |
| | | /** |
| | | * 分页查询设备 |
| | | * |
| | | * @param params |
| | | */ |
| | | PageUtils queryPage(Map<String, Object> params); |
| | | /** |
| | | * 查询设备详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | |
| | | PageResult<ChannelOPCUADeviceEntity> queryPage(OpcUaDevicePageReqVO reqVO); |
| | | |
| | | ChannelOPCUADeviceEntity info(String id); |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<ChannelOPCUADeviceEntity> list(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 添加设备 |
| | | * |
| | | * @param channelOPCUADeviceEntity |
| | | */ |
| | | void add(ChannelOPCUADeviceEntity channelOPCUADeviceEntity); |
| | | /** |
| | | * 修改设备 |
| | | * |
| | | * @param channelOPCUADeviceEntity |
| | | */ |
| | | |
| | | void update(ChannelOPCUADeviceEntity channelOPCUADeviceEntity); |
| | | /** |
| | | * 删除设备 |
| | | * |
| | | * @param id |
| | | */ |
| | | |
| | | void delete(String id); |
| | | /** |
| | | * 查询全部设备 |
| | | * |
| | | */ |
| | | |
| | | List<ChannelOPCUADeviceDTO> selectAll(); |
| | | |
| | | List<ChannelOPCUADeviceEntity> list(Map<String, Object> params); |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.service; |
| | | |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.channel.opcua.dto.ChannelOPCUATagDTO; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public interface ChannelOPCUATagService { |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | PageUtils queryPage(Map<String, Object> params); |
| | | PageResult<ChannelOPCUATagEntity> queryPage(OpcUaTagPageReqVO reqVO); |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | | * @param id |
| | | * |
| | | */ |
| | | ChannelOPCUATagEntity info(String id); |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param channelOPCUATagEntity |
| | | */ |
| | | |
| | | void add(ChannelOPCUATagEntity channelOPCUATagEntity); |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelOPCUATagEntity |
| | | */ |
| | | |
| | | void update(ChannelOPCUATagEntity channelOPCUATagEntity); |
| | | /** |
| | | * 删除tag |
| | | * @param id |
| | | * |
| | | */ |
| | | |
| | | void delete(String id); |
| | | |
| | | List<ChannelOPCUATagEntity> getByDevice(String device); |
| | | |
| | | |
| | | List<ChannelOPCUATagDTO> selectAll(); |
| | | |
| | | List<ChannelOPCUATagEntity> listByIds(List<String> ids); |
| | | |
| | | /** |
| | | * 通过deviceName删除 |
| | | * |
| | | */ |
| | | void deleteByDeviceName(String name); |
| | | |
| | | /** |
| | | * 导入Tag |
| | | * |
| | | * @param device |
| | | * @param file |
| | | * @throws Exception |
| | | */ |
| | | void importTag(String device, MultipartFile file) throws Exception; |
| | | |
| | | } |
| | |
| | | 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.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity; |
| | | import com.iailab.module.data.channel.opcda.vo.OpcDaDevicePageReqVO; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaDevicePageReqVO; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.Query; |
| | | import com.iailab.module.data.channel.opcua.dao.ChannelOPCUADeviceDao; |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Service |
| | | public class ChannelOPCUADeviceServiceImpl extends ServiceImpl<ChannelOPCUADeviceDao, ChannelOPCUADeviceEntity> implements ChannelOPCUADeviceService { |
| | |
| | | |
| | | @Resource |
| | | private ChannelOPCUATagService channelOPCUATagService; |
| | | /** |
| | | * 分页查询opc ua配置 |
| | | * |
| | | * @param params |
| | | */ |
| | | @Override |
| | | public PageUtils queryPage(Map<String, Object> params) { |
| | | String serverName = (String) params.get("serverName"); |
| | | |
| | | IPage<ChannelOPCUADeviceEntity> page = this.page( |
| | | new Query<ChannelOPCUADeviceEntity>().getPage(params), |
| | | new QueryWrapper<ChannelOPCUADeviceEntity>() |
| | | .like(StringUtils.isNotBlank(serverName), "server_name", serverName) |
| | | .orderByDesc("create_time") |
| | | ); |
| | | return new PageUtils(page); |
| | | @Override |
| | | public PageResult<ChannelOPCUADeviceEntity> queryPage(OpcUaDevicePageReqVO reqVO) { |
| | | return channelOPCUADeviceDao.selectPage(reqVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询opc ua配置详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public ChannelOPCUADeviceEntity info(String id) { |
| | | return channelOPCUADeviceDao.selectById(id); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChannelOPCUADeviceEntity> list(Map<String, Object> params) { |
| | | return channelOPCUADeviceDao.selectList(new QueryWrapper<ChannelOPCUADeviceEntity>().orderByAsc("server_name")); |
| | | } |
| | | |
| | | /** |
| | | * 添加opc ua配置 |
| | | * |
| | | * @param channelOPCUADeviceEntity |
| | | */ |
| | | @Override |
| | | public void add(ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | channelOPCUADeviceDao.insert(channelOPCUADeviceEntity); |
| | | } |
| | | |
| | | /** |
| | | * 修改opc ua配置 |
| | | * |
| | | * @param channelOPCUADeviceEntity |
| | | */ |
| | | @Override |
| | | public void update(ChannelOPCUADeviceEntity channelOPCUADeviceEntity) { |
| | | channelOPCUADeviceDao.updateById(channelOPCUADeviceEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除opc ua配置 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void delete(String id) { |
| | | |
| | |
| | | ); |
| | | return ConvertUtils.sourceToTarget(entityList, ChannelOPCUADeviceDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCUADeviceEntity> list(Map<String, Object> params) { |
| | | return channelOPCUADeviceDao.selectList(new QueryWrapper<ChannelOPCUADeviceEntity>().orderByAsc("server_name")); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.channel.opcua.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.common.utils.PageUtils; |
| | | import com.iailab.module.data.common.utils.Query; |
| | | import com.iailab.module.data.channel.opcua.dao.ChannelOPCUATagDao; |
| | | import com.iailab.module.data.channel.opcua.dto.ChannelOPCUATagDTO; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService; |
| | | import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.CellType; |
| | | import org.apache.poi.xssf.usermodel.XSSFRow; |
| | |
| | | import java.io.FileInputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author DongYukun |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2023年05月08日 15:04:00 |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Value("${iems.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | /** |
| | | * 分页查询tag |
| | | * |
| | | * @param params |
| | | */ |
| | | @Override |
| | | public PageUtils queryPage(Map<String, Object> params) { |
| | | String tagName = (String) params.get("tagName"); |
| | | String device = (String) params.get("device"); |
| | | |
| | | IPage<ChannelOPCUATagEntity> page = this.page( |
| | | new Query<ChannelOPCUATagEntity>().getPage(params), |
| | | new QueryWrapper<ChannelOPCUATagEntity>() |
| | | .like(StringUtils.isNotBlank(tagName), "tag_name", tagName) |
| | | .eq(StringUtils.isNotBlank(device), "device", device) |
| | | .orderByDesc("create_time") |
| | | ); |
| | | return new PageUtils(page); |
| | | public PageResult<ChannelOPCUATagEntity> queryPage(OpcUaTagPageReqVO reqVO) { |
| | | return channelOPCUATagDao.selectPage(reqVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询tag详情 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public ChannelOPCUATagEntity info(String id) { |
| | | return channelOPCUATagDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCUATagEntity> getByDevice(String device) { |
| | | QueryWrapper<ChannelOPCUATagEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("device", device).orderByDesc ("create_time"); |
| | | return channelOPCUATagDao.selectList(queryWrapper); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 添加tag |
| | | * |
| | | * @param channelOPCUATagEntity |
| | | */ |
| | | @Override |
| | | public void add(ChannelOPCUATagEntity channelOPCUATagEntity) { |
| | | channelOPCUATagDao.insert(channelOPCUATagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 修改tag |
| | | * |
| | | * @param channelOPCUATagEntity |
| | | */ |
| | | @Override |
| | | public void update(ChannelOPCUATagEntity channelOPCUATagEntity) { |
| | | channelOPCUATagDao.updateById(channelOPCUATagEntity); |
| | | } |
| | | |
| | | /** |
| | | * 删除tag |
| | | * |
| | | * @param id |
| | | */ |
| | | @Override |
| | | public void delete(String id) { |
| | | channelOPCUATagDao.deleteById(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ChannelOPCUATagEntity> getByDevice(String device) { |
| | | QueryWrapper<ChannelOPCUATagEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("device", device).orderByDesc ("create_time"); |
| | | return channelOPCUATagDao.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelOPCUATagDTO> selectAll() { |
| | | |
| | | List<ChannelOPCUATagEntity> entityList = baseMapper.selectList( |
| | | null |
| | | ); |
| | |
| | | baseMapper.delete(new QueryWrapper<ChannelOPCUATagEntity>().eq("device",name)); |
| | | } |
| | | |
| | | /** |
| | | * 导入Tag |
| | | * |
| | | * @param device |
| | | * @param file |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importTag(String device, MultipartFile file) throws Exception { |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcua.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 = "数据平台 - opcua分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class OpcUaDevicePageReqVO extends PageParam { |
| | | |
| | | private String serverName; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcua.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 = "数据平台 - opcuaDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class OpcUaDeviceRespVO { |
| | | |
| | | @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 serverName; |
| | | |
| | | @Schema(description = "端点URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("端点URL") |
| | | private String endpointUrl; |
| | | |
| | | @Schema(description = "安全策略", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("安全策略") |
| | | private String securityPolicy; |
| | | |
| | | @Schema(description = "安全模式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("安全模式") |
| | | private String securityMode; |
| | | |
| | | @Schema(description = "连接方式(0,匿名;1,用户名密码; 2,安全证书)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("连接方式") |
| | | private String connectionType; |
| | | |
| | | @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 certificatePath; |
| | | |
| | | @Schema(description = "设备不活动超时时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("设备不活动超时时间") |
| | | private Integer connectInactivityTimeout; |
| | | |
| | | @Schema(description = "重连超时", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("重连超时") |
| | | private Integer reconnectInterval; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcua.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 = "数据平台 - opcua分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class OpcUaTagPageReqVO extends PageParam { |
| | | |
| | | private String tagName; |
| | | |
| | | private String device; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.channel.opcua.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 = "数据平台 - opcuaTag Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class OpcUaTagRespVO { |
| | | |
| | | @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 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 Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | package com.iailab.module.data.channel.tag.controller; |
| | | |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioDeviceEntity; |
| | | import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity; |
| | | import com.iailab.module.data.common.enums.DataSourceType; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioDeviceDTO; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioDeviceService; |
| | | import com.iailab.module.data.channel.kio.service.ChannelKioTagService; |
| | | import com.iailab.module.data.channel.modbus.entity.ChannelModBusDeviceEntity; |
| | |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUADeviceService; |
| | | import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService; |
| | | import com.iailab.module.data.channel.tag.dto.TagOptionDTO; |
| | | import com.iailab.module.data.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.kio.dto.ChannelKioTagDTO; |
| | | import com.iailab.module.data.channel.http.entity.HttpApiEntity; |
| | | import com.iailab.module.data.channel.http.entity.HttpTagEntity; |
| | | import com.iailab.module.data.channel.http.service.HttpApiService; |
| | | import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity; |
| | | import com.iailab.module.data.http.service.HttpTagService; |
| | | import com.iailab.module.data.channel.http.service.HttpTagService; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | TagOptionDTO kioData = new TagOptionDTO(); |
| | | kioData.setValue(DataSourceType.KIO.getCode()); |
| | | kioData.setLabel(DataSourceType.KIO.getDesc()); |
| | | List<ChannelKioDeviceDTO> kioList = channelKioDeviceService.list(new HashMap<>()); |
| | | List<ChannelKioDeviceEntity> kioList = channelKioDeviceService.list(new HashMap<>()); |
| | | List<TagOptionDTO> kioDeviceOp = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(kioList)) { |
| | | kioList.forEach(item -> { |
| | | TagOptionDTO op1 = new TagOptionDTO(); |
| | | op1.setValue(item.getId()); |
| | | op1.setLabel(item.getInstanceName()); |
| | | List<ChannelKioTagDTO> tags = channelKioTagService.getByDevice(item.getInstanceName()); |
| | | List<ChannelKioTagEntity> tags = channelKioTagService.getByDevice(item.getInstanceName()); |
| | | List<TagOptionDTO> op2 = new ArrayList<>(); |
| | | tags.forEach(item1 -> { |
| | | TagOptionDTO op3 = new TagOptionDTO(); |
| | |
| | | import com.iailab.module.data.point.common.PointTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.http.collector.HttpCollectorForZxzk; |
| | | import com.iailab.module.data.channel.http.collector.HttpCollectorForZxzk; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; |
| | | import com.iailab.module.data.channel.modbus.collector.ModBusCollector; |
| | | import com.iailab.module.data.channel.opcua.collector.OpcUaCollector; |
| | |
| | | import com.iailab.module.data.point.common.PointDataTypeEnum; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.http.collector.HttpCollectorForZxzk; |
| | | import com.iailab.module.data.channel.http.collector.HttpCollectorForZxzk; |
| | | import com.iailab.module.data.influxdb.pojo.InfluxPointValuePOJO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import javax.annotation.Resource; |
| | |
| | | package com.iailab.module.data.point.controller.admin; |
| | | |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.validation.ValidationUtils; |
| | | import com.iailab.framework.common.validation.group.AddGroup; |
| | | import com.iailab.framework.common.validation.group.UpdateGroup; |
| | | import com.iailab.framework.common.validation.group.DefaultGroup; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.entity.DaPointEntity; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.point.vo.DaPointPageReqVO; |
| | | import com.iailab.module.data.point.vo.DaPointRespVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.Parameters; |
| | | import javax.annotation.Resource; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.validation.Valid; |
| | | |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年05月12日 |
| | | * @createTime 2024年09月2日 |
| | | */ |
| | | @Tag(name = "数据采集,测点") |
| | | @RestController |
| | |
| | | private DaPointService daPointService; |
| | | |
| | | @GetMapping("page") |
| | | @Operation(summary = "分页") |
| | | @Parameters({ |
| | | @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
| | | @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
| | | @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
| | | @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermission('data:point:query')") |
| | | public CommonResult<PageData<DaPointDTO>> page(@RequestParam Map<String, Object> params){ |
| | | PageData<DaPointDTO> page = daPointService.page(params); |
| | | |
| | | return success(page); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | @Operation(summary = "信息") |
| | | @PreAuthorize("@ss.hasPermission('data:point:query')") |
| | | public CommonResult<DaPointDTO> get(@PathVariable("id") String id){ |
| | | DaPointDTO data = daPointService.get(id); |
| | | |
| | | return new CommonResult<DaPointDTO>().setData(data); |
| | | public CommonResult<PageResult<DaPointRespVO>> page(@Valid DaPointPageReqVO reqVO){ |
| | | PageResult<DaPointEntity> page = daPointService.queryPage(reqVO); |
| | | return success(BeanUtils.toBean(page, DaPointRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "列表") |
| | | @PreAuthorize("@ss.hasPermission('data:point:query')") |
| | | public CommonResult<List<DaPointDTO>> list(@Valid @RequestParam Map<String, Object> params) { |
| | | List<DaPointDTO> list = daPointService.list(params); |
| | | return success(list); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Operation(summary = "保存") |
| | | @PreAuthorize("@ss.hasPermission('data:point:save')") |
| | | public CommonResult save(@RequestBody DaPointDTO dto){ |
| | | //效验数据 |
| | | ValidationUtils.validate(dto, AddGroup.class, DefaultGroup.class); |
| | | daPointService.add(dto); |
| | | |
| | | return new CommonResult(); |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<DaPointDTO> info(@PathVariable("id") String id){ |
| | | DaPointDTO info= daPointService.info(id); |
| | | return success(info); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Operation(summary = "修改") |
| | | @PreAuthorize("@ss.hasPermission('data:point:update')") |
| | | public CommonResult update(@RequestBody DaPointDTO dto){ |
| | | //效验数据 |
| | | ValidationUtils.validate(dto, UpdateGroup.class, DefaultGroup.class); |
| | | |
| | | daPointService.update(dto); |
| | | |
| | | return new CommonResult(); |
| | | @PostMapping("/add") |
| | | public CommonResult<Boolean> add(@RequestBody DaPointDTO daPointDTO){ |
| | | String id = UUID.randomUUID().toString(); |
| | | daPointDTO.setId(id); |
| | | daPointService.add(daPointDTO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Operation(summary = "删除") |
| | | @PreAuthorize("@ss.hasPermission('data:point:delete')") |
| | | public CommonResult delete(@RequestBody String[] ids){ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody DaPointDTO daPointDTO) { |
| | | daPointService.update(daPointDTO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(String[] ids) { |
| | | daPointService.delete(ids); |
| | | return new CommonResult(); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("pointNo") |
| | |
| | | @PutMapping("/enable") |
| | | @Operation(summary = "启用") |
| | | @Transactional |
| | | public CommonResult enable(@RequestBody String[] ids) { |
| | | public CommonResult<Boolean> enable(@RequestBody String[] ids) { |
| | | daPointService.enableByIds(ids); |
| | | return new CommonResult(); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/disable") |
| | | @Operation(summary = "禁用") |
| | | @Transactional |
| | | public CommonResult disable(@RequestBody String[] ids) { |
| | | public CommonResult<Boolean> disable(@RequestBody String[] ids) { |
| | | daPointService.disableByIds(ids); |
| | | return new CommonResult(); |
| | | return success(true); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.iailab.module.data.point.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | 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.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.entity.DaPointEntity; |
| | | import com.iailab.module.data.point.vo.DaPointPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2022年07月12日 13:47:00 |
| | | * @createTime 2024年09月2日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface DaPointDao extends BaseDao<DaPointEntity> { |
| | | public interface DaPointDao extends BaseMapperX<DaPointEntity> { |
| | | |
| | | IPage<DaPointDTO> getPageList(IPage<DaPointEntity> page, @Param("params") Map<String, Object> params); |
| | | |
| | |
| | | List<DaPointDTO> getMeasurePoint(Map<String, Object> params); |
| | | |
| | | List<DaPointDTO> getMathPoint(Map<String, Object> params); |
| | | |
| | | default PageResult<DaPointEntity> selectPage(DaPointPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<DaPointEntity>() |
| | | .likeIfPresent(DaPointEntity::getPointNo, reqVO.getPointNo()) |
| | | .likeIfPresent(DaPointEntity::getPointName, reqVO.getPointName()) |
| | | .orderByDesc(DaPointEntity::getCreateTime)); |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.data.point.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.entity.DaPointEntity; |
| | | import com.iailab.module.data.point.vo.DaPointPageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年05月12日 |
| | | * @createTime 2024年09月2日 |
| | | */ |
| | | public interface DaPointService extends BaseService<DaPointEntity> { |
| | | public interface DaPointService{ |
| | | PageResult<DaPointEntity> queryPage(DaPointPageReqVO reqVO); |
| | | |
| | | PageData<DaPointDTO> page(Map<String, Object> params); |
| | | DaPointDTO info(String id); |
| | | |
| | | DaPointDTO get(String id); |
| | | void add(DaPointDTO daPointDTO); |
| | | |
| | | void update(DaPointDTO daPointDTO); |
| | | |
| | | void delete(String[] id); |
| | | |
| | | |
| | | List<DaPointDTO> list(Map<String, Object> params); |
| | | |
| | | void add(DaPointDTO dataPoint); |
| | | |
| | | void update(DaPointDTO dataPoint); |
| | | |
| | | void delete(String[] ids); |
| | | |
| | | List<DaPointDTO> getConstantPoint(String freq); |
| | | |
| | |
| | | void disableByIds(String[] ids); |
| | | |
| | | void updateDefaultValue(DaPointDTO dto); |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.constant.Constant; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.common.enums.CommonConstant; |
| | | import com.iailab.module.data.common.enums.IsEnableEnum; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.data.point.common.IncreaseCodeEnum; |
| | | import com.iailab.module.data.point.dao.DaPointDao; |
| | | import com.iailab.module.data.point.service.DaMeasurePointService; |
| | | import com.iailab.module.data.point.common.PointTypeEnum; |
| | | import com.iailab.module.data.point.dao.DaPointDao; |
| | | import com.iailab.module.data.point.dto.DaMeasurePointDTO; |
| | | import com.iailab.module.data.point.dto.DaPointDTO; |
| | | import com.iailab.module.data.point.entity.DaPointEntity; |
| | | import com.iailab.module.data.point.service.DaMathPointService; |
| | | import com.iailab.module.data.point.service.DaMeasurePointService; |
| | | import com.iailab.module.data.point.service.DaPointService; |
| | | import com.iailab.module.data.point.service.DaSequenceNumService; |
| | | import com.iailab.module.data.point.vo.DaPointPageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年05月12日 |
| | | * @createTime 2024年09月2日 |
| | | */ |
| | | @Service |
| | | public class DaPointServiceImpl extends BaseServiceImpl<DaPointDao, DaPointEntity> implements DaPointService { |
| | | public class DaPointServiceImpl extends ServiceImpl<DaPointDao, DaPointEntity> implements DaPointService { |
| | | |
| | | @Resource |
| | | private DaMeasurePointService daMeasurePointService; |
| | |
| | | |
| | | @Resource |
| | | private DaSequenceNumService daSequenceNumService; |
| | | |
| | | @Resource |
| | | private DaPointDao daPointDao; |
| | | |
| | | |
| | | @Override |
| | | public PageData<DaPointDTO> page(Map<String, Object> params) { |
| | | IPage<DaPointDTO> page = baseDao.getPageList( |
| | | getPage(params, Constant.CREATE_TIME, false), |
| | | params |
| | | ); |
| | | return getPageData(page, DaPointDTO.class); |
| | | public PageResult<DaPointEntity> queryPage(DaPointPageReqVO reqVO) { |
| | | return daPointDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public DaPointDTO get(String id) { |
| | | DaPointEntity entity = baseDao.selectById(id); |
| | | public DaPointDTO info(String id) { |
| | | DaPointEntity entity = daPointDao.selectById(id); |
| | | DaPointDTO result = ConvertUtils.sourceToTarget(entity, DaPointDTO.class); |
| | | if (PointTypeEnum.MEASURE_POINT.getCode().equals(result.getPointType())) { |
| | | DaMeasurePointDTO measurePoint = daMeasurePointService.getByPoint(id); |
| | |
| | | .in(!CollectionUtils.isEmpty(pointNos),"point_no", pointNos) |
| | | .like(StringUtils.isNotBlank(pointNoLike), "point_no", pointNoLike) |
| | | .last("limit 1, 10"); |
| | | List<DaPointEntity> list = baseDao.selectList(queryWrapper); |
| | | List<DaPointEntity> list = daPointDao.selectList(queryWrapper); |
| | | return ConvertUtils.sourceToTarget(list, DaPointDTO.class); |
| | | } |
| | | |
| | |
| | | } |
| | | daPointEntity.setIsEnable(CommonConstant.IS_ENABLE); |
| | | daPointEntity.setCreateTime(new Date()); |
| | | baseDao.insert(daPointEntity); |
| | | daPointDao.insert(daPointEntity); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void update(DaPointDTO dataPoint) { |
| | | DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class); |
| | | daPointEntity.setUpdateTime(new Date()); |
| | | baseDao.updateById(daPointEntity); |
| | | daPointDao.updateById(daPointEntity); |
| | | if (PointTypeEnum.MEASURE_POINT.getName().equals(dataPoint.getPointType())) { |
| | | DaMeasurePointDTO measurePoint = dataPoint.getMeasurePoint(); |
| | | measurePoint.setSourceType(dataPoint.getSourceOption().get(0)); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void delete(String[] ids) { |
| | | baseDao.deleteBatchIds(Arrays.asList(ids)); |
| | | daPointDao.deleteBatchIds(Arrays.asList(ids)); |
| | | daMeasurePointService.deleteByPoint(ids); |
| | | daMathPointService.deleteByPoint(ids); |
| | | } |
| | |
| | | params.put("pointType", PointTypeEnum.CONSTANT.getCode()); |
| | | params.put("isEnable", CommonConstant.IS_ENABLE); |
| | | params.put("minfreqid", freq); |
| | | return baseDao.getConstantPoint(params); |
| | | return daPointDao.getConstantPoint(params); |
| | | } |
| | | |
| | | @Override |
| | |
| | | params.put("pointType", PointTypeEnum.CONSTANT.getCode()); |
| | | params.put("isEnable", CommonConstant.IS_ENABLE); |
| | | params.put("pointNos", pointNos); |
| | | return baseDao.getConstantPoint(params); |
| | | return daPointDao.getConstantPoint(params); |
| | | } |
| | | |
| | | @Override |
| | |
| | | params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode()); |
| | | params.put("isEnable", CommonConstant.IS_ENABLE); |
| | | params.put("minfreqid", freq); |
| | | return baseDao.getMeasurePoint(params); |
| | | return daPointDao.getMeasurePoint(params); |
| | | } |
| | | |
| | | @Override |
| | |
| | | params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode()); |
| | | params.put("isEnable", CommonConstant.IS_ENABLE); |
| | | params.put("pointNos", pointNos); |
| | | return baseDao.getMeasurePoint(params); |
| | | return daPointDao.getMeasurePoint(params); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode()); |
| | | params.put("pointNo", pointNo); |
| | | List<DaPointDTO> list = baseDao.getMeasurePoint(params); |
| | | List<DaPointDTO> list = daPointDao.getMeasurePoint(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | |
| | | params.put("pointType", PointTypeEnum.CALCULATE_POINT.getCode()); |
| | | params.put("isEnable", CommonConstant.IS_ENABLE); |
| | | params.put("minfreqid", freq); |
| | | return baseDao.getMathPoint(params); |
| | | return daPointDao.getMathPoint(params); |
| | | } |
| | | |
| | | @Override |
| | |
| | | params.put("pointType", PointTypeEnum.CALCULATE_POINT.getCode()); |
| | | params.put("isEnable", CommonConstant.IS_ENABLE); |
| | | params.put("pointNos", pointNos); |
| | | return baseDao.getMathPoint(params); |
| | | return daPointDao.getMathPoint(params); |
| | | } |
| | | |
| | | @Override |
| | | public DaPointDTO getByNo(String pointNo) { |
| | | QueryWrapper<DaPointEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("point_no", pointNo); |
| | | DaPointEntity entity = baseDao.selectOne(wrapper); |
| | | DaPointEntity entity = daPointDao.selectOne(wrapper); |
| | | return ConvertUtils.sourceToTarget(entity, DaPointDTO.class); |
| | | } |
| | | |
| | |
| | | public List<DaPointDTO> getByNos(List<String> pointNos) { |
| | | QueryWrapper<DaPointEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.in("point_no", pointNos); |
| | | List<DaPointEntity> list = baseDao.selectList(wrapper); |
| | | List<DaPointEntity> list = daPointDao.selectList(wrapper); |
| | | return ConvertUtils.sourceToTarget(list, DaPointDTO.class); |
| | | } |
| | | |
| | |
| | | wrapper.eq("point_no", dto.getPointNo()); |
| | | DaPointEntity entity = new DaPointEntity(); |
| | | entity.setDefaultValue(dto.getDefaultValue()); |
| | | baseDao.update(entity, wrapper); |
| | | daPointDao.update(entity, wrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | DaPointEntity entity = new DaPointEntity(); |
| | | entity.setId(item); |
| | | entity.setIsEnable(IsEnableEnum.ENABLE.value()); |
| | | baseDao.updateById(entity); |
| | | daPointDao.updateById(entity); |
| | | }); |
| | | } |
| | | |
| | |
| | | DaPointEntity entity = new DaPointEntity(); |
| | | entity.setId(item); |
| | | entity.setIsEnable(IsEnableEnum.DISABLE.value()); |
| | | baseDao.updateById(entity); |
| | | daPointDao.updateById(entity); |
| | | }); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.point.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年09月2日 |
| | | */ |
| | | @Schema(description = "数据平台 - DaPoint分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class DaPointPageReqVO extends PageParam { |
| | | |
| | | private String pointNo; |
| | | |
| | | private String pointName; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.data.point.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.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2024年09月2日 |
| | | */ |
| | | @Schema(description = "数据平台 - DaPoint Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class DaPointRespVO { |
| | | |
| | | @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 pointNo; |
| | | |
| | | @Schema(description = "测点名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点名称") |
| | | private String pointName; |
| | | |
| | | @Schema(description = "测点类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测点类型") |
| | | private String pointType; |
| | | |
| | | @Schema(description = "数据类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("数据类型") |
| | | private String dataType; |
| | | |
| | | @Schema(description = "值类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("值类型") |
| | | private String valueType; |
| | | |
| | | @Schema(description = "存储类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("存储类型") |
| | | private String storeType; |
| | | |
| | | @Schema(description = "测量单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("测量单位") |
| | | private String unit; |
| | | |
| | | @Schema(description = "单位转换", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("单位转换") |
| | | private BigDecimal unittransfactor; |
| | | |
| | | @Schema(description = "默认值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("默认值") |
| | | private BigDecimal defaultValue; |
| | | |
| | | @Schema(description = "最大值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("最大值") |
| | | private BigDecimal maxValue; |
| | | |
| | | @Schema(description = "最小值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("最小值") |
| | | private BigDecimal minValue; |
| | | |
| | | @Schema(description = "采集频率", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("采集频率") |
| | | private String minfreqid; |
| | | |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("备注") |
| | | private String remark; |
| | | |
| | | @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("是否启用") |
| | | private Integer isEnable; |
| | | |
| | | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
| | |
| | | <nacos.username>nacos</nacos.username> |
| | | <nacos.password>nacos</nacos.password> |
| | | <nacos.metadata.version>1.0.0</nacos.metadata.version> |
| | | <log.path>E:\DLUT\iailab-plat</log.path> |
| | | <log.path>D:\DLUT\iailab-plat</log.path> |
| | | <logstash.address>127.0.0.1:4560</logstash.address> |
| | | </properties> |
| | | <activation> |