Commit 3752637b by 郑永强

修改早晚报定时发送

parent c92e4e0d
...@@ -35,6 +35,9 @@ public class AdNewsGroupRecord extends BaseEntity{ ...@@ -35,6 +35,9 @@ public class AdNewsGroupRecord extends BaseEntity{
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
@ApiModelProperty("自定义内容")
private String customContent;
public Long getQrcodeId() { public Long getQrcodeId() {
return qrcodeId; return qrcodeId;
} }
...@@ -91,6 +94,14 @@ public class AdNewsGroupRecord extends BaseEntity{ ...@@ -91,6 +94,14 @@ public class AdNewsGroupRecord extends BaseEntity{
this.updateUser = updateUser; this.updateUser = updateUser;
} }
public String getCustomContent() {
return customContent;
}
public void setCustomContent(String customContent) {
this.customContent = customContent;
}
@Override @Override
public String toString() { public String toString() {
return "AdNewsGroupRecord{" + return "AdNewsGroupRecord{" +
...@@ -101,6 +112,9 @@ public class AdNewsGroupRecord extends BaseEntity{ ...@@ -101,6 +112,9 @@ public class AdNewsGroupRecord extends BaseEntity{
", adNewsSetId=" + adNewsSetId + ", adNewsSetId=" + adNewsSetId +
", createUser=" + createUser + ", createUser=" + createUser +
", updateUser=" + updateUser + ", updateUser=" + updateUser +
"} " + super.toString(); ", customContent='" + customContent + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
} }
} }
...@@ -16,15 +16,15 @@ public class AdNewsWechat extends BaseEntity { ...@@ -16,15 +16,15 @@ public class AdNewsWechat extends BaseEntity {
public AdNewsWechat() { public AdNewsWechat() {
} }
public AdNewsWechat(String wechatId, String wechatName, Long adviserId, Boolean isDelete) { public AdNewsWechat(String newsFrom, String wechatName, Long adviserId, Boolean isDelete) {
this.wechatId = wechatId; this.newsFrom = newsFrom;
this.wechatName = wechatName; this.wechatName = wechatName;
this.adviserId = adviserId; this.adviserId = adviserId;
this.isDelete = isDelete; this.isDelete = isDelete;
} }
@ApiModelProperty("微信公众号唯一标识") @ApiModelProperty("微信公众号唯一标识")
private String wechatId; private String newsFrom;
@ApiModelProperty("微信公众号名称") @ApiModelProperty("微信公众号名称")
private String wechatName; private String wechatName;
...@@ -39,12 +39,12 @@ public class AdNewsWechat extends BaseEntity { ...@@ -39,12 +39,12 @@ public class AdNewsWechat extends BaseEntity {
return serialVersionUID; return serialVersionUID;
} }
public String getWechatId() { public String getNewsFrom() {
return wechatId; return newsFrom;
} }
public void setWechatId(String wechatId) { public void setNewsFrom(String newsFrom) {
this.wechatId = wechatId; this.newsFrom = newsFrom;
} }
public String getWechatName() { public String getWechatName() {
...@@ -74,7 +74,7 @@ public class AdNewsWechat extends BaseEntity { ...@@ -74,7 +74,7 @@ public class AdNewsWechat extends BaseEntity {
@Override @Override
public String toString() { public String toString() {
return "AdNewsWechat{" + return "AdNewsWechat{" +
"wechatId='" + wechatId + '\'' + "newsFrom='" + newsFrom + '\'' +
", wechatName='" + wechatName + '\'' + ", wechatName='" + wechatName + '\'' +
", adviserId=" + adviserId + ", adviserId=" + adviserId +
", isDelete=" + isDelete + ", isDelete=" + isDelete +
......
...@@ -38,6 +38,7 @@ public interface AdNewsFacade { ...@@ -38,6 +38,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(
...@@ -45,6 +46,7 @@ public interface AdNewsFacade { ...@@ -45,6 +46,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(
...@@ -52,6 +54,7 @@ public interface AdNewsFacade { ...@@ -52,6 +54,7 @@ public interface AdNewsFacade {
@RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId @RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@Deprecated
@ApiOperation("获取早晚报素材库") @ApiOperation("获取早晚报素材库")
@GetMapping("/getAdNewsList") @GetMapping("/getAdNewsList")
ResponseDto<?> getAdNewsList( ResponseDto<?> getAdNewsList(
...@@ -61,6 +64,7 @@ public interface AdNewsFacade { ...@@ -61,6 +64,7 @@ public interface AdNewsFacade {
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@Deprecated
@ApiOperation("获取编辑选择的早晚报素材库") @ApiOperation("获取编辑选择的早晚报素材库")
@GetMapping("/getAdNewsChooseList") @GetMapping("/getAdNewsChooseList")
ResponseDto<?> getAdNewsChooseList( ResponseDto<?> getAdNewsChooseList(
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
<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"/>
</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, qrcode_id, classify_id, book_group_id, ad_news_id, ad_news_set_id, create_user, create_time, update_user, update_time, custom_content
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -36,7 +37,8 @@ ...@@ -36,7 +37,8 @@
create_user, create_user,
create_time, create_time,
update_user, update_user,
update_time update_time,
custom_content
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{qrcodeId,jdbcType=BIGINT}, #{qrcodeId,jdbcType=BIGINT},
...@@ -48,6 +50,7 @@ ...@@ -48,6 +50,7 @@
NOW(), NOW(),
#{updateUser,jdbcType=BIGINT}, #{updateUser,jdbcType=BIGINT},
NOW(), NOW(),
#{customContent,jdbcType=VARCHAR}
</trim> </trim>
</insert> </insert>
...@@ -72,6 +75,9 @@ ...@@ -72,6 +75,9 @@
<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>
update_time=now() update_time=now()
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -88,7 +94,8 @@ ...@@ -88,7 +94,8 @@
create_user, create_user,
create_time, create_time,
update_user, update_user,
update_time update_time,
custom_content
) )
values values
<foreach collection="list" item="item" index="index" separator="," > <foreach collection="list" item="item" index="index" separator="," >
...@@ -101,7 +108,8 @@ ...@@ -101,7 +108,8 @@
#{item.createUser,jdbcType=BIGINT}, #{item.createUser,jdbcType=BIGINT},
NOW(), NOW(),
#{item.updateUser,jdbcType=BIGINT}, #{item.updateUser,jdbcType=BIGINT},
NOW() NOW(),
#{customContent,jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
......
...@@ -104,31 +104,22 @@ ...@@ -104,31 +104,22 @@
</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"/> <include refid="Base_Column_List"/>
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>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatDaoImpl"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="wechat_id" property="wechatId" jdbcType="VARCHAR"/> <result column="news_from" property="newsFrom" jdbcType="VARCHAR"/>
<result column="wechat_name" property="wechatName" jdbcType="VARCHAR"/> <result column="wechat_name" property="wechatName" jdbcType="VARCHAR"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/> <result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/> <result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, wechat_id, wechat_name, adviser_id, is_delete, create_time, update_time id, news_from, wechat_name, adviser_id, is_delete, create_time, update_time
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
select <include refid="Base_Column_List"/> select <include refid="Base_Column_List"/>
from ad_news_wechat from ad_news_wechat
where where
wechat_id IS NOT NULL news_from IS NOT NULL
order by id desc order by id desc
</select> </select>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<select id="getAdNewsWechatChooseList" parameterType="map" resultMap="BaseResultMap"> <select id="getAdNewsWechatChooseList" parameterType="map" resultMap="BaseResultMap">
SELECT SELECT
a.id, a.id,
a.wechat_id, a.news_from,
a.wechat_name, a.wechat_name,
a.adviser_id, a.adviser_id,
a.is_delete, a.is_delete,
...@@ -47,17 +47,17 @@ ...@@ -47,17 +47,17 @@
AND b.is_delete = 0 AND b.is_delete = 0
AND b.adviser_id = #{partyId} AND b.adviser_id = #{partyId}
WHERE WHERE
a.`wechat_id` IS NOT NULL a.`news_from` IS NOT NULL
</select> </select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_wechat insert into ad_news_wechat
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
wechat_id, wechat_name, adviser_id, is_delete, create_time news_from, wechat_name, adviser_id, is_delete, create_time
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{wechatId,jdbcType=VARCHAR}, #{newsFrom,jdbcType=VARCHAR},
#{wechatName,jdbcType=VARCHAR}, #{wechatName,jdbcType=VARCHAR},
#{adviserId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{isDelete,jdbcType=BOOLEAN}, #{isDelete,jdbcType=BOOLEAN},
......
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