fq
zj
2025-06-13 08ea05f85c9dd77834e56a2b912b2c43ac8888cd
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
package project.c2c.internal;
 
import org.springframework.jdbc.core.JdbcTemplate;
 
import project.RedisKeys;
import project.c2c.C2cUserParamBaseSet;
import project.c2c.C2cUserParamBaseSetService;
import project.redis.RedisHandler;
 
public class C2cUserParamBaseSetServiceImpl implements C2cUserParamBaseSetService {
    
    private JdbcTemplate jdbcTemplate;
    private RedisHandler redisHandler;
    
    public void save(C2cUserParamBaseSet entity) {
        String insertSql = "INSERT INTO T_C2C_USER_PARAM_BASE_SET(UUID,C2C_USER_PARTY_ID,THIRTY_DAYS_ORDER,THIRTY_DAYS_ORDER_RATIO,"
                + "THIRTY_DAYS_PASS_AVERAGE_TIME,THIRTY_DAYS_PAY_AVERAGE_TIME,THIRTY_DAYS_AMOUNT,BUY_AMOUNT,SELL_AMOUNT,TOTAL_AMOUNT,"
                + "ACCOUNT_CREATE_DAYS,FIRST_EXCHANGE_DAYS,EXCHANGE_USERS,BUY_SUCCESS_ORDERS,SELL_SUCCESS_ORDERS,TOTAL_SUCCESS_ORDERS,"
                + "APPRAISE_GOOD,APPRAISE_BAD,ORDER_MAIL_NOTICE_OPEN,ORDER_SMS_NOTICE_OPEN,ORDER_APP_NOTICE_OPEN,APPEAL_MAIL_NOTICE_OPEN,"
                + "APPEAL_SMS_NOTICE_OPEN,APPEAL_APP_NOTICE_OPEN,CHAT_APP_NOTICE_OPEN,SECURITY_MAIL_NOTICE_OPEN,SECURITY_SMS_NOTICE_OPEN,"
                + "SECURITY_APP_NOTICE_OPEN,PHONE_AUTHORITY,EMAIL_AUTHORITY,KYC_AUTHORITY,KYC_HIGHLEVEL_AUTHORITY,CREATE_TIME,UPDATE_TIME) "
                + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        jdbcTemplate.update(insertSql,entity.getId(),entity.getC2cUserPartyId(),entity.getThirtyDaysOrder(),entity.getThirtyDaysOrderRatio(),
                entity.getThirtyDaysPassAverageTime(),entity.getThirtyDaysPayAverageTime(),entity.getThirtyDaysAmount(),entity.getBuyAmount(),
                entity.getSellAmount(),entity.getTotalAmount(),entity.getAccountCreateDays(),entity.getFirstExchangeDays(),entity.getExchangeUsers(),
                entity.getBuySuccessOrders(),entity.getSellSuccessOrders(),entity.getTotalSuccessOrders(),entity.getAppraiseGood(),
                entity.getAppraiseBad(),entity.getOrderMailNoticeOpen(),entity.getOrderSmsNoticeOpen(),entity.getOrderAppNoticeOpen(),entity.getAppealMailNoticeOpen(),
                entity.getAppealSmsNoticeOpen(),entity.getAppealAppNoticeOpen(),entity.getChatAppNoticeOpen(),entity.getSecurityMailNoticeOpen(),
                entity.getSecuritySmsNoticeOpen(),entity.getSecurityAppNoticeOpen(),entity.getPhoneAuthority(),entity.getEmailAuthority(),entity.getKycAuthority(),
                entity.getKycHighlevelAuthority(),entity.getCreateTime(),entity.getUpdateTime());
        this.redisHandler.setSync(RedisKeys.C2C_USER_PARAM_BASE_SET_PARTY_ID + entity.getC2cUserPartyId(), entity);
    }
 
