潘志宝
2024-10-31 14cb329f0fec66711e3ddeba7e80db289c7fe8fc
测点列表.xlsx
已修改6个文件
145 ■■■■ 文件已修改
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dao/DaPointDao.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
@@ -100,7 +100,7 @@
    @PreAuthorize("@ss.hasPermission('data:point:query')")
    @GetMapping("pointNo")
    public CommonResult<List<DaPointDTO>> getpoint(@RequestParam Map<String, Object> params){
    public CommonResult<List<DaPointDTO>> getPoint(@RequestParam Map<String, Object> params) {
        List<DaPointDTO> list = daPointService.list(params);
        return new CommonResult<List<DaPointDTO>>().setData(list);
@@ -131,9 +131,14 @@
    public void exportPointList(@Validated DaPointPageReqVO exportReqVO,
                               HttpServletResponse response) throws IOException {
        exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
        List<DaPointEntity> list = daPointService.queryExcelList(exportReqVO).getList();
        List<DaPointExcelVO> daPointExcelVOlist = ConvertUtils.sourceToTarget(list,DaPointExcelVO.class);
        ExcelUtils.write(response, "测点列表.xls", "数据", DaPointExcelVO.class, daPointExcelVOlist);
        List<DaPointExcelVO> dataList = new ArrayList<>();
        List<DaPointDTO> measurePointList = daPointService.getMeasurePoint(exportReqVO);
        dataList.addAll(ConvertUtils.sourceToTarget(measurePointList, DaPointExcelVO.class));
        List<DaPointDTO> mathPointList = daPointService.getMathPoint(exportReqVO);
        dataList.addAll(ConvertUtils.sourceToTarget(mathPointList, DaPointExcelVO.class));
        List<DaPointDTO> constantPointList = daPointService.getConstantPoint(exportReqVO);
        dataList.addAll(ConvertUtils.sourceToTarget(constantPointList, DaPointExcelVO.class));
        ExcelUtils.write(response, "测点列表.xls", "测点列表", DaPointExcelVO.class, dataList);
    }
    @GetMapping("/exportValue")
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dao/DaPointDao.java
@@ -27,6 +27,8 @@
    IPage<DaPointDTO> getPageList(IPage<DaPointEntity> page, @Param("params") DaPointPageReqVO reqVO);
    List<DaPointDTO> getList(DaPointPageReqVO reqVO);
    List<DaPointDTO> getConstantPoint(Map<String, Object> params);
    List<DaPointDTO> getMeasurePoint(Map<String, Object> params);
@@ -35,13 +37,9 @@
    default IPage<DaPointDTO> selectPageList(DaPointPageReqVO reqVO) {
        return getPageList(getPage(reqVO), reqVO);
    };
    default PageResult<DaPointEntity> selectExcelList(DaPointPageReqVO reqVO) {
        return selectPage(reqVO,new QueryWrapper<>());
    }
    default DaPointEntity selectByPointName(String pointName){
        return selectOne("point_name", pointName);
    };
    }
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointService.java
@@ -57,5 +57,11 @@
    PointImportRespVO importPointList(List<PointImportExcelVO> importPoints, boolean isUpdateSupport);
    PageResult<DaPointEntity> queryExcelList(DaPointPageReqVO exportReqVO);
    List<DaPointDTO> getList(DaPointPageReqVO exportReqVO);
    List<DaPointDTO> getConstantPoint(DaPointPageReqVO reqVO);
    List<DaPointDTO> getMeasurePoint(DaPointPageReqVO reqVO);
    List<DaPointDTO> getMathPoint(DaPointPageReqVO reqVO);
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -109,11 +109,17 @@
        if (params.get("pointNos") != null) {
            pointNos = JSONArray.parseArray(JSONArray.toJSONString(params.get("pointNos")), String.class);
        }
        List<String> pointTypes = new ArrayList<>();
        if (params.get("pointTypes") != null) {
            pointTypes = Arrays.asList(params.get("pointTypes").toString().split(","));
        }
        Object pointNoLike = params.get("pointNoLike");
        QueryWrapper<DaPointEntity> queryWrapper = new QueryWrapper();
        queryWrapper.eq(!ObjectUtils.isEmpty(pointType), "point_type", pointType);
        queryWrapper.in(pointNos.size() != 0,"point_no", pointNos);
        queryWrapper.like(!ObjectUtils.isEmpty(pointNoLike), "point_no", pointNoLike);
        queryWrapper.in(pointTypes.size() != 0,"point_type", pointTypes);
        List<DaPointEntity> list = daPointDao.selectList(queryWrapper);
        return ConvertUtils.sourceToTarget(list, DaPointDTO.class);
    }
