|
@@ -1,6 +1,13 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.dayaedu.cbs.common.enums.EAppKey;
|
|
|
+import com.dayaedu.cbs.common.enums.EClientType;
|
|
|
+import com.dayaedu.cbs.common.enums.message.EMessageSendMode;
|
|
|
+import com.dayaedu.cbs.common.enums.message.ESendStatus;
|
|
|
+import com.dayaedu.cbs.openfeign.client.MessageFeignClientService;
|
|
|
+import com.dayaedu.cbs.openfeign.wrapper.message.CbsMessageWrapper;
|
|
|
+import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
@@ -15,6 +22,7 @@ import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.MessageSendMode;
|
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.SendStatusEnum;
|
|
|
+import com.ym.mec.biz.dal.page.SysMessageQueryInfo;
|
|
|
import com.ym.mec.biz.service.SysMessageConfigService;
|
|
|
import com.ym.mec.biz.service.SysMessageService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -24,6 +32,7 @@ import com.ym.mec.common.entity.ImSendMessageUserInfo;
|
|
|
import com.ym.mec.common.entity.ImTxtMessage;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.page.PageUtil;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.page.WrapperUtil;
|
|
|
import com.ym.mec.common.redis.service.RedisCache;
|
|
@@ -40,10 +49,10 @@ import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.imageio.ImageIO;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
@@ -52,8 +61,6 @@ import java.net.URL;
|
|
|
import java.util.*;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
-import java.util.concurrent.ExecutorService;
|
|
|
-import java.util.concurrent.Executors;
|
|
|
|
|
|
import static com.ym.mec.biz.dal.enums.MessageTypeEnum.OA_NOTICE_PUSH;
|
|
|
import static com.ym.mec.biz.dal.enums.MessageTypeEnum.STUDENT_PUSH_VIP_BUY;
|
|
@@ -63,26 +70,28 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
|
|
|
private final static Logger LOGGER = LoggerFactory.getLogger(SysMessageServiceImpl.class);
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysMessageDao sysMessageDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysMessageConfigService sysMessageConfigService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MessageSenderPluginContext messageSenderPluginContext;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private TeacherDao teacherDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private WaitSendMessageDao waitSendMessageDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ImFeignService imFeignService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private RedisCache<String, Object> redisCache;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysEmailServiceImpl sysEmailService;
|
|
|
+ @Resource
|
|
|
+ private MessageFeignClientService messageFeignClientService;
|
|
|
// 验证码有效期
|
|
|
public static final int CODE_EXPIRE = 60 * 10;
|
|
|
// 发送验证码的间隔时间
|
|
@@ -99,23 +108,24 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageInfo<SysMessageDto> queryListPage(QueryInfo queryInfo) {
|
|
|
- PageInfo<SysMessageDto> pageInfo = new PageInfo<SysMessageDto>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- MapUtil.populateMap(params, queryInfo);
|
|
|
-
|
|
|
- List<SysMessageDto> dataList = null;
|
|
|
- int count = this.findCount(params);
|
|
|
- if (count > 0) {
|
|
|
- pageInfo.setTotal(count);
|
|
|
- params.put("offset", pageInfo.getOffset());
|
|
|
- dataList = sysMessageDao.queryListPage(params);
|
|
|
- }
|
|
|
- if (count == 0) {
|
|
|
- dataList = new ArrayList<SysMessageDto>();
|
|
|
- }
|
|
|
- pageInfo.setRows(dataList);
|
|
|
- return pageInfo;
|
|
|
+ public R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMessageWrapper.SysMessage>> queryListPage(SysMessageQueryInfo queryInfo) {
|
|
|
+ CbsMessageWrapper.SysMessageQuery query = new CbsMessageWrapper.SysMessageQuery();
|
|
|
+ query.setPage(queryInfo.getPage());
|
|
|
+ query.setRows(queryInfo.getRows());
|
|
|
+ query.setUserId(queryInfo.getUserId().longValue());
|
|
|
+ query.setClientType(EClientType.SCHOOL);
|
|
|
+ query.setStatus(ESendStatus.WAIT);
|
|
|
+ query.setAppKey(EAppKey.GYM);
|
|
|
+ query.setSendMode(queryInfo.getType() == null?null:queryInfo.getType() == 1? EMessageSendMode.SMS :
|
|
|
+ queryInfo.getType() == 2?EMessageSendMode.EMAIL:
|
|
|
+ queryInfo.getType() == 3?EMessageSendMode.PUSH:EMessageSendMode.SEO);
|
|
|
+ query.setTitle(queryInfo.getTitle());
|
|
|
+ query.setClientId(StringUtils.equals(queryInfo.getJpushType(),"SCHOOL")?EClientType.SCHOOL:
|
|
|
+ StringUtils.equals(queryInfo.getJpushType(),"SYSTEM")?EClientType.BACKEND:
|
|
|
+ StringUtils.equals(queryInfo.getJpushType(),"TEACHER")?EClientType.TEACHER:
|
|
|
+ StringUtils.equals(queryInfo.getJpushType(),"STUDENT")?EClientType.STUDENT:null);
|
|
|
+ query.setReadStatus(queryInfo.getReadStatus() == null?null:queryInfo.getReadStatus()==1);
|
|
|
+ return messageFeignClientService.sysMessagePage(query);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -198,11 +208,6 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int updateMessage(SysMessage message) {
|
|
|
- return sysMessageDao.update(message);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public boolean batchSeoMessage(Set<Integer> userIds, MessageTypeEnum messageType,String memo, Object... args) {
|
|
|
if(userIds != null){
|
|
|
userIds.removeAll(Collections.singleton(null));
|