Commit 88398595 by 吴博

feat: [1004620] 资讯处理

parent c71d04ae
package com.pcloud.book.applet.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@Data
public class ArticleInfoDTO implements Serializable {
//类型
private String type;
//排序值
private Integer seqNum;
//内容
private String content;
//音乐名称
private String musicName;
//音乐地址
private String musicUrl;
}
package com.pcloud.book.applet.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class HandleNewsDTO {
private Long bookId;
private Long adviserId;
private Long channelId;
private Long adviserBookId;
private List<Long> appletNewsIds;
}
...@@ -14,6 +14,7 @@ import com.pcloud.resourcecenter.product.dto.ProductDto; ...@@ -14,6 +14,7 @@ import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.resourcecenter.product.dto.ProductLabelDto; import com.pcloud.resourcecenter.product.dto.ProductLabelDto;
import com.pcloud.resourcecenter.product.dto.ProductTypeDto; import com.pcloud.resourcecenter.product.dto.ProductTypeDto;
import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO; import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Article;
import com.pcloud.resourcecenter.product.entity.Product; import com.pcloud.resourcecenter.product.entity.Product;
import com.pcloud.resourcecenter.product.service.ProductService; import com.pcloud.resourcecenter.product.service.ProductService;
...@@ -347,4 +348,29 @@ public class ProductConsr { ...@@ -347,4 +348,29 @@ public class ProductConsr {
return productDtoMap == null ? new HashMap<>() : productDtoMap; return productDtoMap == null ? new HashMap<>() : productDtoMap;
} }
public Long addProductStepOne(Product product) {
Long productId = null;
try {
productId = ResponseHandleUtil.parseResponse(productService.addProductStepOne(product), Long.class);
} catch (Exception e) {
LOGGER.error("创建作品第一步[productService.addProductStepOne]:创建失败:product:{}" + e.getMessage(), product);
}
return productId;
}
public void addArticle(Article article) {
try {
productService.addArticle(article);
} catch (Exception e) {
LOGGER.error("创建精品文章第二步[productService.addArticle]:创建失败:article:{}" + e.getMessage(), article);
}
}
public void selfAudit(Product product) {
try {
productService.selfAudit(product);
} catch (Exception e) {
LOGGER.error("自主审核失败[productService.selfAudit]:创建失败:article:{}" + e.getMessage(), product);
}
}
} }
...@@ -143,4 +143,12 @@ public interface ResourcePageBiz { ...@@ -143,4 +143,12 @@ public interface ResourcePageBiz {
* * @param null * * @param null
*/ */
void batchUpdateQrcode(List<Long> bookGroupIds); void batchUpdateQrcode(List<Long> bookGroupIds);
/**
* 根据书籍id和channel获取资源配置页
* @param adviserBookId
* @param channelId
* @return
*/
ResourcePageVO getResourcePageByBookIdAndChannelId(Long adviserBookId, Long channelId);
} }
...@@ -1261,4 +1261,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1261,4 +1261,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
} }
} }
@Override
public ResourcePageVO getResourcePageByBookIdAndChannelId(Long bookId, Long channelId) {
ResourcePageVO resourcePageVO = new ResourcePageVO();
ResourcePage resourcePage = resourcePageDao.getByBookId(bookId, channelId, null);
if (null != resourcePage) {
BeanUtils.copyProperties(resourcePage, resourcePageVO);
}
return resourcePageVO;
}
} }
...@@ -268,4 +268,9 @@ public interface RightsSettingBiz { ...@@ -268,4 +268,9 @@ public interface RightsSettingBiz {
* 根据图书信息及权益ID检查是否配置了读书卡片应用 * 根据图书信息及权益ID检查是否配置了读书卡片应用
*/ */
Map<String,Object> getBookCardId4Book(Long bookId, Long channelId, Long adviserId, Long rightsSettingId); Map<String,Object> getBookCardId4Book(Long bookId, Long channelId, Long adviserId, Long rightsSettingId);
/**
* 处理资讯
*/
void handleNews();
} }
package com.pcloud.book.rightsSetting.dao; package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.applet.dto.HandleNewsDTO;
import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto; import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO; import com.pcloud.book.rightsSetting.dto.RightsSettingShowStateDTO;
...@@ -40,4 +42,8 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> { ...@@ -40,4 +42,8 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> {
void updateUser(RightsSetting rightsSetting); void updateUser(RightsSetting rightsSetting);
RightsSettingDto getDTOById(Long id); RightsSettingDto getDTOById(Long id);
List<AppletNews> getAllNews();
List<HandleNewsDTO> getAllBookNews();
} }
package com.pcloud.book.rightsSetting.dao.impl; package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.applet.dto.HandleNewsDTO;
import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO; import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto; import com.pcloud.book.rightsSetting.dto.BookRightsCountsDto;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
...@@ -100,6 +102,16 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement ...@@ -100,6 +102,16 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
} }
@Override @Override
public List<AppletNews> getAllNews() {
return getSessionTemplate().selectList(getStatement("getAllNews"));
}
@Override
public List<HandleNewsDTO> getAllBookNews() {
return getSessionTemplate().selectList(getStatement("getAllBookNews"));
}
@Override
public List<BookRightsCountsDto> rightsCountByBookIds(List<Long> bookIds) { public List<BookRightsCountsDto> rightsCountByBookIds(List<Long> bookIds) {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookIds",bookIds); paramMap.put("bookIds",bookIds);
......
...@@ -429,4 +429,11 @@ public class RightsSettingFacede { ...@@ -429,4 +429,11 @@ public class RightsSettingFacede {
@RequestParam(value = "rightsSettingId",required = false) Long rightsSettingId) { @RequestParam(value = "rightsSettingId",required = false) Long rightsSettingId) {
return new ResponseDto<>(rightsSettingBiz.getBookCardId4Book(bookId, channelId, adviserId, rightsSettingId)); return new ResponseDto<>(rightsSettingBiz.getBookCardId4Book(bookId, channelId, adviserId, rightsSettingId));
} }
@ApiOperation("将资讯转成作品")
@GetMapping("handleNews")
public ResponseDto<?> handleNews() {
rightsSettingBiz.handleNews();
return new ResponseDto<>();
}
} }
\ No newline at end of file
...@@ -77,12 +77,16 @@ ...@@ -77,12 +77,16 @@
p.open_rays p.open_rays
FROM FROM
resource_page p resource_page p
INNER JOIN book_group g ON p.book_group_id = g.id INNER JOIN book_group g ON p.book_group_id = g.id and g.is_delete = 0
AND g.join_group_type = 4 AND g.join_group_type = 4
WHERE WHERE
g.book_id = #{bookId} g.book_id = #{bookId}
AND g.channel_id = #{channelId} <if test="channelId != null">
AND g.create_user = #{adviserId} AND g.channel_id = #{channelId}
</if>
<if test="adviserId != null">
AND g.create_user = #{adviserId}
</if>
ORDER BY ORDER BY
p.open_rays DESC, p.book_group_id desc p.open_rays DESC, p.book_group_id desc
LIMIT 1 LIMIT 1
......
...@@ -76,6 +76,16 @@ ...@@ -76,6 +76,16 @@
column="id" select="com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper.selectBookByRithsSettingId"> column="id" select="com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper.selectBookByRithsSettingId">
</collection> </collection>
</resultMap> </resultMap>
<resultMap id="BookNewsDTOMap" type="com.pcloud.book.applet.dto.HandleNewsDTO">
<result column="book_adviser_id" property="adviserBookId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="channel_id" property="channelId" jdbcType="BIGINT"/>
<collection property="appletNewsIds" ofType="long">
<result column="serve_id" jdbcType="BIGINT"/>
</collection>
</resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id,rights_number, introduce, detail, count, first_classify, second_classify, third_classify,grade_label_id, subject_label_id, id,rights_number, introduce, detail, count, first_classify, second_classify, third_classify,grade_label_id, subject_label_id,
create_time, update_time, enable_group_service, rights_setting_type, book_id create_time, update_time, enable_group_service, rights_setting_type, book_id
...@@ -459,4 +469,46 @@ WHERE ...@@ -459,4 +469,46 @@ WHERE
GROUP BY a.book_id GROUP BY a.book_id
</select> </select>
<select id="getAllNews" resultMap="com.pcloud.book.applet.dao.impl.AppletNewsDaoImpl.BaseResultMap">
select
news.id, news.news_name, news.source, news.news_classify_id, news.pro_label_id, news.dep_label_id, news.pur_label_id, news.type, news.digest,
pic1, pic2, pic3, news.content, news.create_time, news.update_time, news.first_classify, news.second_classify, news.grade_label_id, news.subject_label_id, news.rights_classify_id,
news.jump_type, news.jump_url, news.url_number, news.custom_tag_id
from
rights_setting a
inner join
rights_setting_book_relation c on a.id = c.rights_setting_id
inner join
rights_now_item b on a.id = b.rights_setting_id
inner join
applet_news news on b.serve_id = news.id
where
a.rights_setting_type = 2
and
b.serve_type = 'NEWS'
and
content is not null
group by news.id
</select>
<select id="getAllBookNews" resultMap="BookNewsDTOMap">
SELECT
c.book_adviser_id,
c.book_id,
c.adviser_id,
c.channel_id,
b.serve_id
FROM
rights_setting a
INNER JOIN rights_setting_book_relation c ON a.id = c.rights_setting_id
INNER JOIN rights_now_item b ON a.id = b.rights_setting_id
INNER JOIN applet_news news ON b.serve_id = news.id
INNER JOIN book_group d ON c.book_id = d.book_id
INNER JOIN resource_page e ON e.book_group_id = d.id
WHERE
a.rights_setting_type = 2
AND b.serve_type = 'NEWS'
AND content IS NOT NULL
</select>
</mapper> </mapper>
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