    public void update(C2cUserParamBaseSet entity) {
        String updateSql = "UPDATE T_C2C_USER_PARAM_BASE_SET SET C2C_USER_PARTY_ID=?,THIRTY_DAYS_ORDER=?,THIRTY_DAYS_ORDER_RATIO=?,"
                + "THIRTY_DAYS_PASS_AVERAGE_TIME=?,THIRTY_DAYS_PAY_AVERAGE_TIME=?,THIRTY_DAYS_AMOUNT=?,BUY_AMOUNT=?,SELL_AMOUNT=?,TOTAL_AMOUNT=?,"
                + "ACCOUNT_CREATE_DAYS=?,FIRST_EXCHANGE_DAYS=?,EXCHANGE_USERS=?,BUY_SUCCESS_ORDERS=?,SELL_SUCCESS_ORDERS=?,TOTAL_SUCCESS_ORDERS=?,"
                + "APPRAISE_GOOD=?,APPRAISE_BAD=?,ORDER_MAIL_NOTICE_OPEN=?,ORDER_SMS_NOTICE_OPEN=?,ORDER_APP_NOTICE_OPEN=?,APPEAL_MAIL_NOTICE_OPEN=?,"
                + "APPEAL_SMS_NOTICE_OPEN=?,APPEAL_APP_NOTICE_OPEN=?,CHAT_APP_NOTICE_OPEN=?,SECURITY_MAIL_NOTICE_OPEN=?,SECURITY_SMS_NOTICE_OPEN=?,"
                + "SECURITY_APP_NOTICE_OPEN=?,PHONE_AUTHORITY=?,EMAIL_AUTHORITY=?,KYC_AUTHORITY=?,KYC_HIGHLEVEL_AUTHORITY=?,UPDATE_TIME=?"
                + " WHERE UUID=?";
        jdbcTemplate.update(updateSql,entity.getC2cUserPartyId(),entity.getThirtyDaysOrder(),entity.getThirtyDaysOrderRatio(),
                entity.getThirtyDaysPassAverageTime(),entity.getThirtyDaysPayAverageTime(),entity.getThirtyDaysAmount(),entity.getBuyAmount(),
                entity.getSellAmount(),entity.getTotalAmount(),entity.getAccountCreateDays(),entity.getFirstExchangeDays(),entity.getExchangeUsers(),
                entity.getBuySuccessOrders(),entity.getSellSuccessOrders(),entity.getTotalSuccessOrders(),entity.getAppraiseGood(),
                entity.getAppraiseBad(),entity.getOrderMailNoticeOpen(),entity.getOrderSmsNoticeOpen(),entity.getOrderAppNoticeOpen(),entity.getAppealMailNoticeOpen(),
                entity.getAppealSmsNoticeOpen(),entity.getAppealAppNoticeOpen(),entity.getChatAppNoticeOpen(),entity.getSecurityMailNoticeOpen(),
                entity.getSecuritySmsNoticeOpen(),entity.getSecurityAppNoticeOpen(),entity.getPhoneAuthority(),entity.getEmailAuthority(),entity.getKycAuthority(),
                entity.getKycHighlevelAuthority(),entity.getUpdateTime(),entity.getId());
        
        this.redisHandler.setSync(RedisKeys.C2C_USER_PARAM_BASE_SET_PARTY_ID + entity.getC2cUserPartyId(), entity);
    }
 
    public void delete(String c2c_user_party_id) {
        C2cUserParamBaseSet entity = this.getByPartyId(c2c_user_party_id);
        if (entity != null) {
            jdbcTemplate.update("DELETE FROM T_C2C_USER_PARAM_BASE_SET WHERE UUID=?", entity.getId());
            this.redisHandler.remove(RedisKeys.C2C_USER_PARAM_BASE_SET_PARTY_ID + entity.getC2cUserPartyId());
        }
    }
    
    public C2cUserParamBaseSet getByPartyId(String c2c_user_party_id) {
        return (C2cUserParamBaseSet) this.redisHandler.get(RedisKeys.C2C_USER_PARAM_BASE_SET_PARTY_ID + c2c_user_party_id);
    }
 
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
 
    public void setRedisHandler(RedisHandler redisHandler) {
        this.redisHandler = redisHandler;
    }
    
}