Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
| | |
| | | |
| | | 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; |
| | |
| | | * @return |
| | | */ |
| | | Integer emptyCardBalance(@Param("orderNumber")String orderNumber); |
| | | |
| | | /** |
| | | * 充值机用获取农户水卡信息 |
| | | * @param cardAddr |
| | | * @return |
| | | */ |
| | | VoTermCard getTermCardInfo(@Param("cardAddr")String cardAddr); |
| | | } |
| | |
| | | |
| | | 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 |
| | | */ |
| | | |
| | |
| | | * @return |
| | | */ |
| | | String getManagerCardNumOfMax(@Param("areaCode") String areaCode); |
| | | |
| | | /** |
| | | * 充值机用获取管理卡信息 |
| | | * @param cardAddr |
| | | * @return |
| | | */ |
| | | VoTermCard getTermManagerCardInfo(@Param("cardAddr")String cardAddr); |
| | | } |
| | |
| | | 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) |
| | |
| | | @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; |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | |
| | | 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> |
| | |
| | | <!--@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--> |
| | |
| | | </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--> |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="protocol != null"> |
| | | protocol, |
| | | </if> |
| | | <if test="cardAddr != null"> |
| | | card_addr, |
| | |
| | | <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}, |
| | |
| | | <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> |
| | |
| | | <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> |
| | | |
| | |
| | | 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> |
| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | |
| | | /** |
| | | * 开卡(含充值) |
| | | * |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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 |
| | | */ |
| | | @PostMapping(path = "termUnlock", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> termUnlock(@RequestBody @Valid DtoUnlock po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Map map_result = cardSv.unlock(po); |
| | | if (map_result.get("success").equals(false)) { |
| | | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_result.get("content")); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 补卡 |
| | | * |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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()) ; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrTerminal.card; |
| | | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private SeRechargeHistoryMapper seRechargeHistoryMapper; |
| | | |
| | | @Autowired |
| | | private SeManagerCardMapper seManagerCardMapper; |
| | | |
| | | @Value("${project.projectNo}") |
| | | private Integer projectNo; |
| | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 根据水卡编号判断该卡是否可以解锁 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Map canUnlock(DtoUnlock po) { |
| | | Map map = new HashMap<>(); |
| | | map.put("success", false); |
| | | map.put("content", null); |
| | | |
| | | Long cardNum = po.getCardNum(); |
| | | // 判断当前水卡是否为挂失状态且未补卡,仅已经挂失其未补卡的可以解锁 |
| | | if (!isLostAndUnreplaced(cardNum)) { |
| | | map.put("msg", "水卡状态不支持当前操作"); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 依据水卡编号获取水卡表主键及农户编号 |
| | | */ |
| | | Map map_card = Optional.ofNullable(seClientCardMapper.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); |
| | | if (map_card == null || map_card.size() <= 0) { |
| | | map.put("msg", "卡号错误,该卡不存在"); |
| | | return map; |
| | | } |
| | | CardSimple card = new CardSimple(); |
| | | card.setCardId(Long.parseLong(map_card.get("cardId").toString())); |
| | | card.setClientId(Long.parseLong(map_card.get("clientId").toString())); |
| | | |
| | | map.put("success", true); |
| | | map.put("content", card); |
| | | return map; |
| | | } |
| | | /** |
| | | * 根据水卡编号判断该卡是否可以补卡 |
| | | * @param po |
| | |
| | | } |
| | | |
| | | /** |
| | | * 解锁 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map unlock(DtoUnlock po) { |
| | | Map map = new HashMap<>(); |
| | | map.put("success", false); |
| | | map.put("content", null); |
| | | |
| | | Map map_canUnlock = canUnlock(po); |
| | | if(map_canUnlock.get("success").equals(false)) { |
| | | map.put("msg", map_canUnlock.get("msg").toString()); |
| | | return map; |
| | | } |
| | | CardSimple card = (CardSimple) map_canUnlock.get("content"); |
| | | Long cardId = card.getCardId(); |
| | | Long clientId = card.getClientId(); |
| | | |
| | | /** |
| | | * 修改农户卡信息: |
| | | * 挂失时间 |
| | | * 最后操作类型-4 |
| | | */ |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setUnlockdt(new Date()); |
| | | seClientCard.setMoney(po.getMoney()); |
| | | seClientCard.setState(CardStateENUM.NORMAL.getCode()); |
| | | seClientCard.setLastoper(LastOperateENUM.UNLOCK.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(seClientCardMapper.updateByPrimaryKeySelective(seClientCard)).orElse(0); |
| | | if (rec_updateClientCard == 0) { |
| | | map.put("msg", "解锁失败-农户卡修改异常"); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 添加解锁记录 |
| | | */ |
| | | SeCardOperate seCardOperate = new SeCardOperate(); |
| | | seCardOperate.setCardId(cardId); |
| | | seCardOperate.setClientId(clientId); |
| | | seCardOperate.setMoney(po.getMoney()); |
| | | seCardOperate.setOperateType(OperateTypeENUM.UNLOCK.getCode()); |
| | | seCardOperate.setRemarks(po.getRemarks()); |
| | | seCardOperate.setOperator(po.getOperator()); |
| | | seCardOperate.setOperateDt(new Date()); |
| | | seCardOperate.setOperateValid((byte) 2); |
| | | seCardOperateMapper.insert(seCardOperate); |
| | | Long rec = Optional.ofNullable(seCardOperate.getId()).orElse(0L); |
| | | if (rec == 0) { |
| | | map.put("msg", "解锁失败-解锁记录写入异常"); |
| | | return map; |
| | | } |
| | | |
| | | map.put("success", true); |
| | | map.put("msg", "操作成功"); |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 销卡 |
| | | * @param po |
| | | * @return |
| | |
| | | clientCard.setLastoper(LastOperateENUM.CANCEL.getCode()); |
| | | return seClientCardMapper.updateByPrimaryKeySelective(clientCard); |
| | | } |
| | | |
| | | /** |
| | | * 判断指定水卡是否为挂失状态且无补卡记录 |
| | | * @param cardNum |
| | | * @return |
| | | */ |
| | | public Boolean isLostAndUnreplaced(Long cardNum) { |
| | | Integer lostCount = seClientCardMapper.getLostCount(cardNum); |
| | | Integer replacedCount = seClientCardMapper.getReplacedCount(cardNum); |
| | | if (lostCount > 0 && replacedCount == 0) { |
| | | return true; |
| | | } |
| | | 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; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrTerminal.card.dto; |
| | | |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2025-06-10 17:01 |
| | | * @LastEditTime 2025-06-10 17:01 |
| | | * @Description 解锁传输对象 |
| | | */ |
| | | |
| | | @Data |
| | | @Builder |
| | | @ToString |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class DtoUnlock { |
| | | public static final long serialVersionUID = 202506101702001L; |
| | | |
| | | /** |
| | | * 水卡编号 |
| | | */ |
| | | @NotNull(message = "水卡编号不能为空") |
| | | private Long cardNum; |
| | | |
| | | /** |
| | | * 余额 |
| | | */ |
| | | @NotNull(message = "余额不能为空") |
| | | private Float money; |
| | | |
| | | /** |
| | | * 备注信息 |
| | | */ |
| | | private String remarks; |
| | | |
| | | /** |
| | | * 操作人编号 |
| | | */ |
| | | @NotNull(message = "操作人编号不能为空") |
| | | private Long operator; |
| | | } |
| | |
| | | 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()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private SeClientMapper seClientMapper; |
| | | |
| | | @Autowired |
| | | private PrWaterPriceMapper prWaterPriceMapper; |
| | | /** |
| | | * 根据指定条件获取农户数据_充值机 |
| | | * @param queryVo |
| | |
| | | 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; |
| | | } |
| | | } |