Commit c936e16a by 郑永强

解决早晚报不发送的问题

parent 56b16cd1
...@@ -7,6 +7,7 @@ import com.pcloud.book.adnews.entity.*; ...@@ -7,6 +7,7 @@ import com.pcloud.book.adnews.entity.*;
import com.pcloud.book.adnews.enums.AdContentFromEnum; import com.pcloud.book.adnews.enums.AdContentFromEnum;
import com.pcloud.book.adnews.enums.AdNewsBanEnum; import com.pcloud.book.adnews.enums.AdNewsBanEnum;
import com.pcloud.book.adnews.dto.AdNewsListParam; import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.book.adnews.enums.AdNewsContentTypeEnum;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO; import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.book.adnews.vo.AdNewsMessageStatisticVO; import com.pcloud.book.adnews.vo.AdNewsMessageStatisticVO;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
...@@ -259,7 +260,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -259,7 +260,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
// 遍历记录详情 // 遍历记录详情
for (AdNewsGroupRecord item : adNewsGroupRecords) { for (AdNewsGroupRecord item : adNewsGroupRecords) {
// 获取对应当前群的记录详情 // 获取对应当前群的记录详情
if(groupQrcodeFoAdDTO.getQrcodeId() == item.getQrcodeId()) { if (groupQrcodeFoAdDTO.getQrcodeId() == item.getQrcodeId()) {
// 将对应当前群里的需要发送的新闻链接拼接完成 // 将对应当前群里的需要发送的新闻链接拼接完成
adNews = adNewsList.stream().filter(x -> x.getId() == item.getAdNewsId()).findFirst().get(); adNews = adNewsList.stream().filter(x -> x.getId() == item.getAdNewsId()).findFirst().get();
transferUrl = wechatGroupLinkPrefix transferUrl = wechatGroupLinkPrefix
...@@ -273,22 +274,21 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -273,22 +274,21 @@ public class AdNewsBizImpl implements AdNewsBiz {
// 将多条需要发送的早晚报拼接成300字符一组的消息 // 将多条需要发送的早晚报拼接成300字符一组的消息
contents = this.concatContent(adNewsList); contents = this.concatContent(adNewsList);
// 将对应群的消息发送出去 // 将对应群的消息发送出去
this.sendAdNewsToWechatGroup(adNewsSet,new ArrayList<GroupQrcodeFoAdDTO>(){{ add(groupQrcodeFoAdDTO); }} ,contents); this.sendAdNewsToWechatGroup(adNewsSet, new ArrayList<GroupQrcodeFoAdDTO>() {{
add(groupQrcodeFoAdDTO);
}}, contents);
} }
} else if (adNewsSet.getContentFrom() == AdContentFromEnum.CUSTOM.key) { } else if (adNewsSet.getContentFrom() == AdContentFromEnum.CUSTOM.key) {
// 获取发送早报还是晚报
String customContent = this.getMorningOrEveningContent(adNewsSet);
if (StringUtil.isEmpty(adNewsSet.getMorningContent())) { if (StringUtil.isEmpty(customContent)) {
LOGGER.info("早报内容为空,无法发送"); LOGGER.info(AdNewsContentTypeEnum.getDescriptionByKey(adNewsSet.getContentType()) + "内容为空,无法发送");
return;
}
if (StringUtil.isEmpty(adNewsSet.getEveningContent())) {
LOGGER.info("晚报内容为空,无法发送");
return; return;
} }
// 获取发送早报还是晚报
String customContent = this.getMorningOrEveningContent(adNewsSet);
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) { for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) {
adNewsGroupRecord = new AdNewsGroupRecord(); adNewsGroupRecord = new AdNewsGroupRecord();
adNewsGroupRecord.setAdNewsSetId(adNewsSetId); adNewsGroupRecord.setAdNewsSetId(adNewsSetId);
...@@ -479,6 +479,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -479,6 +479,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
map.put("beginTime", adNewsListParam.getBeginTime()); map.put("beginTime", adNewsListParam.getBeginTime());
map.put("endTime", adNewsListParam.getEndTime()); map.put("endTime", adNewsListParam.getEndTime());
map.put("hasBan", adNewsListParam.getHasBan()); map.put("hasBan", adNewsListParam.getHasBan());
map.put("hasUsed", adNewsListParam.getHasUsed());
map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds()); map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds());
PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList"); PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList");
return pageBeanNew; return pageBeanNew;
......
package com.pcloud.book.adnews.enums;
import java.security.Key;
/**
* 内容类型
*
* @author zhengyongqiang
* @date 2019/8/16 17:25
*/
public enum AdNewsContentTypeEnum {
MORNING(0, "早报"),
EVENING(1, "晚报");
public final Integer key;
public final String description;
AdNewsContentTypeEnum(Integer key, String description) {
this.key = key;
this.description = description;
}
public static String getDescriptionByKey(Integer key) {
AdNewsContentTypeEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdNewsContentTypeEnum methodEnum = var1[var3];
if (methodEnum.key.equals(key)) {
return methodEnum.description;
}
}
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment