|
@@ -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();
|
|
|
}
|
|
|
|