zhubaomin
3 天以前 02faa2bb05b3cdb50ee1f56ae4c9a1282e9f9c44
充值机用读卡接口
9个文件已修改
1个文件已添加
345 ■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeManagerCardMapper.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeManagerCard.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTermCard.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeManagerCardMapper.xml 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/client/ClientCtrl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/client/ClientSv.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java
@@ -2,10 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
import com.dy.pipIrrGlobal.voSe.VoCardInfo;
import com.dy.pipIrrGlobal.voSe.VoCardInfo1;
import com.dy.pipIrrGlobal.voSe.VoCards;
import com.dy.pipIrrGlobal.voSe.VoCards2;
import com.dy.pipIrrGlobal.voSe.*;
import com.dy.pipIrrGlobal.voSt.VoCardUsage;
import com.dy.pipIrrGlobal.voWe.VoCards3;
import org.apache.ibatis.annotations.Mapper;
@@ -264,4 +261,11 @@
     * @return
     */
    Integer emptyCardBalance(@Param("orderNumber")String orderNumber);
    /**
     * 充值机用获取农户水卡信息
     * @param cardAddr
     * @return
     */
    VoTermCard getTermCardInfo(@Param("cardAddr")String cardAddr);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeManagerCardMapper.java
@@ -2,13 +2,14 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dy.pipIrrGlobal.pojoSe.SeManagerCard;
import com.dy.pipIrrGlobal.voSe.VoTermCard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * @author ZhuBaoMin
 * @date 2024-07-24 10:36
 * @LastEditTime 2024-07-24 10:36
 * @date 2025-06-11 10:34
 * @LastEditTime 2025-06-11 10:34
 * @Description
 */
@@ -32,4 +33,11 @@
     * @return
     */
    String getManagerCardNumOfMax(@Param("areaCode") String areaCode);
    /**
     * 充值机用获取管理卡信息
     * @param cardAddr
     * @return
     */
    VoTermCard getTermManagerCardInfo(@Param("cardAddr")String cardAddr);
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeManagerCard.java
@@ -10,18 +10,13 @@
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2024-07-24 10:36
 * @LastEditTime 2024-07-24 10:36
 * @Description
 */
/**
 * 管理员水卡表
 * @date 2025-06-11 10:34
 * @LastEditTime 2025-06-11 10:34
 * @Description 管理员水卡表
 */
