潘志宝
2024-11-29 0ed8ac1f3171e0d43d07f0c1bac32fc3712bd15b
累计点配置
已修改8个文件
已添加5个文件
267 ■■■■■ 文件已修改
iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IncreaseCodeEnum.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/common/PointTypeEnum.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dao/DaCumulatePointDao.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaCumulatePointDTO.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaCumulatePointEntity.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaCumulatePointService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | 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/DaCumulatePointServiceImpl.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql
@@ -386,4 +386,16 @@
                           `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                           PRIMARY KEY (id) USING BTREE,
                           UNIQUE INDEX `uk_item_no` (`item_no`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '计划数据项';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '计划数据项';
CREATE TABLE t_da_cumulate_point(
                                   `id` VARCHAR(36) NOT NULL  COMMENT 'ID' ,
                                   `point_id` VARCHAR(36)   COMMENT '测点ID' ,
                                   `point_no` VARCHAR(36)   COMMENT '瞬时测点' ,
                                   `length` int COMMENT '累计长度',
                                   `divisor` int COMMENT '除数',
                                   PRIMARY KEY (id) USING BTREE,
                                   UNIQUE KEY `uk_point_id` (`point_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '累计点表';
INSERT INTO `iailab_expert_tenant_shasteel`.`t_da_sequence_num` (`id`, `code`, `name`, `sequence_num`, `prefix`) VALUES ('8', 'POINT_L', '累计点编码', 100001, 'L');
INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1657, 4, '累计点', 'CUMULATE', 'data_point_type', 0, '', '', '', '142', '2024-11-29 10:13:12', '142', '2024-11-29 10:13:12', b'0');
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IncreaseCodeEnum.java
@@ -7,5 +7,5 @@
 * @date 2021年05月24日 9:41
 */
