From daa7c1b49bec0e07aa94ffedcb410ddeed2f4c61 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 21 一月 2025 10:26:19 +0800 Subject: [PATCH] 取水统合数据功能部分实现 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeRemote.java | 49 +++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseCtrl.java | 64 ++++++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/说明.txt | 1 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoAllRound/Ar4BaseMapper.java | 31 ++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeBase.java | 47 +++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseSv.java | 40 ++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java | 11 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ar4BaseMapper.xml | 26 +++++ 8 files changed, 266 insertions(+), 3 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeBase.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeBase.java new file mode 100644 index 0000000..798ae3f --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeBase.java @@ -0,0 +1,47 @@ +package com.dy.pipIrrGlobal.VoAllRound; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/1/14 16:01 + * @Description + */ + +@Data +@JsonPropertyOrder({"id", "num", "lng","lat", "blockName", "rtuAddr"}) +public class VoArIntakeBase { + private static final long serialVersionUID = 202501141601001L; + + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long id; + + /** + * 缂栧彿 + */ + public String num; + + /** + * 缁忓害 + */ + public Double lng; + + /** + * 绾害 + */ + public Double lat; + + /** + * 鐗囧尯 + */ + public String blockName; + + /** + * 鎺у埗鍣ㄥ湴鍧� + */ + public String rtuAddr ; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeRemote.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeRemote.java new file mode 100644 index 0000000..a8ae268 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/VoAllRound/VoArIntakeRemote.java @@ -0,0 +1,49 @@ +package com.dy.pipIrrGlobal.VoAllRound; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +import java.util.Date; + +/** + * @Author: liurunyu + * @Date: 2025/1/14 17:03 + * @Description + */ +@Data +@JsonPropertyOrder({"id", "onLine", "alarm", "alarmDt", "lastOpenDt", "lastCloseDt"}) +public class VoArIntakeRemote { + private static final long serialVersionUID = 202501141703001L; + + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long id; + + /** + * 鍦ㄧ嚎鎯呭喌, true鍦ㄧ嚎锛宖alse绂荤嚎锛宯ull鏈煡 + */ + public Boolean onLine ; + + /** + * 鏈�鏂版姤璀︿俊鎭� + */ + public String alarm ; + + /** + * 鏈�鏂版姤璀︽椂闂� + */ + public Date alarmDt ; + + /** + * 鏈�鍚庡紑闃�鏃堕棿 + */ + public Date lastOpenDt ; + + /** + * 鏈�鍚庡叧闂椂闂� + */ + public Date lastCloseDt ; + + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoAllRound/Ar4BaseMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoAllRound/Ar4BaseMapper.java new file mode 100644 index 0000000..a41e16f --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoAllRound/Ar4BaseMapper.java @@ -0,0 +1,31 @@ +package com.dy.pipIrrGlobal.daoAllRound; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.VoAllRound.VoArIntakeBase; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/1/14 16:45 + * @Description + */ +@Mapper +public interface Ar4BaseMapper extends BaseMapper<Object> { + + /** + * 鏌ヨ鍙栨按鍙e熀鏈俊鎭� + * @param intakeId + * @return + */ + List<VoArIntakeBase> intakeInfo(@Param("intakeId") Long intakeId) ; + + /** + * 鏌ヨ鍙栨按鍙e叧鑱旂殑RTU鍦板潃 + * @param intakeId + * @return + */ + List<String> intakeRtuAddr(@Param("intakeId") Long intakeId) ; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ar4BaseMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ar4BaseMapper.xml new file mode 100644 index 0000000..bc3ec2b --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/Ar4BaseMapper.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoAllRound.Ar4BaseMapper"> + + <select id="intakeInfo" resultType="com.dy.pipIrrGlobal.VoAllRound.VoArIntakeBase"> + select + itb.id as id, + itb.name as num, + itb.lng as lng, + itb.lat as lat, + bb.name as blockName, + pc.rtuAddr as rtuAddr + from pr_intake itb + LEFT JOIN ba_block bb on itb.blockId = bb.id + LEFT JOIN pr_controller pc on itb.id = pc.intakeId + where id = #{intakeId,jdbcType=BIGINT} + </select> + + <select id="intakeRtuAddr" resultType="java.lang.String"> + select + rtuAddr + from pr_controller + where intakeId = #{intakeId,jdbcType=BIGINT} + </select> + +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java index 3b223c1..0575f41 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java @@ -18,9 +18,14 @@ }) } ) -@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoSe","com.dy.pipIrrGlobal.daoRm", - "com.dy.pipIrrGlobal.daoPr","com.dy.pipIrrGlobal.daoFi","com.dy.pipIrrGlobal.daoOp" - }) +@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa", + "com.dy.pipIrrGlobal.daoSe", + "com.dy.pipIrrGlobal.daoRm", + "com.dy.pipIrrGlobal.daoPr", + "com.dy.pipIrrGlobal.daoFi", + "com.dy.pipIrrGlobal.daoOp", + "com.dy.pipIrrGlobal.daoAllRound" + }) public class PipIrrBaseApplication { public static void main(String[] args) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseCtrl.java new file mode 100644 index 0000000..f9f8936 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseCtrl.java @@ -0,0 +1,64 @@ +package com.dy.pipIrrBase.allRound; + +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.VoAllRound.VoArIntakeBase; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author: liurunyu + * @Date: 2025/1/14 15:56 + * @Description 鏈夊叧鍩虹淇℃伅鐨勭患鍚� + */ +@Slf4j +@Tag(name = "鏈夊叧鍩虹淇℃伅鐨勭患鍚�", description = "鏈夊叧鍩虹淇℃伅鐨勭患鍚�") +@RestController +@RequestMapping(path = "ar4Base") +@SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") +public class Ar4BaseCtrl { + + private Ar4BaseSv sv; + + @Autowired + private void setSv(Ar4BaseSv sv) { + this.sv = sv; + } + + /** + * 缁煎悎淇℃伅 + * 鍙栨按鍙e熀鏈俊鎭� + * @return 鎵�鏈夌墖鍖烘暟鎹� + */ + @Operation(summary = "缁煎悎淇℃伅", description = "鍙栨按鍙e熀鏈俊鎭�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鍙栨按鍙e熀鏈俊鎭紙BaseResponse.content:QueryResultVo{}锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoArIntakeBase.class))} + ) + }) + @GetMapping(path = "intakeInfo") + @SsoAop() + public BaseResponse<QueryResultVo<VoArIntakeBase>> intakeInfo(Long intakeId) { + if (intakeId == null || intakeId.longValue() == 0L) { + return BaseResponseUtils.buildException("鍙栨按鍙d涓嶈兘涓虹┖"); + } + QueryResultVo<VoArIntakeBase> res = this.sv.intakeInfo(intakeId); + return BaseResponseUtils.buildSuccess(res); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseSv.java new file mode 100644 index 0000000..b31dacf --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/Ar4BaseSv.java @@ -0,0 +1,40 @@ +package com.dy.pipIrrBase.allRound; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.VoAllRound.VoArIntakeBase; +import com.dy.pipIrrGlobal.daoAllRound.Ar4BaseMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/1/14 15:57 + * @Description + */ +@Slf4j +@Service +public class Ar4BaseSv { + + private Ar4BaseMapper dao ; + + @Autowired + private void setDao(Ar4BaseMapper dao){ + this.dao = dao; + } + + /** + * 鍙栨按鍙e熀鏈俊鎭� + * @return 鍙栨按鍙e熀鏈俊鎭� + */ + public QueryResultVo<VoArIntakeBase> intakeInfo(Long intakeId){ + QueryResultVo<VoArIntakeBase> rsVo = new QueryResultVo<>() ; + List<VoArIntakeBase> list = this.dao.intakeInfo(intakeId); + if(list != null && list.size() > 0){ + rsVo.obj = list.get(0) ; + } + return rsVo ; + } +} diff --git "a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/\350\257\264\346\230\216.txt" new file mode 100644 index 0000000..3129cac --- /dev/null +++ "b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/allRound/\350\257\264\346\230\216.txt" @@ -0,0 +1 @@ +allRound浠h〃缁煎悎 \ No newline at end of file -- Gitblit v1.8.0