From bbe0a2fd03063316e50cf141986bda984599bbda Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Tue, 22 Feb 2022 23:41:42 +0800
Subject: [PATCH] Merge branch 'developer'

---
 zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java |   53 ++++++++++++++++++++---------------------------------
 1 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java
index 382487a..1aa4621 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/TaiYanAliyunSmsService.java
+++ b/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;
+    }
+
 
 }

--
Gitblit v1.9.1