Commit 4c915644 by 高鹏

Merge branch 'feat-zyq-1001743' into 'master'

1001743-增加早晚报推送规则

See merge request rays/pcloud-book!201
parents 3419f6da c71de252
...@@ -17,4 +17,30 @@ public interface AdNewsDao extends BaseDao<AdNews> { ...@@ -17,4 +17,30 @@ public interface AdNewsDao extends BaseDao<AdNews> {
* @return * @return
*/ */
List<AdNews> getNewsToSendBySetIdAndAdviser4Own(Long adNewsSetId, Long adviserId, Integer top); List<AdNews> getNewsToSendBySetIdAndAdviser4Own(Long adNewsSetId, Long adviserId, Integer top);
/**
* 根据标签匹配新闻————新闻标题
* @param adNewsSetId
* @param adviserId
* @param beginTime
* @param proLabelName
* @param depLabelName
* @param purLabelName
* @param top
* @return
*/
List<AdNews> getNewsByLabelName(Long adNewsSetId, Long adviserId, String beginTime, String proLabelName, String depLabelName, String purLabelName, Integer top);
/**
* 根据标签匹配新闻————公众号名称
* @param adNewsSetId
* @param adviserId
* @param beginTime
* @param proLabelName
* @param depLabelName
* @param purLabelName
* @param top
* @return
*/
List<AdNews> getNews4WechatByLabelName(Long adNewsSetId, Long adviserId, String beginTime, String proLabelName, String depLabelName, String purLabelName, Integer top);
} }
...@@ -33,4 +33,30 @@ public class AdNewsDaoImpl extends BaseDaoImpl<AdNews> implements AdNewsDao { ...@@ -33,4 +33,30 @@ public class AdNewsDaoImpl extends BaseDaoImpl<AdNews> implements AdNewsDao {
map.put("top", top); map.put("top", top);
return super.getSqlSession().selectList(getStatement("getNewsToSendBySetIdAndAdviser4Own"), map); return super.getSqlSession().selectList(getStatement("getNewsToSendBySetIdAndAdviser4Own"), map);
} }
@Override
public List<AdNews> getNewsByLabelName(Long adNewsSetId, Long adviserId, String beginTime, String proLabelName, String depLabelName, String purLabelName, Integer top) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsSetId", adNewsSetId);
map.put("adviserId", adviserId);
map.put("beginTime", beginTime);
map.put("proLabelName", proLabelName);
map.put("depLabelName", depLabelName);
map.put("purLabelName", purLabelName);
map.put("top", top);
return super.getSqlSession().selectList(getStatement("getNewsByLabelName"), map);
}
@Override
public List<AdNews> getNews4WechatByLabelName(Long adNewsSetId, Long adviserId,String beginTime, String proLabelName, String depLabelName, String purLabelName, Integer top) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsSetId", adNewsSetId);
map.put("adviserId", adviserId);
map.put("beginTime", beginTime);
map.put("proLabelName", proLabelName);
map.put("depLabelName", depLabelName);
map.put("purLabelName", purLabelName);
map.put("top", top);
return super.getSqlSession().selectList(getStatement("getNews4WechatByLabelName"), map);
}
} }
...@@ -33,6 +33,9 @@ public class AdNewsSet extends BaseEntity { ...@@ -33,6 +33,9 @@ public class AdNewsSet extends BaseEntity {
@ApiModelProperty("发送次数") @ApiModelProperty("发送次数")
private Integer sendCount; private Integer sendCount;
@ApiModelProperty("发送规则")
private Integer sendRule;
@ApiModelProperty("开场语") @ApiModelProperty("开场语")
private String startContent; private String startContent;
......
package com.pcloud.book.adnews.enums;
/**
* @author zhengyongqiang
* @date 2019/10/9 9:39
*/
public enum AdNewsSendRuleEnum {
LAST_UPDATE(0, "最近更新"),
MATCH_LABEL(1, "匹配标签");
public final Integer key;
public final String description;
AdNewsSendRuleEnum(Integer key, String description) {
this.key = key;
this.description = description;
}
public static String getDescriptionByKey(Integer key) {
AdNewsSendRuleEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdNewsSendRuleEnum methodEnum = var1[var3];
if (methodEnum.key.equals(key)) {
return methodEnum.description;
}
}
return null;
}
}
package com.pcloud.book.group.dto; package com.pcloud.book.group.dto;
import com.pcloud.book.adnews.entity.AdNews;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @Description * @Description
* @Author ruansiyuan * @Author ruansiyuan
* @Date 2019/7/18 15:09 * @Date 2019/7/18 15:09
**/ **/
@Data
public class GroupQrcodeFoAdDTO implements Serializable { public class GroupQrcodeFoAdDTO implements Serializable {
private static final long serialVersionUID = 7018070035247234809L; private static final long serialVersionUID = 7018070035247234809L;
...@@ -18,45 +23,25 @@ public class GroupQrcodeFoAdDTO implements Serializable { ...@@ -18,45 +23,25 @@ public class GroupQrcodeFoAdDTO implements Serializable {
private String weixinGroupId; private String weixinGroupId;
public Long getQrcodeId() { // 专业id
return qrcodeId; private Long proLabelId;
}
// 深度id
public void setQrcodeId(Long qrcodeId) { private Long depLabelId;
this.qrcodeId = qrcodeId;
} // 目的id
private Long purLabelId;
public Long getClassifyId() {
return classifyId; // 专业
} private String proLabelName;
public void setClassifyId(Long classifyId) { // 深度
this.classifyId = classifyId; private String depLabelName;
}
// 目的
public Long getBookGroupId() { private String purLabelName;
return bookGroupId;
} // 需要发送的早晚报
private List<AdNews> adNewsList;
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getWeixinGroupId() {
return weixinGroupId;
}
public void setWeixinGroupId(String weixinGroupId) {
this.weixinGroupId = weixinGroupId;
}
@Override
public String toString() {
return "GroupQrcodeFoAdDTO{" +
"qrcodeId=" + qrcodeId +
", classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", weixinGroupId='" + weixinGroupId + '\'' +
'}';
}
} }
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = c.adviser_id ) 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}) 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 ORDER BY
a.id DESC a.create_time DESC
LIMIT #{top} LIMIT #{top}
</select> </select>
...@@ -139,10 +139,58 @@ ...@@ -139,10 +139,58 @@
NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = #{adviserId} ) NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = #{adviserId} )
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}) 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 ORDER BY
a.id DESC a.create_time DESC
LIMIT #{top} LIMIT #{top}
</select> </select>
<!--查找要发送的新闻(新闻标题匹配标签)-->
<!--
1、ad_news_ban 排除掉禁止发送的
2、ad_news_group_record 排除掉已发送的
-->
<select id="getNewsByLabelName" parameterType="map" resultMap="BaseResultMap">
SELECT
a.id, a.type, a.news_from, a.title, a.publisher, a.url, a.short_url, a.news_date, a.create_time,0 content_from
FROM
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
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})
AND a.create_time >= #{beginTime}
AND (a.title LIKE CONCAT('%', #{proLabelName},'%')
OR a.title LIKE CONCAT('%', #{depLabelName},'%')
OR a.title LIKE CONCAT('%', #{purLabelName},'%'))
ORDER BY
a.create_time DESC
LIMIT #{top}
</select>
<!--查找要发送的新闻(公众号名称匹配标签)-->
<!--
1、ad_news_ban 排除掉禁止发送的
2、ad_news_group_record 排除掉已发送的
-->
<select id="getNews4WechatByLabelName" parameterType="map" resultMap="BaseResultMap">
SELECT
a.id, a.type, a.news_from, a.title, a.publisher, a.url, a.short_url, a.news_date, a.create_time,0 content_from
FROM
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
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})
AND a.create_time >= #{beginTime}
AND (b.wechat_name LIKE CONCAT('%', #{proLabelName},'%')
OR b.wechat_name LIKE CONCAT('%', #{depLabelName},'%')
OR b.wechat_name LIKE CONCAT('%', #{purLabelName},'%'))
ORDER BY
a.create_time DESC
LIMIT #{top}
</select>
<!--获取素材库列表--> <!--获取素材库列表-->
<select id="getAdNewsList" parameterType="map" resultType="com.pcloud.book.adnews.entity.AdNews"> <select id="getAdNewsList" parameterType="map" resultType="com.pcloud.book.adnews.entity.AdNews">
SELECT SELECT
...@@ -180,10 +228,10 @@ ...@@ -180,10 +228,10 @@
AND a.title like concat('%', #{title},'%') AND a.title like concat('%', #{title},'%')
</if> </if>
<if test="beginTime!=null"> <if test="beginTime!=null">
AND a.news_date <![CDATA[>=]]> #{beginTime} AND a.create_time <![CDATA[>=]]> #{beginTime}
</if> </if>
<if test="endTime!=null"> <if test="endTime!=null">
AND a.news_date<![CDATA[<=]]> #{endTime} AND a.create_time<![CDATA[<=]]> #{endTime}
</if> </if>
<if test="hasBan==0"> <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) AND NOT EXISTS (SELECT 1 FROM ad_news_ban WHERE ad_news_id=a.id and adviser_id=#{partyId} LIMIT 1)
...@@ -197,6 +245,7 @@ ...@@ -197,6 +245,7 @@
<if test="hasUsed==1"> <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) 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 a.create_time DESC,a.id DESC
</select> </select>
<!--获取编辑选择的素材--> <!--获取编辑选择的素材-->
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<result column="has_morning_open" property="hasMorningOpen" jdbcType="BOOLEAN"/> <result column="has_morning_open" property="hasMorningOpen" jdbcType="BOOLEAN"/>
<result column="has_evening_open" property="hasEveningOpen" jdbcType="BOOLEAN"/> <result column="has_evening_open" property="hasEveningOpen" jdbcType="BOOLEAN"/>
<result column="send_count" property="sendCount" jdbcType="INTEGER"/> <result column="send_count" property="sendCount" jdbcType="INTEGER"/>
<result column="send_rule" property="sendRule" jdbcType="INTEGER"/>
<result column="start_content" property="startContent" jdbcType="VARCHAR"/> <result column="start_content" property="startContent" jdbcType="VARCHAR"/>
<result column="end_content" property="endContent" jdbcType="VARCHAR"/> <result column="end_content" property="endContent" jdbcType="VARCHAR"/>
<result column="has_start_content" property="hasStartContent" jdbcType="BOOLEAN"/> <result column="has_start_content" property="hasStartContent" jdbcType="BOOLEAN"/>
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
</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,send_rule, 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 ,content_from,morning_content,evening_content
</sql> </sql>
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
has_morning_open, has_morning_open,
has_evening_open, has_evening_open,
send_count, send_count,
send_rule,
start_content, start_content,
end_content, end_content,
has_start_content, has_start_content,
...@@ -60,6 +62,7 @@ ...@@ -60,6 +62,7 @@
#{hasMorningOpen,jdbcType=BOOLEAN}, #{hasMorningOpen,jdbcType=BOOLEAN},
#{hasEveningOpen,jdbcType=BOOLEAN}, #{hasEveningOpen,jdbcType=BOOLEAN},
#{sendCount,jdbcType=INTEGER}, #{sendCount,jdbcType=INTEGER},
#{sendRule,jdbcType=INTEGER},
#{startContent,jdbcType=VARCHAR}, #{startContent,jdbcType=VARCHAR},
#{endContent,jdbcType=VARCHAR}, #{endContent,jdbcType=VARCHAR},
#{hasStartContent,jdbcType=BOOLEAN}, #{hasStartContent,jdbcType=BOOLEAN},
...@@ -92,6 +95,9 @@ ...@@ -92,6 +95,9 @@
<if test="sendCount != null"> <if test="sendCount != null">
send_count = #{sendCount,jdbcType=INTEGER}, send_count = #{sendCount,jdbcType=INTEGER},
</if> </if>
<if test="sendRule != null">
send_rule = #{sendRule,jdbcType=INTEGER},
</if>
<if test="startContent != null"> <if test="startContent != null">
start_content = #{startContent,jdbcType=VARCHAR}, start_content = #{startContent,jdbcType=VARCHAR},
</if> </if>
......
...@@ -537,13 +537,18 @@ ...@@ -537,13 +537,18 @@
t.id qrcodeId, t.id qrcodeId,
t.weixin_group_id weixinGroupId, t.weixin_group_id weixinGroupId,
t1.id classifyId, t1.id classifyId,
t1.book_group_id bookGroupId t1.book_group_id bookGroupId,
t2.pro_label_id proLabelId,
t2.dep_label_id depLabelId,
t2.pur_label_id purLabelId
FROM FROM
book_group_qrcode t book_group_qrcode t
INNER JOIN book_group_classify t1 ON t.classify_id = t1.id INNER JOIN book_group_classify t1 ON t.classify_id = t1.id
INNER JOIN book_group t2 ON t2.id = t1.book_group_id
WHERE WHERE
t.is_delete = 0 t.is_delete = 0
AND t1.is_delete = 0 AND t1.is_delete = 0
AND t2.is_delete = 0
AND t1.id IN AND t1.id IN
<foreach collection = "list" index="index" item = "item" open = "(" separator= "," close = ")"> <foreach collection = "list" index="index" item = "item" open = "(" separator= "," close = ")">
#{item} #{item}
......
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