puzhibing
2022-08-22 1421f8e9c308c4741cb396309035009393b5b036
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
package com.stylefeng.guns.modular.system.service.impl;
 
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.modular.system.dao.PaymentRecordMapper;
import com.stylefeng.guns.modular.system.model.PaymentRecord;
import com.stylefeng.guns.modular.system.service.IPaymentRecordService;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.Date;
 
 
@Service
public class PaymentRecordServiceImpl extends ServiceImpl<PaymentRecordMapper, PaymentRecord> implements IPaymentRecordService {
 
    @Resource
    private PaymentRecordMapper paymentRecordMapper;
 
 
 
 
    /**
     * 添加数据
     * @param orderId       订单id
     * @param payType       支付方式(1=微信,2=支付宝)
     * @param amount        支付金额
     * @param code          第三方支付单号
     * @param state         支付状态(1=待支付,2=已支付)
     * @throws Exception
     */
    @Override
    public Integer saveData(Integer category, Integer userId, Integer type, Integer orderId, Integer orderType, Integer payType,
                         Double amount, String code, Integer state) throws Exception {
        PaymentRecord paymentRecord = new PaymentRecord();
        paymentRecord.setCategory(category);
        paymentRecord.setUserId(userId);
        paymentRecord.setType(type);
        paymentRecord.setOrderId(orderId);
        paymentRecord.setOrderType(orderType);
        paymentRecord.setPayType(payType);
        paymentRecord.setAmount(amount);
        paymentRecord.setCode(code);
        paymentRecord.setState(state);
        paymentRecord.setInsertTime(new Date());
        this.insert(paymentRecord);
        return paymentRecord.getId();
    }
 
 
    /**
     * 获取数据
     * @param orderId
     * @param payType
     * @param state
     * @return
     * @throws Exception
     */
    @Override
    public PaymentRecord query(Integer category, Integer userId, Integer type, Integer orderId, Integer orderType,
                               Integer payType, Integer state) throws Exception {
        return paymentRecordMapper.query(category, userId, type, orderId, orderType, payType, state);
    }
}