public enum IncreaseCodeEnum {
    POINT_M, POINT_C, POINT_F, IND_A, IND_D, IND_C, PLAN;
    POINT_M, POINT_C, POINT_F, POINT_L, IND_A, IND_D, IND_C, PLAN;
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/common/PointTypeEnum.java
@@ -12,7 +12,8 @@
public enum PointTypeEnum {
    MEASURE_POINT("MEASURE", "测量点"),
    CALCULATE_POINT("CALCULATE", "计算点"),
    CONSTANT("CONSTANT", "常量点");
    CONSTANT("CONSTANT", "常量点"),
    CUMULATE("CUMULATE", "累计点");
    private String code;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dao/DaCumulatePointDao.java
对比新文件
@@ -0,0 +1,16 @@
package com.iailab.module.data.point.dao;
import com.iailab.framework.common.dao.BaseDao;
import com.iailab.framework.tenant.core.db.dynamic.TenantDS;
import com.iailab.module.data.point.entity.DaCumulatePointEntity;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年11月28日
 */
@TenantDS
@Mapper
public interface DaCumulatePointDao extends BaseDao<DaCumulatePointEntity> {
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaCumulatePointDTO.java
对比新文件
@@ -0,0 +1,39 @@
package com.iailab.module.data.point.dto;
import com.iailab.framework.common.validation.group.AddGroup;
import com.iailab.framework.common.validation.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年11月28日
 */
@Data
@Tag(name = "累计点表")
public class DaCumulatePointDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Schema(description = "id")
    @Null(message="{id.null}", groups = AddGroup.class)
    @NotNull(message="{id.require}", groups = UpdateGroup.class)
    private String id;
    @Schema(description = "测点ID", required = true)
    private String pointId;
    @Schema(description = "瞬时测点", required = true)
    private String pointNo;
    @Schema(description = "累计长度", required = true)
    private Integer length;
    @Schema(description = "除数", required = true)
    private Integer divisor;
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java
@@ -115,4 +115,7 @@
    @Schema(description = "测量点")
    private DaMeasurePointDTO measurePoint;
    @Schema(description = "累计点")
    private DaCumulatePointDTO cumulatePoint;
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaCumulatePointEntity.java
对比新文件
@@ -0,0 +1,47 @@
package com.iailab.module.data.point.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
 * 累计点表
 *
 * @author PanZhibao
 * @Description
 * @createTime 2024年11月28日
 */
@Data
@TableName("t_da_cumulate_point")
public class DaCumulatePointEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * id
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;
    /**
     * 测点ID
     */
    private String pointId;
    /**
     * 累计测点
     */
    private String pointNo;
    /**
     * 累计长度
     */
    private Integer length;
    /**
     * 除数
     */
    private Integer divisor;
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaCumulatePointService.java
对比新文件
@@ -0,0 +1,23 @@
package com.iailab.module.data.point.service;
import com.iailab.framework.common.service.BaseService;
import com.iailab.module.data.point.dto.DaCumulatePointDTO;
import com.iailab.module.data.point.entity.DaCumulatePointEntity;
/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年11月28日
 */
public interface DaCumulatePointService extends BaseService<DaCumulatePointEntity> {
    void add(DaCumulatePointDTO dto, String pointId);
    DaCumulatePointDTO getByPoint(String pointId);
    void update(DaCumulatePointDTO dto);
    void deleteBatch(String[] ids);
    void deleteByPoint(String[] ids);
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java
@@ -1,9 +1,7 @@
package com.iailab.module.data.point.service;
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.module.data.common.utils.PageUtils;
import com.iailab.module.data.point.dto.DaPointDTO;
import com.iailab.module.data.point.entity.DaPointEntity;
import com.iailab.module.data.point.vo.*;
import java.util.List;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaCumulatePointServiceImpl.java
对比新文件
@@ -0,0 +1,55 @@
package com.iailab.module.data.point.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iailab.framework.common.service.impl.BaseServiceImpl;
import com.iailab.framework.common.util.object.ConvertUtils;
import com.iailab.module.data.point.dao.DaCumulatePointDao;
import com.iailab.module.data.point.dto.DaCumulatePointDTO;
import com.iailab.module.data.point.entity.DaCumulatePointEntity;
import com.iailab.module.data.point.service.DaCumulatePointService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
/**
 * @author PanZhibao
 * @Description
 * @createTime 2024年11月28日
 */
@Service
public class DaCumulatePointServiceImpl extends BaseServiceImpl<DaCumulatePointDao, DaCumulatePointEntity> implements DaCumulatePointService {
    @Override
    public void add(DaCumulatePointDTO dto, String pointId) {
        DaCumulatePointEntity entity = ConvertUtils.sourceToTarget(dto, DaCumulatePointEntity.class);
        entity.setPointId(pointId);
        baseDao.insert(entity);
    }
    @Override
    public DaCumulatePointDTO getByPoint(String pointId) {
        QueryWrapper<DaCumulatePointEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("point_id", pointId);
        DaCumulatePointEntity entity = baseDao.selectOne(wrapper);
        return ConvertUtils.sourceToTarget(entity, DaCumulatePointDTO.class);
    }
    @Override
    public void update(DaCumulatePointDTO dto) {
        DaCumulatePointEntity entity = ConvertUtils.sourceToTarget(dto, DaCumulatePointEntity.class);
        this.updateById(entity);
    }
    @Override
    public void deleteBatch(String[] ids) {
        baseDao.deleteBatchIds(Arrays.asList(ids));
    }
    @Override
    public void deleteByPoint(String[] ids) {
        QueryWrapper<DaCumulatePointEntity> wrapper = new QueryWrapper<>();
        wrapper.in("point_id", Arrays.asList(ids));
        baseDao.delete(wrapper);
    }
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -15,18 +15,18 @@
import com.iailab.module.data.common.enums.IncreaseCodeEnum;
import com.iailab.module.data.point.common.PointTypeEnum;
import com.iailab.module.data.point.dao.DaPointDao;
import com.iailab.module.data.point.dto.DaCumulatePointDTO;
import com.iailab.module.data.point.dto.DaMathPointDTO;
import com.iailab.module.data.point.dto.DaMeasurePointDTO;
import com.iailab.module.data.point.dto.DaPointDTO;
import com.iailab.module.data.point.entity.DaMeasurePointEntity;
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.service.*;
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 org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -46,13 +46,16 @@
@Service
public class DaPointServiceImpl extends ServiceImpl<DaPointDao, DaPointEntity> implements DaPointService {
    @Resource
    @Autowired
    private DaMeasurePointService daMeasurePointService;
    @Resource
    @Autowired
    private DaMathPointService daMathPointService;
    @Resource
    @Autowired
    private DaCumulatePointService daCumulatePointService;
    @Autowired
    private DaSequenceNumService daSequenceNumService;
    
