shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
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
package com.ishop.merchant.service;
 
import com.ishop.merchant.BrokerageConstants;
import com.walker.jdbc.service.BaseServiceImpl;
import org.springframework.stereotype.Service;
 
@Service
public class UserBrokerageServiceImpl extends BaseServiceImpl {
 
    /**
     * 获取已结算佣金
     * @param userId
     * @return
     */
    public double querySettledCommission(long userId){
        Double d = this.queryForObject(SQL_USER_COMPLETE_TOTAL, new Object[]{userId, BrokerageConstants.BROKERAGE_RECORD_LINK_TYPE_WITHDRAW}, Double.class);
        return d == null? 0: d;
    }
 
    /**
     * 获取(个人)冻结期佣金
     * @param userId
     * @return
     * @date 2023-09-19
     */
    public double queryFreezePrice(long userId){
        // BrokerageConstants.BROKERAGE_RECORD_LINK_TYPE_ORDER, BrokerageConstants.BROKERAGE_RECORD_STATUS_CREATE
        Double d = this.queryForObject(SQL_USER_FREEZE_TOTAL, new Object[]{userId, BrokerageConstants.BROKERAGE_RECORD_LINK_TYPE_ORDER}, Double.class);
        return d == null? 0: d;
    }
 
    private static final String SQL_USER_FREEZE_TOTAL = "select sum(price) total from eb_user_brokerage_record where uid=? and link_type=? and (status=1 or status=2)";
    private static final String SQL_USER_COMPLETE_TOTAL = "select sum(price) total from eb_user_brokerage_record where uid=? and link_type=? and (status=3)";
}