New file |
| | |
| | | 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) ; |
| | | |
| | | } |
New file |
| | |
| | | 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 ; |
| | | |
| | | /** |
| | | * 取水口ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long intakeId; |
| | | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | public Long clientId; |
| | | /** |
| | | * 取水口编号 |
| | | */ |
| | | public String intakeNum; |
| | | /** |
| | | * 取水口经度 |
| | | */ |
| | | public Double intakeLng; |
| | | /** |
| | | * 取水口纬度 |
| | | */ |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | <?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> |
| | |
| | | "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 { |
New file |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 日期 格式为yyyy-mm-dd hh:mm:ss |
| | | * 内部转换用,前端不可见 |
| | | */ |
| | | @Schema(hidden = true) |
| | | public Date fromDate ; |
| | | |
| | | /** |
| | | * 取水口编号 |
| | | */ |
| | | @Schema(description = "取水口编号", 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 ; |
| | | } |
New file |
| | |
| | | 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版本越高,对泛型约束越严,所以配置SuppressWarnings("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 = "涉嫌偷水统计(BaseResponse.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); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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 ; |
| | | } |
| | | |
| | | } |