wuzeyu
2024-05-29 f1599d8230e83fb08ebb0473bbe486979b4d1d38
Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

 Conflicts:
 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
22个文件已修改
7个文件已添加
1286 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCodeVerifyMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeOpenIdMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCodeVerify.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeOpenId.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml 227 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCodeVerifyMapper.xml 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/dto/CodeVerifyDTO.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoPr/PrIntakeMapper.java
@@ -126,4 +126,10 @@
     */
    //List<VoOnLineIntake> getOnLineIntakes(@Param("onLineMap") String onLineMap, @Param("isOnLine") Boolean isOnLine);
    List<VoOnLineIntake> getOnLineIntakes(Map<?, ?> params);
    /**
     * 根据操作员获取常用取水口
     * @return
     */
    List<VoOnLineIntake> getUsedIntakes(@Param("onLineMap") String onLineMap, @Param("operator") Long operator);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoRm/RmCommandHistoryMapper.java
@@ -4,6 +4,7 @@
import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory;
import com.dy.pipIrrGlobal.voRm.VoUnclosedValve;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -29,9 +30,10 @@
    int updateByPrimaryKey(RmCommandHistory record);
    /**
     * 根据操作员ID获取未关阀记录
     * @param operator 操作员ID
     * @return 未关阀记录
     * 根据操作员ID获取未关阀记录(包含在线情况)
     * @param onLineMap
     * @param operator
     * @return
     */
    List<VoUnclosedValve> getUnclosedValves(Long operator);
    List<VoUnclosedValve> getUnclosedValves(@Param("onLineMap") String onLineMap, @Param("operator") Long operator);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientMapper.java
@@ -59,6 +59,13 @@
    Long getClientIdByNum(@Param("clientNum") String clientNum);
    /**
     * 根据电话号码获取农户ID
     * @param phoneNumber
     * @return
     */
    Long getClientIdByPhone(String phoneNumber);
    /**
     * 根据指定条件获取农户记录数
     * @param params
     * @return
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCodeVerifyMapper.java
New file
@@ -0,0 +1,34 @@
package com.dy.pipIrrGlobal.daoSe;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-05-28 14:54
 * @LastEditTime 2024-05-28 14:54
 * @Description
 */
