Commit f8cae75d by 高鹏

Merge branch 'zhengyongqiang' into 'master'

Zhengyongqiang

See merge request rays/pcloud-book!99
parents 2e3fd405 094c905c
package com.pcloud.book.adnews.biz;
import com.pcloud.book.adnews.entity.AdNews;
import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.entity.*;
import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.book.adnews.vo.AdNewsMessageStatisticVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
......@@ -40,10 +42,86 @@ public interface AdNewsBiz {
/**
* 获取素材库列表
*/
PageBeanNew<AdNews> getAdNewsList(String title, Long partyId, Integer currentPage, Integer numPerPage);
PageBeanNew<AdNews> getAdNewsList(AdNewsListParam adNewsListParam);
/**
* 获取编辑已选取的素材库列表
*/
PageBeanNew<AdNews> getAdNewsChooseList(Long partyId, String title, Boolean hasUsed, Integer currentPage, Integer numPerPage);
/**
* 禁用/允许推送
* @param partyId
* @param adNewsId
* @param hasBan
*/
void saveAdNewsBan( Long partyId, Long adNewsId, Integer hasBan);
/**
* 增加公众号反馈
* @param adNewsWechat
* @return
*/
Long addAdNewsWechat(AdNewsWechat adNewsWechat);
/**
* 获取所有的公众号列表
* @param currentPage
* @param numPerPage
* @return
*/
PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage);
/**
* 获取编辑已选择的公众号列表
* @param partyId
* @param currentPage
* @param numPerPage
*/
PageBeanNew<AdNewsWechat> getAdNewsWechatChooseList(Long partyId, Integer currentPage, Integer numPerPage);
/**
* 编辑添加选择的公众号
* @param adNewsWechatIds
* @param partyId
*/
void createAdNewsWechatChooseBatch(List<Long> adNewsWechatIds, Long partyId);
/**
* 编辑移除选择的公众号
* @param adNewsWechatId
* @param partyId
*/
void deleteAdNewsWechatChoose(Long adNewsWechatId, Long partyId);
/**
* 获取早晚报发送记录
* @param partyId
* @param title
* @param beginTime
* @param endTime
* @param proLabelId 专业
* @param depLabelId 深度
* @param purLabelId 目的
* @param currentPage
* @param numPerPage
* @return
*/
PageBeanNew<AdNewsMessageStatisticVO> getAdNewsMessageStatistic(Long partyId, String title, String beginTime, String endTime, Long proLabelId, Long depLabelId, Long purLabelId, Integer currentPage, Integer numPerPage);
/**
* 查询早晚报发送详情
* @param partyId
* @param messageStatisticId
* @return
*/
List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId);
/**
* 记录用户点击量
* @param adNewsClickRecord
* @return
*/
Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord);
}
......@@ -4,28 +4,43 @@ import com.pcloud.book.adnews.biz.AdNewsBiz;
import com.pcloud.book.adnews.check.AdNewsCheck;
import com.pcloud.book.adnews.dao.*;
import com.pcloud.book.adnews.entity.*;
import com.pcloud.book.adnews.enums.AdContentFromEnum;
import com.pcloud.book.adnews.enums.AdNewsBanEnum;
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.AdNewsMessageStatisticVO;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeFoAdDTO;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.facade.quartz.entity.CallBackParam;
import com.pcloud.facade.quartz.entity.ScheduleJob;
import com.pcloud.facade.quartz.service.ScheduleService;
import com.pcloud.labelcenter.label.service.LabelService;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.collections.MapUtils;
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.Component;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.security.cert.X509Certificate;
import java.util.*;
import java.util.stream.Collectors;
......@@ -46,6 +61,18 @@ public class AdNewsBizImpl implements AdNewsBiz {
@Autowired
private AdNewsGroupDao adNewsGroupDao;
@Autowired
private AdNewsWechatDao adNewsWechatDao;
@Autowired
private AdNewsDao adNewsDao;
@Autowired
private AdNewsGroupRecordDao adNewsGroupRecordDao;
@Autowired
private AdNewsMessageStatisticDao adNewsMessageStatisticDao;
@Autowired
private AdNewsClickRecordDao adNewsClickRecordDao;
@Autowired
private AdNewsBanDao adNewsBanDao;
@Autowired
private ScheduleService scheduleService;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
......@@ -54,25 +81,28 @@ public class AdNewsBizImpl implements AdNewsBiz {
@Autowired
private AdNewsChooseDao adNewsChooseDao;
@Autowired
private AdNewsDao adNewsDao;
@Autowired
private AdNewsGroupRecordDao adNewsGroupRecordDao;
private AdNewsWechatChooseDao adNewsWechatChooseDao;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@Autowired
private LabelService labelService;
private static final String AD_MORNING_NEWS_SCHEDULE_PRE = "AD_MORNING_NEWS_SCHEDULE_";
private static final String AD_EVENING_NEWS_SCHEDULE_PRE = "AD_EVENING_NEWS_SCHEDULE_";
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Transactional(rollbackFor = Exception.class)
@ParamLog("新增早晚报设置")
@Override
public Long createAdNewsSet(AdNewsSet adNewsSet) {
adNewsCheck.createAdNewsSetCheck(adNewsSet);
//新增之前判断是否有记录
AdNewsSet adNewsSetOld=adNewsSetDao.getByPartyId(adNewsSet.getCreateUser());
if (adNewsSetOld!=null){
throw new BookBizException(BookBizException.ERROR,"不可重复创建!");
AdNewsSet adNewsSetOld = adNewsSetDao.getByPartyId(adNewsSet.getCreateUser());
if (adNewsSetOld != null) {
throw new BookBizException(BookBizException.ERROR, "不可重复创建!");
}
adNewsSetDao.insert(adNewsSet);
buildAdNewsGroups(adNewsSet, adNewsSet.getCreateUser());
......@@ -155,45 +185,166 @@ public class AdNewsBizImpl implements AdNewsBiz {
@ParamLog("发送编辑端早晚报")
@Override
public void sendAdNews(Long adNewsSetId) {
AdNewsSet adNewsSet = adNewsSetDao.getById(adNewsSetId);
if (adNewsSet == null) {
return;
}
//查询关联
// 查询关联
List<AdNewsGroup> adNewsGroups = adNewsGroupDao.getListByAdNewsSetId(adNewsSetId);
if (ListUtils.isEmpty(adNewsGroups)){
if (ListUtils.isEmpty(adNewsGroups)) {
return;
}
List<Long> classifyIds = adNewsGroups.stream().filter(s -> s.getClassifyId() != null).map(AdNewsGroup::getClassifyId).collect(Collectors.toList());
//查询关联的群
List<GroupQrcodeFoAdDTO> groupQrcodeFoAdDTOS = groupQrcodeDao.GroupQrcodeFoAdDTOSByClassifyIds(classifyIds);
if (ListUtils.isEmpty(groupQrcodeFoAdDTOS)){
return;
}
Integer sendCount = adNewsSet.getSendCount();
//查询要发的记录
Long adviserId = adNewsSet.getCreateUser();
List<AdNews> adNewsList = adNewsDao.getNewsToSendBySetIdAndAdviser(adNewsSetId, adviserId, sendCount);
if (ListUtils.isEmpty(adNewsList)){
if (ListUtils.isEmpty(groupQrcodeFoAdDTOS)) {
return;
}
//分成300一组
// 需要发送的早晚报内容
List<String> contents = new ArrayList<>();
String content = "";
int i = 1;
for (AdNews adNews : adNewsList) {
String contentL = content + i + "." + adNews.getTitle() + adNews.getShortUrl() + "\n";
if (contentL.length() >= 300) {
contents.add(content);
content = i + "." + adNews.getTitle() + adNews.getShortUrl() + "\n";
} else {
content = contentL;
// 插入发送记录
List<AdNewsGroupRecord> adNewsGroupRecords = new ArrayList<>();
// 插入消息统计信息
List<AdNewsMessageStatistic> adNewsMessageStatistics = new ArrayList<>();
// for循环内的临时变量
AdNewsGroupRecord adNewsGroupRecord;
AdNewsMessageStatistic adNewsMessageStatistic;
if (adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT.key) {
//查询要发的记录
List<AdNews> adNewsList = adNewsDao.getNewsToSendBySetIdAndAdviser(adNewsSetId, adNewsSet.getCreateUser(), adNewsSet.getSendCount());
if (ListUtils.isEmpty(adNewsList)) {
return;
}
if (i == adNewsList.size()) {
contents.add(content);
// 构建记录对象
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) {
for (AdNews adNews : adNewsList) {
adNewsGroupRecord = new AdNewsGroupRecord();
adNewsGroupRecord.setAdNewsId(adNews.getId());
adNewsGroupRecord.setAdNewsSetId(adNewsSetId);
adNewsGroupRecord.setBookGroupId(groupQrcodeFoAdDTO.getBookGroupId());
adNewsGroupRecord.setClassifyId(groupQrcodeFoAdDTO.getClassifyId());
adNewsGroupRecord.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId());
adNewsGroupRecord.setCreateUser(adNewsSet.getCreateUser());
adNewsGroupRecord.setUpdateUser(adNewsSet.getCreateUser());
adNewsGroupRecord.setInsertMark(groupQrcodeFoAdDTOS.indexOf(groupQrcodeFoAdDTO));
adNewsGroupRecords.add(adNewsGroupRecord);
}
// 统计记录
adNewsMessageStatistic = new AdNewsMessageStatistic();
adNewsMessageStatistic.setAdNewsSetId(adNewsSetId);
adNewsMessageStatistic.setBookGroupId(groupQrcodeFoAdDTO.getBookGroupId());
adNewsMessageStatistic.setClassifyId(groupQrcodeFoAdDTO.getClassifyId());
adNewsMessageStatistic.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId());
adNewsMessageStatistic.setCreateUser(adNewsSet.getCreateUser());
adNewsMessageStatistic.setContentFrom(adNewsSet.getContentFrom());
adNewsMessageStatistic.setMessageCount(adNewsList.size());
adNewsMessageStatistic.setInsertMark(groupQrcodeFoAdDTOS.indexOf(groupQrcodeFoAdDTO));
adNewsMessageStatistics.add(adNewsMessageStatistic);
}
i = i + 1;
// 记录入库
this.insertRecord(adNewsGroupRecords, adNewsMessageStatistics);
// 拼接中转链接
String transferUrl;
AdNews adNews;
// 遍历微信群
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) {
// 遍历记录详情
for (AdNewsGroupRecord item : adNewsGroupRecords) {
// 获取对应当前群的记录详情
if (groupQrcodeFoAdDTO.getQrcodeId() == item.getQrcodeId()) {
// 将对应当前群里的需要发送的新闻链接拼接完成
adNews = adNewsList.stream().filter(x -> x.getId() == item.getAdNewsId()).findFirst().get();
transferUrl = wechatGroupLinkPrefix
.concat("/link")
.concat("?message_statistic_id=").concat(item.getMessageStatisticId().toString())
.concat("&group_record_id=").concat(item.getId().toString())
.concat("&url=").concat(URLEncoder.encode(adNews.getUrl()));
adNews.setShortUrl(UrlUtils.getShortUrl4Own(transferUrl));
}
}
// 将多条需要发送的早晚报拼接成300字符一组的消息
contents = this.concatContent(adNewsList);
// 将对应群的消息发送出去
this.sendAdNewsToWechatGroup(adNewsSet, new ArrayList<GroupQrcodeFoAdDTO>() {{
add(groupQrcodeFoAdDTO);
}}, contents);
}
} else if (adNewsSet.getContentFrom() == AdContentFromEnum.CUSTOM.key) {
// 获取发送早报还是晚报
String customContent = this.getMorningOrEveningContent(adNewsSet);
if (StringUtil.isEmpty(customContent)) {
LOGGER.info(AdNewsContentTypeEnum.getDescriptionByKey(adNewsSet.getContentType()) + "内容为空,无法发送");
return;
}
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) {
adNewsGroupRecord = new AdNewsGroupRecord();
adNewsGroupRecord.setAdNewsSetId(adNewsSetId);
adNewsGroupRecord.setBookGroupId(groupQrcodeFoAdDTO.getBookGroupId());
adNewsGroupRecord.setClassifyId(groupQrcodeFoAdDTO.getClassifyId());
adNewsGroupRecord.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId());
adNewsGroupRecord.setCreateUser(adNewsSet.getCreateUser());
adNewsGroupRecord.setUpdateUser(adNewsSet.getCreateUser());
adNewsGroupRecord.setCustomContent(customContent);
adNewsGroupRecord.setInsertMark(groupQrcodeFoAdDTOS.indexOf(groupQrcodeFoAdDTO));
adNewsGroupRecord.setContentType(adNewsSet.getContentType());
adNewsGroupRecords.add(adNewsGroupRecord);
// 统计记录
adNewsMessageStatistic = new AdNewsMessageStatistic();
adNewsMessageStatistic.setAdNewsSetId(adNewsSetId);
adNewsMessageStatistic.setBookGroupId(groupQrcodeFoAdDTO.getBookGroupId());
adNewsMessageStatistic.setClassifyId(groupQrcodeFoAdDTO.getClassifyId());
adNewsMessageStatistic.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId());
adNewsMessageStatistic.setCreateUser(adNewsSet.getCreateUser());
adNewsMessageStatistic.setContentFrom(adNewsSet.getContentFrom());
adNewsMessageStatistic.setMessageCount(1);
adNewsMessageStatistic.setInsertMark(groupQrcodeFoAdDTOS.indexOf(groupQrcodeFoAdDTO));
adNewsMessageStatistics.add(adNewsMessageStatistic);
}
// 发送记录入库
this.insertRecord(adNewsGroupRecords, adNewsMessageStatistics);
contents.add(customContent);
// 通过机器人小号发送消息到微信群,自定义的消息无法记录点击,所以可以一起发(其实里面也是遍历微信群然后发送消息)
this.sendAdNewsToWechatGroup(adNewsSet, groupQrcodeFoAdDTOS, contents);
}
}
/**
* 将发送记录入库
*
* @param adNewsGroupRecords
* @param adNewsMessageStatistics
*/
private void insertRecord(List<AdNewsGroupRecord> adNewsGroupRecords, List<AdNewsMessageStatistic> adNewsMessageStatistics) {
adNewsMessageStatisticDao.batchInsert(adNewsMessageStatistics);
// 不会mybatis的主从表批量插入,所以只能这么做
for (AdNewsMessageStatistic item : adNewsMessageStatistics) {
adNewsGroupRecords.stream().filter(x -> x.getInsertMark() == item.getInsertMark()).forEach(x -> x.setMessageStatisticId(item.getId()));
}
adNewsGroupRecordDao.batchInsert(adNewsGroupRecords);
}
/**
* 通过机器人小号发送消息到微信群
*
* @param adNewsSet
* @param groupQrcodeFoAdDTOS
* @param contents
*/
private void sendAdNewsToWechatGroup(AdNewsSet adNewsSet, List<GroupQrcodeFoAdDTO> groupQrcodeFoAdDTOS, List<String> contents) {
String startContent = "";
String endContent = "";
if (adNewsSet.getHasStartContent()) {
......@@ -203,11 +354,11 @@ public class AdNewsBizImpl implements AdNewsBiz {
endContent = adNewsSet.getEndContent();
}
//循环发送
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO:groupQrcodeFoAdDTOS){
String weixinGroupId=groupQrcodeFoAdDTO.getWeixinGroupId();
String robotId =wechatGroupConsr.getRobotIdByGroupId(weixinGroupId);
if (StringUtil.isEmpty(robotId)){
LOGGER.info("发送编辑端早晚报未找到小号"+weixinGroupId);
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) {
String weixinGroupId = groupQrcodeFoAdDTO.getWeixinGroupId();
String robotId = wechatGroupConsr.getRobotIdByGroupId(weixinGroupId);
if (StringUtil.isEmpty(robotId)) {
LOGGER.info("发送编辑端早晚报未找到小号" + weixinGroupId);
}
if (!StringUtil.isEmpty(startContent)) {
//发送开场语
......@@ -223,22 +374,55 @@ public class AdNewsBizImpl implements AdNewsBiz {
sendAdNewsText(endContent, robotId, weixinGroupId);
}
}
//插入发送记录
List<AdNewsGroupRecord> adNewsGroupRecords = new ArrayList<>();
for (GroupQrcodeFoAdDTO groupQrcodeFoAdDTO : groupQrcodeFoAdDTOS) {
for (AdNews adNews : adNewsList) {
AdNewsGroupRecord adNewsGroupRecord = new AdNewsGroupRecord();
adNewsGroupRecord.setAdNewsId(adNews.getId());
adNewsGroupRecord.setAdNewsSetId(adNewsSetId);
adNewsGroupRecord.setBookGroupId(groupQrcodeFoAdDTO.getBookGroupId());
adNewsGroupRecord.setClassifyId(groupQrcodeFoAdDTO.getClassifyId());
adNewsGroupRecord.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId());
adNewsGroupRecord.setCreateUser(adviserId);
adNewsGroupRecord.setUpdateUser(adviserId);
adNewsGroupRecords.add(adNewsGroupRecord);
}
/**
* 发送早报还是晚报
*
* @param adNewsSet
* @return
*/
private String getMorningOrEveningContent(AdNewsSet adNewsSet) {
Date date = new Date();
String dateOnly = DateUtils.formatDate(date, DateUtils.DATE_FORMAT_DATEONLY);
Date morningDateTime = DateUtils.StringToDateTime(dateOnly.concat(" ").concat(adNewsSet.getMorningTime()));
Date eveningDateTime = DateUtils.StringToDateTime(dateOnly.concat(" ").concat(adNewsSet.getEveningTime()));
Long morningDiff = date.getTime() - morningDateTime.getTime();
Long eveningDiff = date.getTime() - eveningDateTime.getTime();
// 判断正负太麻烦,直接判断绝对值,哪个时间差小就发哪个
adNewsSet.setContentType(Math.abs(morningDiff) <= Math.abs(eveningDiff) ? 0 : 1);
return adNewsSet.getContentType() == 0 ? adNewsSet.getMorningContent() : adNewsSet.getEveningContent();
}
/**
* 将内容拼接为300字符一条数据项的数组【微信目前单次消息发送字符长度为300】
* 拼接内容大致为
* 1.xxxxxxxxxxx 2.xxxxxxxxxx 3.xxxxxxxx 【假设此条数据加下一条数据【4.xxx】 就大于300字符,那就先将之前的存一条到数组】
* 4.xxxxx 5.xxxxxxx 【多余300字符再重新拼接,以此循环下去】
*
* @param adNewsList
* @return
*/
private List<String> concatContent(List<AdNews> adNewsList) {
List<String> contents = new ArrayList<>();
String content = "";
int i = 1;
for (AdNews adNews : adNewsList) {
String temp = content + i + "." + adNews.getTitle() + adNews.getShortUrl() + "\n";
if (temp.length() >= 300) {
// 如果本次拼接后的长度大于 300,那么将之前拼接的内容存入数组
contents.add(content);
// 重置 content 的内容
content = i + "." + adNews.getTitle() + adNews.getShortUrl() + "\n";
} else {
content = temp;
}
if (i == adNewsList.size()) {
contents.add(content);
}
i = i + 1;
}
adNewsGroupRecordDao.batchInsert(adNewsGroupRecords);
return contents;
}
@ParamLog("获取编辑早晚报设置")
......@@ -246,6 +430,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
public AdNewsSet getAdNewsSet(Long partyId) {
AdNewsSet adNewsSet = adNewsSetDao.getByPartyId(partyId);
if (adNewsSet != null) {
// 获取勾选的社群
List<AdNewsGroup> adNewsGroups = adNewsGroupDao.getListByAdNewsSetId(adNewsSet.getId());
adNewsSet.setAdNewsGroups(adNewsGroups);
if (!ListUtils.isEmpty(adNewsGroups)) {
......@@ -260,9 +445,9 @@ public class AdNewsBizImpl implements AdNewsBiz {
@ParamLog("编辑添加选择的早晚报素材")
@Override
public void createAdNewsChooseBatch(List<Long> adNewsIds, Long partyId) {
List<AdNewsChoose> adNewsChooses=new ArrayList<>();
for (Long adNewsId:adNewsIds){
AdNewsChoose adNewsChoose=new AdNewsChoose();
List<AdNewsChoose> adNewsChooses = new ArrayList<>();
for (Long adNewsId : adNewsIds) {
AdNewsChoose adNewsChoose = new AdNewsChoose();
adNewsChoose.setAdNewsId(adNewsId);
adNewsChoose.setAdviserId(partyId);
adNewsChoose.setCreateUser(partyId);
......@@ -281,16 +466,21 @@ public class AdNewsBizImpl implements AdNewsBiz {
@ParamLog("编辑移除选择的早晚报素材")
@Override
public void deleteAdNewsChoose(Long adNewsId, Long partyId) {
adNewsChooseDao.deleteAdNewsChooseById(adNewsId,partyId);
adNewsChooseDao.deleteAdNewsChooseById(adNewsId, partyId);
}
@ParamLog("获取素材库列表")
@Override
public PageBeanNew<AdNews> getAdNewsList(String title, Long partyId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
public PageBeanNew<AdNews> getAdNewsList(AdNewsListParam adNewsListParam) {
PageParam pageParam = new PageParam(adNewsListParam.getCurrentPage(), adNewsListParam.getNumPerPage());
Map<String, Object> map = new HashMap<>();
map.put("title", title);
map.put("partyId",partyId);
map.put("partyId", adNewsListParam.getPartyId());
map.put("title", adNewsListParam.getTitle());
map.put("beginTime", adNewsListParam.getBeginTime());
map.put("endTime", adNewsListParam.getEndTime());
map.put("hasBan", adNewsListParam.getHasBan());
map.put("hasUsed", adNewsListParam.getHasUsed());
map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds());
PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList");
return pageBeanNew;
}
......@@ -307,6 +497,19 @@ public class AdNewsBizImpl implements AdNewsBiz {
return page;
}
@ParamLog("禁用/允许推送")
@Override
public void saveAdNewsBan(Long partyId, Long adNewsId, Integer hasBan) {
if (AdNewsBanEnum.BAN.key == hasBan) {
AdNewsBan model = new AdNewsBan();
model.setAdviserId(partyId);
model.setAdNewsId(adNewsId);
adNewsBanDao.insert(model);
} else {
adNewsBanDao.deleteByAdNewsId(partyId, adNewsId);
}
}
@ParamLog("发送消息")
private void sendAdNewsText(String content, String robotId, String weixinGroupId) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
......@@ -343,4 +546,154 @@ public class AdNewsBizImpl implements AdNewsBiz {
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
return ip;
}
@ParamLog("增加公众号反馈")
@Override
public Long addAdNewsWechat(AdNewsWechat adNewsWechat) {
return adNewsWechatDao.insert(adNewsWechat);
}
@ParamLog("获取公众号列表")
@Override
public PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
PageBeanNew<AdNewsWechat> pageBeanNew = adNewsWechatDao.listPageNew(pageParam, map, "getAdNewsWechatList");
return pageBeanNew;
}
@ParamLog("获取编辑已选取的公众号列表")
@Override
public PageBeanNew<AdNewsWechat> getAdNewsWechatChooseList(Long partyId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("partyId", partyId);
PageBeanNew<AdNewsWechat> pageBeanNew = adNewsWechatDao.listPageNew(pageParam, map, "getAdNewsWechatChooseList");
return pageBeanNew;
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("编辑添加选择的公众号")
@Override
public void createAdNewsWechatChooseBatch(List<Long> adNewsWechatIds, Long partyId) {
List<AdNewsWechatChoose> adNewsWechatChooses = new ArrayList<>();
for (Long adNewsWechatId : adNewsWechatIds) {
AdNewsWechatChoose adNewsWechatChoose = new AdNewsWechatChoose();
adNewsWechatChoose.setAdNewsWechatId(adNewsWechatId);
adNewsWechatChoose.setAdviserId(partyId);
adNewsWechatChoose.setCreateUser(partyId);
adNewsWechatChoose.setUpdateUser(partyId);
adNewsWechatChooses.add(adNewsWechatChoose);
}
// //校验重复添加
// Integer count = adNewsWechatChooseDao.getCountByAdNewsWechatIdsAndPartyId(adNewsWechatIds, partyId);
// if (count > 0) {
// throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请勿重复添加!");
// }
// 移除编辑之前的选择
adNewsWechatChooseDao.deleteAdNewsWechatChooseByPartyId(partyId);
// 重新建立关系
adNewsWechatChooseDao.batchInsert(adNewsWechatChooses);
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("编辑移除选择的公众号")
@Override
public void deleteAdNewsWechatChoose(Long adNewsWechatId, Long partyId) {
adNewsWechatChooseDao.deleteAdNewsWechatChooseById(adNewsWechatId, partyId);
}
@Override
@ParamLog("获取早晚报发送记录")
public PageBeanNew<AdNewsMessageStatisticVO> getAdNewsMessageStatistic(Long partyId, String title, String beginTime, String endTime, Long proLabelId, Long depLabelId, Long purLabelId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("partyId", partyId);
map.put("title", title);
map.put("beginTime", beginTime);
map.put("endTime", StringUtil.isEmpty(endTime) ? null : endTime.concat(" 23:59:59"));
map.put("proLabelId", proLabelId);
map.put("depLabelId", depLabelId);
map.put("purLabelId", purLabelId);
PageBeanNew<AdNewsMessageStatisticVO> pageBeanNew = adNewsMessageStatisticDao.listPageNew(pageParam, map, "getAdNewsMessageStatistic");
if (pageBeanNew == null) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
}
// 遍历填充标签
List<AdNewsMessageStatisticVO> adNewsMessageStatisticVOS = pageBeanNew.getRecordList();
if (!ListUtils.isEmpty((adNewsMessageStatisticVOS))) {
List<Long> labelIds = new ArrayList<>();
for (AdNewsMessageStatisticVO item : adNewsMessageStatisticVOS) {
if (item.getProLabelId() != null) {
labelIds.add(item.getProLabelId());
}
if (item.getDepLabelId() != null) {
labelIds.add(item.getDepLabelId());
}
if (item.getPurLabelId() != null) {
labelIds.add(item.getPurLabelId());
}
}
Map<Long, String> labelMap = new HashMap<>();
if (!ListUtils.isEmpty(labelIds)) {
labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
}
if (!MapUtils.isEmpty(labelMap)) {
for (AdNewsMessageStatisticVO item : adNewsMessageStatisticVOS) {
if (item.getProLabelId() != null) {
item.setProLabelName(labelMap.get(item.getProLabelId()));
}
if (item.getDepLabelId() != null) {
item.setDepLabelName(labelMap.get(item.getDepLabelId()));
}
if (item.getPurLabelId() != null) {
item.setPurLabelName(labelMap.get(item.getPurLabelId()));
}
}
}
}
return pageBeanNew;
}
@Override
@ParamLog("查询早晚报发送详情")
public List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId) {
return adNewsGroupRecordDao.getAdNewsGroupRecord(partyId, messageStatisticId);
}
@Override
@ParamLog("记录用户点击量")
public Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord) {
return adNewsClickRecordDao.insert(adNewsClickRecord);
}
}
package com.pcloud.book.adnews.check;
import com.google.common.base.Enums;
import com.pcloud.book.adnews.entity.AdNewsGroup;
import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.enums.AdContentFromEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component;
......@@ -16,49 +19,52 @@ import org.springframework.stereotype.Component;
public class AdNewsCheck {
public void createAdNewsSetCheck(AdNewsSet adNewsSet){
if (adNewsSet==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
public void createAdNewsSetCheck(AdNewsSet adNewsSet) {
if (adNewsSet == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
}
if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"发送群分类不能为空!");
if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送群分类不能为空!");
}
if (adNewsSet.getSendCount()==null||adNewsSet.getSendCount()<=0){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"推送条数不能为空且必须大于0!");
if (adNewsSet.getSendCount() == null || adNewsSet.getSendCount() <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "推送条数不能为空且必须大于0!");
}
if (adNewsSet.getHasMorningOpen()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启早报不能为空!");
if (adNewsSet.getHasMorningOpen() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启早报不能为空!");
}
if (adNewsSet.getHasEveningOpen()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启晚报不能为空!");
if (adNewsSet.getHasEveningOpen() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启晚报不能为空!");
}
if (adNewsSet.getHasStartContent()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启开场语不能为空!");
if (adNewsSet.getHasStartContent() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启开场语不能为空!");
}
if (adNewsSet.getHasEndContent()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启结束语不能为空!");
if (adNewsSet.getHasEndContent() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启结束语不能为空!");
}
if (adNewsSet.getHasMorningOpen()&&StringUtil.isEmpty(adNewsSet.getMorningTime())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"早报时间不能为空!");
if (adNewsSet.getHasMorningOpen() && StringUtil.isEmpty(adNewsSet.getMorningTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "早报时间不能为空!");
}
if (adNewsSet.getHasEveningOpen()&&StringUtil.isEmpty(adNewsSet.getEveningTime())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"晚报时间不能为空!");
if (adNewsSet.getHasEveningOpen() && StringUtil.isEmpty(adNewsSet.getEveningTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "晚报时间不能为空!");
}
if (adNewsSet.getHasStartContent()&&StringUtil.isEmpty(adNewsSet.getStartContent())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"开场语不能为空!");
if (adNewsSet.getHasStartContent() && StringUtil.isEmpty(adNewsSet.getStartContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "开场语不能为空!");
}
if (adNewsSet.getHasEndContent()&&StringUtil.isEmpty(adNewsSet.getEndContent())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"结束语不能为空!");
if (adNewsSet.getHasEndContent() && StringUtil.isEmpty(adNewsSet.getEndContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "结束语不能为空!");
}
for(AdNewsGroup adNewsGroup:adNewsSet.getAdNewsGroups()){
if (adNewsGroup==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"早晚报关联不能为空!");
if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key && adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!");
}
for (AdNewsGroup adNewsGroup : adNewsSet.getAdNewsGroups()) {
if (adNewsGroup == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "早晚报关联不能为空!");
}
if (adNewsGroup.getClassifyId()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"群分类id不能为空!");
if (adNewsGroup.getClassifyId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "群分类id不能为空!");
}
if (adNewsGroup.getBookGroupId()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"社群码id不能为空!");
if (adNewsGroup.getBookGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群码id不能为空!");
}
}
......
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsBan;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:12
*/
public interface AdNewsBanDao extends BaseDao<AdNewsBan> {
void deleteByAdNewsId(Long partyId,Long adNewsId);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author zhengyongqiang
* @date 2019/8/15 11:10
*/
public interface AdNewsClickRecordDao extends BaseDao<AdNewsClickRecord> {
}
......@@ -6,9 +6,15 @@ import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface AdNewsGroupDao extends BaseDao<AdNewsGroup> {
Integer batchInsert(List<AdNewsGroup> adNewsGroups);
void deleteByAdNewsSetId(Long adNewsSetId);
/**
* 获取勾选关联的社群
* @param adNewsSetId
* @return
*/
List<AdNewsGroup> getListByAdNewsSetId(Long adNewsSetId);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
......@@ -12,4 +13,6 @@ import java.util.List;
**/
public interface AdNewsGroupRecordDao extends BaseDao<AdNewsGroupRecord> {
Integer batchInsert(List<AdNewsGroupRecord> adNewsGroupRecords);
List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsMessageStatistic;
import com.pcloud.common.core.dao.BaseDao;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* @author zhengyongqiang
* @date 2019/8/13 19:05
*/
public interface AdNewsMessageStatisticDao extends BaseDao<AdNewsMessageStatistic> {
Integer batchInsert(List<AdNewsMessageStatistic> list);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsChoose;
import com.pcloud.book.adnews.entity.AdNewsWechatChoose;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:47
*/
public interface AdNewsWechatChooseDao extends BaseDao<AdNewsWechatChoose> {
Integer batchInsert(List<AdNewsWechatChoose> adNewsWechatChooses);
void deleteAdNewsWechatChooseById(Long adNewsWechatId, Long partyId);
void deleteAdNewsWechatChooseByPartyId(Long partyId);
Integer getCountByAdNewsWechatIdsAndPartyId(List<Long> adNewsIds, Long partyId);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:46
*/
public interface AdNewsWechatDao extends BaseDao<AdNewsWechat> {
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsBanDao;
import com.pcloud.book.adnews.entity.AdNewsBan;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:11
*/
@Repository("adnewsBanDao")
public class AdNewsBanDaoImpl extends BaseDaoImpl<AdNewsBan> implements AdNewsBanDao {
@Override
public void deleteByAdNewsId(Long partyId, Long adNewsId) {
Map<String,Object> map = new HashMap<>();
map.put("partyId",partyId);
map.put("adNewsId",adNewsId);
super.getSqlSession().delete(getStatement("deleteByAdNewsId"),map);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsClickRecordDao;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @author zhengyongqiang
* @date 2019/8/15 11:10
*/
@Repository("adNewsClickRecordDao")
public class AdNewsClickRecordDaoImpl extends BaseDaoImpl<AdNewsClickRecord> implements AdNewsClickRecordDao {
}
......@@ -2,10 +2,13 @@ package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsGroupRecordDao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
......@@ -18,4 +21,12 @@ public class AdNewsGroupRecordDaoImpl extends BaseDaoImpl<AdNewsGroupRecord> imp
public Integer batchInsert(List<AdNewsGroupRecord> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId) {
Map<String,Object> map = new HashMap<>();
map.put("partyId",partyId );
map.put("messageStatisticId",messageStatisticId );
return super.getSqlSession().selectList(getStatement("getAdNewsGroupRecord"),map);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsMessageStatisticDao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.entity.AdNewsMessageStatistic;
import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.page.PageBeanNew;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhengyongqiang
* @date 2019/8/13 19:05
*/
@Repository("adNewsMessageStatisticDao")
public class AdNewsMessageStatisticDaoImpl extends BaseDaoImpl<AdNewsMessageStatistic> implements AdNewsMessageStatisticDao {
@Override
public Integer batchInsert(List<AdNewsMessageStatistic> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsWechatChooseDao;
import com.pcloud.book.adnews.entity.AdNewsWechatChoose;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:52
*/
@Repository("adNewsWechatChooseDao")
public class AdNewsWechatChooseDaoImpl extends BaseDaoImpl<AdNewsWechatChoose> implements AdNewsWechatChooseDao {
@Override
public Integer batchInsert(List<AdNewsWechatChoose> adNewsWechatChooses) {
return super.getSqlSession().insert(getStatement("batchInsert"),adNewsWechatChooses);
}
@Override
public void deleteAdNewsWechatChooseById(Long adNewsWechatId, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsWechatId", adNewsWechatId);
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteAdNewsWechatChooseById"), map);
}
@Override
public void deleteAdNewsWechatChooseByPartyId(Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteAdNewsWechatChooseByPartyId"), map);
}
@Override
public Integer getCountByAdNewsWechatIdsAndPartyId(List<Long> adNewsWechatIds, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsWechatIds", adNewsWechatIds);
map.put("partyId", partyId);
return super.getSqlSession().selectOne(getStatement("getCountByAdNewsWechatIdsAndPartyId"), map);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsWechatDao;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:52
*/
@Repository("adNewsWechatDao")
public class AdNewsWechatDaoImpl extends BaseDaoImpl<AdNewsWechat> implements AdNewsWechatDao {
}
package com.pcloud.book.adnews.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import java.util.List;
/**
* @author zhengyongqiang
* @date 2019/8/12 11:33
*/
@Data
@ApiModel("查询素材列表")
public class AdNewsListParam {
@ApiModelProperty("当前人")
private Long partyId;
@ApiModelProperty ("标题")
private String title;
@ApiModelProperty("开始时间")
private String beginTime;
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty ("公众号id")
private List<Long> adNewsWechatIds;
@ApiModelProperty("已被禁用;0:没禁用; 1:已禁用;")
private Integer hasBan;
@ApiModelProperty("使用状态;0:未使用; 1:已使用;")
private Integer hasUsed;
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页展示条数")
private Integer numPerPage;
}
......@@ -38,6 +38,9 @@ public class AdNews extends BaseEntity {
@ApiModelProperty("是否使用")
private Boolean hasUsed;
@ApiModelProperty("是否禁用")
private Boolean hasBan ;
public String getType() {
return type;
}
......@@ -102,6 +105,14 @@ public class AdNews extends BaseEntity {
this.hasUsed = hasUsed;
}
public Boolean getHasBan() {
return hasBan;
}
public void setHasBan(Boolean hasBan) {
this.hasBan = hasBan;
}
@Override
public String toString() {
return "AdNews{" +
......@@ -113,6 +124,9 @@ public class AdNews extends BaseEntity {
", shortUrl='" + shortUrl + '\'' +
", newsDate='" + newsDate + '\'' +
", hasUsed=" + hasUsed +
"} " + super.toString();
", hasBan=" + hasBan +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:13
*/
@ApiModel("禁止推送")
@Data
public class AdNewsBan extends BaseEntity {
private static final long serialVersionUID = -5102664638916548405L;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("新闻id")
private Long adNewsId;
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/15 11:02
*/
@Data
@ApiModel("记录点击量")
public class AdNewsClickRecord extends BaseEntity {
private static final long serialVersionUID = -3879628889314992714L;
@ApiModelProperty("微信统计记录id")
private Long messageStatisticId;
@ApiModelProperty("微信记录详情id")
private Long groupRecordId;
@ApiModelProperty("微信用户id")
private Long wechatUserId;
}
......@@ -3,12 +3,14 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/7/17 15:20
**/
@Data
@ApiModel("编辑新闻群关联")
public class AdNewsGroup extends BaseEntity {
......@@ -32,63 +34,7 @@ public class AdNewsGroup extends BaseEntity {
@ApiModelProperty("修改人")
private Long updateUser;
public Long getClassifyId() {
return classifyId;
}
@ApiModelProperty("分类")
private String classify;
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getAdNewsSetId() {
return adNewsSetId;
}
public void setAdNewsSetId(Long adNewsSetId) {
this.adNewsSetId = adNewsSetId;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "AdNewsGroup{" +
"classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", adNewsSetId=" + adNewsSetId +
", isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
"} " + super.toString();
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
......@@ -10,10 +11,14 @@ import io.swagger.annotations.ApiModelProperty;
* @Date 2019/7/17 15:55
**/
@ApiModel("编辑新闻发送记录")
@Data
public class AdNewsGroupRecord extends BaseEntity{
private static final long serialVersionUID = -3271071194854381077L;
@ApiModelProperty("消息统计表id")
private Long messageStatisticId;
@ApiModelProperty("群id")
private Long qrcodeId;
......@@ -35,72 +40,12 @@ public class AdNewsGroupRecord extends BaseEntity{
@ApiModelProperty("修改人")
private Long updateUser;
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getAdNewsId() {
return adNewsId;
}
public void setAdNewsId(Long adNewsId) {
this.adNewsId = adNewsId;
}
public Long getAdNewsSetId() {
return adNewsSetId;
}
public void setAdNewsSetId(Long adNewsSetId) {
this.adNewsSetId = adNewsSetId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
@ApiModelProperty("自定义内容")
private String customContent;
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@ApiModelProperty("内容类型,0:早报;1:晚报")
private Integer contentType;
@Override
public String toString() {
return "AdNewsGroupRecord{" +
"qrcodeId=" + qrcodeId +
", classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", adNewsId=" + adNewsId +
", adNewsSetId=" + adNewsSetId +
", createUser=" + createUser +
", updateUser=" + updateUser +
"} " + super.toString();
}
@ApiModelProperty("insert时父子表标识")
Integer insertMark;
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/13 18:51
*/
@ApiModel("消息记录统计表")
@Data
public class AdNewsMessageStatistic extends BaseEntity {
private static final long serialVersionUID = 5892129036072748567L;
@ApiModelProperty("群id")
private Long qrcodeId;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("编辑新闻设置id")
private Long adNewsSetId;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("发送消息数")
private Integer messageCount;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("insert时父子表标识")
private Integer insertMark;
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
......@@ -11,6 +12,7 @@ import java.util.List;
* @Author ruansiyuan
* @Date 2019/7/17 16:13
**/
@Data
@ApiModel("编辑新闻发送记录")
public class AdNewsSet extends BaseEntity {
......@@ -49,132 +51,21 @@ public class AdNewsSet extends BaseEntity {
@ApiModelProperty("修改人")
private Long updateUser;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("早报内容")
private String morningContent;
@ApiModelProperty("晚报内容")
private String eveningContent;
@ApiModelProperty("内容类型")
private Integer contentType;
@ApiModelProperty("分类关联集合")
private List<AdNewsGroup> adNewsGroups;
@ApiModelProperty("分类id集合")
private List<Long> classifyIds;
public String getMorningTime() {
return morningTime;
}
public void setMorningTime(String morningTime) {
this.morningTime = morningTime;
}
public String getEveningTime() {
return eveningTime;
}
public void setEveningTime(String eveningTime) {
this.eveningTime = eveningTime;
}
public Boolean getHasMorningOpen() {
return hasMorningOpen;
}
public void setHasMorningOpen(Boolean hasMorningOpen) {
this.hasMorningOpen = hasMorningOpen;
}
public Boolean getHasEveningOpen() {
return hasEveningOpen;
}
public void setHasEveningOpen(Boolean hasEveningOpen) {
this.hasEveningOpen = hasEveningOpen;
}
public Integer getSendCount() {
return sendCount;
}
public void setSendCount(Integer sendCount) {
this.sendCount = sendCount;
}
public String getStartContent() {
return startContent;
}
public void setStartContent(String startContent) {
this.startContent = startContent;
}
public String getEndContent() {
return endContent;
}
public void setEndContent(String endContent) {
this.endContent = endContent;
}
public Boolean getHasStartContent() {
return hasStartContent;
}
public void setHasStartContent(Boolean hasStartContent) {
this.hasStartContent = hasStartContent;
}
public Boolean getHasEndContent() {
return hasEndContent;
}
public void setHasEndContent(Boolean hasEndContent) {
this.hasEndContent = hasEndContent;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
public List<AdNewsGroup> getAdNewsGroups() {
return adNewsGroups;
}
public void setAdNewsGroups(List<AdNewsGroup> adNewsGroups) {
this.adNewsGroups = adNewsGroups;
}
public List<Long> getClassifyIds() {
return classifyIds;
}
public void setClassifyIds(List<Long> classifyIds) {
this.classifyIds = classifyIds;
}
@Override
public String toString() {
return "AdNewsSet{" +
"morningTime='" + morningTime + '\'' +
", eveningTime='" + eveningTime + '\'' +
", hasMorningOpen=" + hasMorningOpen +
", hasEveningOpen=" + hasEveningOpen +
", sendCount=" + sendCount +
", startContent='" + startContent + '\'' +
", endContent='" + endContent + '\'' +
", hasStartContent=" + hasStartContent +
", hasEndContent=" + hasEndContent +
", createUser=" + createUser +
", updateUser=" + updateUser +
", adNewsGroups=" + adNewsGroups +
", classifyIds=" + classifyIds +
"} " + super.toString();
}
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:23
*/
@ApiModel("新闻微信公众号")
public class AdNewsWechat extends BaseEntity {
private static final long serialVersionUID = 454065623001378319L;
public AdNewsWechat() {
}
public AdNewsWechat(String newsFrom, String wechatName, Long adviserId, Boolean isDelete) {
this.newsFrom = newsFrom;
this.wechatName = wechatName;
this.adviserId = adviserId;
this.isDelete = isDelete;
}
@ApiModelProperty("微信公众号唯一标识")
private String newsFrom;
@ApiModelProperty("微信公众号名称")
private String wechatName;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("是否删除")
private Boolean isDelete;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getNewsFrom() {
return newsFrom;
}
public void setNewsFrom(String newsFrom) {
this.newsFrom = newsFrom;
}
public String getWechatName() {
return wechatName;
}
public void setWechatName(String wechatName) {
this.wechatName = wechatName;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
@Override
public String toString() {
return "AdNewsWechat{" +
"newsFrom='" + newsFrom + '\'' +
", wechatName='" + wechatName + '\'' +
", adviserId=" + adviserId +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:32
*/
@ApiModel("新闻公众号选择关联")
public class AdNewsWechatChoose extends BaseEntity {
private static final long serialVersionUID = 209558478794921448L;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("公众号id")
private Long adNewsWechatId;
@ApiModelProperty("是否删除")
private Boolean isDelete;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Long getAdNewsWechatId() {
return adNewsWechatId;
}
public void setAdNewsWechatId(Long adNewsWechatId) {
this.adNewsWechatId = adNewsWechatId;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "AdNewsWechatChoose{" +
"adviserId=" + adviserId +
", adNewsWechatId=" + adNewsWechatId +
", isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.pcloud.book.adnews.enums;
import com.pcloud.book.advertising.enums.AdDetailModeEnum;
import org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl;
/**
* 早晚报内容来源
*
* @author zhengyongqiang
* @date 2019/8/6 17:50
*/
public enum AdContentFromEnum {
WECHAT(0, "微信公众号"),
CUSTOM(1, "自定义内容 ");
public final Integer key;
public final String name;
AdContentFromEnum(Integer key, String name) {
this.key = key;
this.name = name;
}
public static String getNameByKey(String key) {
AdContentFromEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdContentFromEnum methodEnum = var1[var3];
if (methodEnum.key.equals(key)) {
return methodEnum.name;
}
}
return null;
}
}
package com.pcloud.book.adnews.enums;
/**
* 禁止推送/允许推送
* @author zhengyongqiang
* @date 2019/8/12 14:42
*/
public enum AdNewsBanEnum {
NONBAN(0), // 不禁止推送
BAN(1); // 禁止推送
public final Integer key;
AdNewsBanEnum(Integer key){
this.key=key;
}
}
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;
}
}
package com.pcloud.book.adnews.enums;
/**
* 公众号状态
* @author zhengyongqiang
* @date 2019/8/7 11:37
*/
public enum AdNewsWechatEnum {
EXAMINING(0), // 审核中
ENABLE(1); // 已启用
public final Integer key;
AdNewsWechatEnum(Integer key){
this.key=key;
}
}
package com.pcloud.book.adnews.facade;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.*;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(value = "pcloud-service-book",qualifier = "adNewsFacadeCloud",path = "adNews")
@FeignClient(value = "pcloud-service-book", qualifier = "adNewsFacadeCloud", path = "adNews")
@Api(description = "推送群消息外部接口")
public interface AdNewsFacade {
@ApiOperation("新增编辑端早晚报设置")
@PostMapping("/createAdNewsSet")
ResponseDto<?> createAdNewsSet(
......@@ -37,6 +36,7 @@ public interface AdNewsFacade {
@RequestHeader("token") @ApiParam("token信息") String token
) throws BizException, PermissionException;
@Deprecated
@ApiOperation("编辑添加选择的早晚报素材")
@PostMapping("/createAdNewsChooseBatch")
ResponseDto<?> createAdNewsChooseBatch(
......@@ -44,6 +44,7 @@ public interface AdNewsFacade {
@RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds
) throws BizException, PermissionException;
@Deprecated
@ApiOperation("编辑移除选择的早晚报素材")
@GetMapping("/deleteAdNewsChoose")
ResponseDto<?> deleteAdNewsChoose(
......@@ -51,23 +52,91 @@ public interface AdNewsFacade {
@RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId
) throws BizException, PermissionException;
@ApiOperation("获取早晚报素材库")
@GetMapping("/getAdNewsList")
@Deprecated
@ApiOperation("获取编辑选择的早晚报素材库")
@GetMapping("/getAdNewsChooseList")
ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("标题") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("早晚报素材库")
@PostMapping("/getAdNewsList")
ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestBody @ApiParam("查询参数") AdNewsListParam adNewsListParam
) throws BizException, PermissionException;
@ApiOperation("禁用/解除禁用")
@GetMapping("/saveAdNewsBan")
ResponseDto<?> saveAdNewsBan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("adNewsId") @ApiParam("新闻id") Long adNewsId,
@RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan
) throws BizException, PermissionException;
@ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch")
ResponseDto<?> createAdNewsWechatChooseBatch(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("选择的公众号主键") List<Long> adNewsWechatIds
) throws BizException, PermissionException;
@ApiOperation("移除编辑已选择的公众号")
@GetMapping("/deleteAdNewsWechatChoose")
ResponseDto<?> deleteAdNewsWechatChoose(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "adNewsWechatId") @ApiParam("公众号主键") Long adNewsWechatId
) throws BizException, PermissionException;
@ApiOperation("获取编辑已选择的公众号")
@GetMapping("/getAdNewsWechatChooseList")
ResponseDto<?> getAdNewsWechatChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("获取编辑选择的早晚报素材库")
@GetMapping("/getAdNewsChooseList")
ResponseDto<?> getAdNewsChooseList(
@ApiOperation("获取所有的公众号列表")
@GetMapping("/getAdNewsWechatList")
ResponseDto<?> getAdNewsWechatList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed",required = false) @ApiParam("标题") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("获取早晚报发送记录")
@GetMapping("/getAdNewsMessageStatistic")
ResponseDto<?> getAdNewsMessageStatistic(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("群名称、群分类、社群码、社群书") String title,
@RequestParam(value = "beginTime", required = false) @ApiParam("开始日期") String beginTime,
@RequestParam(value = "endTime", required = false) @ApiParam("结束日期") String endTime,
@RequestParam(value = "proLabelId", required = false) @ApiParam("专业") Long proLabelId,
@RequestParam(value = "depLabelId", required = false) @ApiParam("深度") Long depLabelId,
@RequestParam(value = "purLabelId", required = false) @ApiParam("目的") Long purLabelId,
@RequestParam(value = "currentPage", required = false, defaultValue = "0") @ApiParam("当前页") Integer currentPage,
@RequestParam(value = "numPerPage", required = false, defaultValue = "10") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("查询早晚报发送详情")
@GetMapping("/getAdNewsGroupRecord")
ResponseDto<?> getAdNewsGroupRecord(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("messageStatisticId") @ApiParam("统计表id") Long messageStatisticId
) throws BizException, PermissionException;
@ApiOperation("记录用户点击量")
@PostMapping("/addAdNewsClickRecord")
@ApiImplicitParams({
@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "adNewsClickRecord", value = "用户点击量对象", dataType = "AdNewsClickRecord", paramType = "body")})
ResponseDto<?> addAdNewsClickRecord(
@CookieValue("userInfo") @ApiParam("用户信息") String userInfo,
@RequestBody @ApiParam("用户点击量对象") AdNewsClickRecord adNewsClickRecord
) throws BizException, PermissionException;
}
package com.pcloud.book.adnews.facade.impl;
import com.pcloud.book.adnews.biz.AdNewsBiz;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.book.adnews.facade.AdNewsFacade;
import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Description
......@@ -25,6 +33,7 @@ import java.util.List;
@RequestMapping("adNews")
public class AdNewsFacadeImpl implements AdNewsFacade {
private static final Logger LOGGER = LoggerFactory.getLogger(AdNewsFacadeImpl.class);
@Autowired
private AdNewsBiz adNewsBiz;
......@@ -83,10 +92,10 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (ListUtils.isEmpty(adNewsIds)){
if (ListUtils.isEmpty(adNewsIds)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
}
adNewsBiz.createAdNewsChooseBatch(adNewsIds,partyId);
adNewsBiz.createAdNewsChooseBatch(adNewsIds, partyId);
return new ResponseDto<>();
}
......@@ -105,12 +114,95 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
return new ResponseDto<>();
}
@ApiOperation("获取早晚报素材库")
@GetMapping("/getAdNewsList")
@ApiOperation("获取编辑选择的早晚报素材库")
@GetMapping("/getAdNewsChooseList")
@Override
public ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("使用状态") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsChooseList(partyId, title, hasUsed, currentPage, numPerPage));
}
@ApiOperation("早晚报素材库")
@PostMapping("/getAdNewsList")
@Override
public ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestBody @ApiParam("查询参数") AdNewsListParam adNewsListParam
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (adNewsListParam.getCurrentPage() == null || adNewsListParam.getCurrentPage() < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (adNewsListParam.getNumPerPage() == null || adNewsListParam.getNumPerPage() <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
adNewsListParam.setPartyId(partyId);
// 将2019-08-12时间转换为 2019-08-12 23:59:59
if (adNewsListParam.getEndTime() != null)
adNewsListParam.setEndTime(adNewsListParam.getEndTime().concat(" 23:59:59"));
return new ResponseDto<>(adNewsBiz.getAdNewsList(adNewsListParam));
}
@Override
@ApiOperation("禁用/解除禁用")
@GetMapping("/saveAdNewsBan")
public ResponseDto<?> saveAdNewsBan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("adNewsId") @ApiParam("新闻id") Long adNewsId,
@RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (!NumberUtil.isNumber(adNewsId)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "adNewsId 不能小于0!");
}
if (!NumberUtil.isNumber(hasBan)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "hasBan 必须大于0!");
}
adNewsBiz.saveAdNewsBan(partyId, adNewsId, hasBan);
return new ResponseDto<>();
}
@ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch")
@Override
public ResponseDto<?> createAdNewsWechatChooseBatch(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("选择的公众号主键") List<Long> adNewsWechatIds
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
adNewsBiz.createAdNewsWechatChooseBatch(adNewsWechatIds, partyId);
return new ResponseDto<>();
}
@Override
@ApiOperation("移除编辑已选择的公众号")
@GetMapping("/deleteAdNewsWechatChoose")
public ResponseDto<?> deleteAdNewsWechatChoose(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "adNewsWechatId") @ApiParam("公众号主键") Long adNewsWechatId
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
adNewsBiz.deleteAdNewsWechatChoose(adNewsWechatId, partyId);
return new ResponseDto<>();
}
@Override
@ApiOperation("获取编辑已选择的公众号")
@GetMapping("/getAdNewsWechatChooseList")
public ResponseDto<?> getAdNewsWechatChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
......@@ -121,16 +213,14 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsList(title,partyId,currentPage,numPerPage));
return new ResponseDto<>(adNewsBiz.getAdNewsWechatChooseList(partyId, currentPage, numPerPage));
}
@ApiOperation("获取编辑选择的早晚报素材库")
@GetMapping("/getAdNewsChooseList")
@Override
public ResponseDto<?> getAdNewsChooseList(
@ApiOperation("获取所有的公众号列表")
@GetMapping("/getAdNewsWechatList")
public ResponseDto<?> getAdNewsWechatList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed",required = false) @ApiParam("使用状态") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
......@@ -141,8 +231,58 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsChooseList(partyId, title, hasUsed, currentPage, numPerPage));
return new ResponseDto<>(adNewsBiz.getAdNewsWechatList(currentPage, numPerPage));
}
@Override
@ApiOperation("获取早晚报发送记录")
@GetMapping("/getAdNewsMessageStatistic")
public ResponseDto<?> getAdNewsMessageStatistic(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("群名称、群分类、社群码、社群书") String title,
@RequestParam(value = "beginTime", required = false) @ApiParam("开始日期") String beginTime,
@RequestParam(value = "endTime", required = false) @ApiParam("结束日期") String endTime,
@RequestParam(value = "proLabelId", required = false) @ApiParam("专业") Long proLabelId,
@RequestParam(value = "depLabelId", required = false) @ApiParam("深度") Long depLabelId,
@RequestParam(value = "purLabelId", required = false) @ApiParam("目的") Long purLabelId,
@RequestParam(value = "currentPage", required = false, defaultValue = "0") @ApiParam("当前页") Integer currentPage,
@RequestParam(value = "numPerPage", required = false, defaultValue = "10") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsMessageStatistic(partyId, title, beginTime, endTime, proLabelId, depLabelId, purLabelId, currentPage, numPerPage));
}
@Override
@ApiOperation("查询早晚报发送详情")
@GetMapping("/getAdNewsGroupRecord")
public ResponseDto<?> getAdNewsGroupRecord(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("messageStatisticId") @ApiParam("统计表id") Long messageStatisticId
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(adNewsBiz.getAdNewsGroupRecord(partyId, messageStatisticId));
}
@Override
@ApiOperation("记录用户点击量")
@PostMapping("/addAdNewsClickRecord")
public ResponseDto<?> addAdNewsClickRecord(
@CookieValue("userInfo") @ApiParam("用户信息") String userInfo,
@RequestBody @ApiParam("用户点击量对象") AdNewsClickRecord adNewsClickRecord
) throws BizException, PermissionException {
Map<String, Object> map = Cookie.getUserInfo(userInfo);
Long channelId = (Long) map.get(Cookie._CHANNEL_ID);
Long wechatUserId = (Long) map.get(Cookie._WECHAT_USER_ID);
LOGGER.info("addAdNewsClickRecord Map => "+map.toString());
adNewsClickRecord.setWechatUserId(wechatUserId);
return new ResponseDto<>(adNewsBiz.addAdNewsClickRecord(adNewsClickRecord));
}
}
package com.pcloud.book.adnews.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/14 14:41
*/
@ApiModel
@Data
public class AdNewsGroupRecordVO {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("新闻id")
private Long adNewsId;
@ApiModelProperty("公众号名称")
private String wechatName;
@ApiModelProperty("新闻标题")
private String title;
@ApiModelProperty("新闻短链接")
private String shortUrl;
@ApiModelProperty("自定义早晚报内容")
private String customContent;
@ApiModelProperty("内容类型,0:早报;1:晚报")
private Integer contentType;
}
package com.pcloud.book.adnews.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zhengyongqiang
* @date 2019/8/14 10:43
*/
@Data
public class AdNewsMessageStatisticVO {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("微信群名称")
private String groupName;
@ApiModelProperty("分类")
private String classify;
@ApiModelProperty("社群码名称")
private String groupQrcodeName;
@ApiModelProperty("社群书名称")
private String bookName;
@ApiModelProperty("专业")
private String depLabelName;
@ApiModelProperty("深度")
private String proLabelName;
@ApiModelProperty("目的")
private String purLabelName;
@ApiModelProperty("专业Id")
private Long depLabelId;
@ApiModelProperty("深度Id")
private Long proLabelId;
@ApiModelProperty("目的Id")
private Long purLabelId;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("发送消息数")
private Integer messageCount;
@ApiModelProperty("发送时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("点击次数")
private Long clickCount;
@ApiModelProperty("点击人数")
private Long userCount;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsBanDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsBan">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="ad_news_id" property="adNewsId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, adviser_id, ad_news_id, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_choose
where id = #{id,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsBan" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_ban
(adviser_id,
ad_news_id,
create_time)
values(
#{adviserId,jdbcType=BIGINT},
#{adNewsId,jdbcType=BIGINT},
NOW())
</insert>
<!--根据id删除-->
<delete id="deleteByAdNewsId" parameterType="map">
DELETE FROM ad_news_ban
where ad_news_id=#{adNewsId} and adviser_id=#{partyId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsChooseDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsChoose">
<id column="id" property="id" jdbcType="BIGINT"/>
......@@ -8,7 +8,6 @@
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsClickRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsClickRecord">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="message_statistic_id" property="messageStatisticId" jdbcType="BIGINT"/>
<result column="group_record_id" property="groupRecordId" jdbcType="BIGINT"/>
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, message_statistic_id, group_record_id, wechat_user_id, create_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_click_record
where id = #{id,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsClickRecord" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_click_record
(message_statistic_id,
group_record_id,
wechat_user_id,
create_time)
values(
#{messageStatisticId,jdbcType=BIGINT},
#{groupRecordId,jdbcType=BIGINT},
#{wechatUserId,jdbcType=BIGINT},
NOW())
</insert>
</mapper>
......@@ -107,8 +107,19 @@
</update>
<!--根据早晚报设置id查询-->
<select id="getListByAdNewsSetId" parameterType="Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from ad_news_group
where is_delete=0 and ad_news_set_id=#{adNewsSetId}
<select id="getListByAdNewsSetId" parameterType="Long" resultType="com.pcloud.book.adnews.entity.AdNewsGroup">
select
a.id,
a.classify_id classifyId,
a.book_group_id bookGroupId,
a.ad_news_set_id adNewsSetId,
a.is_delete isDelete,
a.create_user createUser,
a.create_time createTime,
a.update_user updateUser,
a.update_time updateTime,
(select classify from book_group_classify b where b.id=a.classify_id) classify
from ad_news_group a
where a.is_delete=0 and a.ad_news_set_id=#{adNewsSetId}
</select>
</mapper>
\ No newline at end of file
......@@ -3,6 +3,7 @@
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsGroupRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsGroupRecord">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="message_statistic_id" property="messageStatisticId" jdbcType="BIGINT"/>
<result column="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
......@@ -12,10 +13,12 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="custom_content" property="customContent" jdbcType="VARCHAR"/>
<result column="content_type" property="contentType" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id, qrcode_id, classify_id, book_group_id, ad_news_id, ad_news_set_id, create_user, create_time, update_user, update_time
id, message_statistic_id,qrcode_id, classify_id, book_group_id, ad_news_id, ad_news_set_id, create_user, create_time, update_user, update_time, custom_content,content_type
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -25,9 +28,27 @@
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getAdNewsGroupRecord" resultType="com.pcloud.book.adnews.vo.AdNewsGroupRecordVO" parameterType="java.lang.Long">
SELECT
a.id,
a.ad_news_id adNewsId,
c.wechat_name wechatName,
b.title,
b.short_url shortUrl,
a.custom_content customContent,
a.content_type contentType
FROM
ad_news_group_record a
LEFT JOIN ad_news b ON a.ad_news_id=b.id
LEFT JOIN ad_news_wechat c ON b.news_from=c.news_from
WHERE a.message_statistic_id=#{messageStatisticId,jdbcType=BIGINT}
AND a.create_user=#{partyId,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsGroupRecord" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_group_record
<trim prefix="(" suffix=")" suffixOverrides=",">
message_statistic_id,
qrcode_id,
classify_id,
book_group_id,
......@@ -36,9 +57,12 @@
create_user,
create_time,
update_user,
update_time
update_time,
custom_content,
content_type
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{messageStatisticId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{bookGroupId,jdbcType=BIGINT},
......@@ -48,12 +72,17 @@
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
#{customContent,jdbcType=VARCHAR},
#{contentType,jdbcType=INTEGER}
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.adnews.entity.AdNewsGroupRecord">
update ad_news_group_record
<set>
<if test="messageStatisticId != null">
message_statistic_id = #{messageStatisticId,jdbcType=BIGINT},
</if>
<if test="qrcodeId != null">
qrcode_id = #{qrcodeId,jdbcType=BIGINT},
</if>
......@@ -72,14 +101,21 @@
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR},
</if>
<if test="customContent != null">
custom_content = #{customContent,jdbcType=VARCHAR},
</if>
<if test="contentType != null">
content_type = #{contentType,jdbcType=INTEGER},
</if>
update_time=now()
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
insert into ad_news_group_record (
message_statistic_id,
qrcode_id,
classify_id,
book_group_id,
......@@ -88,11 +124,14 @@
create_user,
create_time,
update_user,
update_time
update_time,
custom_content,
content_type
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.messageStatisticId,jdbcType=BIGINT},
#{item.qrcodeId,jdbcType=BIGINT},
#{item.classifyId,jdbcType=BIGINT},
#{item.bookGroupId,jdbcType=BIGINT},
......@@ -101,7 +140,9 @@
#{item.createUser,jdbcType=BIGINT},
NOW(),
#{item.updateUser,jdbcType=BIGINT},
NOW()
NOW(),
#{item.customContent,jdbcType=VARCHAR},
#{item.contentType,jdbcType=INTEGER}
)
</foreach>
</insert>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNews">
<id column="id" property="id" jdbcType="BIGINT"/>
......@@ -104,45 +104,70 @@
</insert>
<!--查找要发送的新闻-->
<!--
1、ad_news_ban 排除掉禁止发送的
2、ad_news_group_record 排除掉已发送的
-->
<select id="getNewsToSendBySetIdAndAdviser" parameterType="map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
a.id, a.type, a.news_from, a.title, a.publisher, a.url, a.short_url, a.news_date, a.create_time
FROM
ad_news t
ad_news a
INNER JOIN ad_news_wechat b ON a.news_from = b.news_from AND b.is_delete = 0
INNER JOIN ad_news_wechat_choose c ON c.ad_news_wechat_id = b.id AND c.is_delete = 0 AND c.adviser_id = #{adviserId}
WHERE
t.id IN (
SELECT
t1.ad_news_id
FROM
ad_news_choose t1
WHERE
t1.is_delete=0
and t1.adviser_id =#{adviserId}
)
AND t.id NOT IN (
SELECT
t2.ad_news_id
FROM
ad_news_group_record t2
WHERE
t2.ad_news_set_id =#{adNewsSetId}
)
NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = c.adviser_id )
AND NOT EXISTS (SELECT 1 from ad_news_group_record f WHERE f.ad_news_id=a.id and f.ad_news_set_id=#{adNewsSetId})
ORDER BY
t.create_time DESC
LIMIT #{top}
a.id DESC
LIMIT #{top}
</select>
<!--获取素材库列表-->
<select id="getAdNewsList" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from ad_news
where id not in (
select distinct ad_news_id from ad_news_choose
where adviser_id = #{partyId}
)
<select id="getAdNewsList" parameterType="map" resultType="com.pcloud.book.adnews.entity.AdNews">
SELECT
a.id id
,a.type type
,a.news_from newsFrom
,a.title title
,a.publisher publisher
,a.url url
,a.short_url shortUrl
,a.news_date newsDate
,a.create_time createTime
,IFNULL((SELECT 1 FROM ad_news_group_record WHERE ad_news_id=a.id and create_user=#{partyId} LIMIT 1),0) hasUsed
,IFNULL((SELECT 1 FROM ad_news_ban WHERE ad_news_id=a.id and adviser_id=#{partyId} LIMIT 1),0) hasBan
FROM
ad_news a
INNER JOIN ad_news_wechat b on a.news_from=b.news_from and b.is_delete=0
<if test="adNewsWechatIds != null and adNewsWechatIds.size()>0">
AND b.id IN
<foreach collection="adNewsWechatIds" item="item" index="i" separator="," open="(" close=")">
${item}
</foreach>
</if>
where 1=1
<if test="title!=null">
and title like concat('%', #{title},'%')
AND a.title like concat('%', #{title},'%')
</if>
<if test="beginTime!=null">
AND a.news_date <![CDATA[>=]]> #{beginTime}
</if>
<if test="endTime!=null">
AND a.news_date<![CDATA[<=]]> #{endTime}
</if>
<if test="hasBan==0">
AND NOT EXISTS (SELECT 1 FROM ad_news_ban WHERE ad_news_id=a.id and adviser_id=#{partyId} LIMIT 1)
</if>
<if test="hasBan==1">
AND EXISTS (SELECT 1 FROM ad_news_ban WHERE ad_news_id=a.id and adviser_id=#{partyId} LIMIT 1)
</if>
<if test="hasUsed==0">
AND NOT EXISTS (SELECT 1 FROM ad_news_group_record WHERE ad_news_id=a.id and create_user=#{partyId} LIMIT 1)
</if>
<if test="hasUsed==1">
AND EXISTS (SELECT 1 FROM ad_news_group_record WHERE ad_news_id=a.id and create_user=#{partyId} LIMIT 1)
</if>
order by create_time desc
</select>
<!--获取编辑选择的素材-->
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsMessageStatisticDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsMessageStatistic">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="ad_news_set_id" property="adNewsSetId" jdbcType="BIGINT"/>
<result column="content_from" property="contentFrom" jdbcType="INTEGER"/>
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, qrcode_id, classify_id, book_group_id, ad_news_set_id, content_from, message_count, create_user, create_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_group_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getAdNewsMessageStatistic" resultType="com.pcloud.book.adnews.vo.AdNewsMessageStatisticVO" parameterType="map">
SELECT
DISTINCT
a.id,
d.group_name groupName,
c.classify classify,
b.group_qrcode_name groupQrcodeName,
e.BOOK_NAME bookName,
b.pro_label_id proLabelId,
b.dep_label_id depLabelId,
b.pur_label_id purLabelId,
a.message_count messageCount,
a.create_time createTime,
a.content_from contentFrom,
(SELECT COUNT(1) FROM ad_news_click_record x WHERE x.message_statistic_id=a.id) clickCount,
(SELECT COUNT(DISTINCT wechat_user_id) FROM ad_news_click_record x WHERE x.message_statistic_id=a.id) userCount
FROM
ad_news_message_statistic a
INNER JOIN book_group b ON a.book_group_id = b.id
INNER JOIN book_group_classify c ON a.classify_id = c.id
INNER JOIN book_group_qrcode d ON a.qrcode_id = d.id
INNER JOIN book e ON b.book_id = e.BOOK_ID
WHERE
a.create_user = #{partyId}
<if test="title!=null">
AND (
d.group_name like concat('%', #{title}, '%')
OR c.classify like concat('%', #{title}, '%')
OR b.group_qrcode_name like concat('%', #{title}, '%')
OR e.BOOK_NAME like concat('%', #{title}, '%')
)
</if>
<if test="beginTime!=null">
AND a.create_time <![CDATA[>=]]>#{beginTime}
</if>
<if test="endTime!=null">
AND a.create_time <![CDATA[<=]]>#{endTime}
</if>
<if test="proLabelId!=null">
AND b.pro_label_id=#{proLabelId}
</if>
<if test="depLabelId!=null">
AND b.dep_label_id=#{depLabelId}
</if>
<if test="purLabelId!=null">
AND b.pur_label_id=#{purLabelId}
</if>
ORDER BY
a.id DESC
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsMessageStatistic" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_message_statistic
<trim prefix="(" suffix=")" suffixOverrides=",">
qrcode_id,
classify_id,
book_group_id,
ad_news_set_id,
content_from,
message_count,
create_user,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{qrcodeId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{bookGroupId,jdbcType=BIGINT},
#{adNewsSetId,jdbcType=BIGINT},
#{contentFrom,jdbcType=INTEGER},
#{messageCount,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
insert into ad_news_message_statistic (
qrcode_id,
classify_id,
book_group_id,
ad_news_set_id,
content_from,
message_count,
create_user,
create_time
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.qrcodeId,jdbcType=BIGINT},
#{item.classifyId,jdbcType=BIGINT},
#{item.bookGroupId,jdbcType=BIGINT},
#{item.adNewsSetId,jdbcType=BIGINT},
#{item.contentFrom,jdbcType=INTEGER},
#{item.messageCount,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -16,11 +16,15 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="content_from" property="contentFrom" jdbcType="INTEGER"/>
<result column="morning_content" property="morningContent" jdbcType="VARCHAR"/>
<result column="evening_content" property="eveningContent" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, morning_time, evening_time, has_morning_open, has_evening_open, send_count, start_content,
end_content, has_start_content, has_end_content, create_user, create_time, update_user, update_time
,content_from,morning_content,evening_content
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -45,7 +49,10 @@
create_user,
create_time,
update_user,
update_time
update_time,
content_from,
morning_content,
evening_content
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{morningTime,jdbcType=VARCHAR},
......@@ -61,6 +68,9 @@
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
#{contentFrom,jdbcType=BIGINT},
#{morningContent,jdbcType=VARCHAR},
#{eveningContent,jdbcType=VARCHAR},
</trim>
</insert>
......@@ -97,7 +107,16 @@
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=BIGINT},
</if>
update_time = NOW(),
<if test="contentFrom != null">
content_from = #{contentFrom,jdbcType=BIGINT},
</if>
<if test="morningContent != null">
morning_content = #{morningContent,jdbcType=VARCHAR},
</if>
<if test="eveningContent != null">
evening_content = #{eveningContent,jdbcType=VARCHAR},
</if>
update_time = NOW()
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatChooseDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechatChoose">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="ad_news_wechat_id" property="adNewsWechatId" jdbcType="BIGINT"/>
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, adviser_id, ad_news_wechat_id, is_delete, create_time, create_user, update_time, update_user
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_wechat_choose
where id = #{id,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechatChoose" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_wechat_choose
<trim prefix="(" suffix=")" suffixOverrides=",">
adviser_id,
ad_news_wechat_id,
is_delete,
create_user,
create_time,
update_user,
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{adviserId,jdbcType=BIGINT},
#{adNewsWechatId,jdbcType=BIGINT},
0,
#{createUser,jdbcType=BIGINT},
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.adnews.entity.AdNewsWechatChoose">
update ad_news_wechat_choose
<set>
<if test="adviserId != null">
adviser_id = #{adviserId,jdbcType=BIGINT},
</if>
<if test="adNewsWechatId != null">
ad_news_wechat_id = #{adNewsWechatId,jdbcType=BIGINT},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=BOOLEAN},
</if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR},
</if>
update_time=now()
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into ad_news_wechat_choose (
adviser_id,
ad_news_wechat_id,
is_delete,
create_user,
create_time,
update_user,
update_time
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.adviserId,jdbcType=BIGINT},
#{item.adNewsWechatId,jdbcType=BIGINT},
0,
#{item.createUser,jdbcType=BIGINT},
NOW(),
#{item.updateUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<!--根据id删除-->
<update id="deleteAdNewsWechatChooseById" parameterType="map">
update ad_news_wechat_choose set
is_delete=1,
update_user=#{partyId},
update_time=now()
where ad_news_wechat_id=#{adNewsWechatId}
</update>
<!--根据编辑id删除-->
<update id="deleteAdNewsWechatChooseByPartyId" parameterType="map">
update ad_news_wechat_choose set
is_delete=1,
update_user=#{partyId},
update_time=now()
where adviser_id=#{partyId}
</update>
<!--根据条件获取数量-->
<select id="getCountByAdNewsWechatIdsAndPartyId" parameterType="map" resultType="Integer">
select count(1) from ad_news_wechat_choose where
is_delete=0
and adviser_id=#{partyId}
and ad_news_wechat_id in
<foreach collection="adNewsWechatIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="news_from" property="newsFrom" jdbcType="VARCHAR"/>
<result column="wechat_name" property="wechatName" jdbcType="VARCHAR"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, news_from, wechat_name, adviser_id, is_delete, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_wechat
where id = #{id,jdbcType=BIGINT}
</select>
<!--获取公众号列表-->
<select id="getAdNewsWechatList" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from ad_news_wechat
where
news_from IS NOT NULL
order by id desc
</select>
<!--获取编辑已选中的公众号列表-->
<select id="getAdNewsWechatChooseList" parameterType="map" resultMap="BaseResultMap">
SELECT
a.id,
a.news_from,
a.wechat_name,
a.adviser_id,
a.is_delete,
a.create_time,
a.update_time
FROM
ad_news_wechat a
INNER JOIN ad_news_wechat_choose b ON b.ad_news_wechat_id = a.id
AND b.is_delete = 0
AND b.adviser_id = #{partyId}
WHERE
a.`news_from` IS NOT NULL
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_wechat
<trim prefix="(" suffix=")" suffixOverrides=",">
news_from, wechat_name, adviser_id, is_delete, create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{newsFrom,jdbcType=VARCHAR},
#{wechatName,jdbcType=VARCHAR},
#{adviserId,jdbcType=BIGINT},
#{isDelete,jdbcType=BOOLEAN},
NOW()
</trim>
</insert>
</mapper>
\ No newline at end of file
import com.pcloud.book.BookApplication;
import com.pcloud.book.adnews.biz.AdNewsBiz;
import com.pcloud.book.book.biz.BookKeywordWarehouseBiz;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.vo.BookKeywordDetailVO;
import com.pcloud.book.book.vo.BookKeywordProductVO;
import com.pcloud.book.book.vo.KeywordWearhouseLabelVO;
import com.pcloud.book.book.vo.request.AddBookKeywordRequestVO;
import com.pcloud.book.book.vo.request.CheckKeywordRequestVO;
import com.pcloud.book.book.vo.request.EditBookKeywordRequestVO;
import com.pcloud.book.book.vo.request.QueryBookKeywordWarehouseRequestVO;
import com.pcloud.book.book.vo.response.BookKeywordResponseVO;
import com.pcloud.common.page.PageBeanNew;
import org.assertj.core.util.Lists;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {BookApplication.class, BookKeywordWarehouseBizTest.class})
public class BookKeywordWarehouseBizTest {
@Resource
private BookKeywordWarehouseBiz bookKeywordWarehouseBiz;
@Resource
private AdNewsBiz adNewsBiz;
@Test
public void testQuartzAdNewsBiz(){
adNewsBiz.sendAdNews((2L));
}
@Test
public void addBookKeyword() {
AddBookKeywordRequestVO vo = new AddBookKeywordRequestVO();
vo.setUserId(1L);
vo.setKeyword("语文1");
vo.setGuide("12341234");
vo.setMatchingRule(0);
vo.setScope(0);
vo.setAuditStatus(1);
List<BookKeywordDetailVO> details = Lists.newArrayList();
for (Integer i = 1; i < 3; i++) {
BookKeywordDetailVO v = new BookKeywordDetailVO();
final List<KeywordWearhouseLabelVO> objects = Lists.newArrayList();
for (Integer j = 3; j < 6; j++) {
KeywordWearhouseLabelVO v1 = new KeywordWearhouseLabelVO();
v1.setProfessionalLabelId(6L);
v1.setDepthLabelId(j.longValue());
v1.setPurposeLabelId(j.longValue());
objects.add(v1);
}
v.setGroupId(1);
v.setProductId(1L);
v.setProductType("APP");
v.setDescription("111");
v.setLinkUrl("www.baidu.com");
v.setPicUrl("www.baidu.com");
details.add(v);
}
BookKeywordDetailVO v = new BookKeywordDetailVO();
final List<KeywordWearhouseLabelVO> objects = Lists.newArrayList();
KeywordWearhouseLabelVO v1 = new KeywordWearhouseLabelVO();
v1.setProfessionalLabelId(6L);
v1.setDepthLabelId(8L);
v1.setPurposeLabelId(9L);
objects.add(v1);
v.setLabels(Collections.singletonList(v1));
v.setGroupId(2);
v.setProductId(1L);
v.setProductType("APP");
v.setDescription("111");
v.setLinkUrl("www.baidu.com");
v.setPicUrl("www.baidu.com");
details.add(v);
vo.setDetails(details);
this.bookKeywordWarehouseBiz.addBookKeyword(vo, null);
}
@Test
public void editBookKeyword() {
EditBookKeywordRequestVO vo = new EditBookKeywordRequestVO();
vo.setUserId(3L);
vo.setKeywordId(1L);
vo.setKeyword("数学");
vo.setGuide("数学之美");
vo.setMatchingRule(0);
vo.setScope(0);
vo.setEditorId(1L);
List<BookKeywordDetailVO> details = Lists.newArrayList();
for (Integer i = 0; i < 3; i++) {
BookKeywordDetailVO v = new BookKeywordDetailVO();
final List<KeywordWearhouseLabelVO> objects = Lists.newArrayList();
for (Integer j = 3; j < 6; j++) {
KeywordWearhouseLabelVO v1 = new KeywordWearhouseLabelVO();
v1.setProfessionalLabelId(6L);
v1.setDepthLabelId(j.longValue());
v1.setPurposeLabelId(j.longValue());
objects.add(v1);
}
v.setGroupId(1);
v.setProductId(3L);
v.setProductType("APP");
v.setDescription("333");
v.setLinkUrl("www.baidu3.com");
v.setPicUrl("www.baidu3.com");
details.add(v);
}
BookKeywordDetailVO v = new BookKeywordDetailVO();
KeywordWearhouseLabelVO v1 = new KeywordWearhouseLabelVO();
v1.setProfessionalLabelId(6L);
v1.setDepthLabelId(8L);
v1.setPurposeLabelId(9L);
v.setLabels(Collections.singletonList(v1));
v.setGroupId(2);
v.setProductId(4L);
v.setProductType("APP");
v.setDescription("444");
v.setLinkUrl("www.baidu4.com");
v.setPicUrl("www.baidu4.com");
details.add(v);
vo.setDetails(details);
this.bookKeywordWarehouseBiz.editBookKeyword(vo);
}
@Test
public void deleteBookKeyword() {
this.bookKeywordWarehouseBiz.deleteBookKeyword(1L, 1L);
}
@Test
public void listBookKeywordWarehouse() {
QueryBookKeywordWarehouseRequestVO vo = new QueryBookKeywordWarehouseRequestVO();
vo.setCurrentPage(0);
vo.setNumPerPage(10);
vo.setKeyword("1234123414");
final PageBeanNew<BookKeywordResponseVO> warehouse = this.bookKeywordWarehouseBiz.listBookKeywordWarehouse(vo);
for (BookKeywordResponseVO responseVO : warehouse.getRecordList()) {
System.out.println(responseVO);
}
}
@Test
public void useKeyword() {
this.bookKeywordWarehouseBiz.useKeyword(1L, 1L);
}
@Test
public void oftenKeyword() {
final PageBeanNew<BookKeywordProductVO> oftenKeyword = this.bookKeywordWarehouseBiz.oftenKeyword(0, 10, 0L, 1L, 1L, 0L);
for (BookKeywordProductVO responseVO : oftenKeyword.getRecordList()) {
System.out.println(responseVO);
}
}
@Test
public void hotKeyword() {
final PageBeanNew<BookKeywordProductVO> oftenKeyword = this.bookKeywordWarehouseBiz.hotKeyword(0, 10, 47L, 50L,"", 1L, 0L);
for (BookKeywordProductVO responseVO : oftenKeyword.getRecordList()) {
System.out.println(responseVO);
}
}
@Test
public void auditKeyword() {
this.bookKeywordWarehouseBiz.auditKeyword(1L, 3L, BookConstant.BookKeywordAuditEnum.PASS_THE_AUDIT);
}
@Test
public void checkKeyword() {
CheckKeywordRequestVO vo = new CheckKeywordRequestVO();
final List<Long> longs = this.bookKeywordWarehouseBiz.checkKeyword(vo);
System.out.println(longs);
}
}
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