@TableName(value = "se_manager_card", autoResultMap = true)
@@ -31,42 +26,51 @@
@NoArgsConstructor
@AllArgsConstructor
public class SeManagerCard implements BaseEntity {
    public static final long serialVersionUID = 202407241040001L;
    public static final long serialVersionUID = 202506111039001L;
    /**
    * 主键
    */
     * 主键
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    @TableId(type = IdType.INPUT)
    private Long id;
    /**
    * 卡片地址
    */
     * 通讯协议
     */
    private String protocol;
    /**
     * 卡片地址
     */
    @NotBlank(message = "卡片地址不能为空")
    private String cardAddr;
    /**
    * 卡片编号
    */
     * 卡片编号
     */
    @NotBlank(message = "卡片编号不能为空")
    private String cardNum;
    /**
    * 卡片类型;2-管理科,4-巡检卡,5清空卡
    */
     * 卡片类型;2-管理科,4-巡检卡,5清空卡
     */
    @NotNull(message = "卡片类型不能为空")
    private Byte cardType;
    /**
    * 开卡时间
    */
     * 开卡时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
    * 备注信息
    */
    @Length(max = 200)
     * 备注信息
     */
    private String remarks;
    /**
     * 订单号
     */
    private String orderNo;
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoTermCard.java
New file
@@ -0,0 +1,74 @@
package com.dy.pipIrrGlobal.voSe;
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Data;
import java.util.Date;
/**
 * @author ZhuBaoMin
 * @date 2025-06-11 9:31
 * @LastEditTime 2025-06-11 9:31
 * @Description 充值机用水卡视图对象
 */
@Data
@JsonPropertyOrder({"cardNum", "cardType", "money", "state", "userName", "clientNum", "phone", "address", "lastRechargeTime",  "cardAgreement"})
public class VoTermCard {
    private static final long serialVersionUID = 202506110933001L;
    /**
     * 水卡编号
     */
    @JSONField(serializeUsing= ObjectWriterImplToString.class)
    private Long cardNum;
    /**
     * 水卡类型:1-农户卡,?
     */
    private Integer cardType;
    /**
     * 水卡余额
     */
    private Double money;
    /*
    水卡状态:1-正常,2-已注销,3-已挂失,4-无效卡片
     */
    private Integer state;
    /**
     * 用户名称
     */
    private String userName;
    /**
     * 用户编号
     */
    private String clientNum;
    /**
     * 手机号码
     */
    private String phone;
    /**
     * 地址
     */
    private String address;
    /**
     * 最后充值时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastRechargeTime;
    /**
     * 卡协议
     */
    private String cardAgreement;
}
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml
@@ -788,4 +788,23 @@
    SET money = 0
    WHERE id = (SELECT original_card_id FROM se_client_card WHERE id = (SELECT card_id FROM se_card_operate WHERE order_no = #{orderNumber}))
  </update>
  <!--充值机用获取农户水卡信息-->
  <select id="getTermCardInfo" resultType="com.dy.pipIrrGlobal.voSe.VoTermCard">
    SELECT
        card.cardNum,
        1 AS cardType,
        card.money,
        card.state,
        cli.name AS userName,
        cli.clientNum,
        cli.phone,
        cli.address,
        card.rechargeDt AS lastRechargeTime,
        card.protocol AS cardAgreement
    FROM se_client_card card
        INNER JOIN se_client cli ON cli.id = card.clientId
    WHERE card.cardAddr = #{cardAddr}
    LIMIT 1
  </select>
</mapper>
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeManagerCardMapper.xml
@@ -5,15 +5,17 @@
    <!--@mbg.generated-->
    <!--@Table se_manager_card-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="protocol" jdbcType="VARCHAR" property="protocol" />
    <result column="card_addr" jdbcType="VARCHAR" property="cardAddr" />
    <result column="card_num" jdbcType="VARCHAR" property="cardNum" />
    <result column="card_type" jdbcType="TINYINT" property="cardType" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, card_addr, card_num, card_type, create_time, remarks
    id, protocol, card_addr, card_num, card_type, create_time, remarks, order_no
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -29,12 +31,12 @@
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeManagerCard">
    <!--@mbg.generated-->
    insert into se_manager_card (id, card_addr, card_num,
      card_type, create_time, remarks
      )
    values (#{id,jdbcType=BIGINT}, #{cardAddr,jdbcType=VARCHAR}, #{cardNum,jdbcType=VARCHAR},
      #{cardType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}
      )
    insert into se_manager_card (id, protocol, card_addr,
      card_num, card_type, create_time,
      remarks, order_no)
    values (#{id,jdbcType=BIGINT}, #{protocol,jdbcType=VARCHAR}, #{cardAddr,jdbcType=VARCHAR},
      #{cardNum,jdbcType=VARCHAR}, #{cardType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
      #{remarks,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeManagerCard">
    <!--@mbg.generated-->
@@ -42,6 +44,9 @@
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="protocol != null">
        protocol,
      </if>
      <if test="cardAddr != null">
        card_addr,
@@ -58,10 +63,16 @@
      <if test="remarks != null">
        remarks,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="protocol != null">
        #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="cardAddr != null">
        #{cardAddr,jdbcType=VARCHAR},
@@ -78,12 +89,18 @@
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeManagerCard">
    <!--@mbg.generated-->
    update se_manager_card
    <set>
      <if test="protocol != null">
        protocol = #{protocol,jdbcType=VARCHAR},
      </if>
      <if test="cardAddr != null">
        card_addr = #{cardAddr,jdbcType=VARCHAR},
      </if>
@@ -99,17 +116,22 @@
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeManagerCard">
    <!--@mbg.generated-->
    update se_manager_card
    set card_addr = #{cardAddr,jdbcType=VARCHAR},
    set protocol = #{protocol,jdbcType=VARCHAR},
      card_addr = #{cardAddr,jdbcType=VARCHAR},
      card_num = #{cardNum,jdbcType=VARCHAR},
      card_type = #{cardType,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      remarks = #{remarks,jdbcType=VARCHAR}
      remarks = #{remarks,jdbcType=VARCHAR},
      order_no = #{orderNo,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
@@ -121,4 +143,22 @@
    ORDER BY card_num desc
    LIMIT 0,1
  </select>
  <!--充值机用获取管理卡信息-->
  <select id="getTermManagerCardInfo" resultType="com.dy.pipIrrGlobal.voSe.VoTermCard">
    SELECT
      card_num AS cardNum,
      card_type AS cardType,
      NULL AS money,
      NULL AS state,
      NULL AS userName,
      NULL AS clientNum,
      NULL AS phone,
      NULL AS address,
      NULL AS lastRechargeTime,
      card.protocol AS cardcardAgreement
    FROM se_manager_card card
    WHERE card.card_addr = #{cardAddr}
      LIMIT 1
  </select>
</mapper>
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardCtrl.java
@@ -3,7 +3,10 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.voSe.VoTermActiveCard;
import com.dy.pipIrrGlobal.voSe.VoTermCard;
import com.dy.pipIrrGlobal.voSe.VoTermClient;
import com.dy.pipIrrGlobal.voSe.VoTermCommon;
import com.dy.pipIrrTerminal.card.dto.*;
import jakarta.validation.Valid;
@@ -11,11 +14,9 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -35,6 +36,7 @@
    /**
     * 开卡(含充值)
     *
     * @param po
     * @param bindingResult
     * @return
@@ -47,15 +49,16 @@
        }
        Map map_result = cardSv.activeOrReissueTermCard(po);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
    /**
     * 充值
     *
     * @param po
     * @param bindingResult
     * @return
@@ -68,15 +71,16 @@
        }
        Map map_result = cardSv.addRecharge(po, null);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
    /**
     * 挂失
     *
     * @param po
     * @param bindingResult
     * @return
@@ -89,15 +93,16 @@
        }
        Map map_result = cardSv.reportLoss(po);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
    /**
     * 解锁
     *
     * @param po
     * @param bindingResult
     * @return
@@ -110,15 +115,16 @@
        }
        Map map_result = cardSv.unlock(po);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
    /**
     * 补卡
     *
     * @param po
     * @param bindingResult
     * @return
@@ -131,15 +137,16 @@
        }
        Map map_result = cardSv.reissue(po);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
    /**
     * 销卡
     *
     * @param po
     * @param bindingResult
     * @return
@@ -152,15 +159,16 @@
        }
        Map map_result = cardSv.cancel(po);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
    /**
     * 操作执行回调
     *
     * @param po
     * @param bindingResult
     * @return
@@ -173,9 +181,26 @@
        }
        Map map_result = cardSv.callBack(po);
        if(map_result.get("success").equals(false)) {
        if (map_result.get("success").equals(false)) {
            return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString());
        }
        return BaseResponseUtils.buildSuccess(map_result.get("content")) ;
        return BaseResponseUtils.buildSuccess(map_result.get("content"));
    }
}
    /**
     * 读取卡信息
     * @param cardAddr
     * @return
     */
    @GetMapping(path = "readCard")
    @SsoAop()
    public BaseResponse<VoTermCard> readCard(@RequestParam String cardAddr){
        try {
            return BaseResponseUtils.buildSuccess(cardSv.readCard(cardAddr));
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/card/CardSv.java
@@ -2,15 +2,13 @@
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper;
import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientMapper;
import com.dy.pipIrrGlobal.daoSe.SeRechargeHistoryMapper;
import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeCardOperate;
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
import com.dy.pipIrrGlobal.pojoSe.SeRechargeHistory;
import com.dy.pipIrrGlobal.voSe.VoAfterRecharge;
import com.dy.pipIrrGlobal.voSe.VoTermActiveCard;
import com.dy.pipIrrGlobal.voSe.VoTermCard;
import com.dy.pipIrrGlobal.voSe.VoTermCommon;
import com.dy.pipIrrTerminal.card.dto.*;
import com.dy.pipIrrTerminal.card.enums.CardStateENUM;
@@ -51,6 +49,9 @@
    @Autowired
    private SeRechargeHistoryMapper seRechargeHistoryMapper;
    @Autowired
    private SeManagerCardMapper seManagerCardMapper;
    @Value("${project.projectNo}")
    private Integer projectNo;
@@ -928,4 +929,23 @@
        }
        return false;
    }
    /**
     * 读取水卡信息
     * @param cardAddr
     * @return
     */
    public VoTermCard readCard(String cardAddr) {
        VoTermCard voTermCard = seClientCardMapper.getTermCardInfo(cardAddr);
        if(voTermCard != null) {
            return voTermCard;
        }
        VoTermCard voTermManagerCard = seManagerCardMapper.getTermManagerCardInfo(cardAddr);
        if(voTermManagerCard != null) {
            return voTermManagerCard;
        }
        return null;
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/client/ClientCtrl.java
@@ -64,4 +64,19 @@
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 获取水价
     * @return
     */
    @GetMapping(path = "getWaterPrice")
    @SsoAop()
    public BaseResponse<Boolean> getWaterPrice(){
        try {
            return BaseResponseUtils.buildSuccess(clientSv.getWaterPrice());
        } catch (Exception e) {
            log.error("查询农户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-terminal/src/main/java/com/dy/pipIrrTerminal/client/ClientSv.java
@@ -1,6 +1,8 @@
package com.dy.pipIrrTerminal.client;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientMapper;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrGlobal.voSe.VoTermClient;
@@ -27,6 +29,8 @@
    @Autowired
    private SeClientMapper seClientMapper;
    @Autowired
    private PrWaterPriceMapper prWaterPriceMapper;
    /**
     * 根据指定条件获取农户数据_充值机
     * @param queryVo
@@ -54,4 +58,16 @@
    public VoTermClient getTermOneClient(Long clientId) {
        return seClientMapper.getTermOneClient(clientId);
    }
    /**
     * 获取水价
     * @return
     */
    public JSONObject getWaterPrice() {
        Double price = prWaterPriceMapper.getPrice();
        JSONObject rs = new JSONObject();
        rs.put("price", price);
        return rs;
    }
}