Commit 558d3dc7 by 阮思源

加处理关键词的内部接口

parent e92e6b9f
...@@ -96,4 +96,8 @@ public interface BookGroupService { ...@@ -96,4 +96,8 @@ public interface BookGroupService {
ResponseEntity<ResponseDto<Map<String, Integer>>> getBookGroupFriendsCountByDay( ResponseEntity<ResponseDto<Map<String, Integer>>> getBookGroupFriendsCountByDay(
@RequestParam("bookGroupId") Long bookGroupId, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate); @RequestParam("bookGroupId") Long bookGroupId, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate);
@ApiOperation("将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面")
@GetMapping("dealSelfBookGroupKeywordToServer")
void dealSelfBookGroupKeywordToServer();
} }
...@@ -439,4 +439,9 @@ public interface BookGroupBiz { ...@@ -439,4 +439,9 @@ public interface BookGroupBiz {
* @param bookGroupServes * @param bookGroupServes
*/ */
void batchUpdateBookGroupServe(Long partyId, List<BookGroupServe> bookGroupServes); void batchUpdateBookGroupServe(Long partyId, List<BookGroupServe> bookGroupServes);
/**
* 将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面
*/
void dealSelfBookGroupKeywordToServer();
} }
...@@ -77,6 +77,7 @@ import com.pcloud.book.group.vo.StatisticVO; ...@@ -77,6 +77,7 @@ import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.vo.TotalRescourceDataVO; import com.pcloud.book.group.vo.TotalRescourceDataVO;
import com.pcloud.book.group.vo.WxGroupStatisticVO; import com.pcloud.book.group.vo.WxGroupStatisticVO;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.ListKeywordVO; import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
...@@ -2241,6 +2242,51 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -2241,6 +2242,51 @@ public class BookGroupBizImpl implements BookGroupBiz {
batchAddBookGroupServe(partyId,bookGroupServes); batchAddBookGroupServe(partyId,bookGroupServes);
} }
@ParamLog("将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面")
@Override
public void dealSelfBookGroupKeywordToServer() {
List<BookGroup> bookGroups = bookGroupDao.getBookGroupByJoinGroupType(JoinGroupTypeEnum.ROBOT.getCode());
if (ListUtils.isEmpty(bookGroups)) {
return;
}
List<Long> bookGroupIds = bookGroups.stream().filter(s -> s.getId() != null).map(BookGroup::getId).collect(Collectors.toList());
//查询关键词
List<KeywordDTO> keywordDTOS = bookKeywordDao.getListByBookGroupIdsAndType(bookGroupIds, ReplyTypeEnum.APP.value);
if (ListUtils.isEmpty(keywordDTOS)) {
return;
}
Map<Long, List<KeywordDTO>> map = keywordDTOS.stream().filter(s -> s.getBookGroupId() != null).collect(Collectors.groupingBy(KeywordDTO::getBookGroupId));
for (BookGroup bookGroup : bookGroups) {
Long bookGroupId = bookGroup.getId();
List<KeywordDTO> list = map.get(bookGroupId);
if (ListUtils.isEmpty(list)) {
continue;
}
//查询有没有配置资源,如果没有则新增加入
List<BookGroupServe> bookGroupServes = bookGroupServeDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(bookGroupServes)) {
continue;
}
List<BookGroupServe> bookGroupServesNew = new ArrayList<>();
for (KeywordDTO keywordDTO : list) {
BookGroupServe bookGroupServe = new BookGroupServe();
bookGroupServe.setBookGroupId(bookGroupId);
bookGroupServe.setServeId(keywordDTO.getServeId());
bookGroupServe.setServeType(keywordDTO.getServeType());
bookGroupServe.setCreateUser(bookGroup.getCreateUser());
bookGroupServe.setServeUrl(keywordDTO.getLinkUrl());
// 处理链接地址
String endUrl = bookGroupServe.getServeUrl() + "&book_group_id=" + bookGroupId;
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(bookGroup.getChannelId());
String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl);
//转短链
String resultUrl = UrlUtils.getShortUrl4Own(linkUrl);
bookGroupServe.setShortUrl(resultUrl);
bookGroupServesNew.add(bookGroupServe);
}
}
}
@ParamLog("生成暗号") @ParamLog("生成暗号")
private String createBookGroupCipher(){ private String createBookGroupCipher(){
//生成暗号规则:abc1234,前三位小写字母,后四位数字 //生成暗号规则:abc1234,前三位小写字母,后四位数字
......
...@@ -169,4 +169,9 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -169,4 +169,9 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* @return * @return
*/ */
BookGroup getByBookGroupCipher(String bookGroupCipher); BookGroup getByBookGroupCipher(String bookGroupCipher);
/**
* 根据入群方式查询社群书集合
*/
List<BookGroup> getBookGroupByJoinGroupType(Integer joinGroupType);
} }
...@@ -173,4 +173,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -173,4 +173,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public BookGroup getByBookGroupCipher(String bookGroupCipher) { public BookGroup getByBookGroupCipher(String bookGroupCipher) {
return this.getSqlSession().selectOne(getStatement("getByBookGroupCipher"), bookGroupCipher); return this.getSqlSession().selectOne(getStatement("getByBookGroupCipher"), bookGroupCipher);
} }
@Override
public List<BookGroup> getBookGroupByJoinGroupType(Integer joinGroupType) {
return this.getSqlSession().selectList(getStatement("getBookGroupByJoinGroupType"), joinGroupType);
}
} }
...@@ -158,4 +158,11 @@ public class BookGroupServiceImpl implements BookGroupService { ...@@ -158,4 +158,11 @@ public class BookGroupServiceImpl implements BookGroupService {
return ResponseHandleUtil.toResponse(map); return ResponseHandleUtil.toResponse(map);
} }
@ApiOperation("将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面")
@GetMapping("dealSelfBookGroupKeywordToServer")
@Override
public void dealSelfBookGroupKeywordToServer() {
bookGroupBiz.dealSelfBookGroupKeywordToServer();
}
} }
...@@ -117,4 +117,9 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> { ...@@ -117,4 +117,9 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
* @return * @return
*/ */
List<KeywordDTO> getListByBookGroupId(Long bookGroupId); List<KeywordDTO> getListByBookGroupId(Long bookGroupId);
/**
* 根据社群码id集合获取列表
*/
List<KeywordDTO> getListByBookGroupIdsAndType(List<Long> bookGroupIds, Integer replyType);
} }
...@@ -149,4 +149,12 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book ...@@ -149,4 +149,12 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
public List<KeywordDTO> getListByBookGroupId(Long bookGroupId) { public List<KeywordDTO> getListByBookGroupId(Long bookGroupId) {
return this.getSqlSession().selectList(this.getStatement("getListByBookGroupId"), bookGroupId); return this.getSqlSession().selectList(this.getStatement("getListByBookGroupId"), bookGroupId);
} }
@Override
public List<KeywordDTO> getListByBookGroupIdsAndType(List<Long> bookGroupIds, Integer replyType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupIds", bookGroupIds);
paramMap.put("replyType", replyType);
return this.getSqlSession().selectList(this.getStatement("getListByBookGroupIdsAndType"), paramMap);
}
} }
...@@ -49,5 +49,11 @@ public class KeywordDTO implements Serializable { ...@@ -49,5 +49,11 @@ public class KeywordDTO implements Serializable {
@ApiModelProperty("回复类型") @ApiModelProperty("回复类型")
private Integer replyType; private Integer replyType;
@ApiModelProperty("社群书id")
private Long bookGroupId;
@ApiModelProperty("创建人")
private Long createUser;
} }
...@@ -435,4 +435,12 @@ ...@@ -435,4 +435,12 @@
and is_delete=0 and is_delete=0
limit 1 limit 1
</select> </select>
<!--根据入群方式查询社群书集合-->
<select id="getBookGroupByJoinGroupType" parameterType="Integer" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group
where join_group_type=#{joinGroupType}
and is_delete=0
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,6 +2,27 @@ ...@@ -2,6 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.keywords.dao.impl.BookKeywordDaoImpl"> <mapper namespace="com.pcloud.book.keywords.dao.impl.BookKeywordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.BookKeyword">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="keyword_id" property="keywordId" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="rank" property="rank" jdbcType="TINYINT"/>
<result column="set_type" property="setType" jdbcType="TINYINT"/>
<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"/>
<result column="is_warehouse" property="isWarehouse" jdbcType="TINYINT"/>
<result column="warehouse_id" property="warehouseId" jdbcType="BIGINT"/>
<result column="is_edit" property="isEdit" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
id,keyword_id,book_group_id, book_id, channel_id, classify_id, rank, set_type, is_delete,create_user, create_time, update_user,
update_time, is_warehouse, warehouse_id, is_edit
</sql>
<insert id="insert" parameterType="bookKeyword" useGeneratedKeys="true" <insert id="insert" parameterType="bookKeyword" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into book_keyword insert into book_keyword
...@@ -400,4 +421,35 @@ ...@@ -400,4 +421,35 @@
k.is_delete = 0 k.is_delete = 0
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc
</select> </select>
<!--根据社群码id获取列表-->
<select id="getListByBookGroupIdsAndType" resultType="com.pcloud.book.keywords.dto.KeywordDTO" parameterType="map">
SELECT
k.keywords,
k.id keywordId,
bk.is_warehouse as isWarehouse,
bk.warehouse_id as warehouseId,
bk.book_group_id bookGroupId,
k.guide,
k.reply_type replyType,
k.content,
k.description,
k.link_url linkUrl,
k.serve_id serveId,
k.serve_type serveType,
bk.create_user createUser
FROM
book_keyword bk
JOIN
keyword k ON bk.keyword_id = k.id
WHERE
bk.is_delete = 0
AND
k.is_delete = 0
AND bk.book_group_id in
<foreach collection="bookGroupIds" separator="," index="index" item="item" open="(" close=")">
#{item}
</foreach>
and k.reply_type=#{replyType}
</select>
</mapper> </mapper>
\ No newline at end of file
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