Helius
2022-02-14 59cf24b0aba393e145f4ba3d58e98b7a01a80992
zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java
@@ -15,12 +15,14 @@
import com.matrix.system.common.bean.BusParameterSettings;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.dao.BusParameterSettingsDao;
import com.matrix.system.common.service.BusParameterSettingService;
import com.matrix.system.hive.bean.SysBeauticianState;
import com.matrix.system.hive.bean.SysProjServices;
import com.matrix.system.hive.bean.SysShopInfo;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.dao.SysVipInfoDao;
import lombok.AllArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Date;
@@ -47,22 +49,17 @@
    SysBeauticianStateService sysBeauticianStateService;
    BusParameterSettingsDao busParameterSettingsDao;
    BusParameterSettingService busParameterSettingService;
    /**
     * 预约成功短信提醒
     *
     * @param services
     */
//    @Async
    @Async
    public void sendYycgNotice(SysProjServices services) {
        //短信接口为肽妍公司定制,暂时写死
        if (services.getCompanyId() != 17L) {
            return;
        }
        if (isCloseSmsNotice(services)){
            return;
        }
        if (chackSetting(services)) return;
        SysVipInfo sysVipInfo = vipInfoDao.selectById(services.getVipId());
        SysShopInfo shopInfo = shopInfoService.findById(services.getShopId());
        String date = DateUtil.dateFormatStr(new Date(), "yyyy年MM月dd日");
@@ -80,35 +77,14 @@
    /**
     * 判断是否开启了短信提醒
     * @param services
     * @return
     */
    private boolean isCloseSmsNotice(SysProjServices services) {
        BusParameterSettings openSmsNoticeSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.OPEN_SMS_NOTICE, services.getCompanyId());
        if (StringUtils.isBlank(openSmsNoticeSetting.getParamValue())
                || AppConstance.IS_N.equals(openSmsNoticeSetting.getParamValue())) {
            LogUtil.debug("未开启短信提醒");
            return true;
        }
        return false;
    }
    /**
     * 项目划扣短信提醒
     *
     * @param services
     */
//    @Async
    @Async
    public void sendHkNotice(SysProjServices services) {
        //短信接口为肽妍公司定制,暂时写死
       if (services.getCompanyId() != 17L) {
            return;
        }
        if (isCloseSmsNotice(services)){
            return;
        }
        if (chackSetting(services)) return;
        SysVipInfo sysVipInfo = vipInfoDao.selectById(services.getVipId());
        SysShopInfo shopInfo = shopInfoService.findById(services.getShopId());
        String date = DateUtil.dateFormatStr(new Date(), "yyyy年MM月dd日");
@@ -135,5 +111,16 @@
    }
    private boolean chackSetting(SysProjServices services) {
        //短信接口为肽妍公司定制,暂时写死
        if (services.getCompanyId() != 17L) {
            return true;
        }
        if (!busParameterSettingService.isSettingOpen(AppConstance.OPEN_SMS_NOTICE, services.getCompanyId())) {
            return true;
        }
        return false;
    }
}