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; package com.pcloud.book.adnews.biz;
import com.pcloud.book.adnews.entity.AdNews; import com.pcloud.book.adnews.entity.*;
import com.pcloud.book.adnews.entity.AdNewsSet; 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 com.pcloud.common.page.PageBeanNew;
import java.util.List; import java.util.List;
...@@ -40,10 +42,86 @@ public interface AdNewsBiz { ...@@ -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); 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);
} }
package com.pcloud.book.adnews.check; 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.AdNewsGroup;
import com.pcloud.book.adnews.entity.AdNewsSet; import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.enums.AdContentFromEnum;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -16,49 +19,52 @@ import org.springframework.stereotype.Component; ...@@ -16,49 +19,52 @@ import org.springframework.stereotype.Component;
public class AdNewsCheck { public class AdNewsCheck {
public void createAdNewsSetCheck(AdNewsSet adNewsSet){ public void createAdNewsSetCheck(AdNewsSet adNewsSet) {
if (adNewsSet==null){ if (adNewsSet == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
} }
if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())){ if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"发送群分类不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送群分类不能为空!");
} }
if (adNewsSet.getSendCount()==null||adNewsSet.getSendCount()<=0){ if (adNewsSet.getSendCount() == null || adNewsSet.getSendCount() <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"推送条数不能为空且必须大于0!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "推送条数不能为空且必须大于0!");
} }
if (adNewsSet.getHasMorningOpen()==null){ if (adNewsSet.getHasMorningOpen() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启早报不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启早报不能为空!");
} }
if (adNewsSet.getHasEveningOpen()==null){ if (adNewsSet.getHasEveningOpen() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启晚报不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启晚报不能为空!");
} }
if (adNewsSet.getHasStartContent()==null){ if (adNewsSet.getHasStartContent() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启开场语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启开场语不能为空!");
} }
if (adNewsSet.getHasEndContent()==null){ if (adNewsSet.getHasEndContent() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启结束语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启结束语不能为空!");
} }
if (adNewsSet.getHasMorningOpen()&&StringUtil.isEmpty(adNewsSet.getMorningTime())){ if (adNewsSet.getHasMorningOpen() && StringUtil.isEmpty(adNewsSet.getMorningTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"早报时间不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "早报时间不能为空!");
} }
if (adNewsSet.getHasEveningOpen()&&StringUtil.isEmpty(adNewsSet.getEveningTime())){ if (adNewsSet.getHasEveningOpen() && StringUtil.isEmpty(adNewsSet.getEveningTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"晚报时间不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "晚报时间不能为空!");
} }
if (adNewsSet.getHasStartContent()&&StringUtil.isEmpty(adNewsSet.getStartContent())){ if (adNewsSet.getHasStartContent() && StringUtil.isEmpty(adNewsSet.getStartContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"开场语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "开场语不能为空!");
} }
if (adNewsSet.getHasEndContent()&&StringUtil.isEmpty(adNewsSet.getEndContent())){ if (adNewsSet.getHasEndContent() && StringUtil.isEmpty(adNewsSet.getEndContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"结束语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "结束语不能为空!");
} }
for(AdNewsGroup adNewsGroup:adNewsSet.getAdNewsGroups()){ if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key && adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key) {
if (adNewsGroup==null){ throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!");
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){ if (adNewsGroup.getClassifyId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"群分类id不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "群分类id不能为空!");
} }
if (adNewsGroup.getBookGroupId()==null){ if (adNewsGroup.getBookGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"社群码id不能为空!"); 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; ...@@ -6,9 +6,15 @@ import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
public interface AdNewsGroupDao extends BaseDao<AdNewsGroup> { public interface AdNewsGroupDao extends BaseDao<AdNewsGroup> {
Integer batchInsert(List<AdNewsGroup> adNewsGroups); Integer batchInsert(List<AdNewsGroup> adNewsGroups);
void deleteByAdNewsSetId(Long adNewsSetId); void deleteByAdNewsSetId(Long adNewsSetId);
/**
* 获取勾选关联的社群
* @param adNewsSetId
* @return
*/
List<AdNewsGroup> getListByAdNewsSetId(Long adNewsSetId); List<AdNewsGroup> getListByAdNewsSetId(Long adNewsSetId);
} }
package com.pcloud.book.adnews.dao; package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord; import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
...@@ -12,4 +13,6 @@ import java.util.List; ...@@ -12,4 +13,6 @@ import java.util.List;
**/ **/
public interface AdNewsGroupRecordDao extends BaseDao<AdNewsGroupRecord> { public interface AdNewsGroupRecordDao extends BaseDao<AdNewsGroupRecord> {
Integer batchInsert(List<AdNewsGroupRecord> adNewsGroupRecords); 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; ...@@ -2,10 +2,13 @@ package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsGroupRecordDao; import com.pcloud.book.adnews.dao.AdNewsGroupRecordDao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord; import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description * @Description
...@@ -18,4 +21,12 @@ public class AdNewsGroupRecordDaoImpl extends BaseDaoImpl<AdNewsGroupRecord> imp ...@@ -18,4 +21,12 @@ public class AdNewsGroupRecordDaoImpl extends BaseDaoImpl<AdNewsGroupRecord> imp
public Integer batchInsert(List<AdNewsGroupRecord> list) { public Integer batchInsert(List<AdNewsGroupRecord> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), 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 { ...@@ -38,6 +38,9 @@ public class AdNews extends BaseEntity {
@ApiModelProperty("是否使用") @ApiModelProperty("是否使用")
private Boolean hasUsed; private Boolean hasUsed;
@ApiModelProperty("是否禁用")
private Boolean hasBan ;
public String getType() { public String getType() {
return type; return type;
} }
...@@ -102,6 +105,14 @@ public class AdNews extends BaseEntity { ...@@ -102,6 +105,14 @@ public class AdNews extends BaseEntity {
this.hasUsed = hasUsed; this.hasUsed = hasUsed;
} }
public Boolean getHasBan() {
return hasBan;
}
public void setHasBan(Boolean hasBan) {
this.hasBan = hasBan;
}
@Override @Override
public String toString() { public String toString() {
return "AdNews{" + return "AdNews{" +
...@@ -113,6 +124,9 @@ public class AdNews extends BaseEntity { ...@@ -113,6 +124,9 @@ public class AdNews extends BaseEntity {
", shortUrl='" + shortUrl + '\'' + ", shortUrl='" + shortUrl + '\'' +
", newsDate='" + newsDate + '\'' + ", newsDate='" + newsDate + '\'' +
", hasUsed=" + hasUsed + ", 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; ...@@ -3,12 +3,14 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @Description * @Description
* @Author ruansiyuan * @Author ruansiyuan
* @Date 2019/7/17 15:20 * @Date 2019/7/17 15:20
**/ **/
@Data
@ApiModel("编辑新闻群关联") @ApiModel("编辑新闻群关联")
public class AdNewsGroup extends BaseEntity { public class AdNewsGroup extends BaseEntity {
...@@ -32,63 +34,7 @@ public class AdNewsGroup extends BaseEntity { ...@@ -32,63 +34,7 @@ public class AdNewsGroup extends BaseEntity {
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
public Long getClassifyId() { @ApiModelProperty("分类")
return classifyId; 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; ...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @Description * @Description
...@@ -10,10 +11,14 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -10,10 +11,14 @@ import io.swagger.annotations.ApiModelProperty;
* @Date 2019/7/17 15:55 * @Date 2019/7/17 15:55
**/ **/
@ApiModel("编辑新闻发送记录") @ApiModel("编辑新闻发送记录")
@Data
public class AdNewsGroupRecord extends BaseEntity{ public class AdNewsGroupRecord extends BaseEntity{
private static final long serialVersionUID = -3271071194854381077L; private static final long serialVersionUID = -3271071194854381077L;
@ApiModelProperty("消息统计表id")
private Long messageStatisticId;
@ApiModelProperty("群id") @ApiModelProperty("群id")
private Long qrcodeId; private Long qrcodeId;
...@@ -35,72 +40,12 @@ public class AdNewsGroupRecord extends BaseEntity{ ...@@ -35,72 +40,12 @@ public class AdNewsGroupRecord extends BaseEntity{
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
public Long getQrcodeId() { @ApiModelProperty("自定义内容")
return qrcodeId; private String customContent;
}
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;
}
public void setUpdateUser(Long updateUser) { @ApiModelProperty("内容类型,0:早报;1:晚报")
this.updateUser = updateUser; private Integer contentType;
}
@Override @ApiModelProperty("insert时父子表标识")
public String toString() { Integer insertMark;
return "AdNewsGroupRecord{" +
"qrcodeId=" + qrcodeId +
", classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", adNewsId=" + adNewsId +
", adNewsSetId=" + adNewsSetId +
", createUser=" + createUser +
", updateUser=" + updateUser +
"} " + super.toString();
}
} }
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; ...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List; import java.util.List;
...@@ -11,6 +12,7 @@ import java.util.List; ...@@ -11,6 +12,7 @@ import java.util.List;
* @Author ruansiyuan * @Author ruansiyuan
* @Date 2019/7/17 16:13 * @Date 2019/7/17 16:13
**/ **/
@Data
@ApiModel("编辑新闻发送记录") @ApiModel("编辑新闻发送记录")
public class AdNewsSet extends BaseEntity { public class AdNewsSet extends BaseEntity {
...@@ -49,132 +51,21 @@ public class AdNewsSet extends BaseEntity { ...@@ -49,132 +51,21 @@ public class AdNewsSet extends BaseEntity {
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("早报内容")
private String morningContent;
@ApiModelProperty("晚报内容")
private String eveningContent;
@ApiModelProperty("内容类型")
private Integer contentType;
@ApiModelProperty("分类关联集合") @ApiModelProperty("分类关联集合")
private List<AdNewsGroup> adNewsGroups; private List<AdNewsGroup> adNewsGroups;
@ApiModelProperty("分类id集合") @ApiModelProperty("分类id集合")
private List<Long> classifyIds; 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; 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.entity.AdNewsSet;
import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@FeignClient(value = "pcloud-service-book",qualifier = "adNewsFacadeCloud",path = "adNews") @FeignClient(value = "pcloud-service-book", qualifier = "adNewsFacadeCloud", path = "adNews")
@Api(description = "推送群消息外部接口") @Api(description = "推送群消息外部接口")
public interface AdNewsFacade { public interface AdNewsFacade {
@ApiOperation("新增编辑端早晚报设置") @ApiOperation("新增编辑端早晚报设置")
@PostMapping("/createAdNewsSet") @PostMapping("/createAdNewsSet")
ResponseDto<?> createAdNewsSet( ResponseDto<?> createAdNewsSet(
...@@ -37,6 +36,7 @@ public interface AdNewsFacade { ...@@ -37,6 +36,7 @@ public interface AdNewsFacade {
@RequestHeader("token") @ApiParam("token信息") String token @RequestHeader("token") @ApiParam("token信息") String token
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@Deprecated
@ApiOperation("编辑添加选择的早晚报素材") @ApiOperation("编辑添加选择的早晚报素材")
@PostMapping("/createAdNewsChooseBatch") @PostMapping("/createAdNewsChooseBatch")
ResponseDto<?> createAdNewsChooseBatch( ResponseDto<?> createAdNewsChooseBatch(
...@@ -44,6 +44,7 @@ public interface AdNewsFacade { ...@@ -44,6 +44,7 @@ public interface AdNewsFacade {
@RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds @RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@Deprecated
@ApiOperation("编辑移除选择的早晚报素材") @ApiOperation("编辑移除选择的早晚报素材")
@GetMapping("/deleteAdNewsChoose") @GetMapping("/deleteAdNewsChoose")
ResponseDto<?> deleteAdNewsChoose( ResponseDto<?> deleteAdNewsChoose(
...@@ -51,23 +52,91 @@ public interface AdNewsFacade { ...@@ -51,23 +52,91 @@ public interface AdNewsFacade {
@RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId @RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("获取早晚报素材库") @Deprecated
@GetMapping("/getAdNewsList") @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( ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token, @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("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("获取编辑选择的早晚报素材库") @ApiOperation("获取所有的公众号列表")
@GetMapping("/getAdNewsChooseList") @GetMapping("/getAdNewsWechatList")
ResponseDto<?> getAdNewsChooseList( ResponseDto<?> getAdNewsWechatList(
@RequestHeader("token") @ApiParam("token信息") String token, @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("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) 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.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" ?> <?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"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsChooseDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsChoose"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsChoose">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/> <result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/> <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_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap> </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 @@ ...@@ -107,8 +107,19 @@
</update> </update>
<!--根据早晚报设置id查询--> <!--根据早晚报设置id查询-->
<select id="getListByAdNewsSetId" parameterType="Long" resultMap="BaseResultMap"> <select id="getListByAdNewsSetId" parameterType="Long" resultType="com.pcloud.book.adnews.entity.AdNewsGroup">
select <include refid="Base_Column_List"/> from ad_news_group select
where is_delete=0 and ad_news_set_id=#{adNewsSetId} 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> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsGroupRecordDaoImpl"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsGroupRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsGroupRecord"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsGroupRecord">
<id column="id" property="id" jdbcType="BIGINT"/> <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="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/> <result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/> <result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
...@@ -12,10 +13,12 @@ ...@@ -12,10 +13,12 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/> <result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <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> </resultMap>
<sql id="Base_Column_List"> <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> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -25,9 +28,27 @@ ...@@ -25,9 +28,27 @@
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </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 id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsGroupRecord" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_group_record insert into ad_news_group_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
message_statistic_id,
qrcode_id, qrcode_id,
classify_id, classify_id,
book_group_id, book_group_id,
...@@ -36,9 +57,12 @@ ...@@ -36,9 +57,12 @@
create_user, create_user,
create_time, create_time,
update_user, update_user,
update_time update_time,
custom_content,
content_type
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{messageStatisticId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT}, #{qrcodeId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT}, #{classifyId,jdbcType=BIGINT},
#{bookGroupId,jdbcType=BIGINT}, #{bookGroupId,jdbcType=BIGINT},
...@@ -48,12 +72,17 @@ ...@@ -48,12 +72,17 @@
NOW(), NOW(),
#{updateUser,jdbcType=BIGINT}, #{updateUser,jdbcType=BIGINT},
NOW(), NOW(),
#{customContent,jdbcType=VARCHAR},
#{contentType,jdbcType=INTEGER}
</trim> </trim>
</insert> </insert>
<update id="update" parameterType="com.pcloud.book.adnews.entity.AdNewsGroupRecord"> <update id="update" parameterType="com.pcloud.book.adnews.entity.AdNewsGroupRecord">
update ad_news_group_record update ad_news_group_record
<set> <set>
<if test="messageStatisticId != null">
message_statistic_id = #{messageStatisticId,jdbcType=BIGINT},
</if>
<if test="qrcodeId != null"> <if test="qrcodeId != null">
qrcode_id = #{qrcodeId,jdbcType=BIGINT}, qrcode_id = #{qrcodeId,jdbcType=BIGINT},
</if> </if>
...@@ -72,14 +101,21 @@ ...@@ -72,14 +101,21 @@
<if test="updateUser != null"> <if test="updateUser != null">
update_user = #{updateUser,jdbcType=VARCHAR}, update_user = #{updateUser,jdbcType=VARCHAR},
</if> </if>
<if test="customContent != null">
custom_content = #{customContent,jdbcType=VARCHAR},
</if>
<if test="contentType != null">
content_type = #{contentType,jdbcType=INTEGER},
</if>
update_time=now() update_time=now()
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </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 ( insert into ad_news_group_record (
message_statistic_id,
qrcode_id, qrcode_id,
classify_id, classify_id,
book_group_id, book_group_id,
...@@ -88,11 +124,14 @@ ...@@ -88,11 +124,14 @@
create_user, create_user,
create_time, create_time,
update_user, update_user,
update_time update_time,
custom_content,
content_type
) )
values values
<foreach collection="list" item="item" index="index" separator="," > <foreach collection="list" item="item" index="index" separator="," >
( (
#{item.messageStatisticId,jdbcType=BIGINT},
#{item.qrcodeId,jdbcType=BIGINT}, #{item.qrcodeId,jdbcType=BIGINT},
#{item.classifyId,jdbcType=BIGINT}, #{item.classifyId,jdbcType=BIGINT},
#{item.bookGroupId,jdbcType=BIGINT}, #{item.bookGroupId,jdbcType=BIGINT},
...@@ -101,7 +140,9 @@ ...@@ -101,7 +140,9 @@
#{item.createUser,jdbcType=BIGINT}, #{item.createUser,jdbcType=BIGINT},
NOW(), NOW(),
#{item.updateUser,jdbcType=BIGINT}, #{item.updateUser,jdbcType=BIGINT},
NOW() NOW(),
#{item.customContent,jdbcType=VARCHAR},
#{item.contentType,jdbcType=INTEGER}
) )
</foreach> </foreach>
</insert> </insert>
......
<?xml version="1.0" encoding="UTF-8" ?> <?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"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNews"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNews">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
...@@ -104,45 +104,70 @@ ...@@ -104,45 +104,70 @@
</insert> </insert>
<!--查找要发送的新闻--> <!--查找要发送的新闻-->
<!--
1、ad_news_ban 排除掉禁止发送的
2、ad_news_group_record 排除掉已发送的
-->
<select id="getNewsToSendBySetIdAndAdviser" parameterType="map" resultMap="BaseResultMap"> <select id="getNewsToSendBySetIdAndAdviser" parameterType="map" resultMap="BaseResultMap">
SELECT 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 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 WHERE
t.id IN ( NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = c.adviser_id )
SELECT 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})
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}
)
ORDER BY ORDER BY
t.create_time DESC a.id DESC
LIMIT #{top} LIMIT #{top}
</select> </select>
<!--获取素材库列表--> <!--获取素材库列表-->
<select id="getAdNewsList" parameterType="map" resultMap="BaseResultMap"> <select id="getAdNewsList" parameterType="map" resultType="com.pcloud.book.adnews.entity.AdNews">
select <include refid="Base_Column_List"/> from ad_news SELECT
where id not in ( a.id id
select distinct ad_news_id from ad_news_choose ,a.type type
where adviser_id = #{partyId} ,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"> <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> </if>
order by create_time desc
</select> </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 @@ ...@@ -16,11 +16,15 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/> <result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <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> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, morning_time, evening_time, has_morning_open, has_evening_open, send_count, start_content, 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 end_content, has_start_content, has_end_content, create_user, create_time, update_user, update_time
,content_from,morning_content,evening_content
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -45,7 +49,10 @@ ...@@ -45,7 +49,10 @@
create_user, create_user,
create_time, create_time,
update_user, update_user,
update_time update_time,
content_from,
morning_content,
evening_content
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{morningTime,jdbcType=VARCHAR}, #{morningTime,jdbcType=VARCHAR},
...@@ -61,6 +68,9 @@ ...@@ -61,6 +68,9 @@
NOW(), NOW(),
#{updateUser,jdbcType=BIGINT}, #{updateUser,jdbcType=BIGINT},
NOW(), NOW(),
#{contentFrom,jdbcType=BIGINT},
#{morningContent,jdbcType=VARCHAR},
#{eveningContent,jdbcType=VARCHAR},
</trim> </trim>
</insert> </insert>
...@@ -97,7 +107,16 @@ ...@@ -97,7 +107,16 @@
<if test="updateUser != null"> <if test="updateUser != null">
update_user = #{updateUser,jdbcType=BIGINT}, update_user = #{updateUser,jdbcType=BIGINT},
</if> </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> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </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