|
@@ -3,15 +3,31 @@ package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.microsvc.toolkit.common.webportal.exception.BizException;
|
|
|
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
+import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.SysSuggestionType;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.SysSuggestionV2;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.MessageTypeEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.mapper.SysSuggestionTypeMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.SysSuggestionV2Mapper;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SysMessageService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SysSuggestionTypeService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.SysSuggestionV2Service;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.SysSuggestionWrapper;
|
|
|
+import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
* 平台建议表
|
|
@@ -21,6 +37,11 @@ import java.util.Date;
|
|
|
@Service
|
|
|
public class SysSuggestionV2ServiceImpl extends ServiceImpl<SysSuggestionV2Mapper, SysSuggestionV2> implements SysSuggestionV2Service {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysSuggestionTypeMapper sysSuggestionTypeMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询详情
|
|
@@ -85,9 +106,11 @@ public class SysSuggestionV2ServiceImpl extends ServiceImpl<SysSuggestionV2Mappe
|
|
|
if (Boolean.TRUE.equals(handleStatus)) {
|
|
|
throw new BizException("反馈意见已经处理");
|
|
|
}
|
|
|
+
|
|
|
+ Date handTime = new Date();
|
|
|
this.lambdaUpdate()
|
|
|
.set(SysSuggestionV2::getHandleStatus, true)
|
|
|
- .set(SysSuggestionV2::getHandleTime, new Date())
|
|
|
+ .set(SysSuggestionV2::getHandleTime, handTime)
|
|
|
.set(SysSuggestionV2::getFeedback, handleSuggestion.getFeedback())
|
|
|
.set(SysSuggestionV2::getFeedbackContent, handleSuggestion.getFeedbackContent())
|
|
|
.set(SysSuggestionV2::getHandleBy,handleSuggestion.getHandleBy())
|
|
@@ -95,6 +118,25 @@ public class SysSuggestionV2ServiceImpl extends ServiceImpl<SysSuggestionV2Mappe
|
|
|
.eq(SysSuggestionV2::getId, handleSuggestion.getId())
|
|
|
.eq(SysSuggestionV2::getHandleStatus, false)
|
|
|
.update();
|
|
|
+
|
|
|
+ Boolean feedback = handleSuggestion.getFeedback();
|
|
|
+ if (feedback && StringUtils.isNotEmpty(handleSuggestion.getFeedbackContent())) {
|
|
|
+ // 推送消息
|
|
|
+ try {
|
|
|
+ Map<Long, String> receivers = new HashMap<>();
|
|
|
+ receivers.put(suggestion.getUserId(), suggestion.getMobileNo());
|
|
|
+ MessageTypeEnum messageType = MessageTypeEnum.SYS_SUGGEST_FEEDBACK_STUDENT;
|
|
|
+ if (ClientEnum.TEACHER.equals(suggestion.getClientType())) {
|
|
|
+ messageType = MessageTypeEnum.SYS_SUGGEST_FEEDBACK_TEACHER;
|
|
|
+ }
|
|
|
+ SysSuggestionType type = Optional.ofNullable(sysSuggestionTypeMapper.selectById(suggestion.getSuggestionTypeId())).orElse(new SysSuggestionType());
|
|
|
+ String title = "【" + Optional.ofNullable(type.getName()).orElse("") + "】" + DateFormatUtils.format(handTime, "yyyy-MM-dd");
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, messageType,
|
|
|
+ receivers, null, 0, null, null, title, handleSuggestion.getFeedbackContent());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("意见反馈推送发送失败,{}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
}
|