From 4b1d11a68a2d04a0b9bbf89d9368ca563d932687 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 07 二月 2025 15:21:31 +0800 Subject: [PATCH] 涉嫌偷水功能开发 --- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java | 61 ++++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSpecial/SpecialMapper.java | 32 ++++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml | 58 ++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java | 50 +++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSpecial/VoSteal.java | 140 ++++++++++++++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialCtrl.java | 71 ++++++++++ 7 files changed, 413 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSpecial/SpecialMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSpecial/SpecialMapper.java new file mode 100644 index 0000000..a4f9434 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSpecial/SpecialMapper.java @@ -0,0 +1,32 @@ +package com.dy.pipIrrGlobal.daoSpecial; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.voSpecial.VoSteal; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * @Author: liurunyu + * @Date: 2025/2/7 14:40 + * @Description + */ +@Mapper +public interface SpecialMapper extends BaseMapper<Object> { + + /** + * 鏌ヨ鎬绘暟 + * @param params 鏌ヨ鏉′欢 + * @return 鎬绘暟 + */ + Long selectStealTotal(Map<?, ?> params) ; + + /** + * 鍒嗛〉鏌ヨ涓�浜� + * @param params 鏌ヨ鏉′欢 + * @return 瀹炰綋闆嗗悎 + */ + List<VoSteal> selectStealSome(Map<?, ?> params) ; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSpecial/VoSteal.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSpecial/VoSteal.java new file mode 100644 index 0000000..bf00b14 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSpecial/VoSteal.java @@ -0,0 +1,140 @@ +package com.dy.pipIrrGlobal.voSpecial; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +import java.util.Date; + +/** + * @Author: liurunyu + * @Date: 2025/2/7 14:11 + * @Description + */ + +@Data +@JsonPropertyOrder({"id", + "intakeId", + "clientId", + "intakeNum", + "intakeLng", + "intakeLat", + "clientName", + "clientNum", + "openDt", + "openType", + "openTotalAmount", + "openRemainMoney", + "closeDt", + "closeType", + "closeTotalAmount", + "closeRemainMoney", + "thisAmount", + "thisMoney", + "thisTime" +}) +public class VoSteal { + private static final long serialVersionUID = 202502071422001L; + /** + * 鏁版嵁璁板綍id(寮�鍏抽榾璁板綍) + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long id ; + + /** + * 鍙栨按鍙D + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long intakeId; + + /** + * 鍐滄埛ID + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long clientId; + /** + * 鍙栨按鍙g紪鍙� + */ + public String intakeNum; + /** + * 鍙栨按鍙g粡搴� + */ + public Double intakeLng; + /** + * 鍙栨按鍙g含搴� + */ + public String intakeLat; + + /** + * 鍐滄埛濮撳悕 + */ + public String clientName; + + /** + * 鍐滄埛缂栧彿 + */ + public String clientNum; + + /** + * 寮�闃�鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date openDt; + /** + * 寮�闃�绫诲瀷 + */ + @JSONField(serialize = false) + public Byte opType; + /** + * 寮�闃�绫诲瀷 + */ + public String openType; + /** + * 寮�闃�鏃剁疮璁℃祦閲忥紙m3锛� + */ + public Double openTotalAmount; + /** + * 寮�闃�鏃跺墿浣欓噾棰濓紙鍏冿級 + */ + public Double openRemainMoney; + + + /** + * 鍏抽榾鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date closeDt; + /** + * 鍏抽榾绫诲瀷 + */ + @JSONField(serialize = false) + public Byte clType; + /** + * 鍏抽榾绫诲瀷 + */ + public String closeType; + /** + * 鍏抽榾鏃剁疮璁℃祦閲忥紙m3锛� + */ + public Double closeTotalAmount; + /** + * 鍏抽榾鏃跺墿浣欓噾棰濓紙鍏冿級 + */ + public Double closeRemainMoney; + + /** + * 鏈鐢ㄦ按閲忥紙m3锛� + */ + public Double thisAmount; + /** + * 鏈閲戦锛堝厓锛� + */ + public Double thisMoney; + /** + * 鏈鏃堕暱锛堝垎閽燂級 + */ + public Integer thisTime; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml new file mode 100644 index 0000000..7e9c338 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SpecialMapper.xml @@ -0,0 +1,58 @@ +<?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.daoSpecial.SpecialMapper"> + + <select id="selectStealTotal" parameterType="java.util.Map" resultType="java.lang.Long"> + select + count(*) + from rm_open_close_valve_history mTb + left join pr_intake piTb on piTb.id = mTb.intake_id + left join se_client scTb on scTb.id = mTb.client_id + <where> + <if test = "fromDate != null"> + mTb.cl_dt <![CDATA[>=]]> #{fromDate, javaType=DATE, jdbcType=TIMESTAMP} + </if> + <if test = "intakeNum != null and intakeNum != '' "> + and piTb.name = #{intakeNum, jdbcType=VARCHAR} + </if> + <if test = "clientNum != null and clientNum != '' "> + and scTb.clientNum = #{clientNum, jdbcType=VARCHAR} + </if> + <if test = "clientName != null and clientName != '' "> + and scTb.name = #{clientName, jdbcType=VARCHAR} + </if> + </where> + </select> + + <select id="selectStealSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voSpecial.VoSteal"> + select mTb.id as id, mTb.intake_id as intakeId, mTb.client_id as clientId, + piTb.name as intakeNum, + scTb.name as clientName, scTb.clientNum as clientNum, + mTb.op_dt as openDt, mTb.op_type as opType, mTb.op_total_amount as openTotalAmount, mTb.op_remain_money as openRemainMoney, + mTb.cl_dt as closeDt, mTb.cl_type as clType, mTb.cl_total_amount as closeTotalAmount, mTb.cl_remain_money as closeRemainMoney, + mTb.cl_this_amount as thisAmount, mTb.cl_this_money as thisMoney, mTb.cl_this_time as thisTime + from rm_open_close_valve_history mTb + left join pr_intake piTb on piTb.id = mTb.intake_id + left join se_client scTb on scTb.id = mTb.client_id + <where> + <if test = "fromDate != null"> + mTb.cl_dt <![CDATA[>=]]> #{fromDate, javaType=DATE, jdbcType=TIMESTAMP} + </if> + <if test = "intakeNum != null and intakeNum != '' "> + and piTb.name = #{intakeNum, jdbcType=VARCHAR} + </if> + <if test = "clientNum != null and clientNum != '' "> + and scTb.clientNum = #{clientNum, jdbcType=VARCHAR} + </if> + <if test = "clientName != null and clientName != '' "> + and scTb.name = #{clientName, jdbcType=VARCHAR} + </if> + </where> + order by mTb.id DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer, jdbcType=INTEGER}, #{count,javaType=Integer, jdbcType=INTEGER} + </if> + </trim> + </select> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java index 7fb2da2..eba918c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/PipIrrStatisticsApplication.java @@ -24,6 +24,7 @@ "com.dy.pipIrrGlobal.daoBa", "com.dy.pipIrrGlobal.daoSt", "com.dy.pipIrrGlobal.daoFi", + "com.dy.pipIrrGlobal.daoSpecial", "com.dy.pipIrrGlobal.daoAllRound", "com.dy.pipIrrGlobal.daoLargeScreen"}) public class PipIrrStatisticsApplication { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java new file mode 100644 index 0000000..86e9661 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/QoSteal.java @@ -0,0 +1,50 @@ +package com.dy.pipIrrStatistics.special; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.NotBlank; + +import java.util.Date; + +/** + * @Author: liurunyu + * @Date: 2025/2/7 13:56 + * @Description + */ + +@Data +@EqualsAndHashCode(callSuper = false) +public class QoSteal extends QueryConditionVo { + /** + * 鏃ユ湡 + */ + @Schema(description = "鏃ユ湡", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "鏃ユ湡涓嶈兘涓虹┖") + public String fromDt; + + /** + * 鏃ユ湡 鏍煎紡涓簓yyy-mm-dd hh:mm:ss + * 鍐呴儴杞崲鐢紝鍓嶇涓嶅彲瑙� + */ + @Schema(hidden = true) + public Date fromDate ; + + /** + * 鍙栨按鍙g紪鍙� + */ + @Schema(description = "鍙栨按鍙g紪鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String intakeNum ; + + /** + * 鍐滄埛缂栧彿 + */ + @Schema(description = "鍐滄埛缂栧彿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String clientNum ; + /** + * 鍐滄埛濮撳悕 + */ + @Schema(description = "鍐滄埛濮撳悕", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String clientName ; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialCtrl.java new file mode 100644 index 0000000..5bc276d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialCtrl.java @@ -0,0 +1,71 @@ +package com.dy.pipIrrStatistics.special; + +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.voLargeScreen.VoBaseInfo; +import com.dy.pipIrrGlobal.voSpecial.VoSteal; +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 jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Objects; + +/** + * @Author: liurunyu + * @Date: 2025/2/7 13:52 + * @Description 涓撻噺缁熻 + */ +@Slf4j +@Tag(name = "涓撻缁熻", description = "涓撻缁熻") +@RestController +@RequestMapping(path = "special") +@SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked") +public class SpecialCtrl { + + private SpecialSv sv; + + @Autowired + private void setSv(SpecialSv sv) { + this.sv = sv; + } + + + /** + * 娑夊珜鍋锋按 + * @return + */ + @Operation(summary = "娑夊珜鍋锋按", description = "娑夊珜鍋锋按缁熻") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "娑夊珜鍋锋按缁熻锛圔aseResponse.content:VoBaseInfo{}锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoBaseInfo.class))} + ) + }) + @GetMapping(path = "steal") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoSteal>>> steal(@Valid QoSteal qo, BindingResult bindingResult) throws Exception { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + QueryResultVo<List<VoSteal>> res = this.sv.steal(qo); + return BaseResponseUtils.buildSuccess(res); + } + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java new file mode 100644 index 0000000..0a4edc5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/special/SpecialSv.java @@ -0,0 +1,61 @@ +package com.dy.pipIrrStatistics.special; + +import com.dy.common.mw.protocol.p206V1.CommonV1; +import com.dy.common.util.DateTime; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoSpecial.SpecialMapper; +import com.dy.pipIrrGlobal.voSpecial.VoSteal; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * @Author: liurunyu + * @Date: 2025/2/7 13:52 + * @Description 涓撻缁熻鏈嶅姟 + */ +@Slf4j +@Service +public class SpecialSv { + private SpecialMapper dao ; + + @Autowired + private void setDao(SpecialMapper dao){ + this.dao = dao; + } + + /** + * 娑夊珜鍋锋按缁熻 + * @param qo + * @return + */ + public QueryResultVo<List<VoSteal>> steal(QoSteal qo) throws Exception { + if(qo.fromDt != null && qo.fromDt != "") { + qo.fromDate = DateTime.dateFrom_yyyy_MM_dd_HH_mm_ss(qo.fromDt + " 00:00:00") ; + } + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + Long itemTotal = Optional.ofNullable(this.dao.selectStealTotal(params)).orElse(0L); + + QueryResultVo<List<VoSteal>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + rsVo.calculateAndSet(itemTotal, params); + + List<VoSteal> list = this.dao.selectStealSome(params) ; + if (list != null && list.size() > 0) { + for (VoSteal vo : list) { + vo.openType = CommonV1.openCloseValveType(vo.opType) ; + vo.closeType = CommonV1.openCloseValveType(vo.clType) ; + } + } + rsVo.obj = list; + return rsVo ; + } + +} -- Gitblit v1.8.0