|
@@ -5,26 +5,27 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
+import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.StudentDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.SubjectDao;
|
|
|
import com.yonge.cooleshow.biz.dal.dao.TeacherDao;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.Student;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.Subject;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.StudentService;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.TeacherService;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.*;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
+import com.yonge.cooleshow.common.constant.SysConfigConstant;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.TenantUnbindRecord;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantUnbindRecordWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.TenantUnbindRecordMapper;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.TenantUnbindRecordService;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -58,6 +59,15 @@ public class TenantUnbindRecordServiceImpl extends ServiceImpl<TenantUnbindRecor
|
|
|
@Autowired
|
|
|
private TeacherService teacherService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TenantInfoService tenantInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询详情
|
|
|
* @param id 详情ID
|
|
@@ -180,6 +190,14 @@ public class TenantUnbindRecordServiceImpl extends ServiceImpl<TenantUnbindRecor
|
|
|
|
|
|
@Override
|
|
|
public Boolean entry(TenantUnbindRecordWrapper.Audio audio) {
|
|
|
+
|
|
|
+ TenantUnbindRecord record = getById(audio.getId());
|
|
|
+ if (record == null) {
|
|
|
+ throw new BizException("审核数据不存在");
|
|
|
+ } else if (!"DOING".equals(record.getStatus())) {
|
|
|
+ throw new BizException("审核数据已被处理");
|
|
|
+ }
|
|
|
+
|
|
|
boolean update = tenantUnbindRecordService.lambdaUpdate()
|
|
|
.set(TenantUnbindRecord::getStatus, audio.getStatus() ? "PASS" : "UNPASS")
|
|
|
.set(TenantUnbindRecord::getReason, audio.getReason())
|
|
@@ -203,6 +221,39 @@ public class TenantUnbindRecordServiceImpl extends ServiceImpl<TenantUnbindRecor
|
|
|
.eq(Teacher::getUserId, unbindRecord.getUserId()).update();
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+
|
|
|
+ // 老师端发送消息
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ sendTeacherUnBindMessage(audio, record);
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sendTeacherUnBindMessage(TenantUnbindRecordWrapper.Audio audio, TenantUnbindRecord record) {
|
|
|
+ TenantInfo tenantInfo = tenantInfoService.getById(record.getTenantId());
|
|
|
+ if (tenantInfo == null) {
|
|
|
+ log.error("机构入驻审核发送消息失败,机构信息不存在,机构id:{}", record.getTenantId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //发送短信
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(record.getUserId());
|
|
|
+ Map<Long, String> receivers = new HashMap<>();
|
|
|
+ receivers.put(record.getUserId(), sysUser.getPhone());
|
|
|
+ if (Boolean.TRUE.equals(audio.getStatus())) {
|
|
|
+ try {
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.TEACHER_UNBIND_PASS,
|
|
|
+ receivers, null, 0, null, ClientEnum.TEACHER.getCode(),tenantInfo.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("机构入驻审核极光消息推送异常");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String serviceConfig = sysConfigService.findConfigValue(SysConfigConstant.CUSTOMER_SERVICE_PHONE);
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.TEACHER_UNBIND_UNPASS,
|
|
|
+ receivers, null, 0, null, ClientEnum.TEACHER.getCode(),tenantInfo.getName(), audio.getReason(),serviceConfig);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("机构入驻审核极光消息推送异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|