xiaoyong931011
2021-04-07 482847fc97748b67fd8ab93b5b589ab3824f6d02
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
package com.matrix.system.common.service.impl;
 
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.bean.SysCompany;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant;
import com.matrix.system.score.constant.ScoreSettingConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service
public class InitBusParameterSettingService {
 
    @Autowired
    private BusParameterSettingsDao busParameterSettingsDao;
 
    /**
     * 初始化默认积分规则设置
     */
    public void initBusParameterSetting(SysCompany sysCompany) {
        long companyId = sysCompany.getComId();
        List<BusParameterSettings> ruleSettings=new ArrayList<>();
 
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.VALID_PERIOD_POINTS, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CREDIT_POINTS_CASH, companyId));
 
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_BALANCE_CONSUMPTION, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.BONUS_BALANCE_CONSUMPTION, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.PRINCIPAL_CONSUMPTION, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.GIVE_CONSUMPTION, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.REFERRALS_CONSUMPTION, companyId));
 
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.CASH_CONSUMPTION_SHOP, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.RESERVATION_SERVICE_SHOP, companyId));
        ruleSettings.add(addScoreRuleSetting(ScoreSettingConstant.EVALUATUIN_ORDER_SHOP, companyId));
 
        busParameterSettingsDao.batchInsert(ruleSettings);
    }
 
    /**
     * 初始化默认分销规则设置
     */
    public void initBusParameterFenxiaoSetting(SysCompany sysCompany) {
        long companyId = sysCompany.getComId();
        List<BusParameterSettings> ruleSettings=new ArrayList<>();
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_SWITCH, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_MODEL, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_WAY, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_AUDIT_METHOD, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_APPLY_CONDITION, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_PLAN, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_TG_POSTER, companyId));
        ruleSettings.add(addScoreRuleSetting(FenxiaoSettingConstant.FX_ZGFY, companyId));
        busParameterSettingsDao.batchInsert(ruleSettings);
    }
 
    private BusParameterSettings addScoreRuleSetting(String code,long companyId) {
        BusParameterSettings busParameterSetting = new BusParameterSettings();
        busParameterSetting.setParamCode(code);
        busParameterSetting.setCompanyId(companyId);
        return busParameterSetting;
    }
 
}