2023-12-19 朱宝民 重构了开卡、充值等功能
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClientType; |
| | | import com.dy.pipIrrGlobal.voBa.VoAreaCode; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | |
| | | /** |
| | | * 根据农户编号获取5级行政区划代码 |
| | | * @param clientNum 农户编号 |
| | | * @return 5级行政区划代码 |
| | | */ |
| | | VoAreaCode getAreaCodeByNum(@Param("clientNum") String clientNum); |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.daoSe; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeActiveCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/8 16:53 |
| | | * @LastEditTime 2023/12/8 16:53 |
| | | * @date 2023/12/18 16:58 |
| | | * @LastEditTime 2023/12/18 16:58 |
| | | * @Description |
| | | */ |
| | | public interface SeActiveCardMapper extends BaseMapper<SeActiveCard> { |
| | | public interface SeActiveCardMapper { |
| | | int deleteByPrimaryKey(Long id); |
| | | |
| | | int insert(SeActiveCard record); |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/7 9:06 |
| | | * @LastEditTime 2023/12/7 9:06 |
| | | * @date 2023/12/18 16:26 |
| | | * @LastEditTime 2023/12/18 16:26 |
| | | * @Description |
| | | */ |
| | | public interface SeClientCardMapper { |
| | |
| | | int updateByPrimaryKey(SeClientCard record); |
| | | |
| | | /** |
| | | * 依据水卡地址获取水卡编号(主键) |
| | | * 依据水卡地址获取水卡编号(12月19日废弃) |
| | | * @param cardAddr |
| | | * @return |
| | | */ |
| | | Long getCardIdByAddr(@Param("cardAddr") String cardAddr); |
| | | |
| | | /** |
| | | * 根据水卡编号获取水卡表主键(12月19日添加后废弃) |
| | | * @param cardNum 16位水卡编号 |
| | | * @return 水卡表主键 |
| | | */ |
| | | Long getCardIdByNum(@Param("cardNum") String cardNum); |
| | | |
| | | /** |
| | | * 根据行政区划串模块查询水卡编号 |
| | | * @param areaCode |
| | | * @return |
| | | */ |
| | | String getCardNumOfMax(@Param("areaCode") String areaCode); |
| | | |
| | | /** |
| | | * 根据水卡编号获取水卡表主键及农户编号 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | Map getCardIdAndClientNum(@Param("cardNum") String cardNum); |
| | | } |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/8 15:25 |
| | | * @LastEditTime 2023/12/8 15:25 |
| | | * @date 2023/12/19 10:35 |
| | | * @LastEditTime 2023/12/19 10:35 |
| | | * @Description |
| | | */ |
| | | public interface SeRechargeHistoryMapper { |
| | |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/8 15:25 |
| | | * @LastEditTime 2023/12/8 15:25 |
| | | * @date 2023/12/19 10:18 |
| | | * @LastEditTime 2023/12/19 10:18 |
| | | * @Description |
| | | */ |
| | | public interface SeRechargeMapper { |
| | |
| | | |
| | | Long getRecordCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定的条件获取充值记录 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoRecharge> getRecharges(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据水卡编号删除充值记录 |
| | | * @param cardId |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | Integer deleteByCardId(@Param("cardId") Long cardId); |
| | | //Integer deleteByCardId(@Param("cardId") Long cardId); |
| | | Integer deleteByCardNum(@Param("cardNum") String cardNum); |
| | | } |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.Max; |
| | | import jakarta.validation.constraints.Min; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | | import org.hibernate.validator.constraints.Length; |
| | |
| | | public static final long serialVersionUID = 202312071927001L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | * 主键 |
| | | */ |
| | | @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) |
| | | @Length(message = "水卡编号不小于{min}", min = 1) |
| | | private Long cardid; |
| | | @NotBlank(message = "水卡编号不能为空") |
| | | private String cardnum; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | * 农户编号 |
| | | */ |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "农户编号不小于{min}", min = 1) |
| | | private Long clientid; |
| | | @NotBlank(message = "农户编号不能为空") |
| | | private String clientnum; |
| | | |
| | | /** |
| | | * 卡片费用 |
| | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/7 9:06 |
| | | * @LastEditTime 2023/12/7 9:06 |
| | | * @Description |
| | | * @LastEditTime 2023/12/18 10:14 |
| | | * @Description 添加水卡编号(cardnum)字段 |
| | | */ |
| | | |
| | | /** |
| | |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | * 主键 |
| | | */ |
| | | @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 cardaddr; |
| | | |
| | | /** |
| | | * 农户ID |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "农户ID必须为大于0的整数") |
| | | private Long clientid; |
| | | * 水卡编号 |
| | | */ |
| | | @Schema(description = "水卡编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "水卡编号不能为空") |
| | | private String cardnum; |
| | | |
| | | /** |
| | | * 余额 |
| | | */ |
| | | * 农户编号 |
| | | */ |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank(message = "农户编号不能为空") |
| | | private String clientnum; |
| | | |
| | | /** |
| | | * 余额 |
| | | */ |
| | | @Schema(description = "余额", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Double money; |
| | | |
| | | /** |
| | | * 卡片状态;1-正常,2-已注销,3-已挂失 |
| | | */ |
| | | * 卡片状态;1-正常,2-已注销,3-已挂失 |
| | | */ |
| | | @Schema(description = "卡片状态", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "卡片状态必须为1或2或3") |
| | | @Size(min = 1, max = 3) |
| | | private Byte state; |
| | | |
| | | /** |
| | | * 开卡时间 |
| | | */ |
| | | * 开卡时间 |
| | | */ |
| | | @Schema(description = "开卡时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date createdt; |
| | | |
| | | /** |
| | | * 补卡时间 |
| | | */ |
| | | * 补卡时间 |
| | | */ |
| | | @Schema(description = "补卡时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date replacedt; |
| | | |
| | | /** |
| | | * 充值时间 |
| | | */ |
| | | * 充值时间 |
| | | */ |
| | | @Schema(description = "充值时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date rechargedt; |
| | | |
| | | /** |
| | | * 挂失时间 |
| | | */ |
| | | * 挂失时间 |
| | | */ |
| | | @Schema(description = "挂失时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date lossdtdt; |
| | | |
| | | /** |
| | | * 注销时间 |
| | | */ |
| | | * 注销时间 |
| | | */ |
| | | @Schema(description = "注销时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date canceldt; |
| | | |
| | | /** |
| | | * 解锁时间 |
| | | */ |
| | | * 解锁时间 |
| | | */ |
| | | @Schema(description = "解锁时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date unlockdt; |
| | | |
| | | /** |
| | | * 冲正时间 |
| | | */ |
| | | * 冲正时间 |
| | | */ |
| | | @Schema(description = "冲正时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date reversaldt; |
| | | |
| | | /** |
| | | * 消费时间 |
| | | */ |
| | | * 消费时间 |
| | | */ |
| | | @Schema(description = "消费时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Date consumedt; |
| | | |
| | | /** |
| | | * 最后操作类型;1-开卡,2-补卡,3-充值,4-挂失,5-注销,6-解锁,7-冲正,8-消费 |
| | | */ |
| | | * 最后操作类型;1-开卡,2-补卡,3-充值,4-挂失,5-注销,6-解锁,7-冲正,8-消费 |
| | | */ |
| | | @Schema(description = "最后操作类型", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "卡片状态必须为1到8的正整数") |
| | | @Size(min = 1, max = 8) |
| | | private Byte lastoper; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | * 备注信息 |
| | | */ |
| | | @Schema(description = "备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "备注长度小于{max}字", min = 1, max = 200) |
| | | private String remarks; |
| | |
| | | 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 jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | |
| | | * 水卡编号 |
| | | */ |
| | | @Schema(description = "水卡编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "水卡编号不小于{min}", min = 1) |
| | | private Long cardid; |
| | | @NotBlank(message = "水卡编号不能为空") |
| | | private String cardnum; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "农户编号不小于{min}", min = 1) |
| | | private Long clientid; |
| | | @NotBlank(message = "农户编号不能为空") |
| | | private String clientnum; |
| | | |
| | | /** |
| | | * 卡片余额 |
| | |
| | | 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 jakarta.validation.constraints.Positive; |
| | | import lombok.*; |
| | |
| | | * 水卡编号 |
| | | */ |
| | | @Schema(description = "水卡编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "水卡编号不小于{min}", min = 1) |
| | | private Long cardid; |
| | | @NotBlank(message = "水卡编号不能为空") |
| | | private String cardnum; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Length(message = "农户编号不小于{min}", min = 1) |
| | | private Long clientid; |
| | | @NotBlank(message = "农户编号不能为空") |
| | | private String clientnum; |
| | | |
| | | /** |
| | | * 卡片余额 |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voBa; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/18 14:32 |
| | | * @LastEditTime 2023/12/18 14:32 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "5级行政区划视图对象") |
| | | public class VoAreaCode implements BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(title = "省级区划代码") |
| | | private String provinceId; |
| | | |
| | | @Schema(title = "市级区划代码") |
| | | private String cityId; |
| | | |
| | | @Schema(title = "县级区划代码") |
| | | private String countryId; |
| | | |
| | | @Schema(title = "镇级区划代码") |
| | | private String townId; |
| | | |
| | | @Schema(title = "村级区划代码") |
| | | private String villageId; |
| | | } |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <!--根据农户编号获取5级行政区划代码--> |
| | | <select id="getAreaCodeByNum" resultType="com.dy.pipIrrGlobal.voBa.VoAreaCode"> |
| | | SELECT |
| | | pro.num AS provinceId, |
| | | cit.num AS cityId, |
| | | con.num AS countryId, |
| | | tow.num AS townId, |
| | | vil.num AS villageId |
| | | FROM ba_client cli |
| | | INNER JOIN ba_district con ON cli.countyId = con.id |
| | | INNER JOIN ba_district tow ON cli.townId = tow.id |
| | | INNER JOIN ba_district vil ON cli.villageId = vil.id |
| | | INNER JOIN ba_district cit ON cit.id = con.supperId |
| | | INNER JOIN ba_district pro ON pro.id = cit.supperId |
| | | WHERE cli.num = #{clientNum} |
| | | </select> |
| | | </mapper> |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_active_card--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="cardId" jdbcType="BIGINT" property="cardid" /> |
| | | <result column="clientId" jdbcType="BIGINT" property="clientid" /> |
| | | <result column="cardNum" jdbcType="VARCHAR" property="cardnum" /> |
| | | <result column="clientNum" jdbcType="VARCHAR" property="clientnum" /> |
| | | <result column="cardCost" jdbcType="INTEGER" property="cardcost" /> |
| | | <result column="paymentId" jdbcType="BIGINT" property="paymentid" /> |
| | | <result column="reissueAmount" jdbcType="DOUBLE" property="reissueamount" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, cardId, clientId, cardCost, paymentId, reissueAmount, operateType, remarks, `operator`, |
| | | operateDt |
| | | id, cardNum, clientNum, cardCost, paymentId, reissueAmount, operateType, remarks, |
| | | `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeActiveCard"> |
| | | <!--@mbg.generated--> |
| | | insert into se_active_card (id, cardId, clientId, cardCost, paymentId, reissueAmount, operateType, remarks, `operator`, operateDt) |
| | | insert into se_active_card (id, cardNum, clientNum, cardCost, paymentId, reissueAmount, operateType, remarks, `operator`, operateDt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{cardid,jdbcType=BIGINT}, |
| | | #{clientid,jdbcType=BIGINT}, |
| | | #{cardcost,jdbcType=INTEGER}, |
| | | #{paymentid,jdbcType=BIGINT}, |
| | | #{reissueamount,jdbcType=DOUBLE}, |
| | | #{operatetype,jdbcType=TINYINT}, |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | #{cardnum,jdbcType=VARCHAR}, |
| | | #{clientnum,jdbcType=VARCHAR}, |
| | | #{cardcost,jdbcType=INTEGER}, |
| | | #{paymentid,jdbcType=BIGINT}, |
| | | #{reissueamount,jdbcType=DOUBLE}, |
| | | #{operatetype,jdbcType=TINYINT}, |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | |
| | | <!-- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeActiveCard" useGeneratedKeys="true">--> |
| | | <!-- <!–@mbg.generated–>--> |
| | | <!-- insert into se_active_card (cardId, clientId, cardCost, --> |
| | | <!-- paymentId, reissueAmount, operateType, --> |
| | | <!-- remarks, `operator`, operateDt--> |
| | | <!-- )--> |
| | | <!-- values (#{cardid,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT}, #{cardcost,jdbcType=INTEGER}, --> |
| | | <!-- #{paymentid,jdbcType=BIGINT}, #{reissueamount,jdbcType=DOUBLE}, #{operatetype,jdbcType=TINYINT}, --> |
| | | <!-- #{remarks,jdbcType=VARCHAR}, #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}--> |
| | | <!-- )--> |
| | | <!-- </insert>--> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeActiveCard" useGeneratedKeys="true"> |
| | | <!--@mbg.generated--> |
| | | insert into se_active_card |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="cardid != null"> |
| | | cardId, |
| | | <if test="cardnum != null"> |
| | | cardNum, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId, |
| | | <if test="clientnum != null"> |
| | | clientNum, |
| | | </if> |
| | | <if test="cardcost != null"> |
| | | cardCost, |
| | |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="cardid != null"> |
| | | #{cardid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientnum != null"> |
| | | #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="cardcost != null"> |
| | | #{cardcost,jdbcType=INTEGER}, |
| | |
| | | <!--@mbg.generated--> |
| | | update se_active_card |
| | | <set> |
| | | <if test="cardid != null"> |
| | | cardId = #{cardid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientnum != null"> |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="cardcost != null"> |
| | | cardCost = #{cardcost,jdbcType=INTEGER}, |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeActiveCard"> |
| | | <!--@mbg.generated--> |
| | | update se_active_card |
| | | set cardId = #{cardid,jdbcType=BIGINT}, |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | set cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | cardCost = #{cardcost,jdbcType=INTEGER}, |
| | | paymentId = #{paymentid,jdbcType=BIGINT}, |
| | | reissueAmount = #{reissueamount,jdbcType=DOUBLE}, |
| | |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_active_card act |
| | | INNER JOIN ba_client cli ON act.clientId = cli.id |
| | | INNER JOIN se_client_card card ON act.cardId = card.id |
| | | , (SELECT @i:=0) AS itable |
| | | INNER JOIN ba_client cli ON act.clientNum = cli.num |
| | | INNER JOIN se_client_card card ON act.cardNum = card.cardNum |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND act.operateType = ${operateType} |
| | |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardAddr != null and cardAddr !=''"> |
| | | AND card.cardAddr like CONCAT('%',#{cardAddr},'%') |
| | | <!-- <if test = "cardAddr != null and cardAddr !=''">--> |
| | | <!-- AND card.cardAddr like CONCAT('%',#{cardAddr},'%')--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "state != null and state > 0"> |
| | |
| | | card.cardAddr, |
| | | card.state, |
| | | (CASE |
| | | WHEN card.state = 1 THEN "正常" |
| | | WHEN card.state = 2 THEN "已注销" |
| | | ELSE "已挂失" |
| | | WHEN card.state = 1 THEN "正常" |
| | | WHEN card.state = 2 THEN "已注销" |
| | | ELSE "已挂失" |
| | | END) AS stateName, |
| | | act.reissueAmount, |
| | | act.cardCost, |
| | | act.paymentId, |
| | | (SELECT `name` FROM ba_user WHERE id = act.operator) AS operator, |
| | | act.operateDt |
| | | act.reissueAmount, |
| | | act.cardCost, |
| | | act.paymentId, |
| | | (SELECT `name` FROM ba_user WHERE id = act.operator) AS operator, |
| | | act.operateDt |
| | | FROM se_active_card act |
| | | INNER JOIN ba_client cli ON act.clientId = cli.id |
| | | INNER JOIN se_client_card card ON act.cardId = card.id |
| | | , (SELECT @i:=0) AS itable |
| | | INNER JOIN ba_client cli ON act.clientNum = cli.num |
| | | INNER JOIN se_client_card card ON act.cardNum = card.cardNum |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND act.operateType = ${operateType} |
| | |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardAddr != null and cardAddr !=''"> |
| | | AND card.cardAddr like CONCAT('%',#{cardAddr},'%') |
| | | <!-- <if test = "cardAddr != null and cardAddr !=''">--> |
| | | <!-- AND card.cardAddr like CONCAT('%',#{cardAddr},'%')--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "state != null and state > 0"> |
| | |
| | | AND act.operateDt BETWEEN #{activeTimeStart} AND #{activeTimeStop} |
| | | </if> |
| | | </where> |
| | | |
| | | ORDER BY act.operateDt DESC |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | |
| | | <!--@Table se_client_card--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="cardAddr" jdbcType="VARCHAR" property="cardaddr" /> |
| | | <result column="clientId" jdbcType="BIGINT" property="clientid" /> |
| | | <result column="cardNum" jdbcType="VARCHAR" property="cardnum" /> |
| | | <result column="clientNum" jdbcType="VARCHAR" property="clientnum" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="state" jdbcType="TINYINT" property="state" /> |
| | | <result column="createDt" jdbcType="TIMESTAMP" property="createdt" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, cardAddr, clientId, money, `state`, createDt, replaceDt, rechargeDt, lossDtDt, |
| | | cancelDt, unlockDt, reversalDt, consumeDt, lastOper, remarks |
| | | id, cardAddr, cardNum, clientNum, money, `state`, createDt, replaceDt, rechargeDt, |
| | | lossDtDt, cancelDt, unlockDt, reversalDt, consumeDt, lastOper, remarks |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <!--依据水卡地址获取水卡编号(主键)--> |
| | | <!--依据水卡地址获取水卡编号(12月19日废弃)--> |
| | | <select id="getCardIdByAddr" resultType="java.lang.Long"> |
| | | SELECT id AS cardId FROM se_client_card WHERE cardAddr = #{cardAddr} |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard"> |
| | | <!--@mbg.generated--> |
| | | insert into se_client_card (id, cardAddr, clientId, money, `state`, createDt, replaceDt, rechargeDt, lossDtDt, cancelDt, unlockDt, reversalDt, consumeDt, lastOper, remarks) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{cardaddr,jdbcType=VARCHAR}, |
| | | #{clientid,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, |
| | | #{state,jdbcType=TINYINT}, |
| | | #{createdt,jdbcType=TIMESTAMP}, |
| | | #{replacedt,jdbcType=TIMESTAMP}, |
| | | #{rechargedt,jdbcType=TIMESTAMP}, |
| | | #{lossdtdt,jdbcType=TIMESTAMP}, |
| | | #{canceldt,jdbcType=TIMESTAMP}, |
| | | #{unlockdt,jdbcType=TIMESTAMP}, |
| | | #{reversaldt,jdbcType=TIMESTAMP}, |
| | | #{consumedt,jdbcType=TIMESTAMP}, |
| | | #{lastoper,jdbcType=TINYINT}, |
| | | #{remarks,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <!--根据水卡编号获取水卡表主键(12月19日添加后废弃)--> |
| | | <select id="getCardIdByNum" resultType="java.lang.Long"> |
| | | SELECT id AS cardId FROM se_client_card WHERE cardNum = #{cardNum} |
| | | </select> |
| | | |
| | | <!-- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard" useGeneratedKeys="true">--> |
| | | <!-- <!–@mbg.generated–>--> |
| | | <!-- insert into se_client_card (cardAddr, clientId, money, --> |
| | | <!-- `state`, createDt, replaceDt, --> |
| | | <!-- rechargeDt, lossDtDt, cancelDt, --> |
| | | <!-- unlockDt, reversalDt, consumeDt, --> |
| | | <!-- lastOper, remarks)--> |
| | | <!-- values (#{cardaddr,jdbcType=VARCHAR}, #{clientid,jdbcType=BIGINT}, #{money,jdbcType=FLOAT}, --> |
| | | <!-- #{state,jdbcType=TINYINT}, #{createdt,jdbcType=TIMESTAMP}, #{replacedt,jdbcType=TIMESTAMP}, --> |
| | | <!-- #{rechargedt,jdbcType=TIMESTAMP}, #{lossdtdt,jdbcType=TIMESTAMP}, #{canceldt,jdbcType=TIMESTAMP}, --> |
| | | <!-- #{unlockdt,jdbcType=TIMESTAMP}, #{reversaldt,jdbcType=TIMESTAMP}, #{consumedt,jdbcType=TIMESTAMP}, --> |
| | | <!-- #{lastoper,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR})--> |
| | | <!-- </insert>--> |
| | | <!--根据水卡编号获取水卡表主键及农户编号--> |
| | | <select id="getCardIdAndClientNum" resultType="java.util.Map"> |
| | | SELECT id AS cardId, clientNum FROM se_client_card WHERE cardNum = #{cardNum} |
| | | </select> |
| | | |
| | | |
| | | <!--根据行政区划串模块查询水卡编号--> |
| | | <select id="getCardNumOfMax" resultType="java.lang.String"> |
| | | SELECT cardNum |
| | | FROM se_client_card |
| | | WHERE cardNum LIKE CONCAT('%',#{areaCode},'%') |
| | | ORDER BY cardNum desc |
| | | LIMIT 0,1 |
| | | </select> |
| | | |
| | | <!--添加水卡记录--> |
| | | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard" useGeneratedKeys="true"> |
| | | <!--@mbg.generated--> |
| | | insert into se_client_card (id, cardAddr, cardNum, clientNum, |
| | | money, `state`, createDt, |
| | | replaceDt, rechargeDt, lossDtDt, |
| | | cancelDt, unlockDt, reversalDt, |
| | | consumeDt, lastOper, remarks |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{cardaddr,jdbcType=VARCHAR}, #{cardnum,jdbcType=VARCHAR}, #{clientnum,jdbcType=VARCHAR}, |
| | | #{money,jdbcType=FLOAT}, #{state,jdbcType=TINYINT}, #{createdt,jdbcType=TIMESTAMP}, |
| | | #{replacedt,jdbcType=TIMESTAMP}, #{rechargedt,jdbcType=TIMESTAMP}, #{lossdtdt,jdbcType=TIMESTAMP}, |
| | | #{canceldt,jdbcType=TIMESTAMP}, #{unlockdt,jdbcType=TIMESTAMP}, #{reversaldt,jdbcType=TIMESTAMP}, |
| | | #{consumedt,jdbcType=TIMESTAMP}, #{lastoper,jdbcType=TINYINT}, #{remarks,jdbcType=VARCHAR} |
| | | ) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeClientCard" useGeneratedKeys="true"> |
| | | <!--@mbg.generated--> |
| | |
| | | <if test="cardaddr != null"> |
| | | cardAddr, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId, |
| | | <if test="cardnum != null"> |
| | | cardNum, |
| | | </if> |
| | | <if test="clientnum != null"> |
| | | clientNum, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | |
| | | <if test="cardaddr != null"> |
| | | #{cardaddr,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | #{clientid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientnum != null"> |
| | | #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | |
| | | <if test="cardaddr != null"> |
| | | cardAddr = #{cardaddr,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientnum != null"> |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | |
| | | <!--@mbg.generated--> |
| | | update se_client_card |
| | | set cardAddr = #{cardaddr,jdbcType=VARCHAR}, |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | `state` = #{state,jdbcType=TINYINT}, |
| | | createDt = #{createdt,jdbcType=TIMESTAMP}, |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_recharge_history--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="cardId" jdbcType="BIGINT" property="cardid" /> |
| | | <result column="clientId" jdbcType="BIGINT" property="clientid" /> |
| | | <result column="cardNum" jdbcType="VARCHAR" property="cardnum" /> |
| | | <result column="clientNum" jdbcType="VARCHAR" property="clientnum" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="amount" jdbcType="FLOAT" property="amount" /> |
| | | <result column="gift" jdbcType="FLOAT" property="gift" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, cardId, clientId, money, amount, gift, afterRecharge, paymentId, price, remarks, |
| | | id, cardNum, clientNum, money, amount, gift, afterRecharge, paymentId, price, remarks, |
| | | `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | |
| | | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory" useGeneratedKeys="true"> |
| | | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory"> |
| | | <!--@mbg.generated--> |
| | | insert into se_recharge_history (id, cardId, clientId, money, amount, gift, afterRecharge, paymentId, price, remarks, `operator`, operateDt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{cardid,jdbcType=BIGINT}, |
| | | #{clientid,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, |
| | | #{amount,jdbcType=FLOAT}, |
| | | #{gift,jdbcType=FLOAT}, |
| | | #{afterrecharge,jdbcType=FLOAT}, |
| | | #{paymentid,jdbcType=BIGINT}, |
| | | #{price,jdbcType=FLOAT}, |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | insert into se_recharge_history (id, cardNum, clientNum, money, |
| | | amount, gift, afterRecharge, |
| | | paymentId, price, remarks, |
| | | `operator`, operateDt) |
| | | values (#{id,jdbcType=BIGINT}, #{cardnum,jdbcType=VARCHAR}, #{clientnum,jdbcType=VARCHAR}, #{money,jdbcType=FLOAT}, |
| | | #{amount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{afterrecharge,jdbcType=FLOAT}, |
| | | #{paymentid,jdbcType=BIGINT}, #{price,jdbcType=FLOAT}, #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory" useGeneratedKeys="true"> |
| | | <!--@mbg.generated--> |
| | | insert into se_recharge_history |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="cardid != null"> |
| | | cardId, |
| | | <if test="cardnum != null"> |
| | | cardNum, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId, |
| | | <if test="clientnum != null"> |
| | | clientNum, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="cardid != null"> |
| | | #{cardid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientnum != null"> |
| | | #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | |
| | | <!--@mbg.generated--> |
| | | update se_recharge_history |
| | | <set> |
| | | <if test="cardid != null"> |
| | | cardId = #{cardid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientnum != null"> |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory"> |
| | | <!--@mbg.generated--> |
| | | update se_recharge_history |
| | | set cardId = #{cardid,jdbcType=BIGINT}, |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | set cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | amount = #{amount,jdbcType=FLOAT}, |
| | | gift = #{gift,jdbcType=FLOAT}, |
| | |
| | | <!--@mbg.generated--> |
| | | <!--@Table se_recharge--> |
| | | <id column="id" jdbcType="BIGINT" property="id" /> |
| | | <result column="cardId" jdbcType="BIGINT" property="cardid" /> |
| | | <result column="clientId" jdbcType="BIGINT" property="clientid" /> |
| | | <result column="cardNum" jdbcType="VARCHAR" property="cardnum" /> |
| | | <result column="clientNum" jdbcType="VARCHAR" property="clientnum" /> |
| | | <result column="money" jdbcType="FLOAT" property="money" /> |
| | | <result column="amount" jdbcType="FLOAT" property="amount" /> |
| | | <result column="gift" jdbcType="FLOAT" property="gift" /> |
| | |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, cardId, clientId, money, amount, gift, afterRecharge, paymentId, price, remarks, |
| | | id, cardNum, clientNum, money, amount, gift, afterRecharge, paymentId, price, remarks, |
| | | `operator`, operateDt |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRecharge"> |
| | | <!-- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRecharge" useGeneratedKeys="true">--> |
| | | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRecharge"> |
| | | <!--@mbg.generated--> |
| | | insert into se_recharge (id, cardId, clientId, money, amount, gift, afterRecharge, paymentId, price, remarks, `operator`, operateDt) |
| | | values (#{id,jdbcType=BIGINT}, |
| | | #{cardid,jdbcType=BIGINT}, |
| | | #{clientid,jdbcType=BIGINT}, |
| | | #{money,jdbcType=FLOAT}, |
| | | #{amount,jdbcType=FLOAT}, |
| | | #{gift,jdbcType=FLOAT}, |
| | | #{afterrecharge,jdbcType=FLOAT}, |
| | | #{paymentid,jdbcType=BIGINT}, |
| | | #{price,jdbcType=FLOAT}, |
| | | #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, |
| | | #{operatedt,jdbcType=TIMESTAMP}) |
| | | insert into se_recharge (id, cardNum, clientNum, money, |
| | | amount, gift, afterRecharge, |
| | | paymentId, price, remarks, |
| | | `operator`, operateDt) |
| | | values (#{id,jdbcType=BIGINT} ,#{cardnum,jdbcType=VARCHAR}, #{clientnum,jdbcType=VARCHAR}, #{money,jdbcType=FLOAT}, |
| | | #{amount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{afterrecharge,jdbcType=FLOAT}, |
| | | #{paymentid,jdbcType=BIGINT}, #{price,jdbcType=FLOAT}, #{remarks,jdbcType=VARCHAR}, |
| | | #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | |
| | | <!-- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRecharge" useGeneratedKeys="true">--> |
| | | <!-- <!–@mbg.generated–>--> |
| | | <!-- insert into se_recharge (cardId, clientId, money, --> |
| | | <!-- amount, gift, afterRecharge, --> |
| | | <!-- paymentId, price, remarks, --> |
| | | <!-- `operator`, operateDt)--> |
| | | <!-- values (#{cardid,jdbcType=BIGINT}, #{clientid,jdbcType=BIGINT}, #{money,jdbcType=FLOAT}, --> |
| | | <!-- #{amount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{afterrecharge,jdbcType=FLOAT}, --> |
| | | <!-- #{paymentid,jdbcType=BIGINT}, #{price,jdbcType=FLOAT}, #{remarks,jdbcType=VARCHAR}, --> |
| | | <!-- #{operator,jdbcType=BIGINT}, #{operatedt,jdbcType=TIMESTAMP})--> |
| | | <!-- </insert>--> |
| | | |
| | | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRecharge" useGeneratedKeys="true"> |
| | | <!--@mbg.generated--> |
| | | insert into se_recharge |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="cardid != null"> |
| | | cardId, |
| | | <if test="cardnum != null"> |
| | | cardNum, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId, |
| | | <if test="clientnum != null"> |
| | | clientNum, |
| | | </if> |
| | | <if test="money != null"> |
| | | money, |
| | |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="cardid != null"> |
| | | #{cardid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientnum != null"> |
| | | #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="money != null"> |
| | | #{money,jdbcType=FLOAT}, |
| | |
| | | <!--@mbg.generated--> |
| | | update se_recharge |
| | | <set> |
| | | <if test="cardid != null"> |
| | | cardId = #{cardid,jdbcType=BIGINT}, |
| | | <if test="cardnum != null"> |
| | | cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="clientid != null"> |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | <if test="clientnum != null"> |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="money != null"> |
| | | money = #{money,jdbcType=FLOAT}, |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeRecharge"> |
| | | <!--@mbg.generated--> |
| | | update se_recharge |
| | | set cardId = #{cardid,jdbcType=BIGINT}, |
| | | clientId = #{clientid,jdbcType=BIGINT}, |
| | | set cardNum = #{cardnum,jdbcType=VARCHAR}, |
| | | clientNum = #{clientnum,jdbcType=VARCHAR}, |
| | | money = #{money,jdbcType=FLOAT}, |
| | | amount = #{amount,jdbcType=FLOAT}, |
| | | gift = #{gift,jdbcType=FLOAT}, |
| | |
| | | </update> |
| | | |
| | | <!--根据水卡编号删除充值记录--> |
| | | <delete id="deleteByCardId" parameterType="java.lang.Long"> |
| | | DELETE FROM se_recharge WHERE cardId = ${cardId} |
| | | <delete id="deleteByCardNum" parameterType="java.lang.String"> |
| | | DELETE FROM se_recharge WHERE cardNum = #{cardNum} |
| | | </delete> |
| | | |
| | | <!--根据指定的条件获取充值记录--> |
| | | <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(*) AS recordCount |
| | | COUNT(*) AS recordCount |
| | | FROM se_recharge_history rec |
| | | INNER JOIN se_client_card card ON rec.cardId = card.id |
| | | INNER JOIN ba_client cli ON rec.clientId = cli.id |
| | | INNER JOIN se_client_card card ON rec.cardNum = card.cardNum |
| | | INNER JOIN ba_client cli ON rec.clientNum = cli.num |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardAddr != null and cardAddr !=''"> |
| | | AND card.cardAddr like CONCAT('%',#{cardAddr},'%') |
| | | <!-- <if test = "clientId != null and clientId > 0">--> |
| | | <!-- AND rec.clientId like CONCAT('%',#{clientId},'%')--> |
| | | <!-- </if>--> |
| | | <if test = "clientNum != null and clientNum > 0"> |
| | | AND rec.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <!-- <if test = "cardAddr != null and cardAddr !=''">--> |
| | | <!-- AND card.cardAddr like CONCAT('%',#{cardAddr},'%')--> |
| | | <!-- </if>--> |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId > 0"> |
| | |
| | | <!--根据指定的条件获取充值记录--> |
| | | <select id="getRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoRecharge"> |
| | | SELECT |
| | | (@i:=@i+1) AS id, |
| | | cli.name AS clientName, |
| | | rec.clientId, |
| | | card.cardAddr, |
| | | rec.amount, |
| | | rec.afterRecharge, |
| | | rec.paymentId, |
| | | rec.price, |
| | | (SELECT `name` FROM ba_user WHERE id = rec.operator) AS operator, |
| | | rec.operateDt |
| | | (@i:=@i+1) AS id, |
| | | cli.name AS clientName, |
| | | cli.num AS clientNum, |
| | | card.cardNum, |
| | | rec.amount, |
| | | rec.afterRecharge, |
| | | rec.paymentId, |
| | | rec.price, |
| | | (SELECT `name` FROM ba_user WHERE id = rec.operator) AS operator, |
| | | rec.operateDt |
| | | FROM se_recharge_history rec |
| | | INNER JOIN se_client_card card ON rec.cardId = card.id |
| | | INNER JOIN ba_client cli ON rec.clientId = cli.id |
| | | , (SELECT @i:=0) AS itable |
| | | INNER JOIN se_client_card card ON rec.cardNum = card.cardNum |
| | | INNER JOIN ba_client cli ON rec.clientNum = cli.num |
| | | , (SELECT @i:=0) AS itable |
| | | <where> |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "clientId != null and clientId > 0"> |
| | | AND rec.clientId like CONCAT('%',#{clientId},'%') |
| | | <!-- <if test = "clientId != null and clientId > 0">--> |
| | | <!-- AND rec.clientId like CONCAT('%',#{clientId},'%')--> |
| | | <!-- </if>--> |
| | | <if test = "clientNum != null and clientNum > 0"> |
| | | AND rec.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "cardAddr != null and cardAddr !=''"> |
| | | AND card.cardAddr like CONCAT('%',#{cardAddr},'%') |
| | | <!-- <if test = "cardAddr != null and cardAddr !=''">--> |
| | | <!-- AND card.cardAddr like CONCAT('%',#{cardAddr},'%')--> |
| | | <!-- </if>--> |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId > 0"> |
| | |
| | | @EnableAspectJAutoProxy |
| | | @EnableMultiDataSource |
| | | @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipIrrSell"}) |
| | | @MapperScan(basePackages={"com.dy.pipIrrGlobal.daoSe"}) |
| | | @MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) |
| | | public class PipIrrSellApplication { |
| | | |
| | | public static void main(String[] args) { |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeActiveCard; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voBa.VoAreaCode; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrSell.clientCard.CardStateENUM; |
| | | import com.dy.pipIrrSell.clientCard.ClientCardSv; |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 获取5级行政区划串areaCode |
| | | * provinceId 省级区划代码 |
| | | * cityId 市级区划代码 |
| | | * countryId 县级区划代码 |
| | | * townId 镇级区划代码 |
| | | * villageId 村级区划代码 |
| | | */ |
| | | VoAreaCode voAreaCode = activeCardSv.getAreaCodeByNum(po.getClientNum()); |
| | | if(voAreaCode == null) { |
| | | return BaseResponseUtils.buildFail("该农户行政区划异常,请联系系统管理员"); |
| | | } |
| | | String provinceId = voAreaCode.getProvinceId(); |
| | | String cityId = voAreaCode.getCityId(); |
| | | String countryId = voAreaCode.getCountryId(); |
| | | String townId = voAreaCode.getTownId(); |
| | | String villageId = voAreaCode.getVillageId(); |
| | | String areaCode = provinceId + cityId + countryId + townId + villageId; |
| | | |
| | | /** |
| | | * 根据行政区划串(areaCode)在水卡表中针对水卡编号(cardNum)进行模糊查询 |
| | | * 如果4位顺序号已经达到最大值,提示用户联系系统管理员 |
| | | * 如果4位顺序号未达到最大值,则加1 |
| | | * cardNum为新的卡号 |
| | | */ |
| | | String cardNum = Optional.ofNullable(activeCardSv.getCardNumOfMax(areaCode)).orElse(""); |
| | | if(cardNum != null && cardNum.trim().length() > 0) { |
| | | Integer number = Integer.parseInt(cardNum.substring(12)); |
| | | number = number + 1; |
| | | if(number > 9999) { |
| | | return BaseResponseUtils.buildFail("水卡编号已满,请联系系统管理员"); |
| | | } |
| | | cardNum = cardNum.substring(0, 12) + String.format("%04d", number); |
| | | } else { |
| | | cardNum = areaCode + "0001"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * cardId 水卡编号(插入记录后生成) |
| | | * cardAddr 水卡地址 |
| | | * clientId 农户编号 |
| | | * cardAddr 水卡地址(仅仅写入,无业务) |
| | | * clientNum 农户编号 |
| | | * cardCost 卡片费用 |
| | | * amount 充值金额 |
| | | * reissueAmount 补卡金额,补卡时使用 |
| | |
| | | * operator 操作人编号 |
| | | * activeTime 开卡时间 |
| | | */ |
| | | Long cardId = 0L; |
| | | //Long cardId = 0L; |
| | | String cardAddr = po.getCardAddr(); |
| | | Long clientId = po.getClientId(); |
| | | //Long clientId = po.getClientId(); |
| | | String clientNum = po.getClientNum(); |
| | | Integer cardCost = po.getCardCost(); |
| | | Float amount = po.getAmount(); |
| | | Long paymentId = po.getPaymentId(); |
| | | String remarks = po.getRemarks(); |
| | | Long operator = po.getOperator(); |
| | | Date activeTime = new Date(); |
| | | //LocalDateTime activeTime = LocalDateTime.parse(dtf.format(LocalDateTime.now()), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | Date createTime = new Date(); |
| | | |
| | | /** |
| | | * 添加农户卡记录 |
| | | */ |
| | | SeClientCard clientCard = new SeClientCard(); |
| | | clientCard.setCardaddr(cardAddr); |
| | | clientCard.setClientid(clientId); |
| | | clientCard.setMoney(0.0); |
| | | clientCard.setState(CardStateENUM.NORMAL.getCode()); |
| | | clientCard.setCreatedt(activeTime); |
| | | clientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setCardaddr(cardAddr); |
| | | //seClientCard.setClientid(clientId); |
| | | seClientCard.setCardnum(cardNum); |
| | | seClientCard.setClientnum(clientNum); |
| | | seClientCard.setMoney(0.0); |
| | | seClientCard.setState(CardStateENUM.NORMAL.getCode()); |
| | | seClientCard.setCreatedt(createTime); |
| | | seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | | |
| | | cardId = Optional.ofNullable(clientCardSv.add(clientCard)).orElse(0L) ; |
| | | Long cardId = Optional.ofNullable(clientCardSv.add(seClientCard)).orElse(0L) ; |
| | | if(cardId == 0) { |
| | | return BaseResponseUtils.buildFail("开卡失败-农户卡写入异常"); |
| | | } |
| | |
| | | * 添加开卡记录 |
| | | */ |
| | | SeActiveCard activeCard = new SeActiveCard(); |
| | | activeCard.setCardid(cardId); |
| | | activeCard.setClientid(clientId); |
| | | activeCard.setCardnum(cardNum); |
| | | activeCard.setClientnum(clientNum); |
| | | //activeCard.setCardid(cardId); |
| | | //activeCard.setClientid(clientId); |
| | | activeCard.setCardcost(cardCost); |
| | | activeCard.setPaymentid(paymentId); |
| | | activeCard.setOperatetype(OperateTypeENUM.ACTIVE.getCode()); |
| | | activeCard.setRemarks(remarks); |
| | | activeCard.setOperator(operator); |
| | | activeCard.setOperatedt(activeTime); |
| | | activeCard.setOperatedt(createTime); |
| | | Long rec = Optional.ofNullable(activeCardSv.add(activeCard)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("开卡失败-开卡记录写入异常"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 如果操作人员开卡时输入了充值金额,则开卡后调用充值功能 |
| | | */ |
| | | po.setCardNum(cardNum); |
| | | if(amount != null && amount > 0) { |
| | | DtoRecharge dtoRecharge = RechargeDtoMapper.INSTANCT.po2vo(po); |
| | | dtoRecharge.setMoney(0f); |
| | | dtoRecharge.setGift(0f); |
| | | dtoRecharge.setPrice(0f); |
| | | BaseResponse<Boolean> job = rechargeCtrl.addRecharge(dtoRecharge); |
| | | if(!job.getCode().equals("0001")) { |
| | | return BaseResponseUtils.buildFail("开卡成功,但充值失败"); |
| | | } |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | return BaseResponseUtils.buildSuccess(cardNum) ; |
| | | } |
| | | |
| | | @Operation(summary = "补卡", description = "补卡") |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | /** |
| | | * cardId 水卡编号(非传入参数,由cardAddr反查) |
| | | * cardAddr 水卡地址 |
| | | * clientId 农户编号 |
| | | * cardId 水卡编号(非传入参数,由cardNum反查,更新水卡表用) |
| | | * cardNum 水卡编号 |
| | | * clientNum 农户编号(非传入参数,由cardNum反查,添加补卡使用) |
| | | * cardCost 卡片费用 |
| | | * reissueAmount 补卡金额,补卡时使用 |
| | | * paymentId 支付方式编号 |
| | |
| | | * activeTime 补卡时间 |
| | | */ |
| | | Long cardId = 0L; |
| | | String cardAddr = po.getCardAddr(); |
| | | Long clientId = po.getClientId(); |
| | | String cardNum = po.getCardNum(); |
| | | //String clientNum = po.getClientNum(); |
| | | String clientNum = ""; |
| | | Integer cardCost = po.getCardCost(); |
| | | Double reissueAmount = po.getReissueAmount(); |
| | | Long paymentId = po.getPaymentId(); |
| | | String remarks = po.getRemarks(); |
| | | Long operator = po.getOperator(); |
| | | Date activeTime = new Date(); |
| | | Date replaceTime = new Date(); |
| | | |
| | | /** |
| | | * 依据水卡地址获取水卡编号(主键) |
| | | * 依据水卡编号获取水卡表主键及农户编号 |
| | | */ |
| | | cardId = Optional.ofNullable(clientCardSv.getCardIdByAddr(cardAddr)).orElse(0L); |
| | | if(cardId == 0) { |
| | | Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); |
| | | if(map == null || map.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("卡号错误,该卡不存在"); |
| | | } |
| | | cardId = Long.parseLong(map.get("cardId").toString()); |
| | | clientNum = map.get("clientNum").toString(); |
| | | |
| | | /** |
| | | * 修改农户卡信息: |
| | |
| | | */ |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setReplacedt(activeTime); |
| | | seClientCard.setReplacedt(replaceTime); |
| | | seClientCard.setLastoper(LastOperateENUM.REPLACE.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | |
| | | * 添加补卡记录 |
| | | */ |
| | | SeActiveCard activeCard = new SeActiveCard(); |
| | | activeCard.setCardid(cardId); |
| | | activeCard.setClientid(clientId); |
| | | activeCard.setCardnum(cardNum); |
| | | activeCard.setClientnum(clientNum); |
| | | //activeCard.setCardid(cardId); |
| | | //activeCard.setClientid(clientId); |
| | | activeCard.setCardcost(cardCost); |
| | | activeCard.setPaymentid(paymentId); |
| | | activeCard.setReissueamount(reissueAmount); |
| | | activeCard.setOperatetype(OperateTypeENUM.REPLACE.getCode()); |
| | | activeCard.setRemarks(remarks); |
| | | activeCard.setOperator(operator); |
| | | activeCard.setOperatedt(activeTime); |
| | | activeCard.setOperatedt(replaceTime); |
| | | Long rec = Optional.ofNullable(activeCardSv.add(activeCard)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("补卡失败-补卡记录写入异常"); |
| | |
| | | package com.dy.pipIrrSell.activeCard; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoBa.BaClientMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeActiveCardMapper; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeActiveCard; |
| | | import com.dy.pipIrrGlobal.voBa.VoAreaCode; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | |
| | | public class ActiveCardSv { |
| | | @Autowired |
| | | private SeActiveCardMapper seActiveCardMapper; |
| | | |
| | | @Autowired |
| | | private SeClientCardMapper seClientCardMapper; |
| | | |
| | | @Autowired |
| | | private BaClientMapper baClientMapper; |
| | | |
| | | public QueryResultVo<List<VoActiveCard>> getActiveCards(QueryVo queryVo) { |
| | | //完善查询开卡记录的起止时间 |
| | |
| | | seActiveCardMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 根据农户编号获取5级行政区划代码 |
| | | * @param clientNum 农户编号 |
| | | * @return 5级行政区划代码 |
| | | */ |
| | | public VoAreaCode getAreaCodeByNum(String clientNum) { |
| | | return baClientMapper.getAreaCodeByNum(clientNum); |
| | | } |
| | | |
| | | /** |
| | | * 根据行政区划串模块查询水卡编号 |
| | | * @param areaCode |
| | | * @return |
| | | */ |
| | | String getCardNumOfMax(String areaCode) { |
| | | return seClientCardMapper.getCardNumOfMax(areaCode); |
| | | } |
| | | } |
| | |
| | | * 水卡地址 |
| | | */ |
| | | @Schema(description = "水卡地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank |
| | | @NotBlank(message = "水卡地址不能为空") |
| | | private String cardAddr; |
| | | |
| | | /** |
| | | * 农户ID |
| | | * 农户编号 |
| | | * 开卡时使用 |
| | | */ |
| | | @Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @Positive(message = "农户ID必须为大于0的整数") |
| | | private Long clientId; |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private String clientNum; |
| | | |
| | | /** |
| | | * 农户ID(主键) |
| | | * 废弃,改用clientNum |
| | | */ |
| | | //@Schema(description = "农户ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | //@Positive(message = "农户ID必须为大于0的整数") |
| | | //private Long clientId; |
| | | |
| | | /** |
| | | * 水卡编号 |
| | | * 补卡时使用 |
| | | */ |
| | | @Schema(description = "水卡编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private String cardNum; |
| | | |
| | | /** |
| | | * 卡片费用 |
| | |
| | | public String clientName; |
| | | |
| | | @Schema(description = "IC卡号") |
| | | public String cardAddr; |
| | | //public String cardAddr; |
| | | public String cardNum; |
| | | |
| | | @Schema(description = "卡片状态") |
| | | private Byte state; |
| | |
| | | public interface RechargeDtoMapper { |
| | | RechargeDtoMapper INSTANCT = Mappers.getMapper(RechargeDtoMapper.class); |
| | | |
| | | @Mapping(target = "cardAddr", source = "cardAddr") |
| | | @Mapping(target = "clientId", source = "clientId") |
| | | //@Mapping(target = "cardAddr", source = "cardAddr") |
| | | //@Mapping(target = "clientId", source = "clientId") |
| | | @Mapping(target = "cardNum", source = "cardNum") |
| | | @Mapping(target = "clientNum", source = "clientNum") |
| | | @Mapping(target = "amount", source = "amount") |
| | | @Mapping(target = "paymentId", source = "paymentId") |
| | | @Mapping(target = "remarks", source = "remarks") |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2023/12/7 9:18 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 依据水卡地址获取水卡编号(主键) |
| | | * 依据水卡地址获取水卡编号(12月19日废弃) |
| | | * @param cardAddr |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号获取水卡表主键(12月19日添加后废弃) |
| | | * @param cardNum 16位水卡编号 |
| | | * @return 水卡表主键 |
| | | */ |
| | | public Long getCardIdByNum(String cardNum) { |
| | | return seClientCardMapper.getCardIdByNum(cardNum); |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号获取水卡表主键及农户编号 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | public Map getCardIdAndClientNum(String cardNum) { |
| | | return seClientCardMapper.getCardIdAndClientNum(cardNum); |
| | | } |
| | | /** |
| | | * 根据水卡编号(主键)修改农户卡信息 |
| | | * @param po |
| | | * @return |
| | |
| | | */ |
| | | @Schema(description = "水卡地址", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | @NotBlank |
| | | private String cardAddr; |
| | | //private String cardAddr; |
| | | private String cardNum; |
| | | |
| | | /** |
| | | * 农户编号 |
| | | */ |
| | | @Schema(description = "农户编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED) |
| | | private Long clientId; |
| | | //private Long clientId; |
| | | private String clientNum; |
| | | |
| | | /** |
| | | * 卡片余额 |
| | |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Tag(name = "充值管理", description = "充值操作") |
| | |
| | | */ |
| | | public BaseResponse<Boolean> addRecharge(DtoRecharge po){ |
| | | /** |
| | | * cardId 水卡编号(非传入参数,由cardAddr反查) |
| | | * cardAddr 水卡地址 |
| | | * clientId 农户编号 |
| | | * cardId 水卡编号(插入记录后生成) |
| | | * cardAddr 水卡地址(仅仅写入,无业务) |
| | | * clientNum 农户编号(非传入参数,由cardNum反查,添加充值使用) |
| | | * money 卡片余额 |
| | | * amount 充值金额 |
| | | * gift 赠送金额 |
| | |
| | | * rechargeTime 充值时间 |
| | | */ |
| | | Long cardId = 0L; |
| | | String cardAddr = po.getCardAddr(); |
| | | Long clientId = po.getClientId(); |
| | | //String cardAddr = po.getCardAddr(); |
| | | //Long clientId = po.getClientId(); |
| | | String cardNum = po.getCardNum(); |
| | | //String clientNum = po.getClientNum(); |
| | | String clientNum = ""; |
| | | Float money = po.getMoney(); |
| | | Float amount = po.getAmount(); |
| | | Float gift = po.getGift(); |
| | | //Float afterRecharge = po.getAfterRecharge(); |
| | | Float afterRecharge = money + amount + gift; |
| | | Long paymentId = po.getPaymentId(); |
| | | Float price = po.getPrice(); |
| | |
| | | Date rechargeTime = new Date(); |
| | | |
| | | /** |
| | | * 依据水卡地址获取水卡编号(主键) |
| | | * 依据水卡编号获取水卡表主键及农户编号 |
| | | */ |
| | | cardId = Optional.ofNullable(clientCardSv.getCardIdByAddr(cardAddr)).orElse(0L); |
| | | if(cardId == 0) { |
| | | Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); |
| | | if(map == null || map.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("卡号错误,该卡不存在"); |
| | | } |
| | | cardId = Long.parseLong(map.get("cardId").toString()); |
| | | clientNum = map.get("clientNum").toString(); |
| | | |
| | | /** |
| | | * 修改农户卡信息: |
| | |
| | | /** |
| | | * 删除充值表该卡的充值记录 |
| | | */ |
| | | Integer rec_deleteRecharge = Optional.ofNullable(rechargeSv.deleteByCardId(cardId)).orElse(0); |
| | | Integer rec_deleteRecharge = Optional.ofNullable(rechargeSv.deleteByCardNum(cardNum)).orElse(0); |
| | | /** |
| | | * 添加充值记录 |
| | | */ |
| | | SeRecharge seRecharge = new SeRecharge(); |
| | | seRecharge.setCardid(cardId); |
| | | seRecharge.setClientid(clientId); |
| | | //seRecharge.setCardid(cardId); |
| | | //seRecharge.setClientid(clientId); |
| | | seRecharge.setCardnum(cardNum); |
| | | seRecharge.setClientnum(clientNum); |
| | | seRecharge.setMoney(money); |
| | | seRecharge.setAmount(amount); |
| | | seRecharge.setGift(gift); |
| | |
| | | * 添加补卡历史记录 |
| | | */ |
| | | SeRechargeHistory seRechargeHistory = new SeRechargeHistory(); |
| | | seRechargeHistory.setCardid(cardId); |
| | | seRechargeHistory.setClientid(clientId); |
| | | //seRechargeHistory.setCardid(cardId); |
| | | //seRechargeHistory.setClientid(clientId); |
| | | seRechargeHistory.setCardnum(cardNum); |
| | | seRechargeHistory.setClientnum(clientNum); |
| | | seRechargeHistory.setMoney(money); |
| | | seRechargeHistory.setAmount(amount); |
| | | seRechargeHistory.setGift(gift); |
| | |
| | | * @param cardId |
| | | * @return |
| | | */ |
| | | public Integer deleteByPrimaryKey(Long cardId) { |
| | | return seRechargeMapper.deleteByPrimaryKey(cardId); |
| | | } |
| | | //public Integer deleteByPrimaryKey(Long cardId) { |
| | | // return seRechargeMapper.deleteByPrimaryKey(cardId); |
| | | //} |
| | | |
| | | /** |
| | | * 添加充值记录 |
| | |
| | | |
| | | /** |
| | | * 根据水卡编号删除充值记录 |
| | | * @param cardId |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | public Integer deleteByCardId(Long cardId) { |
| | | return seRechargeMapper.deleteByCardId(cardId); |
| | | //public Integer deleteByCardId(Long cardId) { |
| | | // return seRechargeMapper.deleteByCardId(cardId); |
| | | //} |
| | | public Integer deleteByCardNum(String cardNum) { |
| | | return seRechargeMapper.deleteByCardNum(cardNum); |
| | | } |
| | | |
| | | /** |