@@ -167,6 +173,15 @@
    }
    @Override
    public List<DaPointDTO> getConstantPoint(DaPointPageReqVO reqVO) {
        Map<String, Object> params = new HashMap<>();
        params.put("pointType", PointTypeEnum.CONSTANT.getCode());
        params.put("pointNo", reqVO.getPointNo());
        params.put("pointName", reqVO.getPointName());
        return daPointDao.getConstantPoint(params);
    }
    @Override
    public List<DaPointDTO> getConstantPoint(String freq) {
        Map<String, Object> params = new HashMap<>();
        params.put("pointType", PointTypeEnum.CONSTANT.getCode());
@@ -182,6 +197,16 @@
        params.put("isEnable", CommonConstant.IS_ENABLE);
        params.put("pointNos", pointNos);
        return daPointDao.getConstantPoint(params);
    }
    @Override
    public List<DaPointDTO> getMeasurePoint(DaPointPageReqVO reqVO) {
        Map<String, Object> params = new HashMap<>();
        params.put("pointType", PointTypeEnum.MEASURE_POINT.getCode());
        params.put("pointNo", reqVO.getPointNo());
        params.put("pointName", reqVO.getPointName());
        params.put("sourceName", reqVO.getSourceName());
        return daPointDao.getMeasurePoint(params);
    }
    @Override
@@ -212,6 +237,15 @@
            return null;
        }
        return list.get(0);
    }
    @Override
    public List<DaPointDTO> getMathPoint(DaPointPageReqVO reqVO) {
        Map<String, Object> params = new HashMap<>();
        params.put("pointType", PointTypeEnum.CALCULATE_POINT.getCode());
        params.put("pointNo", reqVO.getPointNo());
        params.put("pointName", reqVO.getPointName());
        return daPointDao.getMathPoint(params);
    }
    @Override
@@ -311,10 +345,8 @@
    }
    @Override
    public PageResult<DaPointEntity> queryExcelList(DaPointPageReqVO exportReqVO) {
        return daPointDao.selectExcelList(exportReqVO);
    public List<DaPointDTO> getList(DaPointPageReqVO exportReqVO) {
        return daPointDao.getList(exportReqVO);
    }
    @Override
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/vo/DaPointExcelVO.java
@@ -69,11 +69,15 @@
    @ExcelProperty("数据源类型")
    private String sourceType;
    @Schema(description = "数据源ID")
    @ExcelProperty("数据源ID")
    private String sourceId;
    @Schema(description = "数据源名称")
    @ExcelProperty("数据源名称")
    private String sourceName;
    @Schema(description = "测点Tag")
    @ExcelProperty("测点Tag")
    private String tagNo;
    @Schema(description = "计算公式")
    @ExcelProperty("计算公式")
    private String expression;
}
iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
@@ -68,6 +68,71 @@
        order by t1.create_time desc
    </select>
    <select id="getList" resultType="com.iailab.module.data.point.dto.DaPointDTO">
        select
        t1.id,
        t1.point_no,
        t1.point_name,
        t1.point_type ,
        t1.data_type,
        t1.unit,
        t1.unittransfactor,
        t1.default_value,
        t1.max_value,
        t1.min_value,
        t1.minfreqid,
        t1.remark,
        t1.is_enable,
        t1.creator,
        t1.create_time,
        t1.updater,
        t1.update_time,
        t2.source_type,
        t3.source_name,
        t2.tag_no,
        t2.dimension,
        t2.value_type
        from t_da_point t1
        left join t_da_measure_point t2 on t2.point_id = t1.id
        left join (
        select id source_id,server_name source_name
        from t_channel_opcua_device
        union
        select id source_id, name source_name
        from t_channel_modbus_device
        union
        select id source_id, code source_name
        from t_http_api
        union
        select id source_id, instance_name source_name
        from t_channel_kio_device
        ) t3 on t3.source_id = t2.source_id
        <where>
            <if test="pointNo != null and pointNo != ''">
                and t1.point_no like concat('%', #{pointNo}, '%')
            </if>
            <if test="pointName != null and pointName != ''">
                and t1.point_name like concat('%', #{pointName}, '%')
            </if>
            <if test="pointType != null and pointType != ''">
                and t1.point_type = #{pointType}
            </if>
            <if test="dataType != null and dataType != ''">
                and t1.data_type = #{dataType}
            </if>
            <if test="sourceName != null and sourceName != ''">
                and t3.source_name like concat('%', #{sourceName}, '%')
            </if>
            <if test="tagNo != null and tagNo != ''">
                and t2.tag_no like concat('%', #{tagNo}, '%')
            </if>
            <if test="isEnable != null ">
                and t1.is_enable = #{isEnable}
            </if>
        </where>
        order by t1.create_time desc
    </select>
    <select id="getConstantPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
        SELECT
        t1.point_no,
@@ -145,6 +210,7 @@
            </if>
        </where>
    </select>
    <select id="getMathPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
        SELECT
        t1.point_no,