|
@@ -3,6 +3,7 @@ package com.leromro.core.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -20,6 +21,7 @@ import com.leromro.core.domain.BusinessManagement;
|
|
|
import com.leromro.core.domain.SecondOrder;
|
|
|
import com.leromro.core.domain.UserPointChange;
|
|
|
import com.leromro.core.domain.VolunteerInfo;
|
|
|
+import com.leromro.core.domain.dto.ConversationMsgDTO;
|
|
|
import com.leromro.core.domain.dto.HomePageDTO;
|
|
|
import com.leromro.core.domain.dto.VolunteerInfoDTO;
|
|
|
import com.leromro.core.domain.dto.VolunteerListDTO;
|
|
@@ -28,6 +30,8 @@ import com.leromro.core.domain.vo.VolunteerInfoVO;
|
|
|
import com.leromro.core.mapper.VolunteerInfoMapper;
|
|
|
import com.leromro.core.service.*;
|
|
|
import com.leromro.core.utils.DateTimeUtil;
|
|
|
+import com.leromro.core.utils.SendSmsUtil;
|
|
|
+import com.leromro.framework.config.ConstantsConfig;
|
|
|
import com.leromro.system.service.ISysConfigService;
|
|
|
import com.leromro.system.service.ISysUserService;
|
|
|
import com.leromro.system.service.impl.SysUserServiceImpl;
|
|
@@ -75,6 +79,9 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
|
|
|
@Autowired
|
|
|
private ISysUserService iSysUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IConversationRecordService conversationRecordService;
|
|
|
+
|
|
|
/**
|
|
|
* 新增志愿者信息
|
|
|
* @param dto
|
|
@@ -194,13 +201,24 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void approval(VolunteerInfo volunteerInfo) {
|
|
|
+ String appStatus = volunteerInfo.getAppStatus();
|
|
|
// 更新志愿者审核信息
|
|
|
this.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 = this.getById(volunteerInfo.getVolunteerInfoId());
|
|
|
+ //异步推送系统消息给志愿者
|
|
|
+ conversationRecordService.sendSystemMsg(ConversationMsgDTO.builder()
|
|
|
+ .system(2).volunteerId(info.getVolunteerId())
|
|
|
+ .msgContent("2".equals(appStatus)?"您的志愿者申请已通过,请配置排班时间":("您的志愿者申请未通过,原因:"+volunteerInfo.getRejectReason()))
|
|
|
+ .build());
|
|
|
+ //发送短信通知
|
|
|
+ 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());
|
|
|
// 用户成为志愿者积分处理
|
|
|
userToVolunteerPointHandler(info.getVolunteerId());
|
|
|
}
|