liurunyu
2024-10-23 e7393ef75b7df2799f627b4707cd8bc4b9d555e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package com.dy.pipIrrWechat.wechatpay;
 
import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeClient;
import com.dy.pipIrrGlobal.pojoSe.SeOpenId;
import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
import com.dy.pipIrrGlobal.pojoSe.SeWechatpay;
import com.dy.pipIrrGlobal.voSe.VoClient;
import com.dy.pipIrrWechat.virtualCard.SeClientToVoClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
/**
 * @author ZhuBaoMin
 * @date 2024-07-16 15:03
 * @LastEditTime 2024-07-16 15:03
 * @Description
 */
 
@Slf4j
@Service
public class PaymentSv {
    @Autowired
    private SeVcRechargeMapper seVcRechargeMapper;
 
    @Autowired
    private SeOpenIdMapper seOpenIdMapper;
 
    @Autowired
    private SeClientMapper seClientMapper;
 
    @Autowired
    private SeVcOperateMapper seVcOperateMapper;
 
    @Autowired
    private SeWechatpayMapper seWechatpayMapper;
 
    /**
     * 根据登录态ID获取登录态对象
     * @param sessionId
     * @return
     */
    SeOpenId selectOne(Long sessionId) {
        return seOpenIdMapper.selectByPrimaryKey(sessionId);
    }
 
    /**
     * 添加虚拟卡充值记录
     * @param po
     * @return
     */
    Long insertVCRecharge(SeVcRecharge po) {
        seVcRechargeMapper.insert(po);
        return po.getId();
    }
 
    /**
     * 根据主键获取农户对象
     * @param id 农户主键
     * @return 农户对象
     */
    public VoClient getOneClient(Long id) {
        SeClient seClient = seClientMapper.selectByPrimaryKey(id);
        VoClient voClient = SeClientToVoClient.INSTANCT.po2vo(seClient);
        return voClient;
    }
 
    /**
     * 根据电话号码获取农户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 Long insertVcOperate(SeVcOperate po) {
    //    seVcOperateMapper.insert(po);
    //    return po.getId();
    //}
 
    /**
     * 添加微信支付信息
     * @param po
     * @return
     */
    Long addWechatpay(SeWechatpay po) {
        seWechatpayMapper.insert(po);
        return po.getId();
    }
 
    /**
     * 根据AppId获取微信支付对象
     * @param appId
     * @return
     */
    SeWechatpay getWechatpayByAppId(String appId) {
        return seWechatpayMapper.getWechatpayByAppId(appId);
    }
}