Browse Source

fixed 卡券发放失败问题

fushengqian 1 year ago
parent
commit
513169d9b1

+ 6 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/CouponServiceImpl.java

@@ -26,6 +26,8 @@ import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.data.domain.PageImpl;
@@ -47,6 +49,8 @@ import java.util.*;
 @AllArgsConstructor(onConstructor_= {@Lazy})
 public class CouponServiceImpl extends ServiceImpl<MtCouponMapper, MtCoupon> implements CouponService {
 
+    private static final Logger logger = LoggerFactory.getLogger(CouponServiceImpl.class);
+
     private MtCouponMapper mtCouponMapper;
 
     private MtUserCouponMapper mtUserCouponMapper;
@@ -701,7 +705,8 @@ public class CouponServiceImpl extends ServiceImpl<MtCouponMapper, MtCoupon> imp
                     weixinService.sendSubscribeMessage(userInfo.getMerchantId(), userInfo.getId(), userInfo.getOpenId(), WxMessageEnum.COUPON_ARRIVAL.getKey(), "pages/user/index", params, sendTime);
                 }
             } catch (Exception e) {
-                throw new BusinessCheckException("卡券发放失败.");
+                logger.error("卡券发放失败:{}", e.getMessage());
+                throw new BusinessCheckException("抱歉,卡券发放失败");
             }
         }
     }

+ 7 - 7
fuint-application/src/main/java/com/fuint/common/service/impl/SendSmsServiceImpl.java

@@ -71,15 +71,15 @@ public class SendSmsServiceImpl implements SendSmsService {
      * @return
      * */
     @Override
-    public Map<Boolean,List<String>> sendSms(Integer merchantId, String templateUname, List<String> phones, Map<String, String> contentParams) throws BusinessCheckException {
+    public Map<Boolean,List<String>> sendSms(Integer merchantId, String templateUname, List<String> phones, Map<String, String> contentParams) {
         logger.info("使用短信平台发送短信.....");
+        Map<Boolean, List<String>> result = new HashMap<>();
         Integer mode = Integer.parseInt(env.getProperty("aliyun.sms.mode"));
         if (mode.intValue() != 1) {
-            throw new BusinessCheckException("未开启短信发送开关,请联系管理员!");
+            logger.info("短信平台未开启 mode = {}", mode);
+            return result;
         }
-
         if (templateUname != null && !CollectionUtils.isEmpty(phones)) {
-            Map<Boolean, List<String>> result = new HashMap<>();
             try {
                 if (mode != null && mode.intValue() == 1) {
                     // 手机号以","分隔拼接
@@ -92,13 +92,13 @@ public class SendSmsServiceImpl implements SendSmsService {
                 }
             } catch (Exception e) {
                 result.put(Boolean.FALSE,phones);
-                logger.error("推送至短信平台出错...参数[smscontent={},phones={}]", templateUname, phones);
+                logger.error("推送至短信平台出错,参数[templateUname={},phones={}]", templateUname, phones);
                 logger.error(e.getMessage(),e);
             }
-            return result;
         } else {
-            throw new BusinessCheckException("手机号码和短信内容不能为空,请确认!");
+            logger.error("手机号码和短信内容不能为空,请确认!");
         }
+        return result;
     }
 
     /**