Commit 3fec1b58 by 朱亚洁

bug:[none]超级作者作品自动上架

parent c21c8baa
......@@ -274,6 +274,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
createOfficialAccountUrl(resourcePageColumnId, updateResourceColumnVO);
return;
}
//作品id
List<Long> productIds4Shelve = updateResourceColumnVO.getItemVOList().stream().filter(s->s.getServeType().equals(ResourcePageConstants.ServeTypeEnum.PRODUCT.getValue())).map(ResourcePageItemVO::getServeId).distinct().collect(Collectors.toList());
if (!ListUtils.isEmpty(updateResourceColumnVO.getItemVOList())) {
List<ResourcePageItemVO> itemVOList = updateResourceColumnVO.getItemVOList();
List<ResourcePageItem> itemList = new ArrayList<>();
......@@ -304,6 +306,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
resourcePageItemDao.insert(itemList);
}
if (!ListUtils.isEmpty(productIds4Shelve)){
//作品自动上架
List<Long> productIds = productIds4Shelve;
ThreadPoolUtils.OTHER_POOL.execute(()->{
Long channelId = getChannelIdFromUrl(updateResourceColumnVO.getItemVOList().get(0).getLinkUrl());
productConsr.productAutoOnShelves(channelId, productIds);
});
}
}
private void checkResourceColumn(UpdateResourceColumnVO updateResourceColumnVO) throws BizException {
......@@ -313,6 +323,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if (ListUtils.isEmpty(updateResourceColumnVO.getItemVOList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, updateResourceColumnVO.getColumnName()+"缺少资源");
}
List<String> typeCodes = Arrays.asList(ResourcePageConstants.ServeTypeEnum.APP.getValue(),ResourcePageConstants.ServeTypeEnum.PRODUCT.getValue());
for (ResourcePageItemVO itemVO : updateResourceColumnVO.getItemVOList()) {
if (ResourcePageConstants.ServeTypeEnum.ADVISER_BOOK.getValue().equals(itemVO.getServeType()) &&
(null == itemVO.getLinkFrom() || StringUtil.isEmpty(itemVO.getLinkUrl()))) {
......@@ -322,6 +333,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
&& (null == itemVO.getServeId() || StringUtil.isEmpty(itemVO.getServeType()))) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少资源id或类型");
}
if (typeCodes.contains(itemVO.getServeType()) && StringUtil.isEmpty(itemVO.getLinkUrl())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少资源链接");
}
}
}
......
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