Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getRoleNamesByUserId(@Param("userId") Long userId); |
| | | |
| | | BaUser selectById(Long id); |
| | | } |
| | |
| | | */ |
| | | //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); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | private String intakeNum; |
| | | |
| | | private Boolean isOnLine; |
| | | |
| | | private String rtuAddr; |
| | | |
| | | private String orderNo; |
| | |
| | | <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"/> |
| | | <result property="password" column="password"/> |
| | | <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="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Deleted"/> |
| | | <result property="disabled" column="disabled" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" |
| | | javaType="com.dy.common.mybatis.envm.Disabled"/> |
| | | <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" |
| | | javaType="com.dy.common.mybatis.envm.Deleted"/> |
| | | </resultMap> |
| | | |
| | | <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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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> |
| | |
| | | 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> |
| | |
| | | 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.supperAdmin = null;//设置为null,不做更新 |
| | | po.deleted = null;//设置为null,不做更新 |
| | | po.orgTag = null;//设置为null,不做更新 |
| | | po.password = MD5.encrypt(po.password);//进行加密 |
| | | 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(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 插入用户与角色关联记录数量 |
| | | */ |
| | | public int setRoles(Long userId, String[] roleIds) { |
| | | this.urDao.deleteByUserId(userId); |
| | | |
| | | int count = 0; |
| | | if (roleIds != null && roleIds.length > 0) { |
| | | this.urDao.deleteByUserId(userId); |
| | | for (String roleId : roleIds) { |
| | | count += this.urDao.insertSelective(new BaUserRole(userId, Long.parseLong(roleId))); |
| | | } |
| | | } |
| | | return count; |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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; |
| | |
| | | return rmCommandHistoryMapper.updateByPrimaryKeySelective(po); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据操作员ID获取未关阀记录 |
| | | * @param operator |
| | | * @return |
| | | */ |
| | | public List<VoUnclosedValve> getUnclosedValves(Long operator) { |
| | | return rmCommandHistoryMapper.getUnclosedValves(operator); |
| | | } |
| | | |
| | | /** |
| | | * 获取取水口列表 |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员获取常用取水口 |
| | | * @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<>(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | protected static String controllerType = "57"; |
| | | |
| | | /** |
| | | * 查询所有RTU在线情况 |
| | | * 查询所有RTU在线情况(仅测试用) |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "get_online") |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据操作员获取常用取水口 |
| | | * @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 |
| | |
| | | @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); |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 获取农户列表 |
| | | * |
| | | * @param vo |
| | | * @return |
| | | */ |
| | |
| | | }) |
| | | @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 |
| | | */ |
| | |
| | | }) |
| | | @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 |
| | |
| | | @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()); |
| | | } |
| | | |
| | |
| | | * 获取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("区划信息有误"); |
| | | } |
| | | |
| | |
| | | |
| | | // 生成虚拟卡号 |
| | | 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("虚拟卡号超限"); |
| | | } |
| | | } |
| | |
| | | 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); |
| | |
| | | |
| | | /** |
| | | * 修改农户对象(虚拟卡号、禁止标志、逻辑删除标识不参与修改) |
| | | * |
| | | * @param po 农户对象 |
| | | * @param po 农户对象 |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | |
| | | @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()); |
| | | } |
| | | |
| | |
| | | * 获取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("区划信息有误"); |
| | | } |
| | | |
| | |
| | | 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 |
| | | */ |
| | |
| | | |
| | | @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 |
| | | */ |
| | |
| | | }) |
| | | @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 |
| | | */ |
| | |
| | | @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()); |
| | | } |
| | | |
| | |
| | | |
| | | //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 = { |
| | |
| | | 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 |
| | | */ |
| | |
| | | }) |
| | | @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("区划信息有误"); |
| | | } |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | 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 农户对象 |
| | | */ |
| | |
| | | VoClient voClient = SeClientToVoClient.INSTANCT.po2vo(seClient); |
| | | return voClient; |
| | | } |
| | | |
| | | /** |
| | | * 增开农户 |
| | | * |
| | | * @param po |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加验证码记录 |
| | | * @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 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据村编号获取5级区划信息 |
| | | * |
| | | * @param villageId 村编号(主键) |
| | | * @return 5级行政区划信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改农户对象 |
| | | * |
| | | * @param po 农户对象 |
| | | * @return 修改记录条数 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据主键获取村ID |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取虚拟卡号最大值 |
| | | * |
| | | * @return |
| | | */ |
| | | public Long getMa1xVirtualId() { |
| | |
| | | |
| | | /** |
| | | * 获取用水方式列表 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<Map<String, Object>> 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(); |
| | | } |
| | | |
| | | /** |
| | | * 根据配置项获取配置项值 |
| | | * @param itemName |
| | | * @return |
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"; |
| | | |
| | | /* |
| | | * 小程序的授权类型,登录凭证校验使用 |
| | |
| | | @GetMapping(path = "loginUserId") |
| | | public Long loginUserId(String token){ |
| | | BaUser userPo = this.sv.getByUuid(token) ; |
| | | return userPo == null ? null : userPo.userId ; |
| | | return userPo == null ? null : userPo.id ; |
| | | } |
| | | /** |
| | | * 此方法供子模块系统调用,所以不公开在API接口中 |
| | |
| | | BaUser userPo = this.sv.getByUuid(token) ; |
| | | CurUserVo vo = new CurUserVo(); |
| | | if(userPo != null){ |
| | | vo.id = userPo.userId ; |
| | | vo.id = userPo.id ; |
| | | vo.name = userPo.userName; |
| | | } |
| | | return vo ; |
| | |
| | | @Cacheable(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid", sync=true) |
| | | public BaUser loginWithMapperXml(String uuid, String phone, String password){ |
| | | BaUser baUser = this.baUserMapper.login(phone, password) ; |
| | | if(baUser != null && baUser.userId != null){ |
| | | baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.userId) ; |
| | | if(baUser != null && baUser.id != null){ |
| | | baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ; |
| | | } |
| | | return baUser; |
| | | } |
| | |
| | | .eq("phone", phone) |
| | | .eq("password", password); |
| | | BaUser baUser = this.baUserMapper.selectOne(qw) ; |
| | | if(baUser != null && baUser.userId != null){ |
| | | baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.userId) ; |
| | | if(baUser != null && baUser.id != null){ |
| | | baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ; |
| | | } |
| | | return baUser; |
| | | } |
| | |
| | | * @param po |
| | | * @return |
| | | */ |
| | | @Mapping(target = "id", source = "userId") |
| | | @Mapping(target = "id", source = "id") |
| | | @Mapping(target = "name", source = "userName") |
| | | @Mapping(target = "phone", source = "phone") |
| | | @Mapping(target = "token", ignore=true) |