liurunyu
2024-09-02 e021502051079ac2b2c2adcea60b9ec01556b7fe
Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
6个文件已添加
25个文件已修改
1个文件已删除
2735 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/AreaCode2023Mapper.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/AreaCode2023.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoDistrict.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoMapCenter.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCardInfo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database-pj.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/AreaCode2023Mapper.xml 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml 630 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml 1219 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-parent.iml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictCtrl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictSv.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/qo/DistrictQO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/report/ReportSv.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/LoginVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java 85 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/CloseTypeQo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/AreaCode2023Mapper.java
New file
@@ -0,0 +1,38 @@
package com.dy.pipIrrGlobal.daoBa;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoBa.AreaCode2023;
import com.dy.pipIrrGlobal.voBa.VoDistrict;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @author ZhuBaoMin
 * @date 2024-08-30 16:09
 * @LastEditTime 2024-08-30 16:09
 * @Description
 */
@Mapper
public interface AreaCode2023Mapper extends BaseMapper<AreaCode2023> {
    int deleteByPrimaryKey(Long code);
    int insert(AreaCode2023 record);
    int insertSelective(AreaCode2023 record);
    AreaCode2023 selectByPrimaryKey(Long code);
    int updateByPrimaryKeySelective(AreaCode2023 record);
    int updateByPrimaryKey(AreaCode2023 record);
    /**
     * 根据区划代码查询指定级别行政区划
     * @param aredCode
     * @param level
     * @return
     */
    List<VoDistrict> getDistrictS(@Param("aredCode") String aredCode, @Param("level") Integer level);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
@@ -3,11 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
import com.dy.pipIrrGlobal.voSe.VoCardInfo;
import com.dy.pipIrrGlobal.voSe.VoCardInfo1;
import com.dy.pipIrrGlobal.voSe.VoCards;
import com.dy.pipIrrGlobal.voSe.VoCards2;
import com.dy.pipIrrGlobal.voSt.VoICCard;
import com.dy.pipIrrGlobal.voWe.VoCards3;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -190,4 +188,18 @@
     * @return
     */
    Double getTotalMoneyIcCards();
    /**
     * 根据水卡地址获取水卡数量,用来判断该卡是否允许开卡
     * @param cardAddr
     * @return
     */
    Long getCountByCardAddr(String cardAddr);
    /**
     * 根据水卡地址获取指定状态的水卡数量,用来判断该卡是否允许开卡
     * @param cardAddr
     * @return
     */
    Long getCountByCardAddrAndState(String cardAddr);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/AreaCode2023.java
New file
@@ -0,0 +1,52 @@
package com.dy.pipIrrGlobal.pojoBa;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import lombok.*;
/**
 * @author ZhuBaoMin
 * @date 2024-08-30 16:09
 * @LastEditTime 2024-08-30 16:09
 * @Description
 */
@TableName(value="area_code_2023", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class AreaCode2023 implements BaseEntity {
    public static final long serialVersionUID = 202408301613001L;
    /**
    * 区划代码
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long code;
    /**
    * 名称
    */
    private String name;
    /**
    * 级别1-5,省市县镇村
    */
    private Boolean level;
    /**
    * 父级区划代码
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long pcode;
    /**
    * 城乡分类
    */
    private Integer category;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoDistrict.java
New file
@@ -0,0 +1,30 @@
package com.dy.pipIrrGlobal.voBa;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-08-30 16:02
 * @LastEditTime 2024-08-30 16:02
 * @Description 区划视图对象
 */
@Data
public class VoDistrict {
    private static final long serialVersionUID = 202408301604001L;
    /**
     * 区划名称
     */
    private String name;
    /**
     * 区划代码
     */
    private String code;
    /**
     * 级别,1-5省市县镇村
     */
    private Integer level;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voBa/VoMapCenter.java
New file
@@ -0,0 +1,31 @@
package com.dy.pipIrrGlobal.voBa;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @author ZhuBaoMin
 * @date 2024-08-29 17:27
 * @LastEditTime 2024-08-29 17:27
 * @Description
 */
@Data
public class VoMapCenter {
    private static final long serialVersionUID = 202408291727001L;
    /**
     * 纬度
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private BigDecimal lat;
    /**
     * 经度
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private BigDecimal lng;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java
@@ -22,9 +22,11 @@
    private String rtuAddr;
    private String vcNum;
    private String orderNo;
    private String vcNum;
    private String state;
    //private Date openTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCardInfo.java
@@ -1,5 +1,7 @@
package com.dy.pipIrrGlobal.voSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -17,6 +19,7 @@
    private static final long serialVersionUID = 1L;
    @Schema(title = "水卡编号")
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long cardNum;
    @Schema(title = "卡片类型")
pipIrr-platform/pipIrr-global/src/main/resources/application-database-pj.yml
@@ -5,8 +5,8 @@
            #name: pj
            type: com.alibaba.druid.pool.DruidDataSource
            driverClassName: com.mysql.cj.jdbc.Driver
            #url: jdbc:mysql://192.168.40.166:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            #url: jdbc:mysql://8.130.130.233:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
#            url: jdbc:mysql://192.168.40.166:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
#            url: jdbc:mysql://8.130.130.233:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            #url: jdbc:mysql://8.140.179.55:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            url: jdbc:mysql://127.0.0.1:3306/pipIrr_pj?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            username: root
pipIrr-platform/pipIrr-global/src/main/resources/application-database-ym.yml
@@ -7,7 +7,6 @@
            driverClassName: com.mysql.cj.jdbc.Driver
#            url: jdbc:mysql://192.168.40.166:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
#            url: jdbc:mysql://8.130.130.233:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            #url: jdbc:mysql://8.140.179.55:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            url: jdbc:mysql://127.0.0.1:3306/pipIrr_ym?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
            username: root
            password: dysql,;.abc!@#
pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml
@@ -10,6 +10,14 @@
                    </city>
                </province>
            </districts>
            <dictionaries>
                <dict code="protocol" title="协议" valueType="2">
                    <dictItem>
                        <item1 dictCode="protocol" value="p206V1_0_1" name="老协议" status="1" sort="0" />
                        <item2 dictCode="protocol" value="p206V202404" name="新协议" status="0" sort="1" />
                    </dictItem>
                </dict>
            </dictionaries>
            <user name="超级管理员" phone="admin" password="admin" supperAdmin="1" />
            <payments>
                <item1 name="现金"/>
@@ -28,15 +36,16 @@
                <item4 typeName="养殖用水"/>
                <item5 typeName="绿化用水"/>
            </waterTypes>
            <waterPrice price="0.90" />
            <irrigateProfile>
                <item1 default_value = "10" unit = "2" sort = "1" type = "1"/>
                <item2 default_value = "20" unit = "2" sort = "2" type = "1" />
                <item3 default_value = "1" unit = "1" sort = "3" type = "1"/>
                <item4 default_value = "2" unit = "1" sort = "4" type = "1"/>
                <item5 default_value = "20" unit = "3" sort = "1" type = "2"/>
                <item6 default_value = "30" unit = "3" sort = "2" type = "2"/>
                <item7 default_value = "50" unit = "3" sort = "3" type = "2"/>
                <item8 default_value = "80" unit = "3" sort = "4" type = "2"/>
                <item1 defaultValue = "10" unit = "2" sort = "1" type = "1"/>
                <item2 defaultValue = "20" unit = "2" sort = "2" type = "1" />
                <item3 defaultValue = "1" unit = "1" sort = "3" type = "1"/>
                <item4 defaultValue = "2" unit = "1" sort = "4" type = "1"/>
                <item5 defaultValue = "20" unit = "3" sort = "1" type = "2"/>
                <item6 defaultValue = "30" unit = "3" sort = "2" type = "2"/>
                <item7 defaultValue = "50" unit = "3" sort = "3" type = "2"/>
                <item8 defaultValue = "80" unit = "3" sort = "4" type = "2"/>
            </irrigateProfile>
        </org1>
        <org2 tag="pj" name="片角" enable="false">
@@ -47,6 +56,14 @@
                    </city>
                </province>
            </districts>
            <dictionaries>
                <dict code="protocol" title="协议" valueType="2">
                    <dictItem>
                        <item1 dictCode="protocol" value="p206V1_0_1" name="老协议" status="1" sort="0" />
                        <item2 dictCode="protocol" value="p206V202404" name="新协议" status="0" sort="1" />
                    </dictItem>
                </dict>
            </dictionaries>
            <user name="超级管理员" phone="admin" password="admin" supperAdmin="1" />
            <payments>
                <item1 name="现金"/>
@@ -65,15 +82,16 @@
                <item4 typeName="养殖用水"/>
                <item5 typeName="绿化用水"/>
            </waterTypes>
            <waterPrice price="0.90" />
            <irrigateProfile>
                <item1 default_value = "10" unit = "2" sort = "1" type = "1"/>
                <item2 default_value = "20" unit = "2" sort = "2" type = "1" />
                <item3 default_value = "1" unit = "1" sort = "3" type = "1"/>
                <item4 default_value = "2" unit = "1" sort = "4" type = "1"/>
                <item5 default_value = "20" unit = "3" sort = "1" type = "2"/>
                <item6 default_value = "30" unit = "3" sort = "2" type = "2"/>
                <item7 default_value = "50" unit = "3" sort = "3" type = "2"/>
                <item8 default_value = "80" unit = "3" sort = "4" type = "2"/>
                <item1 defaultValue = "10" unit = "2" sort = "1" type = "1"/>
                <item2 defaultValue = "20" unit = "2" sort = "2" type = "1" />
                <item3 defaultValue = "1" unit = "1" sort = "3" type = "1"/>
                <item4 defaultValue = "2" unit = "1" sort = "4" type = "1"/>
                <item5 defaultValue = "20" unit = "3" sort = "1" type = "2"/>
                <item6 defaultValue = "30" unit = "3" sort = "2" type = "2"/>
                <item7 defaultValue = "50" unit = "3" sort = "3" type = "2"/>
                <item8 defaultValue = "80" unit = "3" sort = "4" type = "2"/>
            </irrigateProfile>
        </org2>
    </orgs>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/AreaCode2023Mapper.xml
New file
@@ -0,0 +1,115 @@
<?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.daoBa.AreaCode2023Mapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.AreaCode2023">
    <!--@mbg.generated-->
    <!--@Table area_code_2023-->
    <id column="code" jdbcType="BIGINT" property="code" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="level" jdbcType="BOOLEAN" property="level" />
    <result column="pcode" jdbcType="BIGINT" property="pcode" />
    <result column="category" jdbcType="INTEGER" property="category" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    code, `name`, `level`, pcode, category
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from area_code_2023
    where code = #{code,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from area_code_2023
    where code = #{code,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023">
    <!--@mbg.generated-->
    insert into area_code_2023 (code, `name`, `level`,
      pcode, category)
    values (#{code,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=BOOLEAN},
      #{pcode,jdbcType=BIGINT}, #{category,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023">
    <!--@mbg.generated-->
    insert into area_code_2023
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="level != null">
        `level`,
      </if>
      <if test="pcode != null">
        pcode,
      </if>
      <if test="category != null">
        category,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        #{level,jdbcType=BOOLEAN},
      </if>
      <if test="pcode != null">
        #{pcode,jdbcType=BIGINT},
      </if>
      <if test="category != null">
        #{category,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023">
    <!--@mbg.generated-->
    update area_code_2023
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        `level` = #{level,jdbcType=BOOLEAN},
      </if>
      <if test="pcode != null">
        pcode = #{pcode,jdbcType=BIGINT},
      </if>
      <if test="category != null">
        category = #{category,jdbcType=INTEGER},
      </if>
    </set>
    where code = #{code,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.AreaCode2023">
    <!--@mbg.generated-->
    update area_code_2023
    set `name` = #{name,jdbcType=VARCHAR},
      `level` = #{level,jdbcType=BOOLEAN},
      pcode = #{pcode,jdbcType=BIGINT},
      category = #{category,jdbcType=INTEGER}
    where code = #{code,jdbcType=BIGINT}
  </update>
  <!--根据区划代码查询指定级别行政区划-->
  <select id="getDistrictS" resultType="com.dy.pipIrrGlobal.voBa.VoDistrict">
    SELECT
        name,
        CASE
            WHEN level = 4 THEN SUBSTRING(code,7,3)
            WHEN level = 5 THEN SUBSTRING(code,10,3)
        END AS code,
        level
    FROM area_code_2023
    WHERE code LIKE CONCAT('%', #{aredCode}, '%') AND level = #{level}
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -1,315 +1,359 @@
<?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.daoRm.RmCommandHistoryMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    <!--@Table rm_command_history-->
    <id column="com_id" jdbcType="BIGINT" property="comId" />
    <result column="command_code" jdbcType="VARCHAR" property="commandCode" />
    <result column="command_name" jdbcType="VARCHAR" property="commandName" />
    <result column="intake_id" jdbcType="BIGINT" property="intakeId" />
    <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr" />
    <result column="protocol" jdbcType="VARCHAR" property="protocol" />
    <result column="param" property="param" jdbcType="JAVA_OBJECT" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
    <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
    <result column="operator" jdbcType="BIGINT" property="operator" />
    <result column="result" jdbcType="TINYINT" property="result" />
    <result column="result_time" jdbcType="TIMESTAMP" property="resultTime" />
    <result column="result_text" jdbcType="LONGVARCHAR" property="resultText" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    com_id, command_code, command_name, intake_id, rtu_addr, protocol, param, send_time,
    `operator`, `result`, result_time, result_text
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from rm_command_history
    where com_id = #{comId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from rm_command_history
    where com_id = #{comId,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    insert into rm_command_history (com_id, command_code, command_name,
      intake_id, rtu_addr, protocol,
      param, send_time, `operator`,
      `result`, result_time, result_text
      )
    values (#{comId,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR},
      #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR},
      #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler}, #{sendTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT},
      #{result,jdbcType=TINYINT}, #{resultTime,jdbcType=TIMESTAMP}, #{resultText,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    insert into rm_command_history
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="comId != null">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
        <!--@mbg.generated-->
        <!--@Table rm_command_history-->
        <id column="com_id" jdbcType="BIGINT" property="comId"/>
        <result column="command_code" jdbcType="VARCHAR" property="commandCode"/>
        <result column="command_name" jdbcType="VARCHAR" property="commandName"/>
        <result column="intake_id" jdbcType="BIGINT" property="intakeId"/>
        <result column="rtu_addr" jdbcType="VARCHAR" property="rtuAddr"/>
        <result column="protocol" jdbcType="VARCHAR" property="protocol"/>
        <result column="param" property="param" jdbcType="JAVA_OBJECT"
                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
        <result column="send_time" jdbcType="TIMESTAMP" property="sendTime"/>
        <result column="operator" jdbcType="BIGINT" property="operator"/>
        <result column="result" jdbcType="TINYINT" property="result"/>
        <result column="result_time" jdbcType="TIMESTAMP" property="resultTime"/>
        <result column="result_text" jdbcType="LONGVARCHAR" property="resultText"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        com_id,
      </if>
      <if test="commandCode != null">
        command_code,
      </if>
      <if test="commandName != null">
        command_name,
      </if>
      <if test="intakeId != null">
        intake_id,
      </if>
      <if test="rtuAddr != null">
        rtu_addr,
      </if>
      <if test="protocol != null">
        protocol,
      </if>
      <if test="param != null">
        param,
      </if>
      <if test="sendTime != null">
        send_time,
      </if>
      <if test="operator != null">
        `operator`,
      </if>
      <if test="result != null">
        `result`,
      </if>
      <if test="resultTime != null">
        result_time,
      </if>
      <if test="resultText != null">
        result_text,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="comId != null">
        #{comId,jdbcType=BIGINT},
      </if>
      <if test="commandCode != null">
        #{commandCode,jdbcType=VARCHAR},
      </if>
      <if test="commandName != null">
        #{commandName,jdbcType=VARCHAR},
      </if>
      <if test="intakeId != null">
        #{intakeId,jdbcType=BIGINT},
      </if>
      <if test="rtuAddr != null">
        #{rtuAddr,jdbcType=VARCHAR},
      </if>
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="param != null">
        #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      </if>
      <if test="sendTime != null">
        #{sendTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=BIGINT},
      </if>
      <if test="result != null">
        #{result,jdbcType=TINYINT},
      </if>
      <if test="resultTime != null">
        #{resultTime,jdbcType=TIMESTAMP},
      </if>
      <if test="resultText != null">
        #{resultText,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    update rm_command_history
    <set>
      <if test="commandCode != null">
        command_code = #{commandCode,jdbcType=VARCHAR},
      </if>
      <if test="commandName != null">
        command_name = #{commandName,jdbcType=VARCHAR},
      </if>
      <if test="intakeId != null">
        intake_id = #{intakeId,jdbcType=BIGINT},
      </if>
      <if test="rtuAddr != null">
        rtu_addr = #{rtuAddr,jdbcType=VARCHAR},
      </if>
      <if test="protocol != null">
        protocol = #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="param != null">
        param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      </if>
      <if test="sendTime != null">
        send_time = #{sendTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operator != null">
        `operator` = #{operator,jdbcType=BIGINT},
      </if>
      <if test="result != null">
        `result` = #{result,jdbcType=TINYINT},
      </if>
      <if test="resultTime != null">
        result_time = #{resultTime,jdbcType=TIMESTAMP},
      </if>
      <if test="resultText != null">
        result_text = #{resultText,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where com_id = #{comId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
    <!--@mbg.generated-->
    update rm_command_history
    set command_code = #{commandCode,jdbcType=VARCHAR},
      command_name = #{commandName,jdbcType=VARCHAR},
      intake_id = #{intakeId,jdbcType=BIGINT},
      rtu_addr = #{rtuAddr,jdbcType=VARCHAR},
      protocol = #{protocol,jdbcType=VARCHAR},
      param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
      send_time = #{sendTime,jdbcType=TIMESTAMP},
      `operator` = #{operator,jdbcType=BIGINT},
      `result` = #{result,jdbcType=TINYINT},
      result_time = #{resultTime,jdbcType=TIMESTAMP},
      result_text = #{resultText,jdbcType=LONGVARCHAR}
    where com_id = #{comId,jdbcType=BIGINT}
  </update>
        result_text
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from rm_command_history
        where com_id = #{comId,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        delete
        from rm_command_history
        where com_id = #{comId,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
        <!--@mbg.generated-->
        insert into rm_command_history (com_id, command_code, command_name,
                                        intake_id, rtu_addr, protocol,
                                        param, send_time, `operator`,
                                        `result`, result_time, result_text)
        values (#{comId,jdbcType=BIGINT}, #{commandCode,jdbcType=VARCHAR}, #{commandName,jdbcType=VARCHAR},
                #{intakeId,jdbcType=BIGINT}, #{rtuAddr,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR},
                #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
                #{sendTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=BIGINT},
                #{result,jdbcType=TINYINT}, #{resultTime,jdbcType=TIMESTAMP}, #{resultText,jdbcType=LONGVARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
        <!--@mbg.generated-->
        insert into rm_command_history
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="comId != null">
                com_id,
            </if>
            <if test="commandCode != null">
                command_code,
            </if>
            <if test="commandName != null">
                command_name,
            </if>
            <if test="intakeId != null">
                intake_id,
            </if>
            <if test="rtuAddr != null">
                rtu_addr,
            </if>
            <if test="protocol != null">
                protocol,
            </if>
            <if test="param != null">
                param,
            </if>
            <if test="sendTime != null">
                send_time,
            </if>
            <if test="operator != null">
                `operator`,
            </if>
            <if test="result != null">
                `result`,
            </if>
            <if test="resultTime != null">
                result_time,
            </if>
            <if test="resultText != null">
                result_text,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="comId != null">
                #{comId,jdbcType=BIGINT},
            </if>
            <if test="commandCode != null">
                #{commandCode,jdbcType=VARCHAR},
            </if>
            <if test="commandName != null">
                #{commandName,jdbcType=VARCHAR},
            </if>
            <if test="intakeId != null">
                #{intakeId,jdbcType=BIGINT},
            </if>
            <if test="rtuAddr != null">
                #{rtuAddr,jdbcType=VARCHAR},
            </if>
            <if test="protocol != null">
                #{protocol,jdbcType=VARCHAR},
            </if>
            <if test="param != null">
                #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
            </if>
            <if test="sendTime != null">
                #{sendTime,jdbcType=TIMESTAMP},
            </if>
            <if test="operator != null">
                #{operator,jdbcType=BIGINT},
            </if>
            <if test="result != null">
                #{result,jdbcType=TINYINT},
            </if>
            <if test="resultTime != null">
                #{resultTime,jdbcType=TIMESTAMP},
            </if>
            <if test="resultText != null">
                #{resultText,jdbcType=LONGVARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
        <!--@mbg.generated-->
        update rm_command_history
        <set>
            <if test="commandCode != null">
                command_code = #{commandCode,jdbcType=VARCHAR},
            </if>
            <if test="commandName != null">
                command_name = #{commandName,jdbcType=VARCHAR},
            </if>
            <if test="intakeId != null">
                intake_id = #{intakeId,jdbcType=BIGINT},
            </if>
            <if test="rtuAddr != null">
                rtu_addr = #{rtuAddr,jdbcType=VARCHAR},
            </if>
            <if test="protocol != null">
                protocol = #{protocol,jdbcType=VARCHAR},
            </if>
            <if test="param != null">
                param = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
            </if>
            <if test="sendTime != null">
                send_time = #{sendTime,jdbcType=TIMESTAMP},
            </if>
            <if test="operator != null">
                `operator` = #{operator,jdbcType=BIGINT},
            </if>
            <if test="result != null">
                `result` = #{result,jdbcType=TINYINT},
            </if>
            <if test="resultTime != null">
                result_time = #{resultTime,jdbcType=TIMESTAMP},
            </if>
            <if test="resultText != null">
                result_text = #{resultText,jdbcType=LONGVARCHAR},
            </if>
        </set>
        where com_id = #{comId,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoRm.RmCommandHistory">
        <!--@mbg.generated-->
        update rm_command_history
        set command_code = #{commandCode,jdbcType=VARCHAR},
            command_name = #{commandName,jdbcType=VARCHAR},
            intake_id    = #{intakeId,jdbcType=BIGINT},
            rtu_addr     = #{rtuAddr,jdbcType=VARCHAR},
            protocol     = #{protocol,jdbcType=VARCHAR},
            param        = #{param,jdbcType= JAVA_OBJECT, typeHandler=com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler},
            send_time    = #{sendTime,jdbcType=TIMESTAMP},
            `operator`   = #{operator,jdbcType=BIGINT},
            `result`     = #{result,jdbcType=TINYINT},
            result_time  = #{resultTime,jdbcType=TIMESTAMP},
            result_text  = #{resultText,jdbcType=LONGVARCHAR}
        where com_id = #{comId,jdbcType=BIGINT}
    </update>
  <!--根据操作员ID获取未关阀记录(包含在线情况)-->
  <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve">
    SELECT
        inta.name AS intakeNum,
        rtus.isOnLine,
        com.rtu_addr AS rtuAddr,
        com.param ->>'$.icCardNo' AS vcNum,
        (SELECT param ->>'$.orderNo' AS orderNo FROM rm_command_history WHERE rtu_addr = com.rtu_addr ORDER BY send_time desc LIMIT 0,1) AS orderNo
    FROM rm_command_history com
        INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr
        INNER JOIN pr_intake inta ON con.intakeId = inta.id
        INNER JOIN JSON_TABLE(
            <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
            #{onLineMap},
            '$[*]' COLUMNS(
                rtuAddr VARCHAR(20) PATH '$.rtuAddr',
                isOnLine BOOLEAN PATH '$.isOnLine'
    <!--根据操作员ID获取未关阀记录(包含在线情况)-->
    <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve">
        SELECT inta.name                  AS intakeNum,
               rtus.isOnLine,
               com.rtu_addr               AS rtuAddr,
               com.param ->> '$.icCardNo' AS vcNum,
               (SELECT param ->> '$.orderNo' AS orderNo
                FROM rm_command_history
                WHERE rtu_addr = com.rtu_addr
                ORDER BY send_time desc
                LIMIT 0,1)                AS orderNo,
               'toClose'                  AS state
        FROM rm_command_history com
            INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr
            INNER JOIN pr_intake inta ON con.intakeId = inta.id
            INNER JOIN JSON_TABLE(
        <!--'[{"rtuAddr":"37142501020100215","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
        #{onLineMap},
        '$[*]' COLUMNS (
            rtuAddr VARCHAR(20) PATH '$.rtuAddr',
            isOnLine BOOLEAN PATH '$.isOnLine'
            )
        ) rtus ON com.rtu_addr = rtus.rtuAddr
    <where>
      AND (com.command_code = '92' OR com.command_code = 'A2' OR com.command_code = '97')
      AND com.operator = #{operator}
      AND NOT EXISTS (
        SELECT *
        FROM rm_command_history
        WHERE (result IS NULL OR result = 1 )
            AND (command_code = '93' OR command_code = 'A3' OR command_code = '98')
            AND param ->>'$.orderNo' = com.param ->>'$.orderNo'
      )
    </where>
    GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->>'$.icCardNo'
  </select>
            ) rtus ON com.rtu_addr = rtus.rtuAddr
        <where>
            AND (com.command_code = '92' OR com.command_code = 'A2' OR com.command_code = '97')
                  AND com.operator = #{operator}
                  AND NOT EXISTS(
                    SELECT *
                    FROM rm_command_history
                    WHERE (result IS NULL OR result = 1)
                      AND (command_code = '93' OR command_code = 'A3' OR command_code = '98')
                      AND param ->> '$.orderNo' = com.param ->> '$.orderNo'
                )
        </where>
        GROUP BY inta.name, rtus.isOnLine, com.rtu_addr, com.param ->> '$.icCardNo'
  <!--根据取水口ID获取该取水口未关阀参数-->
  <select id="getUncloseParam" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedParam">
    SELECT
        com.rtu_addr AS rtuAddr,
        com.param ->>'$.orderNo' AS orderNo,
        com.param ->>'$.icCardNo' AS vcNum
    FROM rm_command_history com
        INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr
        INNER JOIN pr_intake inta ON con.intakeId = inta.id
        INNER JOIN JSON_TABLE(
            <!--      '[{"rtuAddr":"620201000029","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
            #{onLineMap},
            '$[*]' COLUMNS(
                rtuAddr VARCHAR(20) PATH '$.rtuAddr',
                isOnLine BOOLEAN PATH '$.isOnLine'
        UNION ALL
        SELECT inta.name                  AS intakeNum,
               rtus.isOnLine,
               com.rtu_addr               AS rtuAddr,
               com.param ->> '$.icCardNo' AS vcNum,
               (SELECT param ->> '$.orderNo' AS orderNo
                FROM rm_command_history
                WHERE rtu_addr = com.rtu_addr
                ORDER BY send_time desc
                LIMIT 0,1)                AS orderNo,
               'toCancel'                 AS state
        FROM rm_command_history com
                 INNER JOIN pr_intake inta ON inta.id = com.intake_id
                 INNER JOIN JSON_TABLE(
                #{onLineMap},
                '$[*]' COLUMNS (
                    rtuAddr VARCHAR(20) PATH '$.rtuAddr',
                    isOnLine BOOLEAN PATH '$.isOnLine'
                    )
            ) rtus ON com.rtu_addr = rtus.rtuAddr
        <where>
            AND (command_code = 'A1' OR command_code = 'A2')
            AND com.operator = #{operator}
                  AND DATE_FORMAT(
                              CONCAT(com.param ->> '$.year', '-', com.param ->> '$.month', '-', com.param ->> '$.day',
                                     ' ',
                                     com.param ->> '$.hour', ':', com.param ->> '$.minute', ':', '0'),
                              '%Y-%m-%d %H:%i:%S') > NOW()
        </where>
    </select>
    <!--根据取水口ID获取该取水口未关阀参数-->
    <select id="getUncloseParam" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedParam">
        SELECT com.rtu_addr               AS rtuAddr,
               com.param ->> '$.orderNo'  AS orderNo,
               com.param ->> '$.icCardNo' AS vcNum
        FROM rm_command_history com
            INNER JOIN pr_controller con ON com.rtu_addr = con.rtuAddr
            INNER JOIN pr_intake inta ON con.intakeId = inta.id
            INNER JOIN JSON_TABLE(
        <!--      '[{"rtuAddr":"620201000029","isOnLine":true},{"rtuAddr":"4000004","isOnLine":true},{"rtuAddr":"dy20240325","isOnLine":false}]',-->
        #{onLineMap},
        '$[*]' COLUMNS (
            rtuAddr VARCHAR(20) PATH '$.rtuAddr',
            isOnLine BOOLEAN PATH '$.isOnLine'
            )
        ) rtus ON com.rtu_addr = rtus.rtuAddr
    WHERE (com.command_code = '92' OR com.command_code = 'A2' OR com.command_code = '97') AND con.intakeId = #{intakeId}
    AND NOT EXISTS (
        SELECT *
        FROM rm_command_history
        WHERE (result IS NULL OR result = 1 )
            AND (command_code = '93' OR command_code = 'A3' OR command_code = '98')
            AND param ->>'$.orderNo' = com.param ->>'$.orderNo'
    )
    ORDER BY com.send_time DESC
    LIMIT 0,1
  </select>
            ) rtus ON com.rtu_addr = rtus.rtuAddr
        WHERE (com.command_code = '92' OR com.command_code = 'A2' OR com.command_code = '97')
          AND con.intakeId = #{intakeId}
          AND NOT EXISTS(
                SELECT *
                FROM rm_command_history
                WHERE (result IS NULL OR result = 1)
                  AND (command_code = '93' OR command_code = 'A3' OR command_code = '98')
                  AND param ->> '$.orderNo' = com.param ->> '$.orderNo'
            )
        ORDER BY com.send_time DESC
        LIMIT 0,1
    </select>
  <!--根据指定条件获取命令日志历史记录总数-->
  <select id="getCommandHistoriesCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM rm_command_history his
      INNER JOIN pr_intake inta ON inta.id = his.intake_id
      LEFT JOIN se_client cli ON cli.id = his.operator
      LEFT JOIN ba_user  user ON user.id = his.operator
    <where>
      <if test="intakeId != null">
        AND his.intake_id = #{intakeId}
      </if>
      <if test = "commandName != null and commandName !=''">
        AND his.command_name LIKE CONCAT('%',#{commandName},'%')
      </if>
      <if test = "result != null">
        AND his.result = #{result}
      </if>
      <if test = "timeStart != null and timeStop != null">
        AND his.send_time BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
  </select>
    <!--根据指定条件获取命令日志历史记录总数-->
    <select id="getCommandHistoriesCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM rm_command_history his
                 INNER JOIN pr_intake inta ON inta.id = his.intake_id
                 LEFT JOIN se_client cli ON cli.id = his.operator
                 LEFT JOIN ba_user user ON user.id = his.operator
        <where>
            <if test="intakeId != null">
                AND his.intake_id = #{intakeId}
            </if>
            <if test="commandName != null and commandName != ''">
                AND his.command_name LIKE CONCAT('%', #{commandName}, '%')
            </if>
            <if test="result != null">
                AND his.result = #{result}
            </if>
            <if test="timeStart != null and timeStop != null">
                AND his.send_time BETWEEN #{timeStart} AND #{timeStop}
            </if>
        </where>
    </select>
  <!--根据指定条件获取命令日志历史记录-->
  <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand">
    SELECT
        his.com_id AS comId,
        his.command_name AS commandName,
        inta.name AS intakeName,
        his.rtu_addr AS rtuAddr,
        his.protocol,
        his.send_time AS sendTime,
        his.result_time AS resultTime,
        (CASE
        WHEN his.result = 1 THEN "成功"
        ELSE "失败"
        END) AS result,
        his.result_text,
        IFNULL(cli.name, user.name) AS userName
    FROM rm_command_history his
        INNER JOIN pr_intake inta ON inta.id = his.intake_id
        LEFT JOIN se_client cli ON cli.id = his.operator
        LEFT JOIN ba_user  user ON user.id = his.operator
    <where>
      <if test="intakeId != null">
        AND his.intake_id = #{intakeId}
      </if>
      <if test = "commandName != null and commandName !=''">
        AND his.command_name LIKE CONCAT('%',#{commandName},'%')
      </if>
      <if test = "result != null">
        AND his.result = #{result}
      </if>
    <!--根据指定条件获取命令日志历史记录-->
    <select id="getCommandHistories" resultType="com.dy.pipIrrGlobal.voRm.VoCommand">
        SELECT his.com_id                  AS comId,
               his.command_name            AS commandName,
               inta.name                   AS intakeName,
               his.rtu_addr                AS rtuAddr,
               his.protocol,
               his.send_time               AS sendTime,
               his.result_time             AS resultTime,
               (CASE
                    WHEN his.result = 1 THEN '成功'
                    ELSE '失败'
                   END)                    AS result,
               his.result_text,
               IFNULL(cli.name, user.name) AS userName
        FROM rm_command_history his
                 INNER JOIN pr_intake inta ON inta.id = his.intake_id
                 LEFT JOIN se_client cli ON cli.id = his.operator
                 LEFT JOIN ba_user user ON user.id = his.operator
        <where>
            <if test="intakeId != null">
                AND his.intake_id = #{intakeId}
            </if>
            <if test="commandName != null and commandName != ''">
                AND his.command_name LIKE CONCAT('%', #{commandName}, '%')
            </if>
            <if test="result != null">
                AND his.result = #{result}
            </if>
      <if test = "timeStart != null and timeStop != null">
        AND his.send_time BETWEEN #{timeStart} AND #{timeStop}
      </if>
    </where>
    ORDER BY his.send_time DESC
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
            <if test="timeStart != null and timeStop != null">
                AND his.send_time BETWEEN #{timeStart} AND #{timeStop}
            </if>
        </where>
        ORDER BY his.send_time 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>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveHistoryMapper.xml
@@ -458,99 +458,7 @@
            </if>
        </where>
    </select>
    <!--根据指定条件获取开关阀报历史记录数量-->
    <select id="getOpenCloseValveReportsCount_history" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM rm_open_close_valve_history oh
                 INNER JOIN pr_intake inta ON inta.id = oh.intake_id
        <where>
            <if test="intakeId != null and intakeId > 0">
                AND oh.intake_id = #{intakeId}
            </if>
            <if test="intakeNum != null and intakeNum != ''">
                AND inta.name LIKE CONCAT('%', #{intakeNum}, '%')
            </if>
            <if test="rtuAddr != null and rtuAddr != ''">
                AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%')
            </if>
            <if test="timeStart_open != null and timeStop_open != null">
                AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open}
            </if>
            <if test="timeStart_close != null and timeStop_close != null">
                AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close}
            </if>
        </where>
    </select>
    <!--根据指定条件获取开关阀报历史记录-->
    <select id="getOpenCloseValveReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve">
        SELECT oh.intake_id            AS intakeId,
               inta.name               AS intakenum,
               oh.rtu_addr             AS rtuAddr,
               oh.client_name          AS clientName,
               oh.op_ic_card_no        AS openIcNum,
               oh.op_ic_card_addr      AS openIcAddr,
               oh.op_dt                AS openTime,
               CASE
                   WHEN oh.op_type = 1 THEN '刷卡开阀'
                   WHEN oh.op_type = 3 THEN '中心站开阀'
                   WHEN oh.op_type = 5 THEN '余额不足关阀'
                   WHEN oh.op_type = 8 THEN '用户远程开阀'
                   WHEN oh.op_type = 11 THEN '开关阀卡开阀'
                   ELSE '未知'
                   END                 AS openType,
               oh.op_order_no          AS openOrderNo,
               oh.op_total_amount      AS openTotalAmount,
               oh.op_remain_money      AS openRemainMoney,
               oh.op_water_remain_user AS openWaterRemain,
               oh.op_ele_total_amount  AS openEleTotalAmount,
               oh.cl_ic_card_no        AS closeIcNum,
               oh.cl_ic_card_addr      AS closeIcAddr,
               oh.cl_dt                AS closeTime,
               CASE
                   WHEN oh.cl_type = 2 THEN '刷卡关阀'
                   WHEN oh.cl_type = 4 THEN '中心站关阀'
                   WHEN oh.cl_type = 5 THEN '余额不足关阀'
                   WHEN oh.cl_type = 6 THEN '流量计故障关阀'
                   WHEN oh.cl_type = 7 THEN '紧急关阀'
                   WHEN oh.cl_type = 9 THEN '用户远程关阀'
                   WHEN oh.cl_type = 10 THEN '开关阀卡关阀'
                   WHEN oh.cl_type = 12 THEN '黑名单命令关阀'
                   WHEN oh.cl_type = 13 THEN '远程定时关阀'
                   WHEN oh.cl_type = 14 THEN '远程定量关阀'
                   ELSE '未知'
                   END                 AS closeType,
               oh.cl_this_amount       AS closeThisAmount,
               oh.cl_this_time         AS thisTime,
               oh.cl_this_money        AS thisMoney,
               oh.cl_remain_money      AS closeRemainMoney,
               oh.cl_total_amount      AS closeTotalAmount
        FROM rm_open_close_valve_history oh
                 INNER JOIN pr_intake inta ON inta.id = oh.intake_id
        <where>
            <if test="intakeId != null and intakeId > 0">
                AND oh.intake_id = #{intakeId}
            </if>
            <if test="intakeNum != null and intakeNum != ''">
                AND inta.name LIKE CONCAT('%', #{intakeNum}, '%')
            </if>
            <if test="rtuAddr != null and rtuAddr != ''">
                AND oh.rtu_addr LIKE CONCAT('%', #{rtuAddr}, '%')
            </if>
            <if test="timeStart_open != null and timeStop_open != null">
                AND oh.op_dt BETWEEN #{timeStart_open} AND #{timeStop_open}
            </if>
            <if test="timeStart_close != null and timeStop_close != null">
                AND oh.cl_dt BETWEEN #{timeStart_close} AND #{timeStop_close}
            </if>
        </where>
        ORDER BY oh.op_dt DESC
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--根据指定条件获取开关阀报历史记录-->
    <select id="getOpenCloseValveReports_history" resultType="com.dy.pipIrrGlobal.voRm.VoOpenCloseValve">
        SELECT oh.intake_id            AS intakeId,
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmOpenCloseValveLastMapper.xml
@@ -637,7 +637,9 @@
        SELECT COUNT(*) AS recordCount
        FROM rm_open_close_valve_history
        <where>
            AND cl_type = #{closeType}
            <if test="closeType != null">
                AND cl_type = #{closeType}
            </if>
            <if test="timeStart != null and timeStop != null">
                AND cl_dt BETWEEN #{timeStart} AND #{timeStop}
            </if>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
@@ -1,618 +1,653 @@
<?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.daoSe.SeClientCardMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
    <!--@mbg.generated-->
    <!--@Table se_client_card-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="protocol" jdbcType="VARCHAR" property="protocol" />
    <result column="cardAddr" jdbcType="VARCHAR" property="cardaddr" />
    <result column="cardNum" jdbcType="BIGINT" property="cardnum" />
    <result column="clientId" jdbcType="BIGINT" property="clientid" />
    <result column="money" jdbcType="FLOAT" property="money" />
    <result column="state" jdbcType="TINYINT" property="state" />
    <result column="original_card_id" jdbcType="BIGINT" property="originalCardId"/>
    <result column="createDt" jdbcType="TIMESTAMP" property="createdt" />
    <result column="replaceDt" jdbcType="TIMESTAMP" property="replacedt" />
    <result column="rechargeDt" jdbcType="TIMESTAMP" property="rechargedt" />
    <result column="lossDtDt" jdbcType="TIMESTAMP" property="lossdtdt" />
    <result column="cancelDt" jdbcType="TIMESTAMP" property="canceldt" />
    <result column="unlockDt" jdbcType="TIMESTAMP" property="unlockdt" />
    <result column="reversalDt" jdbcType="TIMESTAMP" property="reversaldt" />
    <result column="refundDt" jdbcType="TIMESTAMP" property="refunddt" />
    <result column="consumeDt" jdbcType="TIMESTAMP" property="consumedt" />
    <result column="lastOper" jdbcType="TINYINT" property="lastoper" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, protocol, cardAddr, cardNum, clientId, money, `state`, original_card_id, createDt, replaceDt, rechargeDt,
    lossDtDt, cancelDt, unlockDt, reversalDt, refundDt, consumeDt, lastOper, remarks
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from se_client_card
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from se_client_card
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <!--依据水卡地址获取水卡编号(12月19日废弃)-->
  <select id="getCardIdByAddr" resultType="java.lang.Long">
    SELECT id AS cardId FROM se_client_card WHERE cardAddr = #{cardAddr}
  </select>
  <!--根据水卡编号获取水卡表主键(12月19日添加后废弃)-->
  <select id="getCardIdByNum" resultType="java.lang.Long">
    SELECT id AS cardId FROM se_client_card WHERE cardNum = #{cardNum}
  </select>
  <!--根据水卡编号获取水卡表主键及农户编号-->
  <select id="getCardIdAndClientNum" resultType="java.util.Map">
    <!--    SELECT id AS cardId, clientNum FROM se_client_card WHERE cardNum = #{cardNum}-->
    SELECT
      card.id AS cardId,
      cli.clientNum,
      cli.id AS clientId,
      protocol
    FROM se_client_card card
    INNER JOIN se_client cli ON card.clientId = cli.id
    WHERE card.cardNum = #{cardNum}
  </select>
  <!-- 根据水卡编号获取水卡对应的农户id和姓名 -->
  <select id="getClientIdAndNameByCardAddrAndCardNo" resultType="java.util.Map">
    SELECT
    cli.id AS clientId,
    cli.name AS clientName
    FROM se_client_card card
    INNER JOIN se_client cli ON card.clientId = cli.id
    WHERE card.cardAddr = #{cardAddr} and  card.cardNum = #{cardNum}
  </select>
  <!-- 根据水卡编号获取水卡 -->
  <select id="getCardsByAddrAndNum"  resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo1">
    SELECT
    id,
    money
    FROM se_client_card
    WHERE cardAddr = #{cardAddr} and  cardNum = #{cardNum}
  </select>
  <!--根据行政区划串模糊查询水卡编号-->
  <select id="getCardNumOfMax"  resultType="java.lang.String">
    SELECT cardNum
    FROM se_client_card
    WHERE cardNum LIKE CONCAT(#{areaCode},'%')
    ORDER BY cardNum desc
    LIMIT 0,1
  </select>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
    <!--@mbg.generated-->
    insert into se_client_card (id, protocol, cardAddr, cardNum, clientId,
      money, `state`, original_card_id, createDt,
      replaceDt, rechargeDt, lossDtDt,
      cancelDt, unlockDt, reversalDt, refundDt,
      consumeDt, lastOper, remarks
      )
    values (#{id,jdbcType=BIGINT}, #{protocol,jdbcType=VARCHAR}, #{cardaddr,jdbcType=VARCHAR}, #{cardnum,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT},
      #{money,jdbcType=FLOAT}, #{state,jdbcType=TINYINT}, #{originalCardId,jdbcType=BIGINT}, #{createdt,jdbcType=TIMESTAMP},
      #{replacedt,jdbcType=TIMESTAMP}, #{rechargedt,jdbcType=TIMESTAMP}, #{lossdtdt,jdbcType=TIMESTAMP},
      #{canceldt,jdbcType=TIMESTAMP}, #{unlockdt,jdbcType=TIMESTAMP}, #{reversaldt,jdbcType=TIMESTAMP},
      #{refunddt,jdbcType=TIMESTAMP}, #{consumedt,jdbcType=TIMESTAMP}, #{lastoper,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into se_client_card
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
        <!--@mbg.generated-->
        <!--@Table se_client_card-->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="protocol" jdbcType="VARCHAR" property="protocol"/>
        <result column="cardAddr" jdbcType="VARCHAR" property="cardaddr"/>
        <result column="cardNum" jdbcType="BIGINT" property="cardnum"/>
        <result column="clientId" jdbcType="BIGINT" property="clientid"/>
        <result column="money" jdbcType="FLOAT" property="money"/>
        <result column="state" jdbcType="TINYINT" property="state"/>
        <result column="original_card_id" jdbcType="BIGINT" property="originalCardId"/>
        <result column="createDt" jdbcType="TIMESTAMP" property="createdt"/>
        <result column="replaceDt" jdbcType="TIMESTAMP" property="replacedt"/>
        <result column="rechargeDt" jdbcType="TIMESTAMP" property="rechargedt"/>
        <result column="lossDtDt" jdbcType="TIMESTAMP" property="lossdtdt"/>
        <result column="cancelDt" jdbcType="TIMESTAMP" property="canceldt"/>
        <result column="unlockDt" jdbcType="TIMESTAMP" property="unlockdt"/>
        <result column="reversalDt" jdbcType="TIMESTAMP" property="reversaldt"/>
        <result column="refundDt" jdbcType="TIMESTAMP" property="refunddt"/>
        <result column="consumeDt" jdbcType="TIMESTAMP" property="consumedt"/>
        <result column="lastOper" jdbcType="TINYINT" property="lastoper"/>
        <result column="remarks" jdbcType="VARCHAR" property="remarks"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id,
      </if>
      <if test="protocol != null">
        protocol,
      </if>
      <if test="cardaddr != null">
        cardAddr,
      </if>
      <if test="cardnum != null">
        cardNum,
      </if>
      <if test="clientid != null">
        clientId,
      </if>
      <if test="money != null">
        money,
      </if>
      <if test="state != null">
        `state`,
      </if>
      <if test="originalCardId != null">
        original_card_id,
      </if>
      <if test="createdt != null">
        createDt,
      </if>
      <if test="replacedt != null">
        replaceDt,
      </if>
      <if test="rechargedt != null">
        rechargeDt,
      </if>
      <if test="lossdtdt != null">
        lossDtDt,
      </if>
      <if test="canceldt != null">
        cancelDt,
      </if>
      <if test="unlockdt != null">
        unlockDt,
      </if>
      <if test="reversaldt != null">
        reversalDt,
      </if>
      <if test="refunddt != null">
        refundDt,
      </if>
      <if test="consumedt != null">
        consumeDt,
      </if>
      <if test="lastoper != null">
        lastOper,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="cardaddr != null">
        #{cardaddr,jdbcType=VARCHAR},
      </if>
      <if test="cardnum != null">
        #{cardnum,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        #{clientid,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        #{money,jdbcType=FLOAT},
      </if>
      <if test="state != null">
        #{state,jdbcType=TINYINT},
      </if>
      <if test="originalCardId != null">
        #{originalCardId,jdbcType=BIGINT},
      </if>
      <if test="createdt != null">
        #{createdt,jdbcType=TIMESTAMP},
      </if>
      <if test="replacedt != null">
        #{replacedt,jdbcType=TIMESTAMP},
      </if>
      <if test="rechargedt != null">
        #{rechargedt,jdbcType=TIMESTAMP},
      </if>
      <if test="lossdtdt != null">
        #{lossdtdt,jdbcType=TIMESTAMP},
      </if>
      <if test="canceldt != null">
        #{canceldt,jdbcType=TIMESTAMP},
      </if>
      <if test="unlockdt != null">
        #{unlockdt,jdbcType=TIMESTAMP},
      </if>
      <if test="reversaldt != null">
        #{reversaldt,jdbcType=TIMESTAMP},
      </if>
      <if test="refunddt != null">
        #{refunddt,jdbcType=TIMESTAMP},
      </if>
      <if test="consumedt != null">
        #{consumedt,jdbcType=TIMESTAMP},
      </if>
      <if test="lastoper != null">
        #{lastoper,jdbcType=TINYINT},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
    <!--@mbg.generated-->
    update se_client_card
    <set>
      <if test="protocol != null">
        protocol = #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="cardaddr != null">
        cardAddr = #{cardaddr,jdbcType=VARCHAR},
      </if>
      <if test="cardnum != null">
        cardNum = #{cardnum,jdbcType=BIGINT},
      </if>
      <if test="clientid != null">
        clientId = #{clientid,jdbcType=BIGINT},
      </if>
      <if test="money != null">
        money = #{money,jdbcType=FLOAT},
      </if>
      <if test="state != null">
        `state` = #{state,jdbcType=TINYINT},
      </if>
      <if test="originalCardId != null">
        `original_card_id` = #{originalCardId,jdbcType=BIGINT},
      </if>
      <if test="createdt != null">
        createDt = #{createdt,jdbcType=TIMESTAMP},
      </if>
      <if test="replacedt != null">
        replaceDt = #{replacedt,jdbcType=TIMESTAMP},
      </if>
      <if test="rechargedt != null">
        rechargeDt = #{rechargedt,jdbcType=TIMESTAMP},
      </if>
      <if test="lossdtdt != null">
        lossDtDt = #{lossdtdt,jdbcType=TIMESTAMP},
      </if>
      <if test="canceldt != null">
        cancelDt = #{canceldt,jdbcType=TIMESTAMP},
      </if>
      <if test="unlockdt != null">
        unlockDt = #{unlockdt,jdbcType=TIMESTAMP},
      </if>
      <if test="reversaldt != null">
        reversalDt = #{reversaldt,jdbcType=TIMESTAMP},
      </if>
      <if test="refunddt != null">
        refundDt = #{refunddt,jdbcType=TIMESTAMP},
      </if>
      <if test="consumedt != null">
        consumeDt = #{consumedt,jdbcType=TIMESTAMP},
      </if>
      <if test="lastoper != null">
        lastOper = #{lastoper,jdbcType=TINYINT},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
    <!--@mbg.generated-->
    update se_client_card
    set protocol = #{protocol,jdbcType=VARCHAR},
      cardAddr = #{cardaddr,jdbcType=VARCHAR},
      cardNum = #{cardnum,jdbcType=BIGINT},
      clientId = #{clientid,jdbcType=BIGINT},
      money = #{money,jdbcType=FLOAT},
      `state` = #{state,jdbcType=TINYINT},
      original_card_id = #{originalCardId,jdbcType=BIGINT},
      createDt = #{createdt,jdbcType=TIMESTAMP},
      replaceDt = #{replacedt,jdbcType=TIMESTAMP},
      rechargeDt = #{rechargedt,jdbcType=TIMESTAMP},
      lossDtDt = #{lossdtdt,jdbcType=TIMESTAMP},
      cancelDt = #{canceldt,jdbcType=TIMESTAMP},
      unlockDt = #{unlockdt,jdbcType=TIMESTAMP},
      reversalDt = #{reversaldt,jdbcType=TIMESTAMP},
      refundDt = #{refunddt,jdbcType=TIMESTAMP},
      consumeDt = #{consumedt,jdbcType=TIMESTAMP},
      lastOper = #{lastoper,jdbcType=TINYINT},
      remarks = #{remarks,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateMoney" >
    update se_client_card
    set money = #{money,jdbcType=FLOAT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据农户主键获取水卡列表(物理卡+虚拟卡)-->
  <select id="getCardInfoByClientId" resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo">
    SELECT
    *
    FROM
    (SELECT
    '物理卡' AS cardType,
    clientCard.cardNum   AS CardNum,
    clientCard.money   AS Money,
    (CASE
    WHEN clientCard.state = 1 THEN '正常'
    WHEN clientCard.state = 2 THEN '已注销'
    ELSE '已挂失'
    END) AS State
    FROM se_client client
    LEFT JOIN se_client_card clientCard ON clientCard.clientId = client.id
    WHERE client.id = #{clientId,jdbcType=BIGINT}
    UNION ALL
    SELECT
    '虚拟卡' AS cardType,
    virtualCard.vc_num   AS CardNum,
    virtualCard.money   AS vcMoney,
    (CASE
    WHEN virtualCard.in_use = 0 THEN '未使用'
    WHEN virtualCard.in_use = 1 THEN '使用中'
    END) AS State
    FROM se_client client
    LEFT JOIN se_virtual_card virtualCard ON client.id = virtualCard.client_id
    WHERE client.id = #{clientId,jdbcType=BIGINT}
    ) card
    ORDER BY card.Money DESC , card.State DESC
  </select>
  <!--根据水卡编号获取操作记录列表-->
  <select id="getOperateRecordsByCardNum" resultType="java.util.HashMap">
    SELECT * FROM v_operate WHERE cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取余额-->
  <select id="getMoneyByCardNum" resultType="java.lang.Float">
    SELECT money FROM se_client_card WHERE cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取充值总额-->
  <select id="sumRechargeByCardNum" resultType="java.lang.Float">
    SELECT
      SUM(his.amount) AS amount
    FROM se_recharge_history his
        INNER JOIN se_client_card card ON his.cardId = card.id
    WHERE card.cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据水卡编号获取卡片状态:1-开卡,2-补卡,3-充值,4-挂失,5-注销,6-解锁,7-冲正,8-消费-->
  <select id="getCardStateByCardNum" resultType="java.lang.String">
<!--    SELECT-->
<!--      (CASE-->
<!--         WHEN lastOper = 1 THEN "开卡"-->
<!--         WHEN lastOper = 2 THEN "补卡"-->
<!--         WHEN lastOper = 3 THEN "充值"-->
<!--         WHEN lastOper = 4 THEN "挂失"-->
<!--         WHEN lastOper = 5 THEN "注销"-->
<!--         WHEN lastOper = 6 THEN "解锁"-->
<!--         WHEN lastOper = 7 THEN "冲正"-->
<!--         WHEN lastOper = 8 THEN "消费"-->
<!--        END) AS stateName-->
<!--    FROM se_client_card-->
<!--    WHERE cardNum = ${cardNum}-->
    SELECT
        (CASE
            WHEN state = 1 THEN '正常'
            WHEN state = 2 THEN '已注销'
            WHEN state = 3 THEN '已挂失'
        END) AS stateName
    FROM se_client_card
    WHERE cardNum = #{cardNum,jdbcType=BIGINT}
  </select>
  <!--根据指定条件获取水卡列表记录数,应用程序使用-->
  <select id="getCardsCount" parameterType="java.util.Map" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM se_client_card card
      INNER JOIN se_client cli ON card.clientId = cli.id
    <where>
      AND card.state = 1
      <if test = "clientNum != null and clientNum !=''">
        AND cli.clientNum like CONCAT('%',#{clientNum},'%')
      </if>
      <if test = "clientName != null and clientName !=''">
        AND cli.name like CONCAT('%',#{clientName},'%')
      </if>
      <if test = "cardNum != null and cardNum !=''">
        AND card.cardNum like CONCAT('%',#{cardNum},'%')
      </if>
    </where>
  </select>
  <!--根据指定条件获取水卡列表,应用程序使用-->
  <select id="getCards" resultType="com.dy.pipIrrGlobal.voSe.VoCards">
    SELECT
        cli.clientNum,
        cli.name AS clientName,
        cardNum,
<!--        CASE-->
<!--            WHEN card.cardNum LIKE '10%' THEN CONCAT(SUBSTRING(card.cardNum, 7, 6),SUBSTRING(card.cardNum, 14, 4))-->
<!--            ELSE card.cardNum-->
<!--        END AS cardNum,-->
        cli.phone,
        cli.idCard,
        card.state AS cardState,
<!--        (CASE-->
<!--            WHEN card.state = 1 THEN '正常'-->
<!--            WHEN card.state = 2 THEN '已注销'-->
<!--            WHEN card.state = 3 THEN '已挂失'-->
<!--        End) AS stateName,-->
        '正常' AS stateName,
        '农户卡' AS cardType,
        FORMAT(card.money, 2) AS money
    FROM se_client_card card
        INNER JOIN se_client cli ON card.clientId = cli.id
    <where>
      AND card.state = 1
      <if test = "clientNum != null and clientNum !=''">
        AND cli.clientNum like CONCAT('%',#{clientNum},'%')
      </if>
      <if test = "clientName != null and clientName !=''">
        AND cli.name like CONCAT('%',#{clientName},'%')
      </if>
      <if test = "cardNum != null and cardNum !=''">
        AND card.cardNum like CONCAT('%',#{cardNum},'%')
      </if>
    </where>
    ORDER BY card.id
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <!--获取已挂失未补卡的记录数量-->
  <select id="getUnreplacedRecordCount" resultType="java.lang.Long">
    SELECT
        COUNT(*) AS recordCount
    FROM se_client_card card
           INNER JOIN se_client cli ON card.clientId = cli.id
    WHERE card.state = 3 AND NOT EXISTS (SELECT * FROM se_client_card card2 WHERE card2.original_card_id = card.cardNum)
  </select>
  <!--获取已挂失未补卡的记录-->
  <select id="getUnreplaced" resultType="com.dy.pipIrrGlobal.voSe.VoCards">
    SELECT
        cli.clientNum,
        cli.name AS clientName,
        cardNum,
<!--        CASE-->
<!--          WHEN card.cardNum LIKE '10%' THEN CONCAT(SUBSTRING(card.cardNum, 7, 6),SUBSTRING(card.cardNum, 14, 4))-->
<!--          ELSE card.cardNum-->
<!--        END AS cardNum,-->
        cli.phone,
        cli.idCard,
        card.state AS cardState,
        '已挂失' AS stateName,
        '农户卡' AS cardType,
        FORMAT(card.money,2) AS money
    FROM se_client_card card
        INNER JOIN se_client cli ON card.clientId = cli.id
    WHERE card.state = 3 AND NOT EXISTS (SELECT * FROM se_client_card card2 WHERE card2.original_card_id = card.id)
    ORDER BY card.id
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <!--根据指定水卡编号获取挂失事记录数量(补卡、解锁使用)-->
  <select id="getLostCount" resultType="java.lang.Integer">
    SELECT
        COUNT(*) AS recordCount
    FROM se_client_card card
    <where>
      AND card.state = 3
      <if test = "cardNum != null and cardNum > 0">
        AND card.cardNum = #{cardNum}
      </if>
    </where>
  </select>
  <!--根据指定水卡编号获取已补卡数量(补卡、解锁使用)-->
  <select id="getReplacedCount" resultType="java.lang.Integer">
    SELECT
        COUNT(*) AS recordCount
    FROM se_client_card card
        INNER JOIN se_client_card card2 ON card2.original_card_id = card.id
    <where>
      <if test = "cardNum != null and cardNum > 0">
        AND card.cardNum = #{cardNum}
      </if>
    </where>
  </select>
  <!--根据农户姓名和手机号获取水卡列表记录数,应用程序使用-->
  <select id="getCardsByClientNameAndPhoneCount" resultType="java.lang.Long">
    SELECT
      COUNT(*) AS recordCount
    FROM se_client_card card
    INNER JOIN se_client cli ON card.clientId = cli.id
    <where>
      card.state = 1
      <if test = "clientName != null and clientName !=''">
        AND cli.name like CONCAT('%',#{clientName},'%')
      </if>
      <if test = "phone != null and phone !=''">
        AND cli.phone like CONCAT('%',#{phone},'%')
      </if>
    </where>
        remarks
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from se_client_card
        where id = #{id,jdbcType=BIGINT}
    </select>
  <!--根据农户姓名和手机号获取水卡列表,应用程序使用-->
  <select id="getCardsByClientNameAndPhone" resultType="com.dy.pipIrrGlobal.voSe.VoCards2">
    SELECT
    card.id AS clientCardId,
    cli.id AS clientId,
    cli.clientNum,
    cli.name AS clientName,
    card.cardNum,
    cli.phone,
    cli.idCard,
    card.state AS cardState,
    (CASE
    WHEN card.state = 1 THEN '正常'
    WHEN card.state = 2 THEN '已注销'
    WHEN card.state = 3 THEN '已挂失'
    End) AS stateName,
    '农户卡' AS cardType,
    FORMAT(card.money, 2) AS money
    FROM se_client_card card
    INNER JOIN se_client cli ON card.clientId = cli.id
    <where>
      card.state = 1
      <if test = "clientName != null and clientName !=''">
        AND cli.name like CONCAT('%',#{clientName},'%')
      </if>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        delete
        from se_client_card
        where id = #{id,jdbcType=BIGINT}
    </delete>
      <if test = "phone != null and phone !=''">
        AND cli.phone like CONCAT('%',#{phone},'%')
      </if>
    </where>
    ORDER BY card.id
    <trim prefix="limit " >
      <if test="start != null and count != null">
        #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
      </if>
    </trim>
  </select>
  <!--根据农户ID查询正常状态的水卡列表,小程序使用-->
  <select id="getCardsByClientID" resultType="com.dy.pipIrrGlobal.voWe.VoCards3">
    SELECT
    card.id AS clientCardId,
    cli.id AS clientId,
    cli.clientNum,
    cli.name AS clientName,
    card.cardNum,
    cli.phone,
    cli.idCard,
    card.state AS cardState,
    (CASE
    WHEN card.state = 1 THEN '正常'
    WHEN card.state = 2 THEN '已注销'
    WHEN card.state = 3 THEN '已挂失'
    End) AS stateName,
    '农户卡' AS cardType,
    FORMAT(card.money, 2) AS money
    FROM se_client_card card
    INNER JOIN se_client cli ON card.clientId = cli.id
    where
      card.state = 1
      AND cli.id like CONCAT('%',#{clientId},'%')
    <!--依据水卡地址获取水卡编号(12月19日废弃)-->
    <select id="getCardIdByAddr" resultType="java.lang.Long">
        SELECT id AS cardId
        FROM se_client_card
        WHERE cardAddr = #{cardAddr}
    </select>
    <!--根据水卡编号获取水卡表主键(12月19日添加后废弃)-->
    <select id="getCardIdByNum" resultType="java.lang.Long">
        SELECT id AS cardId
        FROM se_client_card
        WHERE cardNum = #{cardNum}
    </select>
    <!--根据水卡编号获取水卡表主键及农户编号-->
    <select id="getCardIdAndClientNum" resultType="java.util.Map">
        <!--    SELECT id AS cardId, clientNum FROM se_client_card WHERE cardNum = #{cardNum}-->
        SELECT card.id AS cardId,
               cli.clientNum,
               cli.id  AS clientId,
               protocol
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        WHERE card.cardNum = #{cardNum}
    </select>
    <!-- 根据水卡编号获取水卡对应的农户id和姓名 -->
    <select id="getClientIdAndNameByCardAddrAndCardNo" resultType="java.util.Map">
        SELECT cli.id   AS clientId,
               cli.name AS clientName
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        WHERE card.cardAddr = #{cardAddr}
          and card.cardNum = #{cardNum}
    </select>
    ORDER BY card.id
  </select>
  <!--当前余额总量(物理卡)-->
  <select id="getTotalMoneyIcCards" resultType="java.lang.Double">
    SELECT
      IFNULL(SUM(money),0) AS totalMoney
    FROM
      `se_client_card`
    WHERE state = 1
  </select>
    <!-- 根据水卡编号获取水卡 -->
    <select id="getCardsByAddrAndNum" resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo1">
        SELECT id,
               money
        FROM se_client_card
        WHERE cardAddr = #{cardAddr}
          and cardNum = #{cardNum}
    </select>
    <!--根据行政区划串模糊查询水卡编号-->
    <select id="getCardNumOfMax" resultType="java.lang.String">
        SELECT cardNum
        FROM se_client_card
        WHERE cardNum LIKE CONCAT(#{areaCode}, '%')
        ORDER BY cardNum desc
        LIMIT 0,1
    </select>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
        <!--@mbg.generated-->
        insert into se_client_card (id, protocol, cardAddr, cardNum, clientId,
                                    money, `state`, original_card_id, createDt,
                                    replaceDt, rechargeDt, lossDtDt,
                                    cancelDt, unlockDt, reversalDt, refundDt,
                                    consumeDt, lastOper, remarks)
        values (#{id,jdbcType=BIGINT}, #{protocol,jdbcType=VARCHAR}, #{cardaddr,jdbcType=VARCHAR},
                #{cardnum,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT},
                #{money,jdbcType=FLOAT}, #{state,jdbcType=TINYINT}, #{originalCardId,jdbcType=BIGINT},
                #{createdt,jdbcType=TIMESTAMP},
                #{replacedt,jdbcType=TIMESTAMP}, #{rechargedt,jdbcType=TIMESTAMP}, #{lossdtdt,jdbcType=TIMESTAMP},
                #{canceldt,jdbcType=TIMESTAMP}, #{unlockdt,jdbcType=TIMESTAMP}, #{reversaldt,jdbcType=TIMESTAMP},
                #{refunddt,jdbcType=TIMESTAMP}, #{consumedt,jdbcType=TIMESTAMP}, #{lastoper,jdbcType=TINYINT},
                #{remarks,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into se_client_card
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="protocol != null">
                protocol,
            </if>
            <if test="cardaddr != null">
                cardAddr,
            </if>
            <if test="cardnum != null">
                cardNum,
            </if>
            <if test="clientid != null">
                clientId,
            </if>
            <if test="money != null">
                money,
            </if>
            <if test="state != null">
                `state`,
            </if>
            <if test="originalCardId != null">
                original_card_id,
            </if>
            <if test="createdt != null">
                createDt,
            </if>
            <if test="replacedt != null">
                replaceDt,
            </if>
            <if test="rechargedt != null">
                rechargeDt,
            </if>
            <if test="lossdtdt != null">
                lossDtDt,
            </if>
            <if test="canceldt != null">
                cancelDt,
            </if>
            <if test="unlockdt != null">
                unlockDt,
            </if>
            <if test="reversaldt != null">
                reversalDt,
            </if>
            <if test="refunddt != null">
                refundDt,
            </if>
            <if test="consumedt != null">
                consumeDt,
            </if>
            <if test="lastoper != null">
                lastOper,
            </if>
            <if test="remarks != null">
                remarks,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="protocol != null">
                #{protocol,jdbcType=VARCHAR},
            </if>
            <if test="cardaddr != null">
                #{cardaddr,jdbcType=VARCHAR},
            </if>
            <if test="cardnum != null">
                #{cardnum,jdbcType=BIGINT},
            </if>
            <if test="clientid != null">
                #{clientid,jdbcType=BIGINT},
            </if>
            <if test="money != null">
                #{money,jdbcType=FLOAT},
            </if>
            <if test="state != null">
                #{state,jdbcType=TINYINT},
            </if>
            <if test="originalCardId != null">
                #{originalCardId,jdbcType=BIGINT},
            </if>
            <if test="createdt != null">
                #{createdt,jdbcType=TIMESTAMP},
            </if>
            <if test="replacedt != null">
                #{replacedt,jdbcType=TIMESTAMP},
            </if>
            <if test="rechargedt != null">
                #{rechargedt,jdbcType=TIMESTAMP},
            </if>
            <if test="lossdtdt != null">
                #{lossdtdt,jdbcType=TIMESTAMP},
            </if>
            <if test="canceldt != null">
                #{canceldt,jdbcType=TIMESTAMP},
            </if>
            <if test="unlockdt != null">
                #{unlockdt,jdbcType=TIMESTAMP},
            </if>
            <if test="reversaldt != null">
                #{reversaldt,jdbcType=TIMESTAMP},
            </if>
            <if test="refunddt != null">
                #{refunddt,jdbcType=TIMESTAMP},
            </if>
            <if test="consumedt != null">
                #{consumedt,jdbcType=TIMESTAMP},
            </if>
            <if test="lastoper != null">
                #{lastoper,jdbcType=TINYINT},
            </if>
            <if test="remarks != null">
                #{remarks,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
        <!--@mbg.generated-->
        update se_client_card
        <set>
            <if test="protocol != null">
                protocol = #{protocol,jdbcType=VARCHAR},
            </if>
            <if test="cardaddr != null">
                cardAddr = #{cardaddr,jdbcType=VARCHAR},
            </if>
            <if test="cardnum != null">
                cardNum = #{cardnum,jdbcType=BIGINT},
            </if>
            <if test="clientid != null">
                clientId = #{clientid,jdbcType=BIGINT},
            </if>
            <if test="money != null">
                money = #{money,jdbcType=FLOAT},
            </if>
            <if test="state != null">
                `state` = #{state,jdbcType=TINYINT},
            </if>
            <if test="originalCardId != null">
                `original_card_id` = #{originalCardId,jdbcType=BIGINT},
            </if>
            <if test="createdt != null">
                createDt = #{createdt,jdbcType=TIMESTAMP},
            </if>
            <if test="replacedt != null">
                replaceDt = #{replacedt,jdbcType=TIMESTAMP},
            </if>
            <if test="rechargedt != null">
                rechargeDt = #{rechargedt,jdbcType=TIMESTAMP},
            </if>
            <if test="lossdtdt != null">
                lossDtDt = #{lossdtdt,jdbcType=TIMESTAMP},
            </if>
            <if test="canceldt != null">
                cancelDt = #{canceldt,jdbcType=TIMESTAMP},
            </if>
            <if test="unlockdt != null">
                unlockDt = #{unlockdt,jdbcType=TIMESTAMP},
            </if>
            <if test="reversaldt != null">
                reversalDt = #{reversaldt,jdbcType=TIMESTAMP},
            </if>
            <if test="refunddt != null">
                refundDt = #{refunddt,jdbcType=TIMESTAMP},
            </if>
            <if test="consumedt != null">
                consumeDt = #{consumedt,jdbcType=TIMESTAMP},
            </if>
            <if test="lastoper != null">
                lastOper = #{lastoper,jdbcType=TINYINT},
            </if>
            <if test="remarks != null">
                remarks = #{remarks,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard">
        <!--@mbg.generated-->
        update se_client_card
        set protocol         = #{protocol,jdbcType=VARCHAR},
            cardAddr         = #{cardaddr,jdbcType=VARCHAR},
            cardNum          = #{cardnum,jdbcType=BIGINT},
            clientId         = #{clientid,jdbcType=BIGINT},
            money            = #{money,jdbcType=FLOAT},
            `state`          = #{state,jdbcType=TINYINT},
            original_card_id = #{originalCardId,jdbcType=BIGINT},
            createDt         = #{createdt,jdbcType=TIMESTAMP},
            replaceDt        = #{replacedt,jdbcType=TIMESTAMP},
            rechargeDt       = #{rechargedt,jdbcType=TIMESTAMP},
            lossDtDt         = #{lossdtdt,jdbcType=TIMESTAMP},
            cancelDt         = #{canceldt,jdbcType=TIMESTAMP},
            unlockDt         = #{unlockdt,jdbcType=TIMESTAMP},
            reversalDt       = #{reversaldt,jdbcType=TIMESTAMP},
            refundDt         = #{refunddt,jdbcType=TIMESTAMP},
            consumeDt        = #{consumedt,jdbcType=TIMESTAMP},
            lastOper         = #{lastoper,jdbcType=TINYINT},
            remarks          = #{remarks,jdbcType=VARCHAR}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateMoney">
        update se_client_card
        set money = #{money,jdbcType=FLOAT}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <!--根据农户主键获取水卡列表(物理卡+虚拟卡)-->
    <select id="getCardInfoByClientId" resultType="com.dy.pipIrrGlobal.voSe.VoCardInfo">
        SELECT *
        FROM (SELECT '物理卡'        AS cardType,
                     card.cardNum AS cardNum,
                     card.money   AS money,
                     (CASE
                          WHEN card.state = 1 THEN '正常'
                          WHEN card.state = 2 THEN '已注销'
                          ELSE '已挂失'
                         END)     AS state
              FROM se_client_card card
                       INNER JOIN se_client cli ON cli.id = card.clientId
              WHERE card.clientId = #{clientId,jdbcType=BIGINT}
              UNION ALL
              SELECT '虚拟卡'     AS cardType,
                     vc.vc_num AS cardNum,
                     vc.money  AS money,
                     (CASE
                          WHEN vc.in_use = 0 THEN '未使用'
                          WHEN vc.in_use = 1 THEN '使用中'
                         END)  AS state
              FROM se_virtual_card vc
                       INNER JOIN se_client cli ON cli.id = vc.client_id
              WHERE vc.client_id = #{clientId,jdbcType=BIGINT}
        <!--              SELECT '虚拟卡'              AS cardType,-->
        <!--                     virtualCard.vc_num AS CardNum,-->
        <!--                     virtualCard.money  AS vcMoney,-->
        <!--                     (CASE-->
        <!--                          WHEN virtualCard.in_use = 0 THEN '未使用'-->
        <!--                          WHEN virtualCard.in_use = 1 THEN '使用中'-->
        <!--                         END)           AS State-->
        <!--              FROM se_client client-->
        <!--                       LEFT JOIN se_virtual_card virtualCard ON client.id = virtualCard.client_id-->
        <!--              WHERE client.id = #{clientId,jdbcType=BIGINT}-->
        ) card
        ORDER BY card.Money DESC, card.State DESC
    </select>
    <!--根据水卡编号获取操作记录列表-->
    <select id="getOperateRecordsByCardNum" resultType="java.util.HashMap">
        SELECT *
        FROM v_operate
        WHERE cardNum = #{cardNum,jdbcType=BIGINT}
    </select>
    <!--根据水卡编号获取余额-->
    <select id="getMoneyByCardNum" resultType="java.lang.Float">
        SELECT money
        FROM se_client_card
        WHERE cardNum = #{cardNum,jdbcType=BIGINT}
    </select>
    <!--根据水卡编号获取充值总额-->
    <select id="sumRechargeByCardNum" resultType="java.lang.Float">
        SELECT SUM(his.amount) AS amount
        FROM se_recharge_history his
                 INNER JOIN se_client_card card ON his.cardId = card.id
        WHERE card.cardNum = #{cardNum,jdbcType=BIGINT}
    </select>
    <!--根据水卡编号获取卡片状态:1-开卡,2-补卡,3-充值,4-挂失,5-注销,6-解锁,7-冲正,8-消费-->
    <select id="getCardStateByCardNum" resultType="java.lang.String">
        <!--    SELECT-->
        <!--      (CASE-->
        <!--         WHEN lastOper = 1 THEN "开卡"-->
        <!--         WHEN lastOper = 2 THEN "补卡"-->
        <!--         WHEN lastOper = 3 THEN "充值"-->
        <!--         WHEN lastOper = 4 THEN "挂失"-->
        <!--         WHEN lastOper = 5 THEN "注销"-->
        <!--         WHEN lastOper = 6 THEN "解锁"-->
        <!--         WHEN lastOper = 7 THEN "冲正"-->
        <!--         WHEN lastOper = 8 THEN "消费"-->
        <!--        END) AS stateName-->
        <!--    FROM se_client_card-->
        <!--    WHERE cardNum = ${cardNum}-->
        SELECT (CASE
                    WHEN state = 1 THEN '正常'
                    WHEN state = 2 THEN '已注销'
                    WHEN state = 3 THEN '已挂失'
            END) AS stateName
        FROM se_client_card
        WHERE cardNum = #{cardNum,jdbcType=BIGINT}
    </select>
    <!--根据指定条件获取水卡列表记录数,应用程序使用-->
    <select id="getCardsCount" parameterType="java.util.Map" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        <where>
            AND card.state = 1
            <if test="clientNum != null and clientNum != ''">
                AND cli.clientNum like CONCAT('%', #{clientNum}, '%')
            </if>
            <if test="clientName != null and clientName != ''">
                AND cli.name like CONCAT('%', #{clientName}, '%')
            </if>
            <if test="cardNum != null and cardNum != ''">
                AND card.cardNum like CONCAT('%', #{cardNum}, '%')
            </if>
        </where>
    </select>
    <!--根据指定条件获取水卡列表,应用程序使用-->
    <select id="getCards" resultType="com.dy.pipIrrGlobal.voSe.VoCards">
        SELECT cli.clientNum,
               cli.name AS clientName,
               cardNum,
        <!--        CASE-->
        <!--            WHEN card.cardNum LIKE '10%' THEN CONCAT(SUBSTRING(card.cardNum, 7, 6),SUBSTRING(card.cardNum, 14, 4))-->
        <!--            ELSE card.cardNum-->
        <!--        END AS cardNum,-->
        cli.phone,
        cli.idCard,
        card.state AS cardState,
        <!--        (CASE-->
        <!--            WHEN card.state = 1 THEN '正常'-->
        <!--            WHEN card.state = 2 THEN '已注销'-->
        <!--            WHEN card.state = 3 THEN '已挂失'-->
        <!--        End) AS stateName,-->
        '正常'                  AS stateName,
        '农户卡'                 AS cardType,
        FORMAT(card.money, 2) AS money
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        <where>
            AND card.state = 1
            <if test="clientNum != null and clientNum != ''">
                AND cli.clientNum like CONCAT('%', #{clientNum}, '%')
            </if>
            <if test="clientName != null and clientName != ''">
                AND cli.name like CONCAT('%', #{clientName}, '%')
            </if>
            <if test="cardNum != null and cardNum != ''">
                AND card.cardNum like CONCAT('%', #{cardNum}, '%')
            </if>
        </where>
        ORDER BY card.id
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--获取已挂失未补卡的记录数量-->
    <select id="getUnreplacedRecordCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        WHERE card.state = 3
          AND NOT EXISTS(SELECT * FROM se_client_card card2 WHERE card2.original_card_id = card.cardNum)
    </select>
    <!--获取已挂失未补卡的记录-->
    <select id="getUnreplaced" resultType="com.dy.pipIrrGlobal.voSe.VoCards">
        SELECT cli.clientNum,
               cli.name AS clientName,
               cardNum,
        <!--        CASE-->
        <!--          WHEN card.cardNum LIKE '10%' THEN CONCAT(SUBSTRING(card.cardNum, 7, 6),SUBSTRING(card.cardNum, 14, 4))-->
        <!--          ELSE card.cardNum-->
        <!--        END AS cardNum,-->
        cli.phone,
        cli.idCard,
        card.state            AS cardState,
        '已挂失'                 AS stateName,
        '农户卡'                 AS cardType,
        FORMAT(card.money, 2) AS money
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        WHERE card.state = 3
          AND NOT EXISTS(SELECT * FROM se_client_card card2 WHERE card2.original_card_id = card.id)
        ORDER BY card.id
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--根据指定水卡编号获取挂失事记录数量(补卡、解锁使用)-->
    <select id="getLostCount" resultType="java.lang.Integer">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card card
        <where>
            AND card.state = 3
            <if test="cardNum != null and cardNum > 0">
                AND card.cardNum = #{cardNum}
            </if>
        </where>
    </select>
    <!--根据指定水卡编号获取已补卡数量(补卡、解锁使用)-->
    <select id="getReplacedCount" resultType="java.lang.Integer">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card card
                 INNER JOIN se_client_card card2 ON card2.original_card_id = card.id
        <where>
            <if test="cardNum != null and cardNum > 0">
                AND card.cardNum = #{cardNum}
            </if>
        </where>
    </select>
    <!--根据农户姓名和手机号获取水卡列表记录数,应用程序使用-->
    <select id="getCardsByClientNameAndPhoneCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        <where>
            card.state = 1
            <if test="clientName != null and clientName != ''">
                AND cli.name like CONCAT('%', #{clientName}, '%')
            </if>
            <if test="phone != null and phone != ''">
                AND cli.phone like CONCAT('%', #{phone}, '%')
            </if>
        </where>
    </select>
    <!--根据农户姓名和手机号获取水卡列表,应用程序使用-->
    <select id="getCardsByClientNameAndPhone" resultType="com.dy.pipIrrGlobal.voSe.VoCards2">
        SELECT card.id               AS clientCardId,
               cli.id                AS clientId,
               cli.clientNum,
               cli.name              AS clientName,
               card.cardNum,
               cli.phone,
               cli.idCard,
               card.state            AS cardState,
               (CASE
                    WHEN card.state = 1 THEN '正常'
                    WHEN card.state = 2 THEN '已注销'
                    WHEN card.state = 3 THEN '已挂失'
                   End)              AS stateName,
               '农户卡'                 AS cardType,
               FORMAT(card.money, 2) AS money
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        <where>
            card.state = 1
            <if test="clientName != null and clientName != ''">
                AND cli.name like CONCAT('%', #{clientName}, '%')
            </if>
            <if test="phone != null and phone != ''">
                AND cli.phone like CONCAT('%', #{phone}, '%')
            </if>
        </where>
        ORDER BY card.id
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <!--根据农户ID查询正常状态的水卡列表,小程序使用-->
    <select id="getCardsByClientID" resultType="com.dy.pipIrrGlobal.voWe.VoCards3">
        SELECT card.id               AS clientCardId,
               cli.id                AS clientId,
               cli.clientNum,
               cli.name              AS clientName,
               card.cardNum,
               cli.phone,
               cli.idCard,
               card.state            AS cardState,
               (CASE
                    WHEN card.state = 1 THEN '正常'
                    WHEN card.state = 2 THEN '已注销'
                    WHEN card.state = 3 THEN '已挂失'
                   End)              AS stateName,
               '农户卡'                 AS cardType,
               FORMAT(card.money, 2) AS money
        FROM se_client_card card
                 INNER JOIN se_client cli ON card.clientId = cli.id
        where card.state = 1
          AND cli.id like CONCAT('%', #{clientId}, '%')
        ORDER BY card.id
    </select>
    <!--当前余额总量(物理卡)-->
    <select id="getTotalMoneyIcCards" resultType="java.lang.Double">
        SELECT IFNULL(SUM(money), 0) AS totalMoney
        FROM `se_client_card`
        WHERE state = 1
    </select>
    <!--根据水卡地址获取水卡数量-->
    <select id="getCountByCardAddr" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card
        WHERE cardAddr = #{cardAddr}
    </select>
    <!--根据水卡地址获取指定状态的水卡数量-->
    <select id="getCountByCardAddrAndState" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client_card
        WHERE cardAddr = #{cardAddr}
          AND state IN (1, 3)
    </select>
</mapper>
pipIrr-platform/pipIrr-parent.iml
File was deleted
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/PipIrrBaseApplication.java
@@ -18,7 +18,7 @@
                })
        }
)
@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoSe","com.dy.pipIrrGlobal.daoRm"})
@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoSe","com.dy.pipIrrGlobal.daoRm","com.dy.pipIrrGlobal.daoPr"})
public class PipIrrBaseApplication {
    public static void main(String[] args) {
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictCtrl.java
@@ -4,6 +4,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.voBa.VoDictItem;
import com.dy.pipIrrGlobal.voBa.VoMapCenter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,4 +41,25 @@
        return BaseResponseUtils.buildSuccess(dictSv.getDictItemsByDictCode(dictCode));
    }
    /**
     * 根据配置项名称获取配置项值
     * @param itemName
     * @return
     */
    @GetMapping(path = "setting")
    @SsoAop()
    public BaseResponse<String> getSettingValue(String itemName) {
        return BaseResponseUtils.buildSuccess(dictSv.getItemValue(itemName));
    }
    /**
     * 获取地图中心坐标
     * @return
     */
    @GetMapping(path = "map_center")
    @SsoAop
    public BaseResponse<VoMapCenter> getMapCenter() {
        return BaseResponseUtils.buildSuccess(dictSv.getMapCenter());
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/dict/DictSv.java
@@ -1,11 +1,14 @@
package com.dy.pipIrrBase.dict;
import com.dy.pipIrrGlobal.daoBa.BaDictItemMapper;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.voBa.VoDictItem;
import com.dy.pipIrrGlobal.voBa.VoMapCenter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -23,6 +26,9 @@
    @Autowired
    private BaDictItemMapper dictItemMapper;
    @Autowired
    private BaSettingsMapper baSettingsMapper;
    /**
     * 根据字典Code获取字典项
     * @param dictCode
@@ -32,4 +38,27 @@
        List<VoDictItem> rs = Optional.ofNullable(dictItemMapper.getDictItemsByDictCode(dictCode)).orElse(new ArrayList<>());
        return rs ;
    }
    /**
     * 根据配置项名称获取配置项值
     * @param itemName
     * @return
     */
    public String getItemValue(String itemName) {
        return baSettingsMapper.getItemValue(itemName);
    }
    /**
     * 获取地图中心坐标
     * @return
     */
    public VoMapCenter getMapCenter() {
        BigDecimal lat = new BigDecimal(baSettingsMapper.getItemValue("lat"));
        BigDecimal lng = new BigDecimal(baSettingsMapper.getItemValue("lng"));
        VoMapCenter po = new VoMapCenter();
        po.setLat(lat);
        po.setLng(lng);
        return po;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictCtrl.java
@@ -9,9 +9,11 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrBase.district.qo.DistrictQO;
import com.dy.pipIrrGlobal.pojoBa.BaClient;
import com.dy.pipIrrGlobal.pojoBa.BaDistrict;
import com.dy.pipIrrGlobal.util.DistrictLevel;
import com.dy.pipIrrGlobal.voBa.VoDistrict;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -324,4 +326,29 @@
        //return BaseResponseUtils.buildSuccess();
    }
    /**
     * 根据区划代码查询指定级别行政区划
     * @param qo
     * @return
     */
    @GetMapping(path = "/districts")
    @SsoAop()
    public BaseResponse<List<VoDistrict>> getDistrictS(DistrictQO qo) {
        String aredCode = qo.getAredCode();
        Integer level = qo.getLevel();
        if((aredCode.trim().length() == 6 && level == 4) || (aredCode.trim().length() == 9 && level == 5)) {
            try {
                return BaseResponseUtils.buildSuccess(sv.getDistrictS(qo));
            } catch (Exception e) {
                log.error("获取开卡记录异常", e);
                return BaseResponseUtils.buildException(e.getMessage());
            }
        }else {
            return BaseResponseUtils.buildErrorMsg("行政区划位数与级别不匹配");
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictSv.java
@@ -1,8 +1,11 @@
package com.dy.pipIrrBase.district;
import com.dy.pipIrrBase.district.qo.DistrictQO;
import com.dy.pipIrrGlobal.daoBa.AreaCode2023Mapper;
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.pojoBa.BaDistrict;
import com.dy.pipIrrGlobal.util.DistrictLevel;
import com.dy.pipIrrGlobal.voBa.VoDistrict;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -16,10 +19,16 @@
public class DistrictSv {
    private BaDistrictMapper dao;
    private AreaCode2023Mapper areaCode2023Dao;
    @Autowired
    private void setDao(BaDistrictMapper dao){
        this.dao = dao;
    }
    @Autowired
    private void setDao(AreaCode2023Mapper areaCode2023Dao){
        this.areaCode2023Dao = areaCode2023Dao;
    }
    /**
@@ -117,4 +126,13 @@
    public List<Map<String, Object>> getDistrictsBySupperId(Long supperId) {
        return dao.getDistrictsBySupperId(supperId);
    }
    /**
     * 根据区划代码查询指定级别行政区划
     * @param qo
     * @return
     */
    public List<VoDistrict> getDistrictS(DistrictQO qo) {
        return areaCode2023Dao.getDistrictS(qo.getAredCode(), qo.getLevel());
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/qo/DistrictQO.java
New file
@@ -0,0 +1,21 @@
package com.dy.pipIrrBase.district.qo;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * @author ZhuBaoMin
 * @date 2024-08-30 16:28
 * @LastEditTime 2024-08-30 16:28
 * @Description
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class DistrictQO {
    private String aredCode;
    private Integer level;
}
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java
@@ -5,15 +5,13 @@
import com.dy.common.mybatis.envm.Disabled;
import com.dy.common.util.ConfigXml4Springboot;
import com.dy.common.util.MD5;
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.daoBa.BaUserMapper;
import com.dy.pipIrrGlobal.daoBa.*;
import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper;
import com.dy.pipIrrGlobal.daoRm.RmIrrigateProfileMapper;
import com.dy.pipIrrGlobal.daoSe.SePaymentMethodMapper;
import com.dy.pipIrrGlobal.daoSe.SeWaterTypeMapper;
import com.dy.pipIrrGlobal.pojoBa.BaDistrict;
import com.dy.pipIrrGlobal.pojoBa.BaSettings;
import com.dy.pipIrrGlobal.pojoBa.BaUser;
import com.dy.pipIrrGlobal.pojoBa.*;
import com.dy.pipIrrGlobal.pojoPr.PrWaterPrice;
import com.dy.pipIrrGlobal.pojoRm.RmIrrigateProfile;
import com.dy.pipIrrGlobal.pojoSe.SePaymentMethod;
import com.dy.pipIrrGlobal.pojoSe.SeWaterType;
@@ -43,6 +41,9 @@
    private BaSettingsMapper settingsDao ;
    private SeWaterTypeMapper waterTypeDao ;
    private RmIrrigateProfileMapper rmIrrigateProfileDao;
    private PrWaterPriceMapper prWaterPriceDao;
    private BaDictMapper baDictDao;
    private BaDictItemMapper baDictItemDao;
    @Autowired
    public void setResourceLoader(ResourceLoader resourceLoader){
@@ -77,6 +78,21 @@
    @Autowired
    public void setRmIrrigateProfileDao(RmIrrigateProfileMapper rmIrrigateProfileDao) {
        this.rmIrrigateProfileDao = rmIrrigateProfileDao;
    }
    @Autowired
    public void setWaterPriceDao(PrWaterPriceMapper prWaterPriceDao) {
        this.prWaterPriceDao = prWaterPriceDao;
    }
    @Autowired
    public void setBaDictDao(BaDictMapper baDictDao) {
        this.baDictDao = baDictDao;
    }
    @Autowired
    public void setBaDictItemDao(BaDictItemMapper baDictItemDao) {
        this.baDictItemDao = baDictItemDao;
    }
    /**
@@ -178,13 +194,53 @@
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".irrigateProfile")){
                                for(int i = 1 ; i < 10000; i++){
                                    if(configXml.existElement(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i)){
                                        String default_value = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"default_value", null, false, null) ;
                                        String defaultValue = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"defaultValue", null, false, null) ;
                                        String unit = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"unit", null, false, null) ;
                                        String sort = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"sort", null, false, null) ;
                                        String type = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"type", null, false, null) ;
                                        this.saveIrrigateProfile(orgTag, default_value, unit,sort,type);
                                        this.saveIrrigateProfile(orgTag, defaultValue, unit,sort,type);
                                    }else{
                                        break ;
                                    }
                                }
                            }
                        }
                        if(!this.existWaterTypes()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes")){
                                for(int i = 1 ; i < 10000; i++){
                                    if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes.item" + i)){
                                        String typeName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".waterTypes.item" + i,"typeName", null, false, null) ;
                                        this.saveWaterType(orgTag, typeName);
                                    }else{
                                        break ;
                                    }
                                }
                            }
                        }
                        if(!this.existWaterPrice()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".waterPrice")){
                                String price = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".waterPrice","price", null, false, null) ;
                                this.saveWaterPrice(orgTag, price);
                            }
                        }
                        if(!this.existDict()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".dictionaries.dict")){
                                String code = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict","code", null, false, null) ;
                                String title = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict","title", null, false, null) ;
                                String valueType = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict","valueType", null, false, null) ;
                                this.saveDicts(orgTag, code,title,valueType);
                                if(configXml.existElement(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem")){
                                    for(int i = 1 ; i < 10000; i++){
                                        if(configXml.existElement(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem.item" + i)){
                                            String dictCode = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem.item" + i,"dictCode", null, false, null) ;
                                            String value = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem.item" + i,"value", null, false, null) ;
                                            String name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem.item" + i,"name", null, false, null) ;
                                            String status = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem.item" + i,"status", null, false, null) ;
                                            String sort = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".dictionaries.dict.dictItem.item" + i,"sort", null, false, null) ;
                                            this.saveDictItems(orgTag,dictCode,value,name,status,sort);
                                        }else{
                                            break ;
                                        }
                                    }
                                }
                            }
@@ -238,7 +294,7 @@
     * @return 存在否
     */
    private boolean existWaterTypes(){
        Long total = this.waterTypeDao.selectCount(null) ;
        Long total = this.prWaterPriceDao.selectCount(null) ;
        return (total != null && total > 0) ;
    }
@@ -248,6 +304,24 @@
     */
    private boolean existIrrigateProfile(){
        Long total = this.rmIrrigateProfileDao.selectCount(null) ;
        return (total != null && total > 0) ;
    }
    /**
     * 数据库中是否存在水价
     * @return
     */
    private boolean existWaterPrice() {
        Long total = this.prWaterPriceDao.selectCount(null);
        return (total != null && total > 0) ;
    }
    /**
     * 数据库中是否存在字典
     * @return
     */
    private boolean existDict() {
        Long total = this.baDictDao.selectCount(null);
        return (total != null && total > 0) ;
    }
@@ -366,8 +440,73 @@
            po.setUnit(Byte.valueOf(unit));
            po.setSort(Integer.parseInt(sort));
            po.setType(Byte.valueOf(type));
            po.setDeleted(0L);
            this.rmIrrigateProfileDao.insert(po);
        }
    }
    /**
     * 保存水价
     * @param price
     */
    private void saveWaterPrice(String orgTag, String price) {
        if(price != null && !price.trim().equals("")) {
            PrWaterPrice po = new PrWaterPrice();
            po.setPrice(Double.parseDouble(price));
            po.setDeleted((byte)0);
            this.prWaterPriceDao.insert(po);
        }
    }
    /**
     * 保存字典
     * @param orgTag
     * @param code
     * @param title
     * @param valueType
     * @return
     */
    private void saveDicts(String orgTag, String code, String title, String valueType) {
        if((code != null && !code.trim().equals("")) &&
                (title != null && !title.trim().equals("")) &&
                (valueType != null && !valueType.trim().equals(""))) {
            BaDict po = new BaDict();
            po.setCode(code);
            po.setTitle(title);
            po.setValueType(Byte.valueOf(valueType));
            po.setHashCode("c4ca4238a0b923820dcc509a6f75849b");
            po.setDeleted(0L);
            this.baDictDao.insert(po);
        }
    }
    /**
     * 保存字典项
     * @param orgTag
     * @param dictCode
     * @param value
     * @param name
     * @param status
     * @param sort
     */
    private void saveDictItems(String orgTag, String dictCode, String value, String name, String status, String sort) {
        if((dictCode != null && !dictCode.trim().equals("")) &&
                (value != null && !value.trim().equals("")) &&
                (name != null && !name.trim().equals("")) &&
                (status != null && !status.trim().equals("")) &&
                (sort != null && !sort.trim().equals(""))) {
            BaDictItem po = new BaDictItem();
            po.setDictCode(dictCode);
            po.setValue(value);
            po.setName(name);
            po.setStatus(Byte.valueOf(status));
            po.setSort(Integer.parseInt(sort));
            po.setDeleted(0L);
            this.baDictItemDao.insert(po);
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java
@@ -67,12 +67,13 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoDivide>>> getDivides(QueryVo vo){
        try {
            QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo);
            if(res.itemTotal != null && res.itemTotal > 0) {
                return BaseResponseUtils.buildSuccess(res);
            }else {
                return BaseResponseUtils.buildSuccess(ProjectResultCode.NO_DIVIDES.getMessage());
            }
            //QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo);
            //if(res.itemTotal != null && res.itemTotal > 0) {
            //    return BaseResponseUtils.buildSuccess(res);
            //}else {
            //    return BaseResponseUtils.buildSuccess(ProjectResultCode.NO_DIVIDES.getMessage());
            //}
            return BaseResponseUtils.buildSuccess(divideSv.getDivides(vo));
        } catch (Exception e) {
            log.error("获取开卡记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/report/ReportSv.java
@@ -114,7 +114,7 @@
        if(timeStart_open != null && timeStart_open != "") {
            timeStart_open = timeStart_open + " 00:00:00";
        } else {
            timeStart_open = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString();
            timeStart_open = LocalDate.now() + " 00:00:00";
        }
        qo.setTimeStop_open(timeStart_open);
@@ -130,7 +130,7 @@
        if(timeStart_close != null && timeStart_close != "") {
            timeStart_close = timeStart_close + " 00:00:00";
        } else {
            timeStart_close = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString();
            timeStart_close = LocalDate.now() + " 00:00:00";
        }
        qo.setTimeStart_close(timeStart_close);
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -76,6 +76,11 @@
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        // 依据水卡地址判断该卡是否可以开卡,未开过卡或不是正常状态、挂失状态的可开卡
        if(!cardOperateSv.canActiveCard(po.getCardAddr())) {
            return BaseResponseUtils.buildErrorMsg(SellResultCode.ACTIVE_FAIL_CARD_ESIST.getMessage());
        }
        Long clientId = po.getClientId();
        // 获取5级行政区划串areaCode
@@ -153,7 +158,13 @@
        seCardOperate.setMoney(0f);
        seCardOperate.setCardCost(cardCost);
        seCardOperate.setPaymentId(paymentId);
        seCardOperate.setOperateType(OperateTypeENUM.ACTIVE.getCode());
        if(originalCardId != null) {
            // 补卡
            seCardOperate.setOperateType(OperateTypeENUM.REISSUE.getCode());
        }else {
            // 开新卡
            seCardOperate.setOperateType(OperateTypeENUM.ACTIVE.getCode());
        }
        seCardOperate.setRemarks(remarks);
        seCardOperate.setOperator(operator);
        seCardOperate.setOperateDt(activeTime);
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -491,4 +491,26 @@
    public Double getTradeAmountByCardNo(Long cardNum) {
        return seCardOperateMapper.getTradeAmountByCardNo(cardNum);
    }
    /**
     * 根据水卡地址判断该卡是否可以开卡
     * @param cardAddr
     * @return
     */
    public Boolean canActiveCard(String cardAddr) {
        // 指定水卡地址的水卡数量
        Long cardCount = Optional.ofNullable(seClientCardMapper.getCountByCardAddr(cardAddr)).orElse(0L);
        if(cardCount == 0) {
           return true;
        }
        // 指定水卡地址且正常状态或挂失状态的水卡数量
        cardCount = Optional.ofNullable(seClientCardMapper.getCountByCardAddrAndState(cardAddr)).orElse(0L);
        if(cardCount == 0) {
            return true;
        }
        return false;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -19,6 +19,7 @@
    AREA_CODE_MISTAKE(10001, "该农户行政区划异常"),
    CLIENT_NUM_ERROR(10001, "农户编号错误"),
    CARD_NUMBER_OVERRUN(10002, "水卡编号已满"),
    ACTIVE_FAIL_CARD_ESIST(10005, "开卡失败-此卡已存在"),
    ACTIVE_FAIL_WRITE_CLIENT_CARD_ERROR(10003, "开卡失败-农户卡写入异常"),
    ACTIVE_FAIL_WRITE_ACTIVE_CARD_ERROR(10004, "开卡失败-开卡记录写入异常"),
    ACTIVE_FAIL_RECHARGE_EXCEPTION(10005, "开卡失败-充值异常"),
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/LoginVo.java
@@ -26,7 +26,7 @@
    @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "密码不能为空") //不能为空也不能为null
    @Length(message = "密码必须{min}位", min = 5, max = 20)
    @Length(message = "密码不小于{min}位", min = 5, max = 30)
    public String password ;
    @Schema(description = "组织单位", requiredMode = Schema.RequiredMode.REQUIRED)
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -329,7 +329,7 @@
        Integer openType = qo.getOpenType();
        String openTypeName = "";
        if (openType == null){
            openTypeName = "未知";
            openTypeName = "不知道您要查那种开阀类型";
        }else {
            switch (openType) {
                case 1:
@@ -348,7 +348,7 @@
                    openTypeName = "开关阀卡开阀";
                    break;
                default:
                    openTypeName = "未知";
                    openTypeName = "不知道您要查那种开阀类型";
            }
        }
@@ -374,52 +374,59 @@
         */
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart != null) {
            timeStart = timeStart + " 00:00:00";
        }else {
            timeStart = LocalDate.now() + " 00:00:00";
        }
        if(timeStop != null) {
            timeStop = timeStop + " 23:59:59";
            if(timeStart != null) {
                timeStart = timeStart + " 00:00:00";
            }else {
                timeStart = LocalDate.now() + " 00:00:00";
            }
        }else {
            timeStart = null;
        }
        qo.setTimeStart(timeStart);
        qo.setTimeStop(timeStop);
        Integer closeType = qo.getCloseType();
        String closeTypeName = "";
        switch (closeType) {
            case 2:
                closeTypeName = "刷卡关阀";
                break;
            case 4:
                closeTypeName = "中心站关阀";
                break;
            case 5:
                closeTypeName = "欠费关阀";
                break;
            case 6:
                closeTypeName = "流量计故障关阀";
                break;
            case 7:
                closeTypeName = "紧急关阀";
                break;
            case 9:
                closeTypeName = "用户远程关阀";
                break;
            case 10:
                closeTypeName = "开关阀卡关阀";
                break;
            case 12:
                closeTypeName = "黑名单命令关阀";
                break;
            case 13:
                closeTypeName = "远程定时关阀";
                break;
            case 14:
                closeTypeName = "远程定量关阀";
                break;
        if (closeType == null){
            closeTypeName = "不知道您要查那种关阀类型";
        }else {
            switch (closeType) {
                case 2:
                    closeTypeName = "刷卡关阀";
                    break;
                case 4:
                    closeTypeName = "中心站关阀";
                    break;
                case 5:
                    closeTypeName = "欠费关阀";
                    break;
                case 6:
                    closeTypeName = "流量计故障关阀";
                    break;
                case 7:
                    closeTypeName = "紧急关阀";
                    break;
                case 9:
                    closeTypeName = "用户远程关阀";
                    break;
                case 10:
                    closeTypeName = "开关阀卡关阀";
                    break;
                case 12:
                    closeTypeName = "黑名单命令关阀";
                    break;
                case 13:
                    closeTypeName = "远程定时关阀";
                    break;
                case 14:
                    closeTypeName = "远程定量关阀";
                    break;
                default:
                    closeTypeName = "不知道您要查那种关阀类型";
            }
        }
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        Integer closeTypeCount = Optional.ofNullable(rmOpenCloseValveLastMapper.getCountByCloseType(params)).orElse(0);
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java
@@ -44,7 +44,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoIntake>>> getNotOnlineIntakes(@Valid CommonQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
@@ -64,7 +64,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getLargeFlowIntakes(@Valid CumulativeFlowQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getLargeFlowIntakes(qo));
@@ -83,7 +83,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoCumulativeFlow>>> getSmallFlowIntakes(@Valid CumulativeFlowQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getSmallFlowIntakes(qo));
@@ -102,7 +102,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoBatteryVolt>>> getUnderVoltIntakes(@Valid BatteryVoltQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getUnderVoltIntakes(qo));
@@ -121,7 +121,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoSignalIntensity>>> getSpecifiedSignalIntakes(@Valid SignalIntensityQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getSpecifiedSignalIntakes(qo));
@@ -140,7 +140,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<VoCountOfOpenType>> getCountByOpenType(@Valid OpenTypeQO qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getCountByOpenType(qo));
@@ -159,7 +159,7 @@
    @SsoAop()
    public BaseResponse<QueryResultVo<VoCountOfCloseType>> getCountByCloseType(@Valid CloseTypeQo qo, BindingResult bindingResult) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
            return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        try {
            return BaseResponseUtils.buildSuccess(intakeSv.getCountByCloseType(qo));
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/CloseTypeQo.java
@@ -19,7 +19,7 @@
    /**
     * 关阀类型
     */
    @NotNull(message = "关阀类型不能为空")
//    @NotNull(message = "关阀类型不能为空")
    private Integer closeType;
    /**
@@ -32,6 +32,6 @@
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @NotBlank(message = "结束时间不能为空")
//    @NotBlank(message = "结束时间不能为空")
    private String timeStop;
}