Helius
2022-05-27 4351e71d782741143a98f86f6648acd16689165f
zq-erp/src/main/java/com/matrix/system/common/service/impl/InitBusParameterSettingService.java
New file
@@ -0,0 +1,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;
    }
}