iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java
@@ -14,6 +14,7 @@ import com.iailab.module.data.channel.tag.vo.TagExportExcelVO; import com.iailab.module.data.channel.tag.vo.TagImportExcelVO; import com.iailab.module.data.channel.tag.vo.TagImportRespVO; import com.iailab.module.data.common.enums.IsEnableEnum; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -108,7 +109,7 @@ public void importTemplate(HttpServletResponse response) throws IOException { // 手动创建导出 demo List<TagImportExcelVO> list = Collections.singletonList( TagImportExcelVO.builder().tagName("Tag名称").tagDesc("Tag描述").dataType("String").enabled(1) TagImportExcelVO.builder().tagName("Tag名称").tagDesc("Tag描述").dataType("String").enabled(IsEnableEnum.ENABLE.getCode()) .build() ); // 输出 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java
@@ -14,6 +14,7 @@ import com.iailab.module.data.channel.tag.vo.TagExportExcelVO; import com.iailab.module.data.channel.tag.vo.TagImportExcelVO; import com.iailab.module.data.channel.tag.vo.TagImportRespVO; import com.iailab.module.data.common.enums.IsEnableEnum; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -102,7 +103,7 @@ public void importTemplate(HttpServletResponse response) throws IOException { // 手动创建导出 demo List<TagImportExcelVO> list = Collections.singletonList( TagImportExcelVO.builder().tagName("Tag名称").tagDesc("Tag描述").dataType("String").enabled(1) TagImportExcelVO.builder().tagName("Tag名称").tagDesc("Tag描述").dataType("String").enabled(IsEnableEnum.ENABLE.getCode()) .build() ); // 输出 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java
@@ -14,6 +14,7 @@ import com.iailab.module.data.channel.modbus.vo.ModBusTagPageReqVO; import com.iailab.module.data.channel.modbus.vo.ModBusTagRespVO; import com.iailab.module.data.channel.tag.vo.TagImportRespVO; import com.iailab.module.data.common.enums.IsEnableEnum; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -118,7 +119,7 @@ // 手动创建导出 demo List<ModBusTagImportExcelVO> list = Collections.singletonList( ModBusTagImportExcelVO.builder().tagName("Tag名称").tagDesc("Tag描述").dataType("String"). address("123").format("1").samplingRate(1000).enabled(1) address("123").format("1").samplingRate(1000).enabled(IsEnableEnum.ENABLE.getCode()) .build() ); // 输出 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
@@ -14,6 +14,7 @@ import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO; import com.iailab.module.data.channel.opcda.vo.OpcDaTagRespVO; import com.iailab.module.data.channel.tag.vo.TagImportRespVO; import com.iailab.module.data.common.enums.IsEnableEnum; import com.iailab.module.data.common.exception.RRException; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -116,7 +117,7 @@ public void importTemplate(HttpServletResponse response) throws IOException { // 手动创建导出 demo List<OpcDaTagImportExcelVO> list = Collections.singletonList( OpcDaTagImportExcelVO.builder().tagName("Tag名称").dataType("String").enabled(1) OpcDaTagImportExcelVO.builder().tagName("Tag名称").dataType("String").enabled(IsEnableEnum.ENABLE.getCode()) .build() ); // 输出 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java
@@ -14,6 +14,7 @@ import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO; import com.iailab.module.data.channel.opcua.vo.OpcUaTagRespVO; import com.iailab.module.data.channel.tag.vo.TagImportRespVO; import com.iailab.module.data.common.enums.IsEnableEnum; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -101,7 +102,7 @@ public void importTemplate(HttpServletResponse response) throws IOException { // 手动创建导出 demo List<OpcUaTagImportExcelVO> list = Collections.singletonList( OpcUaTagImportExcelVO.builder().tagName("Tag名称").dataType("String").address("123").samplingRate(1000).enabled(1) OpcUaTagImportExcelVO.builder().tagName("Tag名称").dataType("String").address("123").samplingRate(1000).enabled(IsEnableEnum.ENABLE.getCode()) .build() ); // 输出 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/DataTypeEnum.java
@@ -12,11 +12,12 @@ @AllArgsConstructor public enum DataTypeEnum { INT("int"), INT("int","整型"), FLOAT("float"), FLOAT("float","浮点型"), BOOLEAN("boolean"); BOOLEAN("boolean", "布尔型"); private String code; private String desc; } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IsEnableEnum.java
@@ -1,21 +1,20 @@ package com.iailab.module.data.common.enums; import lombok.AllArgsConstructor; import lombok.Getter; /** * @author PanZhibao * @Description * @createTime 2023年07月17日 17:41:00 */ @Getter @AllArgsConstructor public enum IsEnableEnum { DISABLE(0), // 手动 ENABLE(1); //自动 DISABLE(0, "否"), ENABLE(1, "是"); private Integer value; private Integer code; private String desc; IsEnableEnum(Integer value) { this.value = value; } public Integer value() { return this.value; } } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
@@ -1,6 +1,5 @@ package com.iailab.module.data.point.controller.admin; import com.fasterxml.jackson.annotation.JsonFormat; import com.iailab.framework.apilog.core.annotation.ApiAccessLog; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageParam; @@ -8,11 +7,12 @@ import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.framework.excel.core.util.ExcelUtils; import com.iailab.module.data.api.dto.ApiPointValueQueryDTO; import com.iailab.module.data.channel.common.service.ChannelSourceService; import com.iailab.module.data.common.enums.DataSourceType; import com.iailab.module.data.common.enums.DataTypeEnum; import com.iailab.module.data.common.enums.MeasureValueType; import com.iailab.module.data.influxdb.service.InfluxDBService; import com.iailab.module.data.point.common.PointTypeEnum; 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.*; import io.swagger.v3.oas.annotations.Operation; @@ -34,8 +34,8 @@ import java.text.SimpleDateFormat; import java.util.*; import static com.iailab.framework.common.pojo.CommonResult.success; import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static com.iailab.framework.common.pojo.CommonResult.success; /** @@ -180,14 +180,14 @@ public void importTemplate(HttpServletResponse response) throws IOException { // 手动创建导出 demo List<PointImportExcelVO> list = Arrays.asList( PointImportExcelVO.builder().pointName("测点1").pointType("MEASURE").dataType("float").valueType("SIMULATE") PointImportExcelVO.builder().pointName("测点1").pointType(PointTypeEnum.MEASURE_POINT.getCode()).dataType(DataTypeEnum.FLOAT.getCode()).valueType(MeasureValueType.SIMULATE.getCode()) .storeType(null).unit("t(非必填)").unittransfactor(new BigDecimal(1)).defaultValue(new BigDecimal(0)).maxValue(new BigDecimal(10000000.000000)).minValue(new BigDecimal(0)) .minfreqid("1min").remark("备注(非必填)").sourceType(DataSourceType.HTTP.getCode()) .sourceName("").tagNo("SARD1200G00102RC001") .build() ); // 输出 ExcelUtils.write(response, "测点导入模板.xlsx", "测点列表", PointImportExcelVO.class, list); ExcelUtils.write(response, "测点导入模板.xlsx", "测点列表", PointImportExcelVO.class, list,true); } @PostMapping("/import") iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -1,19 +1,14 @@ package com.iailab.module.data.point.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.annotations.VisibleForTesting; import com.iailab.framework.common.exception.ServiceException; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.framework.datapermission.core.util.DataPermissionUtils; import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; import com.iailab.module.data.channel.common.service.ChannelSourceService; import com.iailab.module.data.common.enums.CommonConstant; import com.iailab.module.data.common.enums.IsEnableEnum; @@ -28,21 +23,20 @@ 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.*; import com.iailab.module.data.point.vo.DaPointPageReqVO; import com.iailab.module.data.point.vo.PointImportExcelVO; import com.iailab.module.data.point.vo.PointImportRespVO; import com.iailab.module.infra.api.config.ConfigApi; import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.util.*; import com.iailab.module.data.enums.ErrorCodeConstants; import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.iailab.module.data.enums.ErrorCodeConstants.*; import static com.iailab.module.data.enums.ErrorCodeConstants.POINT_EXISTS; import static com.iailab.module.data.enums.ErrorCodeConstants.POINT_IMPORT_LIST_IS_EMPTY; /** * @author lirm @@ -389,7 +383,7 @@ Arrays.asList(ids).forEach(item -> { DaPointEntity entity = new DaPointEntity(); entity.setId(item); entity.setIsEnable(IsEnableEnum.ENABLE.value()); entity.setIsEnable(IsEnableEnum.ENABLE.getCode()); daPointDao.updateById(entity); }); } @@ -402,7 +396,7 @@ Arrays.asList(ids).forEach(item -> { DaPointEntity entity = new DaPointEntity(); entity.setId(item); entity.setIsEnable(IsEnableEnum.DISABLE.value()); entity.setIsEnable(IsEnableEnum.DISABLE.getCode()); daPointDao.updateById(entity); }); } iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java
@@ -1,6 +1,9 @@ package com.iailab.module.data.point.vo; import com.alibaba.excel.annotation.ExcelProperty; import com.iailab.framework.excel.core.annotations.DictFormat; import com.iailab.framework.excel.core.annotations.ExcelColumnSelect; import com.iailab.framework.excel.core.convert.DictConvert; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; @@ -26,10 +29,14 @@ @ExcelProperty("测点名称") private String pointName; @ExcelProperty("测点类型") @ExcelProperty(value = "测点类型", converter = DictConvert.class) @ExcelColumnSelect(dictType = "data_point_type") @DictFormat("data_point_type") private String pointType; @ExcelProperty("数据类型") @ExcelProperty(value = "数据类型", converter = DictConvert.class) @ExcelColumnSelect(dictType = "point_data_type") @DictFormat("point_data_type") private String dataType; @ExcelProperty("存储类型") @@ -57,7 +64,9 @@ @ExcelProperty("备注") private String remark; @ExcelProperty("数据源类型") @ExcelProperty(value = "数据源类型", converter = DictConvert.class) @ExcelColumnSelect(dictType = "data_source_type") @DictFormat("data_source_type") private String sourceType; @ExcelProperty("数据源名称") @@ -69,7 +78,9 @@ @ExcelProperty("平滑尺度") private Integer dimension; @ExcelProperty("值类型") @ExcelProperty(value = "值类型", converter = DictConvert.class) @ExcelColumnSelect(dictType = "measure_value_type") @DictFormat("measure_value_type") private String valueType; @ExcelProperty("计算公式")