潘志宝
2024-12-03 eb1c5f3213739999b0c32e66946cd5f5d1c3b1e1
累计点导入
已修改6个文件
62 ■■■■ 文件已修改
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application-dev.yaml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
@@ -137,6 +137,8 @@
        dataList.addAll(ConvertUtils.sourceToTarget(mathPointList, DaPointExcelVO.class));
        List<DaPointDTO> constantPointList = daPointService.getConstantPoint(exportReqVO);
        dataList.addAll(ConvertUtils.sourceToTarget(constantPointList, DaPointExcelVO.class));
        List<DaPointDTO> cumulatePointList = daPointService.getCumulatePoint(exportReqVO);
        dataList.addAll(ConvertUtils.sourceToTarget(cumulatePointList, DaPointExcelVO.class));
        ExcelUtils.write(response, "测点列表.xls", "测点列表", DaPointExcelVO.class, dataList);
    }
@@ -193,7 +195,6 @@
            @Parameter(name = "file", description = "Excel 文件", required = true),
            @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
    })
//    @PreAuthorize("@ss.hasPermission('data:point:import')")
    public CommonResult<PointImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
                                                       @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
        List<PointImportExcelVO> list = ExcelUtils.read(file, PointImportExcelVO.class);
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java
@@ -45,6 +45,8 @@
    List<DaPointDTO> getCumulatePoint(String freq);
    List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO);
    DaPointDTO getByNo(String pointNo);
    List<DaPointDTO> getByNos(List<String> pointNos);
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -215,10 +215,11 @@
    @Override
    @DSTransactional(rollbackFor = Exception.class)
    public void delete(String[] id) {
        daPointDao.deleteBatchIds(Arrays.asList(id));
        daMeasurePointService.deleteByPoint(id);
        daMathPointService.deleteByPoint(id);
    public void delete(String[] ids) {
        daPointDao.deleteBatchIds(Arrays.asList(ids));
        daMeasurePointService.deleteByPoint(ids);
        daMathPointService.deleteByPoint(ids);
        daCumulatePointService.deleteByPoint(ids);
        // 清空缓存
        clearCache();
    }
@@ -319,10 +320,19 @@
    @Override
    public List<DaPointDTO> getCumulatePoint(String freq) {
        Map<String, Object> params = new HashMap<>();
        Map<String, Object> params = new HashMap<>(3);
        params.put("pointType", PointTypeEnum.CUMULATE.getCode());
        params.put("isEnable", CommonConstant.IS_ENABLE);
        params.put("minfreqid", freq);
        return daPointDao.getCumulatePoint(params);
    }
    @Override
    public List<DaPointDTO> getCumulatePoint(DaPointPageReqVO reqVO) {
        Map<String, Object> params = new HashMap<>(3);
        params.put("pointType", PointTypeEnum.CUMULATE.getCode());
        params.put("pointNo", reqVO.getPointNo());
        params.put("pointName", reqVO.getPointName());
        return daPointDao.getCumulatePoint(params);
    }
@@ -395,6 +405,13 @@
                    case CONSTANT:
                        daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name()));
                        break;
                    case CUMULATE:
                        DaCumulatePointDTO cumulatePoint = new DaCumulatePointDTO();
                        cumulatePoint.setMomentPoint(importPoint.getMomentPoint());
                        cumulatePoint.setLength(importPoint.getLength());
                        cumulatePoint.setDivisor(importPoint.getDivisor());
                        daCumulatePointService.add(cumulatePoint, daPointEntity.getId());
                        daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name()));
                    default:
                        break;
                }
@@ -418,9 +435,6 @@
            measurePoint.setSourceId(sourcesIdMap.get(importPoint.getSourceType()).get(importPoint.getSourceName()));
            measurePoint.setTagNo(importPoint.getTagNo());
            daMeasurePointService.update(measurePoint, new QueryWrapper<DaMeasurePointEntity>().eq("point_id",updatePoint.getId()));
            respVO.getUpdatePointnames().add(importPoint.getPointName());
        });
        return respVO;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java
@@ -84,4 +84,16 @@
    @Schema(description = "计算公式")
    @ExcelProperty("计算公式")
    private String expression;
    @Schema(description = "瞬时测点")
    @ExcelProperty("瞬时测点")
    private String momentPoint;
    @Schema(description = "累计长度")
    @ExcelProperty("累计长度")
    private Integer length;
    @Schema(description = "除数")
    @ExcelProperty("除数")
    private Integer divisor;
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/PointImportExcelVO.java
@@ -86,4 +86,13 @@
    @ExcelProperty("计算公式")
    private String expression;
    @ExcelProperty("瞬时测点")
    private String momentPoint;
    @ExcelProperty("累计长度")
    private Integer length;
    @ExcelProperty("除数")
    private Integer divisor;
}
iailab-module-data/iailab-module-data-biz/src/main/resources/application-dev.yaml
@@ -54,10 +54,10 @@
spring:
  # RabbitMQ 配置项,对应 RabbitProperties 配置类
  rabbitmq:
    host: 172.16.8.200 # RabbitMQ 服务的地址
    host: 127.0.0.1 # RabbitMQ 服务的地址
    port: 5672 # RabbitMQ 服务的端口
    username: admin # RabbitMQ 服务的账号
    password: admin123 # RabbitMQ 服务的密码
    username: guest # RabbitMQ 服务的账号
    password: guest # RabbitMQ 服务的密码
  # Kafka 配置项,对应 KafkaProperties 配置类
  kafka:
    bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