| package com.dy.pipIrrWechat.client; | 
|   | 
| import com.dy.pipIrrGlobal.daoSe.SeClientMapper; | 
| import com.dy.pipIrrGlobal.daoSe.SeCodeVerifyMapper; | 
| import com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper; | 
| import com.dy.pipIrrGlobal.pojoSe.SeCodeVerify; | 
| import com.dy.pipIrrGlobal.pojoSe.SeOpenId; | 
| import com.dy.pipIrrGlobal.voSe.VoClientWechat; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Service; | 
|   | 
| /** | 
|  * @author ZhuBaoMin | 
|  * @date 2024-06-19 14:25 | 
|  * @LastEditTime 2024-06-19 14:25 | 
|  * @Description | 
|  */ | 
|   | 
| @Slf4j | 
| @Service | 
| public class ClientSv { | 
|     @Autowired | 
|     private SeClientMapper seClientMapper; | 
|     @Autowired | 
|     private SeCodeVerifyMapper seCodeVerifyMapper; | 
|     @Autowired | 
|     private SeOpenIdMapper seOpenIdMapper; | 
|   | 
|     /** | 
|      * 根据电话号码获取农户ID | 
|      * @param phoneNumber | 
|      * @return | 
|      */ | 
|     public Long getClientIdByPhone(String phoneNumber) { | 
|         return seClientMapper.getClientIdByPhone(phoneNumber); | 
|     } | 
|   | 
|     /** | 
|      * 添加微信用户账户记录 | 
|      * @param po | 
|      * @return | 
|      */ | 
|     public Long addOpenId(SeOpenId po) { | 
|         seOpenIdMapper.insert(po); | 
|         //return po.getClientId(); | 
|         return po.getId(); | 
|     } | 
|   | 
|     /** | 
|      * 添加验证码记录 | 
|      * @param po | 
|      * @return | 
|      */ | 
|     public Integer addCodeVerify(SeCodeVerify po) { | 
|         return seCodeVerifyMapper.insert(po); | 
|     } | 
|   | 
|     /** | 
|      * 根据手机号获取验证码验证对象 | 
|      * @param phoneNumber | 
|      * @return | 
|      */ | 
|     public SeCodeVerify getCodeVerify(String phoneNumber) { | 
|         return seCodeVerifyMapper.getCodeVerify(phoneNumber); | 
|     } | 
|   | 
|     /** | 
|      * 获取农户基本信息,小程序首页使用 | 
|      * @param sessionId | 
|      * @return | 
|      */ | 
|     public VoClientWechat getSimpleClientInfo(Long sessionId, String openId) { | 
|         return seClientMapper.getSimpleClientInfo(sessionId, openId); | 
|     } | 
|   | 
|     /** | 
|      * 解绑农户与微信的绑定,根据sessionId删除绑定记录 | 
|      * @param sessionId | 
|      * @return | 
|      */ | 
|     public Integer unbindWechat(Long sessionId) { | 
|         return seOpenIdMapper.deleteByPrimaryKey(sessionId); | 
|     } | 
|   | 
| } |