    @Resource
@@ -80,16 +83,27 @@
    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);
            result.setMeasurePoint(measurePoint);
            List<String> sourceOption = new ArrayList<>();
            sourceOption.add(measurePoint.getSourceType());
            sourceOption.add(measurePoint.getSourceId());
            sourceOption.add(measurePoint.getTagNo());
            result.setSourceOption(sourceOption);
        } else if (PointTypeEnum.CALCULATE_POINT.getCode().equals(result.getPointType())) {
            result.setMathPoint(daMathPointService.getByPoint(id));
        result.setMeasurePoint(new DaMeasurePointDTO());
        result.setMathPoint(new DaMathPointDTO());
        result.setCumulatePoint(new DaCumulatePointDTO());
        switch (PointTypeEnum.getEumByCode(result.getPointType())) {
            case MEASURE_POINT:
                DaMeasurePointDTO measurePoint = daMeasurePointService.getByPoint(id);
                result.setMeasurePoint(measurePoint);
                List<String> sourceOption = new ArrayList<>();
                sourceOption.add(measurePoint.getSourceType());
                sourceOption.add(measurePoint.getSourceId());
                sourceOption.add(measurePoint.getTagNo());
                result.setSourceOption(sourceOption);
                break;
            case CALCULATE_POINT:
                result.setMathPoint(daMathPointService.getByPoint(id));
                break;
            case CUMULATE:
                result.setCumulatePoint(daCumulatePointService.getByPoint(id));
                break;
            default:
                break;
        }
        return result;
    }
@@ -157,6 +171,10 @@
            case CONSTANT:
                daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_F.name()));
                break;
            case CUMULATE:
                daCumulatePointService.add(dataPoint.getCumulatePoint(), daPointEntity.getId());
                daPointEntity.setPointNo(daSequenceNumService.getAndIncreaseByCode(IncreaseCodeEnum.POINT_L.name()));
                break;
            default:
                break;
        }
@@ -185,6 +203,9 @@
            case CALCULATE_POINT:
                daMathPointService.update(dataPoint.getMathPoint());
                break;
            case CUMULATE:
                daCumulatePointService.update(dataPoint.getCumulatePoint());
                break;
            default:
                break;
        }
iailab-module-data/iailab-module-data-biz/src/main/resources/application-local.yml
@@ -145,9 +145,10 @@
influx-db:
  org: IAILab
  bucket: whs_data
  token: gxhXM4H1VOBv07kYXKWyPag_zJ8_oChP4ooZ3u-BkSae9LS8R1wWzJYlmUjL3Qe9t1hDU3DtoYD5HTgjWoTGOg==
  url: http://localhost:8086
  token: 50m9Kl-7_tvJY9kejwgSwxQpVG258EKKRt4qZeDntRnWetHGpkBhYtOOXrd9gmh85cuikKFZMzkTsw9pm1xlcA==
  url: http://127.0.0.1:8086
  username: root
  password: root123456
iems:
  upload-dir: D:/DLUT/upload/
iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
@@ -211,6 +211,7 @@
      - t_plan_data_set
      - t_plan_item_category
      - t_plan_item
      - t_da_cumulate_point
  app:
    app-key: data
    app-secret: 85b0df7edc3df3611913df34ed695011