@Mapper
public interface SeCodeVerifyMapper extends BaseMapper<SeCodeVerify> {
    int deleteByPrimaryKey(Long id);
    int insert(SeCodeVerify record);
    int insertSelective(SeCodeVerify record);
    SeCodeVerify selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(SeCodeVerify record);
    int updateByPrimaryKey(SeCodeVerify record);
    /**
     * 根据手机号获取验证码验证对象
     * @param phoneNumber
     * @return
     */
    SeCodeVerify getCodeVerify(String phoneNumber);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeOpenIdMapper.java
New file
@@ -0,0 +1,27 @@
package com.dy.pipIrrGlobal.daoSe;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author ZhuBaoMin
 * @date 2024-05-28 21:04
 * @LastEditTime 2024-05-28 21:04
 * @Description
 */
@Mapper
public interface SeOpenIdMapper extends BaseMapper<SeOpenId> {
    int deleteByPrimaryKey(Long id);
    int insert(SeOpenId record);
    int insertSelective(SeOpenId record);
    SeOpenId selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(SeOpenId record);
    int updateByPrimaryKey(SeOpenId record);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java
@@ -29,19 +29,19 @@
    int updateByPrimaryKey(SeVirtualCard record);
    /**
    /** 废弃
     * 验证农户是否拥有指定名称的虚拟卡
     * @param clientId 农户编号
     * @param vcName 虚拟卡名称
     * @return 符合条件记录数
     */
    int getRecordCountByName(@Param("clientId") Long clientId, @Param("vcName") String vcName);
    //int getRecordCountByName(@Param("clientId") Long clientId, @Param("vcName") String vcName);
    /**
     * 获取全部虚拟卡
     * 获取农户全部虚拟卡
     * @return
     */
    List<VoVirtualCard> getVCs();
    List<VoVirtualCard> getVCs(@Param("clientId") Long clientId);
    /**
     * 根据虚拟卡ID获取虚拟卡对象
@@ -56,4 +56,11 @@
     * @return
     */
    Long getVcIdByNum(@Param("vcNum") String vcNum);
    /**
     * 根据行政区划串模糊查询虚拟卡编号
     * @param areaCode
     * @return
     */
    String getVcCardNumOfMax(@Param("areaCode") String areaCode);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaUser.java
@@ -53,6 +53,7 @@
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(value = "id", type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    //public Long userId;
    public Long id;
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeCodeVerify.java
New file
@@ -0,0 +1,64 @@
package com.dy.pipIrrGlobal.pojoSe;
/**
 * @author ZhuBaoMin
 * @date 2024-05-28 14:54
 * @LastEditTime 2024-05-28 14:54
 * @Description
 */
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
/**
 * 验证码记录表
 */
@TableName(value="se_code_verify", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "验证码记录实体")
public class SeCodeVerify implements BaseEntity {
    public static final long serialVersionUID = 202405281457001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
    * 手机号
    */
    @Schema(description = "手机号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "手机号不能为空")
    private String phoneNumber;
    /**
    * 验证码
    */
    @Schema(description = "验证码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "验证码不能为空")
    private String securityCode;
    /**
    * 过期时间
    */
    @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "过期时间不能为空")
    private Long expires;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeOpenId.java
New file
@@ -0,0 +1,70 @@
package com.dy.pipIrrGlobal.pojoSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.po.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-05-28 21:04
 * @LastEditTime 2024-05-28 21:04
 * @Description
 */
/**
 * 微信用户账户表
 */
@TableName(value="se_open_id", autoResultMap = true)
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "微信用户账户实体")
public class SeOpenId implements BaseEntity {
    public static final long serialVersionUID = 202405282108001L;
    /**
    * 主键
    */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Long id;
    /**
    * 农户ID
    */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
    * 用户唯一标识
    */
    @Schema(description = "用户唯一标识", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "用户唯一标识不能为空")
    private String openId;
    /**
    * 会话密钥
    */
    @Schema(description = "会话密钥", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "会话密钥不能为空")
    private String sessionKey;
    /**
    * 创建时间
    */
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    private Date createTime;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voRm/VoUnclosedValve.java
@@ -20,6 +20,8 @@
    private String intakeNum;
    private Boolean isOnLine;
    private String rtuAddr;
    private String orderNo;
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaUserMapper.xml
@@ -2,10 +2,11 @@
<!DOCTYPE mapper  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace对应mapper接口所在的位置-->
<mapper namespace="com.dy.pipIrrGlobal.daoBa.BaUserMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
        <!--@mbg.generated-->
        <!--@Table ba_user-->
        <id property="id" column="id"/>
        <id property="id" column="id" />
        <result property="blockId" column="blockId"/>
        <result property="userName" column="name"/>
        <result property="phone" column="phone"/>
@@ -21,17 +22,16 @@
    <resultMap id="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
        <!--@mbg.generated-->
        <!--@Table ba_user-->
        <id property="id" column="id"/>
        <id property="id" column="id" />
        <result property="userName" column="name"/>
        <result property="phone" column="phone"/>
        <result property="orgTag" column="orgTag"/>
        <result property="supperAdmin" column="supperAdmin"/>
        <result property="disabled" column="disabled" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler"
                javaType="com.dy.common.mybatis.envm.Disabled"/>
        <result property="disabled" column="disabled" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Disabled"/>
    </resultMap>
    <resultMap id="loginResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
        <id property="id" column="id"/>
        <id property="id" column="id" />
        <result property="blockId" column="blockId"/>
        <result property="userName" column="name"/>
        <result property="phone" column="phone"/>
@@ -40,101 +40,79 @@
    </resultMap>
    <resultMap id="someResultMap" extends="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser">
        <collection property="roleList" fetchType="eager" column="{userId=id}"
                    select="com.dy.pipIrrGlobal.daoBa.BaRoleMapper.selectByUserId"/>
        <collection property="roleList" fetchType="eager" column="{userId=id}" select="com.dy.pipIrrGlobal.daoBa.BaRoleMapper.selectByUserId" />
    </resultMap>
    <sql id="Base_Column_List">
        id,
        blockId,
        name,
        phone,
        password,
        orgTag,
        supperAdmin,
        disabled,
        deleted
        id, blockId, name, phone, password, orgTag, supperAdmin, disabled, deleted
    </sql>
    <sql id="part_Column_List">
        ${alias}.id,
        ${alias}.name,
        ${alias}.phone,
        ${alias}.disabled
        ${alias}.id, ${alias}.name, ${alias}.phone, ${alias}.disabled
    </sql>
    <sql id="Login_Column_List">
        id,
        blockId,
        name,
        phone,
        orgTag,
        supperAdmin
        id, blockId, name, phone, orgTag, supperAdmin
    </sql>
    <select id="login" resultMap="loginResultMap">
    <select id="login" resultMap="loginResultMap" >
        select
        <include refid="Login_Column_List"/>
        <include refid="Login_Column_List" />
        from ba_user
        where disabled!=1 and deleted!=1 and phone=#{phone}
          and password=#{password}
        where disabled!=1 and deleted!=1 and phone=#{phone} and password=#{password}
    </select>
    <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long">
        select count(*)
        select
        count(*)
        from ba_user
        where supperAdmin!=1 and deleted!=1
        <trim prefix="and" suffixOverrides="and">
            <if test="name != null and name != ''">
                name like concat('%', #{name}
                    , '%')
                  and
                name like concat('%', #{name}, '%') and
            </if>
            <if test="phone != null and phone != ''">
            <if test="phone != null and phone !=''">
                phone = #{phone,jdbcType=VARCHAR}
            </if>
        </trim>
    </select>
    <select id="selectSome" parameterType="java.util.Map" resultMap="someResultMap">
        select
        <include refid="part_Column_List">
        <include refid="part_Column_List" >
            <property name="alias" value="bu"/>
        </include>
        ,
            bb.`name` blockName
        </include>,
        bb.`name` blockName
        from ba_user bu
                 left join ba_block bb on bu.blockId = bb.id
        left join ba_block bb on bu.blockId = bb.id
        where bu.supperAdmin!=1 and bu.deleted!=1
        <trim prefix="and" suffixOverrides="and">
            <if test="name != null and name != ''">
                bu.name like concat('%', #{name}
                    , '%')
                  and
                bu.name like concat('%', #{name}, '%') and
            </if>
            <if test="phone != null and phone != ''">
            <if test="phone != null and phone !=''">
                bu.phone = #{phone,jdbcType=VARCHAR}
            </if>
        </trim>
        order by id DESC
        <trim prefix="limit ">
        <trim prefix="limit " >
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
    <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
        insert into ba_user (<include refid="Base_Column_List"/>)
    values (#{id,jdbcType=BIGINT},
            #{blockId,jdbcType=BIGINT},
            #{userName,jdbcType=VARCHAR},
            #{phone,jdbcType=VARCHAR},
            #{password,jdbcType=VARCHAR},
            #{orgTag,jdbcType=VARCHAR},
            #{supperAdmin,jdbcType=TINYINT},
            #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
            #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT})
<!--        insert into ba_user (<include refid="Base_Column_List" />)-->
        insert into ba_user(id, blockId, name, phone, password, orgTag, supperAdmin, disabled, deleted)
        values (#{id,jdbcType=BIGINT},
        #{blockId,jdbcType=BIGINT},
        #{userName,jdbcType=VARCHAR},
        #{phone,jdbcType=VARCHAR},
        #{password,jdbcType=VARCHAR},
        #{orgTag,jdbcType=VARCHAR},
        #{supperAdmin,jdbcType=TINYINT},
        #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
        #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
        )
    </insert>
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
        insert into ba_user
@@ -145,7 +123,7 @@
            <if test="blockId != null">
                blockId,
            </if>
            <if test="userName != null">
           <if test="userName != null">
                `name`,
            </if>
            <if test="phone != null">
@@ -160,10 +138,10 @@
            <if test="supperAdmin != null">
                supperAdmin,
            </if>
            <if test="disabled != null">
                disabled,
           <if test="disabled != null">
               disabled,
            </if>
            <if test="deleted != null">
           <if test="deleted != null">
                deleted,
            </if>
        </trim>
@@ -174,7 +152,7 @@
            <if test="blockId != null">
                #{blockId,jdbcType=BIGINT},
            </if>
            <if test="userName != null">
           <if test="userName != null">
                #{userName,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
@@ -204,7 +182,7 @@
            <if test="blockId != null">
                blockId = #{blockId,jdbcType=BIGINT},
            </if>
            <if test="userName != null">
           <if test="userName != null">
                `name` = #{userName,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
@@ -224,46 +202,44 @@
    </update>
    <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
        update ba_user
        set blockId  = #{blockId,jdbcType=BIGINT},
            `name`   = #{userName,jdbcType=VARCHAR},
            phone    = #{phone,jdbcType=VARCHAR},
            password = #{password,jdbcType=VARCHAR},
            disabled = #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
            deleted  = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
        set blockId = #{blockId,jdbcType=BIGINT},
        `name` = #{userName,jdbcType=VARCHAR},
        phone = #{phone,jdbcType=VARCHAR},
        password = #{password,jdbcType=VARCHAR},
        disabled = #{disabled,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
        deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="changePassword">
    <update id="changePassword" >
        update ba_user
        set password = #{password,jdbcType=VARCHAR}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete
        from ba_user
        delete from ba_user
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="deleteLogicById" parameterType="java.lang.Long">
        update ba_user
        set deleted = 1
        update ba_user set deleted = 1
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <!--根据用户编号获取用户信息-->
    <!--2024-01-09 废弃-->
    <select id="getUserInfos" resultType="com.dy.pipIrrGlobal.voBa.VoUserInfo">
        SELECT user.id     AS userId,
               user.`name` AS userName,
               rol.id      AS roleId,
               rol.`name`  AS roleName,
               per.permissions
        SELECT
            user.id AS userId,
            user.`name` AS userName,
            rol.id AS roleId,
            rol.`name` AS roleName,
            per.permissions
        FROM ba_user user
            INNER JOIN ba_user_role use_rol
        ON user.id = use_rol.userId
            INNER JOIN ba_user_role use_rol ON user.id = use_rol.userId
            INNER JOIN ba_role rol ON rol.id = use_rol.roleId
            INNER JOIN ba_role_permissions per ON per.roleId = rol.id
        <where>
            <if test="userId != null and userId > 0">
            <if test = "userId != null and userId > 0">
                AND user.id = ${userId}
            </if>
        </where>
@@ -271,17 +247,18 @@
    <!--根据用户编号获取用户信息-->
    <select id="getUserInfoById" resultType="java.util.Map">
        SELECT us.id                 AS userId,
               us.name               AS userName,
               us.phone,
               IFNULL(us.blockId, 0) AS blockId,
               IFNULL(blo.name, 0)   AS blockName
        SELECT
            us.id AS userId,
            us.name AS userName,
            us.phone,
            IFNULL(us.blockId, 0) AS blockId,
            IFNULL(blo.name, 0) AS blockName
        FROM ba_user us
                 LEFT JOIN ba_block blo ON us.blockId = blo.id
            LEFT JOIN ba_block blo ON us.blockId = blo.id
        <where>
            AND us.disabled = 0
                  AND us.deleted = 0
            <if test="userId != null and userId > 0">
            AND us.deleted = 0
            <if test = "userId != null and userId > 0">
                AND us.id = ${userId}
            </if>
        </where>
@@ -289,26 +266,23 @@
    <!--根据指定的条件获取用户记录数-->
    <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        SELECT
            COUNT(*) AS recordCount
        FROM ba_user user
<!--            INNER JOIN ba_user_role usro ON usro.userId = user.id-->
            INNER JOIN ba_user_role usro ON usro.userId = user.id
        <where>
            AND user.supperAdmin != 1
                AND user.deleted = 0
            AND user.deleted = 0
            <if test="userName != null and userName != ''">
                AND user.name like CONCAT('%'
                  , #{userName}
                  , '%')
            <if test = "userName != null and userName !=''">
                AND user.name like CONCAT('%',#{userName},'%')
            </if>
            <if test="phone != null and phone != ''">
                AND user.phone like CONCAT('%'
                  , #{phone}
                  , '%')
            <if test = "phone != null and phone !=''">
                AND user.phone like CONCAT('%',#{phone},'%')
            </if>
            <if test="roleId != null and roleId > 0">
            <if test = "roleId != null and roleId > 0">
                AND usro.roleId = ${roleId}
            </if>
        </where>
@@ -316,36 +290,37 @@
    <!--根据指定条件获取用户列表-->
    <select id="getUsers" resultType="com.dy.pipIrrGlobal.voBa.VoUserInfo">
        SELECT CAST(user.id AS char)                               AS userId,
               user.phone,
               user.name                                           AS userName,
               user.disabled                                       AS stateId,
               (CASE
                    WHEN disabled = 0 THEN "正常"
                    WHEN disabled = 1 THEN "已禁用"
                   END)                                            AS stateName,
               CAST(user.blockId AS char)                          AS blockId,
               (SELECT name FROM ba_block WHERE id = user.blockId) AS blockName
        SELECT
            CAST(id AS char) AS userId,
            phone,
            name AS userName,
            disabled AS stateId,
            (CASE
                 WHEN disabled = 0 THEN "正常"
                 WHEN disabled = 1 THEN "已禁用"
                END) AS stateName,
            CAST(blockId AS char) AS blockId,
            (SELECT name FROM ba_block WHERE id = user.blockId) AS blockName
        FROM ba_user user
<!--            INNER JOIN ba_user_role usro ON usro.userId = user.id-->
            INNER JOIN ba_user_role usro ON usro.userId = user.id
        <where>
            AND user.supperAdmin != 1
                AND user.deleted = 0
            AND user.deleted = 0
            <if test="userName != null and userName != ''">
                AND user.name like CONCAT('%', #{userName}, '%')
            <if test = "userName != null and userName !=''">
                AND user.name like CONCAT('%',#{userName},'%')
            </if>
            <if test="phone != null and phone != ''">
                AND user.phone like CONCAT('%', #{phone}, '%')
            <if test = "phone != null and phone !=''">
                AND user.phone like CONCAT('%',#{phone},'%')
            </if>
            <if test="roleId != null and roleId > 0">
            <if test = "roleId != null and roleId > 0">
                AND usro.roleId = ${roleId}
            </if>
        </where>
        ORDER BY user.id DESC
        <trim prefix="limit ">
        <trim prefix="limit " >
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
@@ -354,22 +329,18 @@
    <!--根据用户编号获取角色ID列表-->
    <select id="getRoleIdsByUserId" resultType="java.util.HashMap">
        SELECT roleId
        SELECT
            roleId
        FROM ba_user_role
        WHERE userId = ${userId}
    </select>
    <select id="getRoleNamesByUserId" resultType="java.util.HashMap">
        SELECT ro.name AS roleName
        SELECT
            ro.name AS roleName
        FROM ba_user_role usro
                 INNER JOIN ba_role ro ON usro.roleId = ro.id
        WHERE userId = ${userId}
    </select>
    <select id="selectById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from ba_user
        where id = #{id,jdbcType=BIGINT}
    </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -411,4 +411,29 @@
      LIMIT ${(pageCurr-1)*pageSize}, ${pageSize}
    </if>
  </select>
  <!--根据操作员获取常用取水口-->
  <select id="getUsedIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoOnLineIntake">
    SELECT
      DISTINCT con.intakeId,
               con.rtuAddr,
               inta.name AS intakeNum,
               rtus.isOnLine
    FROM pr_controller con
           INNER JOIN pr_intake inta ON con.intakeId = inta.id
           INNER JOIN rm_command_history com ON con.rtuAddr = com.rtuAddr
           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 con.rtuAddr = rtus.rtuAddr
    <where>
      <if test="operator != null">
        com.operator = #{operator}
      </if>
    </where>
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/RmCommandHistoryMapper.xml
@@ -171,20 +171,29 @@
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据操作员ID获取未关阀记录-->
  <!--根据操作员ID获取未关阀记录(包含在线情况)-->
  <select id="getUnclosedValves" resultType="com.dy.pipIrrGlobal.voRm.VoUnclosedValve">
    SELECT
      com.command_code AS commandCode,
      inta.name AS intakeNum,
      com.rtuAddr,
      com.param ->>'$.orderNo' AS orderNo,
      com.param ->>'$.icCardNo' AS vcNum,
      com.send_time AS openTime
        com.command_code AS commandCode,
        inta.name AS intakeNum,
        rtus.isOnLine,
        com.rtuAddr,
        com.param ->>'$.orderNo' AS orderNo,
        com.param ->>'$.icCardNo' AS vcNum,
        com.send_time AS openTime
    FROM rm_command_history com
      INNER JOIN pr_controller con ON com.rtuAddr = con.rtuAddr
      INNER JOIN pr_intake inta ON con.intakeId = inta.id
        INNER JOIN pr_controller con ON com.rtuAddr = 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.rtuAddr = rtus.rtuAddr
    WHERE (com.command_code = '92' OR com.command_code = 'A2') AND com.operator = #{operator}
      AND NOT EXISTS (SELECT * FROM rm_command_history WHERE (command_code = '93' OR command_code = 'A3') AND param ->>'$.orderNo' = com.param ->>'$.orderNo')
    AND NOT EXISTS (SELECT * FROM rm_command_history WHERE (command_code = '93' OR command_code = 'A3') AND param ->>'$.orderNo' = com.param ->>'$.orderNo')
    ORDER BY com.send_time DESC
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientMapper.xml
@@ -406,6 +406,11 @@
    SELECT id FROM se_client WHERE clientNum = ${clientNum}
  </select>
  <!--根据电话号码获取农户ID-->
  <select id="getClientIdByPhone" resultType="java.lang.Long">
    SELECT id FROM se_client WHERE phone = #{phoneNumber}
  </select>
  <!--根据农户ID逻辑删除农户-->
  <update id="deleteClientById" parameterType="java.lang.Long">
    update se_client set deleted = 1
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCodeVerifyMapper.xml
New file
@@ -0,0 +1,99 @@
<?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.SeCodeVerifyMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
    <!--@mbg.generated-->
    <!--@Table se_code_verify-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber" />
    <result column="security_code" jdbcType="VARCHAR" property="securityCode" />
    <result column="expires" jdbcType="BIGINT" property="expires" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, phone_number, security_code, expires
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from se_code_verify
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from se_code_verify
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
    <!--@mbg.generated-->
    insert into se_code_verify (id, phone_number, security_code,
      expires)
    values (#{id,jdbcType=BIGINT}, #{phoneNumber,jdbcType=VARCHAR}, #{securityCode,jdbcType=VARCHAR},
      #{expires,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
    <!--@mbg.generated-->
    insert into se_code_verify
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="phoneNumber != null">
        phone_number,
      </if>
      <if test="securityCode != null">
        security_code,
      </if>
      <if test="expires != null">
        expires,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="phoneNumber != null">
        #{phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="securityCode != null">
        #{securityCode,jdbcType=VARCHAR},
      </if>
      <if test="expires != null">
        #{expires,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
    <!--@mbg.generated-->
    update se_code_verify
    <set>
      <if test="phoneNumber != null">
        phone_number = #{phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="securityCode != null">
        security_code = #{securityCode,jdbcType=VARCHAR},
      </if>
      <if test="expires != null">
        expires = #{expires,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
    <!--@mbg.generated-->
    update se_code_verify
    set phone_number = #{phoneNumber,jdbcType=VARCHAR},
      security_code = #{securityCode,jdbcType=VARCHAR},
      expires = #{expires,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <!--根据手机号获取验证码验证对象-->
  <select id="getCodeVerify" resultType="com.dy.pipIrrGlobal.pojoSe.SeCodeVerify">
    SELECT * FROM se_code_verify
    WHERE phone_number = #{phoneNumber}
    ORDER BY expires DESC
    LIMIT 0,1
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeOpenIdMapper.xml
New file
@@ -0,0 +1,102 @@
<?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.SeOpenIdMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
    <!--@mbg.generated-->
    <!--@Table se_open_id-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="client_id" jdbcType="BIGINT" property="clientId" />
    <result column="open_id" jdbcType="VARCHAR" property="openId" />
    <result column="session_key" jdbcType="VARCHAR" property="sessionKey" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, client_id, open_id, session_key, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from se_open_id
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from se_open_id
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
    <!--@mbg.generated-->
    insert into se_open_id (id, client_id, open_id,
      session_key, create_time)
    values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{openId,jdbcType=VARCHAR},
      #{sessionKey,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
    <!--@mbg.generated-->
    insert into se_open_id
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="clientId != null">
        client_id,
      </if>
      <if test="openId != null">
        open_id,
      </if>
      <if test="sessionKey != null">
        session_key,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="clientId != null">
        #{clientId,jdbcType=BIGINT},
      </if>
      <if test="openId != null">
        #{openId,jdbcType=VARCHAR},
      </if>
      <if test="sessionKey != null">
        #{sessionKey,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
    <!--@mbg.generated-->
    update se_open_id
    <set>
      <if test="clientId != null">
        client_id = #{clientId,jdbcType=BIGINT},
      </if>
      <if test="openId != null">
        open_id = #{openId,jdbcType=VARCHAR},
      </if>
      <if test="sessionKey != null">
        session_key = #{sessionKey,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeOpenId">
    <!--@mbg.generated-->
    update se_open_id
    set client_id = #{clientId,jdbcType=BIGINT},
      open_id = #{openId,jdbcType=VARCHAR},
      session_key = #{sessionKey,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml
@@ -150,7 +150,7 @@
    </where>
  </select>
  <!--获取全部虚拟卡-->
  <!--获取农户全部虚拟卡-->
  <select id="getVCs" resultType="com.dy.pipIrrGlobal.voSe.VoVirtualCard">
    SELECT
      CAST(id AS char) AS id,
@@ -162,6 +162,11 @@
        WHEN in_use = 1 THEN "使用中"
      END) AS inUseName
    FROM se_virtual_card
    <where>
      <if test = "clientId != null">
        AND client_id = #{clientId}
      </if>
    </where>
    ORDER BY in_use, money
  </select>
@@ -184,4 +189,13 @@
  <select id="getVcIdByNum" resultType="java.lang.Long">
    SELECT id FROM se_virtual_card WHERE vc_num = #{vcNum}
  </select>
  <!--根据行政区划串模糊查询虚拟卡编号-->
  <select id="getVcCardNumOfMax"  resultType="java.lang.String">
    SELECT vc_num
    FROM se_virtual_card
    WHERE vc_num LIKE CONCAT('%',#{areaCode},'%')
    ORDER BY vc_num desc
    LIMIT 0,1
  </select>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandSv.java
@@ -18,6 +18,7 @@
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -66,16 +67,6 @@
        return rmCommandHistoryMapper.updateByPrimaryKeySelective(po);
    }
    /**
     * 根据操作员ID获取未关阀记录
     * @param operator
     * @return
     */
    public List<VoUnclosedValve> getUnclosedValves(Long operator) {
        return rmCommandHistoryMapper.getUnclosedValves(operator);
    }
    /**
     * 获取取水口列表
     * @return
@@ -116,4 +107,70 @@
        }
    }
    /**
     * 根据操作员获取常用取水口
     * @param operator
     * @return
     */
    public List<VoOnLineIntake> getUsedIntakes(Long operator) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            return prIntakeMapper.getUsedIntakes(jsonArray.toJSONString(), operator);
        } else {
            return new ArrayList<>();
        }
    }
    /**
     * 根据操作员ID获取未关阀记录(包含在线情况)
     * @param operator
     * @return
     */
    public List<VoUnclosedValve> getUnclosedValves(Long operator) {
        Command com = new Command() ;
        com.id = Command.defaultId;
        com.code = "LCD0001";
        com.type = "innerCommand";
        JSONObject response = (JSONObject) JSON.toJSON(sendCom2Mw(com));
        if(response != null && response.getString("code").equals("0001")) {
            JSONObject attachment = response.getJSONObject("content").getJSONObject("attachment").getJSONObject("onLineMap");
            HashMap<String, Boolean> onLineMap = JSON.parseObject(attachment.toJSONString(), HashMap.class);
            JSONArray jsonArray = new JSONArray();
            for (Map.Entry<String, Boolean> entry : onLineMap.entrySet()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("rtuAddr", entry.getKey());
                jsonObject.put("isOnLine", entry.getValue());
                jsonArray.add(jsonObject);
            }
            List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(jsonArray.toJSONString(), operator);
            if(res != null) {
                return res;
            } else {
                return new ArrayList<>();
            }
        } else {
            QueryResultVo<List<VoOnLineIntake>> rsVo = new QueryResultVo<>();
            return new ArrayList<>();
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/rtu/RtuCtrl.java
@@ -51,7 +51,7 @@
    protected static String controllerType = "57";
    /**
     * 查询所有RTU在线情况
     * 查询所有RTU在线情况(仅测试用)
     * @return
     */
    @GetMapping(path = "get_online")
@@ -86,6 +86,23 @@
    }
    /**
     * 根据操作员获取常用取水口
     * @param operator
     * @return
     */
    @GetMapping(path = "used_intakes")
    @SsoAop()
    public BaseResponse<List<VoOnLineIntake>> getUsedIntakes(Long operator) {
        try {
            List<VoOnLineIntake> res = commandSv.getUsedIntakes(operator);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询取水口异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 设置设备终端地址
     * @param addr 设置设备终端地址传入对象
     * @param bindingResult
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java
@@ -280,7 +280,7 @@
    @SsoAop()
    public BaseResponse<List<VoUnclosedValve>> getUnclosedValves(@RequestParam Long operator){
        try {
            List<VoUnclosedValve> res = rmCommandHistoryMapper.getUnclosedValves(operator);
            List<VoUnclosedValve> res = commandSv.getUnclosedValves(operator);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取未关阀记录异常", e);
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java
@@ -10,10 +10,15 @@
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.pojoBa.BaClient;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrSell.client.dto.CodeVerifyDTO;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.sms.AliyunSmsSv;
import com.dy.pipIrrSell.sms.RandomCode;
import com.dy.pipIrrSell.util.RestTemplateUtil;
import com.dy.pipIrrSell.wechatpay.PayInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -29,6 +34,7 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.*;
/**
@@ -47,10 +53,21 @@
    private final ClientSv clientSv;
    private final AliyunSmsSv aliyunSmsSv;
    //private final RedisUtils redisUtils;
    private final RestTemplateUtil restTemplateUtil;
    private final String privateCertFileName = PayInfo.privateCertFileName;
    private final String appid = PayInfo.appid;
    private final String secret = PayInfo.secret;
    private final String mchid = PayInfo.mchid;
    private final String schema = PayInfo.schema;
    private final String signType = PayInfo.signType;
    private final String description = PayInfo.description;
    private final String loginUrl = PayInfo.loginUrl;
    private final String notifyUrl = PayInfo.notifyUrl;
    private final String grantType = PayInfo.grantType;
    /**
     * 获取农户列表
     *
     * @param vo
     * @return
     */
@@ -65,19 +82,18 @@
    })
    @GetMapping(path = "get")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoClient>>> get(QueryVo vo) {
    public BaseResponse<QueryResultVo<List<VoClient>>> get(QueryVo vo){
        try {
            QueryResultVo<List<VoClient>> res = clientSv.getClients(vo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 根据主键获取一个农户对象
     *
     * @param id
     * @return
     */
@@ -92,20 +108,19 @@
    })
    @GetMapping(path = "/getone/{id}")
    @SsoAop()
    public BaseResponse<VoClient> getOneClient(@PathVariable("id") Long id) {
    public BaseResponse<VoClient> getOneClient(@PathVariable("id") Long id){
        try {
            VoClient res = clientSv.getOneClient(id);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 添加一个农户对象
     *
     * @param po
     * @param bindingResult
     * @return
@@ -123,7 +138,7 @@
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
@@ -134,7 +149,7 @@
         * 获取5级行政区划信息
         */
        Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
        if (map_districts.size() <= 0) {
        if(map_districts.size() <= 0) {
            return BaseResponseUtils.buildFail("区划信息有误");
        }
@@ -159,11 +174,11 @@
        // 生成虚拟卡号
        Long virtualId = Optional.ofNullable(clientSv.getMa1xVirtualId()).orElse(0L);
        if (virtualId == 0) {
        if(virtualId == 0) {
            virtualId = 1000000000L;
        } else {
        }else {
            virtualId = virtualId + 1;
            if (virtualId > 10000000000L) {
            if(virtualId > 10000000000L) {
                return BaseResponseUtils.buildFail("虚拟卡号超限");
            }
        }
@@ -178,33 +193,33 @@
        Date operateTime = new Date();
        seClient.setOperatedt(operateTime);
        seClient.setDisabled((byte) 0);
        seClient.setDeleted((byte) 0);
        seClient.setDisabled((byte)0);
        seClient.setDeleted((byte)0);
        Integer rec = Optional.ofNullable(clientSv.addClient(seClient)).orElse(0);
        if (rec == 0) {
        if(rec == 0) {
            return BaseResponseUtils.buildFail("添加农户失败");
        }
        return BaseResponseUtils.buildSuccess(true);
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 生成10位农户编号
     * 1. 到农户表中查询6位区划串开头的最大的农户编号
     * 2. 是否取到记录
     * 2.1 取到
     * 2.1.1 取出后4位顺序号并转成整形
     * 2.1.2. 整形格式的顺序号加1并判断是否大于9999
     * 2.1.2.1 如果大于则提示用户编号已满
     * 2.1.2.2 如果不大 6位区划加上格式化后的顺序号
     * 2.2 未取到 6位区划加上0001
     *      2.1 取到
     *          2.1.1 取出后4位顺序号并转成整形
     *          2.1.2. 整形格式的顺序号加1并判断是否大于9999
     *              2.1.2.1 如果大于则提示用户编号已满
     *              2.1.2.2 如果不大 6位区划加上格式化后的顺序号
     *      2.2 未取到 6位区划加上0001
     * 3. 返回农户编号
     */
    private String generateClientNum(String district8) {
        String clientNum = Optional.ofNullable(clientSv.getClientNumOfMax(district8)).orElse("");
        if (clientNum != null && clientNum.trim().length() > 0) {
        if(clientNum != null && clientNum.trim().length() > 0) {
            Integer number = Integer.parseInt(clientNum.substring(8));
            number = number + 1;
            if (number > 9999) {
            if(number > 9999) {
                return "农户编号超限";
            }
            clientNum = clientNum.substring(0, 8) + String.format("%04d", number);
@@ -216,8 +231,7 @@
    /**
     * 修改农户对象(虚拟卡号、禁止标志、逻辑删除标识不参与修改)
     *
     * @param po            农户对象
     * @param po 农户对象
     * @param bindingResult
     * @return
     */
@@ -233,8 +247,8 @@
    @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult) {
        if (bindingResult != null && bindingResult.hasErrors()) {
    public BaseResponse<Boolean> update(@RequestBody @Valid DtoClient po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
@@ -245,7 +259,7 @@
         * 获取5级行政区划信息
         */
        Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
        if (map_districts.size() <= 0) {
        if(map_districts.size() <= 0) {
            return BaseResponseUtils.buildFail("区划信息有误");
        }
@@ -278,15 +292,14 @@
        seClient.setOperatedt(operateTime);
        Integer rec = Optional.ofNullable(clientSv.updateByPrimaryKey(seClient)).orElse(0);
        if (rec == 0) {
        if(rec == 0) {
            return BaseResponseUtils.buildFail("农户修改失败");
        }
        return BaseResponseUtils.buildSuccess(true);
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 根据农户ID逻辑删除农户
     *
     * @param id
     * @return
     */
@@ -302,22 +315,21 @@
    @GetMapping(path = "/delone/{id}")
    @SsoAop()
    public BaseResponse<Boolean> deleteClientById(@PathVariable("id") Long id) {
    public BaseResponse<Boolean> deleteClientById(@PathVariable("id") Long id){
        try {
            Integer res = Optional.ofNullable(clientSv.deleteClientById(id)).orElse(0);
            if (res == 0) {
            if(res == 0) {
                return BaseResponseUtils.buildFail("农户删除失败");
            }
            return BaseResponseUtils.buildSuccess(true);
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 获取用水方式列表
     *
     * @param
     * @return
     */
@@ -332,17 +344,16 @@
    })
    @GetMapping(path = "/watertypes")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getWaterTypes() {
    public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getWaterTypes(){
        List<Map<String, Object>> map_WaterTypes = Optional.ofNullable(clientSv.getWaterTypes()).orElse(new ArrayList<>());
        if (map_WaterTypes == null || map_WaterTypes.size() == 0) {
            return BaseResponseUtils.buildFail("没有用水方式");
        if(map_WaterTypes == null || map_WaterTypes.size() == 0) {
            return BaseResponseUtils.buildFail("没有用水方式") ;
        }
        return BaseResponseUtils.buildSuccess(map_WaterTypes);
    }
    /**
     * 发送验证码
     *
     * @param phoneNumber
     * @return
     */
@@ -358,7 +369,7 @@
    @PostMapping(path = "send_sms")
    @SsoAop()
    public BaseResponse<Boolean> sendSms(@RequestParam(name = "phoneNumber", required = true) String phoneNumber) throws ClientException {
        if (phoneNumber == null || phoneNumber.length() <= 0) {
        if(phoneNumber == null || phoneNumber.length() <= 0) {
            return BaseResponseUtils.buildFail(SellResultCode.PHONE_NUMBER_CANNOT_BE_NULL.getMessage());
        }
@@ -370,23 +381,35 @@
        //redisUtils.set(phoneNumber, securityCode, 60);
        // 获取当前时间戳并延后3分钟
        Long timestamp = System.currentTimeMillis();
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(timestamp);
        calendar.add(Calendar.SECOND, 180);
        Long expires = calendar.getTimeInMillis();
        SeCodeVerify codeVerify = new SeCodeVerify();
        codeVerify.setPhoneNumber(phoneNumber);
        codeVerify.setSecurityCode(securityCode);
        codeVerify.setExpires(expires);
        clientSv.addCodeVerify(codeVerify);
        SendSmsResponse response = aliyunSmsSv.sendSms(phoneNumber, templateParam);
        if (response.getCode().equals("OK")) {
            // 发送成功处理逻辑
            return BaseResponseUtils.buildSuccess(true);
            return BaseResponseUtils.buildSuccess(true) ;
        } else {
            // 发送失败处理逻辑
            return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_SEND_FAIL.getMessage());
            return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_SEND_FAIL.getMessage()) ;
        }
    }
    /**
     * 校验验证码
     *
     * @param phoneNumber
     * @param code
     * @param po
     * @param bindingResult
     * @return
     * @throws ClientException
     * @throws IOException
     */
    @Operation(summary = "校验验证码", description = "校验验证码")
    @ApiResponses(value = {
@@ -397,32 +420,66 @@
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @PostMapping(path = "verify")
    @PostMapping(path = "verify", consumes = MediaType.APPLICATION_JSON_VALUE)
    @Transactional(rollbackFor = Exception.class)
    @SsoAop()
    public BaseResponse<Boolean> verify(@RequestParam("phoneNumber") String phoneNumber, @RequestParam("code") String code) throws ClientException {
        if (phoneNumber == null || phoneNumber.length() <= 0 || code == null || code.length() <= 0) {
            return BaseResponseUtils.buildFail(SellResultCode.VERIFY_PARAMS_INCOMPLETE.getMessage());
    public BaseResponse<Boolean> verify(@RequestBody @Valid CodeVerifyDTO po, BindingResult bindingResult) throws IOException {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        // redis中键不存在或键值不存在则提示校验失败
        //if(!redisUtils.hasKey(phoneNumber) || redisUtils.get(phoneNumber) == null)
        //    return BaseResponseUtils.buildFail(SellResultCode.CODE_VERIFY_FAIL.getMessage());
        //
        //String code_redis = redisUtils.get(phoneNumber).toString();
        //System.out.println("--------------------: " + code_redis);
        //
        //if(code_redis != null && code_redis.equals(code)) {
        //    return BaseResponseUtils.buildSuccess(true) ;
        //}else {
        //    return BaseResponseUtils.buildFail(SellResultCode.CODE_VERIFY_FAIL.getMessage());
        //}
        String phoneNumber = po.getPhoneNumber();
        String securityCode = po.getSecurityCode();
        String code = po.getCode();
        return BaseResponseUtils.buildSuccess(true);
        // 进行手机号、验证码、过期时间校验
        SeCodeVerify codeVerify = clientSv.getCodeVerify(phoneNumber);
        if(codeVerify == null) {
            return BaseResponseUtils.buildFail(SellResultCode.NO_SECURITY_CODE_FOR_PHONE.getMessage());
        }
        if(!codeVerify.getSecurityCode().equals(securityCode)) {
            return BaseResponseUtils.buildFail(SellResultCode.SECURITY_CODE_ERROR.getMessage());
        }
        Long currentTimestamp = System.currentTimeMillis();
        if(currentTimestamp > codeVerify.getExpires() ) {
            return BaseResponseUtils.buildFail(SellResultCode.VALIDATION_TIMEOUT.getMessage());
        }
        // 校验通过,进行登录凭证校验
        Map<String, Object> queryParams = new HashMap<>();
        queryParams.put("appid", appid);
        queryParams.put("secret", secret);
        queryParams.put("js_code", code);
        queryParams.put("grant_type", grantType);
        Map<String, String> headerParams = new HashMap<>();
        JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams);
        if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) {
            return BaseResponseUtils.buildFail("登录凭证校验失败");
        }
        String openid = job.getString("openid");
        String sessionKey = job.getString("session_key");
        Long clientId = clientSv.getClientIdByPhone(phoneNumber);
        if(clientId != null) {
            // 添加微信用户账户记录
            SeOpenId seOpenId = new SeOpenId();
            seOpenId.setClientId(clientId);
            seOpenId.setOpenId(openid);
            seOpenId.setSessionKey(sessionKey);
            seOpenId.setCreateTime(new Date());
            Long SessionId = clientSv.addOpenId(seOpenId);
            return BaseResponseUtils.buildSuccess(SessionId);
        } else {
            return BaseResponseUtils.buildError(SellResultCode.PHONE_NUMBER_IS_ERROR.getMessage());
        }
    }
    /**
     * 根据村ID获取12位行政区划
     *
     * @param villageId
     * @return
     */
@@ -437,12 +494,12 @@
    })
    @GetMapping(path = "district")
    @SsoAop()
    public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "村编号不能为空") Long villageId) {
    public BaseResponse<Boolean> getDistrictNum(@RequestParam("villageId") @NotNull(message = "村编号不能为空") Long villageId){
        /**
         * 获取5级行政区划信息
         */
        Map map_districts = Optional.ofNullable(clientSv.getDistrictsByVillageId(villageId)).orElse(new HashMap());
        if (map_districts.size() <= 0) {
        if(map_districts.size() <= 0) {
            return BaseResponseUtils.buildFail("区划信息有误");
        }
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientSv.java
@@ -4,11 +4,14 @@
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientMapper;
import com.dy.pipIrrGlobal.daoSe.SeCodeVerifyMapper;
import com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.voSe.VoClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -32,31 +35,35 @@
    private BaDistrictMapper baDistrictMapper;
    @Autowired
    private SeCodeVerifyMapper seCodeVerifyMapper;
    @Autowired
    private SeOpenIdMapper seOpenIdMapper;
    @Autowired
    private BaSettingsMapper baSettingsMapper;
    /**
     * 根据指定条件获取农户数据
     *
     * @param queryVo
     * @return
     */
    public QueryResultVo<List<VoClient>> getClients(QueryVo queryVo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
    public QueryResultVo<List<VoClient>> getClients(QueryVo queryVo){
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ;
        Long itemTotal = seClientMapper.getRecordCount(params);
        QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = queryVo.pageSize;
        rsVo.pageCurr = queryVo.pageCurr;
        QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = queryVo.pageSize ;
        rsVo.pageCurr = queryVo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = seClientMapper.getClients(params);
        return rsVo;
        return rsVo ;
    }
    /**
     * 根据主键获取农户对象
     *
     * @param id 农户主键
     * @return 农户对象
     */
@@ -65,10 +72,8 @@
        VoClient voClient = SeClientToVoClient.INSTANCT.po2vo(seClient);
        return voClient;
    }
    /**
     * 增开农户
     *
     * @param po
     * @return
     */
@@ -77,8 +82,24 @@
    }
    /**
     * 添加验证码记录
     * @param po
     * @return
     */
    public Integer addCodeVerify(SeCodeVerify po) {
        return seCodeVerifyMapper.insert(po);
    }
    /**
     * 根据手机号获取验证码验证对象
     * @param phoneNumber
     * @return
     */
    public SeCodeVerify getCodeVerify(String phoneNumber) {
        return seCodeVerifyMapper.getCodeVerify(phoneNumber);
    }
    /**
     * 根据6位区划串模糊查询农户编号
     *
     * @param district6
     * @return
     */
@@ -88,7 +109,6 @@
    /**
     * 根据村编号获取5级区划信息
     *
     * @param villageId 村编号(主键)
     * @return 5级行政区划信息
     */
@@ -105,7 +125,6 @@
    /**
     * 修改农户对象
     *
     * @param po 农户对象
     * @return 修改记录条数
     */
@@ -115,7 +134,6 @@
    /**
     * 根据主键获取村ID
     *
     * @param id
     * @return
     */
@@ -125,7 +143,6 @@
    /**
     * 获取虚拟卡号最大值
     *
     * @return
     */
    public Long getMa1xVirtualId() {
@@ -134,7 +151,6 @@
    /**
     * 获取用水方式列表
     *
     * @return
     */
    public List<Map<String, Object>> getWaterTypes() {
@@ -142,6 +158,25 @@
    }
    /**
     * 根据电话号码获取农户ID
     * @param phoneNumber
     * @return
     */
    public Long getClientIdByPhone(String phoneNumber) {
        return seClientMapper.getClientIdByPhone(phoneNumber);
    }
    /**
     * 添加微信用户账户记录
     * @param po
     * @return
     */
    public Long addOpenId(SeOpenId po) {
        seOpenIdMapper.insert(po);
        return po.getClientId();
    }
    /**
     * 根据配置项获取配置项值
     * @param itemName
     * @return
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/dto/CodeVerifyDTO.java
New file
@@ -0,0 +1,34 @@
package com.dy.pipIrrSell.client.dto;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
/**
 * @author ZhuBaoMin
 * @date 2024-05-28 18:41
 * @LastEditTime 2024-05-28 18:41
 * @Description
 */
@Data
public class CodeVerifyDTO {
    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空")
    private String phoneNumber;
    /**
     * 验证码
     */
    @NotBlank(message = "验证码不能为空")
    private String securityCode;
    /**
     * 用户登录凭证
     */
    @NotBlank(message = "用户登录凭证不能为空")
    private String code;
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -92,7 +92,7 @@
    CARD_NAME_ESIST(90001, "该名称虚拟卡已经存在"),
    CLIENT_ID_CANNOT_BE_NULL(90001, "农户编号不能为空"),
    WALLET_OPEN_ACCOUNT_FAIL(90002, "虚拟卡账户注册失败"),
    VC_OPEN_ACCOUNT_FAIL(90002, "虚拟卡账户注册失败"),
    //WALLET_ACCOUNT_EXIST(90003, "该农户已注册电子钱包"),
    NO_ACCOUNT(90004, "您指定的虚拟卡未注册"),
@@ -130,7 +130,12 @@
    PHONE_NUMBER_CANNOT_BE_NULL(20001, "手机号不能为空"),
    SECURITY_CODE_SEND_FAIL(20001, "验证码发送失败"),
    VERIFY_PARAMS_INCOMPLETE(20001, "验证参数不完整"),
    CODE_VERIFY_FAIL(20001, "验证码校验失败");
    CODE_VERIFY_FAIL(20001, "验证码校验失败"),
    NO_SECURITY_CODE_FOR_PHONE(20002, "该手机号未发送验证码"),
    SECURITY_CODE_ERROR(20003, "验证码错误"),
    VALIDATION_TIMEOUT(20004, "验证超时"),
    PHONE_NUMBER_IS_ERROR(20004, "手机号错误,非注册农户");
    private final Integer code;
    private final String message;
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java
@@ -3,15 +3,24 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.util.PayHelper;
import com.dy.pipIrrSell.virtualCard.dto.DtoRegist;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
 * @author ZhuBaoMin
@@ -31,14 +40,14 @@
    private final PayHelper payHelper;
    /**
     * 获取全部虚拟卡
     * 获取农户全部虚拟卡
     * @return
     */
    @GetMapping(path = "/get")
    @SsoAop()
    public BaseResponse<List<VoVirtualCard>> getVCs(){
    public BaseResponse<List<VoVirtualCard>> getVCs(Long clientId){
        try {
            List<VoVirtualCard> res = virtualCardSv.getVCs();
            List<VoVirtualCard> res = virtualCardSv.getVCs(clientId);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取支付方式记录异常", e);
@@ -68,44 +77,48 @@
     * @param bindingResult
     * @return
     */
    //@Operation(summary = "注册虚拟卡", description = "注册虚拟卡")
    //@ApiResponses(value = {
    //        @ApiResponse(
    //                responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
    //                description = "操作结果:true:成功,false:失败(BaseResponse.content)",
    //                content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
    //                        schema = @Schema(implementation = Boolean.class))}
    //        )
    //})
    //@PostMapping(path = "add_vc")
    //@SsoAop()
    //public BaseResponse<Boolean> addVC(@RequestBody @Valid DtoRegist po, BindingResult bindingResult){
    //    if(bindingResult != null && bindingResult.hasErrors()){
    //        return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
    //    }
    //    Long clientId = po.getClientId();
    //    String vcName = po.getVcName();
    //
    //    // 名称验重
    //    Integer rc = virtualCardSv.getRecordCountByName(po);
    //    if(rc != null && rc > 0) {
    //        return BaseResponseUtils.buildFail(SellResultCode.CARD_NAME_ESIST.getMessage());
    //    }
    //
    //    SeVirtualCard seVirtualCard = new SeVirtualCard();
    //    seVirtualCard.setVcName(vcName);
    //    seVirtualCard.setClientId(clientId);
    //    seVirtualCard.setMoney(0d);
    //    seVirtualCard.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
    //    seVirtualCard.setLastOperateTime(new Date());
    //    seVirtualCard.setInUse((byte) 0);
    //    seVirtualCard.setCreateTime(new Date());
    //    Long rec = virtualCardSv.insertVirtualCard(seVirtualCard);
    //    if(rec == null) {
    //        return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
    //    }
    //    return BaseResponseUtils.buildSuccess(true) ;
    //}
    @PostMapping(path = "add_vc")
    @SsoAop()
    public BaseResponse<Boolean> addVC(@RequestBody @Valid DtoRegist po, BindingResult bindingResult){
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        Long clientId = po.getClientId();
        // 获取5级行政区划串areaCode
        String areaCode = String.valueOf(virtualCardSv.getAreaCodeById(clientId));
        /**
         * 根据行政区划串(areaCode)在虚拟卡表中针对虚拟卡编号(vcNum)进行模糊查询
         * 如果5位顺序号已经达到最大值,提示用户联系系统管理员
         * 如果5位顺序号未达到最大值,则加1
         * cardNum为新的卡号
         */
        String vcNum = Optional.ofNullable(virtualCardSv.getVcCardNumOfMax(areaCode)).orElse("");
        if(vcNum != null && vcNum.trim().length() > 0) {
            Integer number = Integer.parseInt(vcNum.substring(12));
            number = number + 1;
            if(number > 99999) {
                return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_OVERRUN.getMessage());
            }
            vcNum = vcNum.substring(0, 12) + String.format("%05d", number);
        } else {
            vcNum = areaCode + "00001";
        }
        SeVirtualCard seVirtualCard = new SeVirtualCard();
        seVirtualCard.setVcNum(Long.parseLong(vcNum));
        seVirtualCard.setClientId(clientId);
        seVirtualCard.setMoney(0d);
        seVirtualCard.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode());
        seVirtualCard.setLastOperateTime(new Date());
        seVirtualCard.setInUse((byte) 0);
        seVirtualCard.setCreateTime(new Date());
        Long rec = virtualCardSv.insertVirtualCard(seVirtualCard);
        if(rec == null) {
            return BaseResponseUtils.buildFail(SellResultCode.VC_OPEN_ACCOUNT_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 用户申请退款
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
@@ -2,10 +2,7 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
import com.dy.pipIrrGlobal.daoSe.SeVcRefundItemMapper;
import com.dy.pipIrrGlobal.daoSe.SeVcRefundMapper;
import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefund;
import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem;
@@ -13,7 +10,6 @@
import com.dy.pipIrrGlobal.voSe.VoOrders;
import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.result.SellResultCode;
import com.dy.pipIrrSell.virtualCard.dto.DtoRegist;
import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM;
@@ -47,13 +43,24 @@
    @Autowired
    private SeVcRefundItemMapper seVcRefundItemMapper;
    @Autowired
    private SeClientMapper seClientMapper;
    /**
     * 获取全部虚拟卡
     * 根据农户ID获取5级行政区划代码,注册虚拟卡使用
     * @param clientId 农户ID
     * @return 5级行政区划代码
     */
    public Long getAreaCodeById(Long clientId) {
        return seClientMapper.getAreaCodeById(clientId);
    }
    /**
     * 获取农户全部虚拟卡
     * @return
     */
    public List<VoVirtualCard> getVCs() {
        return seVirtualCardMapper.getVCs();
    public List<VoVirtualCard> getVCs(Long clientId) {
        return seVirtualCardMapper.getVCs(clientId);
    }
    /**
@@ -76,13 +83,22 @@
    }
    /**
     * 根据行政区划串模糊查询虚拟卡编号,注册虚拟卡使用
     * @param areaCode
     * @return
     */
    String getVcCardNumOfMax(String areaCode) {
        return seVirtualCardMapper.getVcCardNumOfMax(areaCode);
    }
    /** 废弃
     * 验证农户是否拥有指定名称的虚拟卡
     * @param po
     * @return
     */
    public Integer getRecordCountByName(DtoRegist po) {
        return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
    }
    //public Integer getRecordCountByName(DtoRegist po) {
    //    return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
    //}
    /**
     * 修改虚拟卡
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRegist.java
@@ -1,7 +1,6 @@
package com.dy.pipIrrSell.virtualCard.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@@ -24,10 +23,4 @@
    @NotNull(message = "农户ID不能为空")
    private Long clientId;
    /**
     * 虚拟卡名称
     */
    @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @NotBlank(message = "虚拟卡名称不能为空")
    private String vcName;
}
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java
@@ -87,7 +87,7 @@
        seWallet.setCreateTime(new Date());
        Long rec = Optional.ofNullable(walletSv.addWallet(seWallet)).orElse(0L);
        if(rec == 0) {
            return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage());
            return BaseResponseUtils.buildFail(SellResultCode.VC_OPEN_ACCOUNT_FAIL.getMessage());
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java
@@ -67,12 +67,12 @@
    /*
     * 小程序唯一标识
     */
    public static String appid = "wxf776aebf73f34962";
    public static String appid = "wxbc2b6a00dd904ead";
    /*
     * 小程序的 app secret
     */
    public static String secret = "b05862b7fa8a944114dbe970c2764ae6";
    public static String secret = "796ffe3e9921f756db0499e80d6ed0cd";
    /*
     * 小程序的授权类型,登录凭证校验使用