Commit 8a4de81b by 阮思源

Merge branch 'fixbug-rsy' into 'master'

内部接口自动上架

See merge request rays/pcloud-book!243
parents a244d8ed 56eee6cf
......@@ -123,4 +123,8 @@ public interface BookGroupService {
@GetMapping("getQrcodeIdsByBookGroupId")
ResponseEntity<ResponseDto<List<Long>>> getQrcodeIdsByBookGroupId(@RequestParam("bookGroupId") Long bookGroupId);
@ApiOperation("上架所有的个人号配置资源")
@GetMapping("dealBookGroupServeOldOnShelves")
void dealBookGroupServeOldOnShelves();
}
......@@ -513,4 +513,9 @@ public interface BookGroupBiz {
* 获取是否能推送更新的各个状态
*/
Map<String,Boolean> getStatesForPushUpdate(Long bookGroupId);
/**
* 上架所有的个人号配置资源
*/
void dealBookGroupServeOldOnShelves();
}
......@@ -2568,6 +2568,31 @@ public class BookGroupBizImpl implements BookGroupBiz {
return map;
}
@ParamLog("上架所有的个人号配置资源")
@Override
public void dealBookGroupServeOldOnShelves() {
//查询所有的配置资源作品
List<BookGroupServe> list = bookGroupServeDao.getProductServeList();
if (!ListUtils.isEmpty(list)) {
List<Long> bookGroupIds = list.stream().map(BookGroupServe::getBookGroupId).distinct().collect(Collectors.toList());
List<BookGroupDTO> dtos = bookGroupDao.getDTOByIds(bookGroupIds);
Map<Long, Long> channelMap = new HashMap<>();
for (BookGroupDTO bookGroupDTO : dtos) {
channelMap.put(bookGroupDTO.getId(), bookGroupDTO.getChannelId());
}
Map<Long, List<BookGroupServe>> map = list.stream().collect(Collectors.groupingBy(BookGroupServe::getBookGroupId));
for (Long bookGroupId : bookGroupIds) {
List<BookGroupServe> bookGroupServes = map.get(bookGroupId);
Long channelId = channelMap.get(bookGroupId);
if (!ListUtils.isEmpty(bookGroupServes) && channelId != null) {
List<Long> productIds = bookGroupServes.stream().filter(s -> s.getServeId() != null).map(BookGroupServe::getServeId).collect(Collectors.toList());
//上架
productConsr.productAutoOnShelves(channelId, productIds);
}
}
}
}
@ParamLog("生成暗号")
private String createBookGroupCipher(){
//生成暗号规则:abc1234,前三位小写字母,后四位数字
......
......@@ -15,4 +15,6 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
List<BookGroupServe> getListByServerType(String serveType);
void updateShortUrl(Long id, String shortUrl);
List<BookGroupServe> getProductServeList();
}
......@@ -43,4 +43,9 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
map.put("shortUrl", shortUrl);
super.getSqlSession().update(getStatement("updateShortUrl"), map);
}
@Override
public List<BookGroupServe> getProductServeList() {
return super.getSqlSession().selectList(getStatement("getProductServeList"));
}
}
......@@ -205,4 +205,10 @@ public class BookGroupServiceImpl implements BookGroupService {
List<Long> qrcodeIds = bookGroupBiz.getQrcodeIdsByBookGroupId(bookGroupId);
return ResponseHandleUtil.toResponse(qrcodeIds);
}
@ApiOperation("上架所有的个人号配置资源")
@GetMapping("dealBookGroupServeOldOnShelves")
void dealBookGroupServeOldOnShelves(){
bookGroupBiz.dealBookGroupServeOldOnShelves();
}
}
......@@ -96,4 +96,11 @@
short_url=#{shortUrl}
where id=#{id}
</update>
<!--查询所有作品-->
<select id="getProductServeList" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group_serve
where serve_type='PRODUCT'
</select>
</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