Explorar o código

新增获取短信发送费用接口

codingliang hai 1 ano
pai
achega
107d55f7ca

+ 7 - 0
src/main/java/com/sqx/modules/errand/controller/TbIndentSmsController.java

@@ -84,4 +84,11 @@ public class TbIndentSmsController {
         smsSendLogService.removeByIds(Arrays.asList(ids));
         return Result.success();
     }
+
+    @ApiOperation("获取短信金额配置")
+    @DeleteMapping(value = "price-of-sms")
+    public Result getPriceOfSms() {
+        Double price = smsTemplateService.getPriceOfSms();
+        return Result.success().put("data", price);
+    }
 }

+ 6 - 0
src/main/java/com/sqx/modules/errand/service/TbIndentSmsTemplateService.java

@@ -35,4 +35,10 @@ public interface TbIndentSmsTemplateService extends IService<TbIndentSmsTemplate
      * @return 短信发送结果
      */
     SmsSendResult sendSms(Long smsTemplateId, String fromPhone, String fromUserName, Long fromUserId, String toPhone);
+
+    /**
+     * 获取短信发送价格
+     * @return 短信价格
+     */
+    Double getPriceOfSms();
 }

+ 10 - 0
src/main/java/com/sqx/modules/errand/service/impl/TbIndentSmsTemplateServiceImpl.java

@@ -12,6 +12,8 @@ import com.sqx.common.sms.SmsSendUtil;
 import com.sqx.common.utils.Constant;
 import com.sqx.common.utils.PageUtils;
 import com.sqx.modules.app.entity.UserEntity;
+import com.sqx.modules.common.entity.CommonInfo;
+import com.sqx.modules.common.service.CommonInfoService;
 import com.sqx.modules.errand.dao.TbIndentSmsTemplateDao;
 import com.sqx.modules.errand.dto.SmsTemplateDTO;
 import com.sqx.modules.errand.dto.SmsTemplateQueryDTO;
@@ -30,6 +32,7 @@ import java.util.Map;
 @RequiredArgsConstructor
 public class TbIndentSmsTemplateServiceImpl extends ServiceImpl<TbIndentSmsTemplateDao, TbIndentSmsTemplate> implements TbIndentSmsTemplateService {
 
+    private final CommonInfoService commonInfoService;
     private final SmsConfigValueCache smsConfigValueCache;
 
     @Override
@@ -115,6 +118,13 @@ public class TbIndentSmsTemplateServiceImpl extends ServiceImpl<TbIndentSmsTempl
         return smsSendResult;
     }
 
+    @Override
+    public Double getPriceOfSms() {
+        // 查询短信发送费用
+        CommonInfo commonInfo = commonInfoService.findOne(421);
+        return Double.valueOf(commonInfo.getValue());
+    }
+
     /**
      * 获取模板动态参数
      * @param templateContent 模板