| | |
| | | */ |
| | | //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); |
| | | } |
| | |
| | | Long getClientIdByNum(@Param("clientNum") String clientNum); |
| | | |
| | | /** |
| | | * 根据电话号码获取农户ID |
| | | * @param phoneNumber |
| | | * @return |
| | | */ |
| | | Long getClientIdByPhone(String phoneNumber); |
| | | |
| | | /** |
| | | * 根据指定条件获取农户记录数 |
| | | * @param params |
| | | * @return |
New file |
| | |
| | | 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); |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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获取虚拟卡对象 |
| | |
| | | * @return |
| | | */ |
| | | Long getVcIdByNum(@Param("vcNum") String vcNum); |
| | | |
| | | /** |
| | | * 根据行政区划串模糊查询虚拟卡编号 |
| | | * @param areaCode |
| | | * @return |
| | | */ |
| | | String getVcCardNumOfMax(@Param("areaCode") String areaCode); |
| | | } |
| | |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @TableId(value = "id", type = IdType.INPUT) |
| | | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | public Long userId; |
| | | //public Long userId; |
| | | public Long id; |
| | | |
| | | |
| | | @Schema(description = "所属片区ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
New file |
| | |
| | | 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; |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_user--> |
| | | <id property="userId" column="id" /> |
| | | <id property="id" column="id" /> |
| | | <result property="blockId" column="blockId"/> |
| | | <result property="userName" column="name"/> |
| | | <result property="phone" column="phone"/> |
| | |
| | | <resultMap id="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser"> |
| | | <!--@mbg.generated--> |
| | | <!--@Table ba_user--> |
| | | <id property="userId" column="id" /> |
| | | <id property="id" column="id" /> |
| | | <result property="userName" column="name"/> |
| | | <result property="phone" column="phone"/> |
| | | <result property="orgTag" column="orgTag"/> |
| | |
| | | </resultMap> |
| | | |
| | | <resultMap id="loginResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaUser"> |
| | | <id property="userId" column="id" /> |
| | | <id property="id" column="id" /> |
| | | <result property="blockId" column="blockId"/> |
| | | <result property="userName" column="name"/> |
| | | <result property="phone" column="phone"/> |
| | |
| | | </trim> |
| | | </select> |
| | | <insert id="putin" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> |
| | | insert into ba_user (<include refid="Base_Column_List" />) |
| | | values (#{userId,jdbcType=BIGINT}, |
| | | <!-- 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}, |
| | |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> |
| | | insert into ba_user |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="userId != null"> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="blockId != null"> |
| | |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="userId != null"> |
| | | #{userId,jdbcType=BIGINT}, |
| | | <if test="id != null"> |
| | | #{id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="blockId != null"> |
| | | #{blockId,jdbcType=BIGINT}, |
| | |
| | | deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}, |
| | | </if> |
| | | </set> |
| | | where id = #{userId, jdbcType=BIGINT} |
| | | where id = #{id, jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser"> |
| | | update ba_user |
| | |
| | | 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 = #{userId,jdbcType=BIGINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="changePassword" > |
| | | update ba_user |
| | |
| | | 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> |
| | |
| | | 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 |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.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> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dy.pipIrrGlobal.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> |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取全部虚拟卡--> |
| | | <!--获取农户全部虚拟卡--> |
| | | <select id="getVCs" resultType="com.dy.pipIrrGlobal.voSe.VoVirtualCard"> |
| | | SELECT |
| | | CAST(id AS char) AS id, |
| | |
| | | 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> |
| | | |
| | |
| | | <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> |
| | |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | po.userId = null; |
| | | po.id = null; |
| | | Long userId; |
| | | try { |
| | | po.supperAdmin = Constant.no.byteValue() ; |
| | |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | if (po.userId == null) { |
| | | if (po.id == null) { |
| | | return BaseResponseUtils.buildFail("无数据实体ID"); |
| | | } |
| | | int count; |
| | |
| | | po.deleted = null;//设置为null,不做更新 |
| | | po.orgTag = null;//设置为null,不做更新 |
| | | count = this.sv.update(po); |
| | | this.sv.setRoles(po.userId, po.roleIds); |
| | | this.sv.setRoles(po.id, po.roleIds); |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | |
| | | public Long save(BaUser po){ |
| | | //return this.dao.putin(po) ; |
| | | this.dao.putin(po) ; |
| | | return po.getUserId(); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员获取常用取水口 |
| | | * @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<>(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员获取常用取水口 |
| | | * @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 |
| | |
| | | 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; |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 获取农户列表 |
| | |
| | | |
| | | //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")) { |
| | | // 发送成功处理逻辑 |
| | |
| | | |
| | | /** |
| | | * 校验验证码 |
| | | * @param phoneNumber |
| | | * @param code |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | * @throws ClientException |
| | | */ |
| | | @Operation(summary = "校验验证码", description = "校验验证码") |
| | | @ApiResponses(value = { |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private BaDistrictMapper baDistrictMapper; |
| | | |
| | | @Autowired |
| | | private SeCodeVerifyMapper seCodeVerifyMapper; |
| | | |
| | | @Autowired |
| | | private SeOpenIdMapper seOpenIdMapper; |
| | | |
| | | /** |
| | | * 根据指定条件获取农户数据 |
| | |
| | | return seClientMapper.insert(po); |
| | | } |
| | | |
| | | /** |
| | | * 添加验证码记录 |
| | | * @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 |
| | |
| | | public List<Map<String, Object>> getWaterTypes() { |
| | | return seClientMapper.getWaterTypes(); |
| | | } |
| | | |
| | | /** |
| | | * 根据电话号码获取农户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(); |
| | | } |
| | | } |
New file |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | |
| | | 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, "您指定的虚拟卡未注册"), |
| | | |
| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | 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); |
| | |
| | | * @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) ; |
| | | } |
| | | |
| | | /** |
| | | * 用户申请退款 |
| | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据行政区划串模糊查询虚拟卡编号,注册虚拟卡使用 |
| | | * @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()); |
| | | //} |
| | | |
| | | /** |
| | | * 修改虚拟卡 |
| | |
| | | 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; |
| | | |
| | |
| | | @NotNull(message = "农户ID不能为空") |
| | | private Long clientId; |
| | | |
| | | /** |
| | | * 虚拟卡名称 |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "虚拟卡名称不能为空") |
| | | private String vcName; |
| | | } |
| | |
| | | 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) ; |
| | | } |
| | |
| | | /* |
| | | * 小程序唯一标识 |
| | | */ |
| | | public static String appid = "wxf776aebf73f34962"; |
| | | public static String appid = "wxbc2b6a00dd904ead"; |
| | | |
| | | /* |
| | | * 小程序的 app secret |
| | | */ |
| | | public static String secret = "b05862b7fa8a944114dbe970c2764ae6"; |
| | | public static String secret = "796ffe3e9921f756db0499e80d6ed0cd"; |
| | | |
| | | /* |
| | | * 小程序的授权类型,登录凭证校验使用 |