소스 검색

志愿者审批结果短信通知

wangwl 1 주 전
부모
커밋
fb7307cb3c

+ 12 - 2
leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java

@@ -1,5 +1,6 @@
 package com.leromro.core.controller;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.leromro.common.core.controller.BaseController;
 import com.leromro.common.core.domain.AjaxResult;
@@ -11,6 +12,8 @@ import com.leromro.core.domain.dto.VolunteerInfoDTO;
 import com.leromro.core.domain.vo.VolunteerInfoDetailVO;
 import com.leromro.core.domain.vo.VolunteerInfoVO;
 import com.leromro.core.service.IVolunteerInfoService;
+import com.leromro.core.utils.SendSmsUtil;
+import com.leromro.framework.config.ConstantsConfig;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -110,13 +113,20 @@ public class VolunteerInfoController extends BaseController {
     @ApiOperation(value = "志愿者审批",notes = "传入当前行主键volunteerInfoId,审批状态appStatus:2通过,3拒绝,驳回原因rejectReason,状态为3则必填")
     @PostMapping("/web/approval")
     public AjaxResult approval(@RequestBody VolunteerInfo volunteerInfo){
-        if ("3".equals(volunteerInfo.getAppStatus()) && StrUtil.isBlank(volunteerInfo.getRejectReason())){
+        String appStatus = volunteerInfo.getAppStatus();
+        if ("3".equals(appStatus) && StrUtil.isBlank(volunteerInfo.getRejectReason())){
             return AjaxResult.warn("请填写驳回原因");
         }
         volunteerInfoService.update(new LambdaUpdateWrapper<VolunteerInfo>()
                 .eq(VolunteerInfo::getVolunteerInfoId,volunteerInfo.getVolunteerInfoId())
-                .set(VolunteerInfo::getAppStatus,volunteerInfo.getAppStatus())
+                .set(VolunteerInfo::getAppStatus,appStatus)
                 .set(StrUtil.isNotBlank(volunteerInfo.getRejectReason()),VolunteerInfo::getRejectReason,volunteerInfo.getRejectReason()));
+        //发送短信通知
+        VolunteerInfo info = volunteerInfoService.getById(volunteerInfo.getVolunteerInfoId());
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.putOnce("name", info.getName());
+        jsonObject.putOnce("result", "2".equals(appStatus)? "通过" : "驳回");
+        SendSmsUtil.send(info.getPhonenumber(), jsonObject.toString(), ConstantsConfig.SMS_TEMPLATE_TYPE_VOLUNTEER_RESULT.getValue());
         return AjaxResult.success();
     }
 

+ 4 - 1
leromro-framework/src/main/java/com/leromro/framework/config/ConstantsConfig.java

@@ -4,7 +4,10 @@ public enum ConstantsConfig {
 
     REDIS_ONE_MIN_TIMELONG("redis_one_min_timelong", "60"),
     REDIS_SHORT_TIMELONG("redis_short_timelong", "600"),
-    SMS_TEMPLATE_TYPE_PHONE_CODE("sms_template_type_phone_code", "SMS_484025217");
+//    短信通知
+    SMS_TEMPLATE_TYPE_PHONE_CODE("sms_template_type_phone_code", "SMS_484025217"),
+//    志愿者审批通知
+    SMS_TEMPLATE_TYPE_VOLUNTEER_RESULT("sms_template_type_volunteer_result","SMS_485465604");
 
 
     private final String KEY;