Commit a243d221 by 朱亚洁

feat:[none]馆配书修改意见

parent f5af7d41
......@@ -75,7 +75,7 @@ public interface AppletBooklistBiz {
* @return
*/
PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId);
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId, Long relateAgentId);
/**
* 书单添加图书
......
......@@ -15,7 +15,6 @@ import com.pcloud.book.applet.dto.AppletOuterBookDTO;
import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist;
import com.pcloud.book.applet.dto.OuterBooklistAddDTO;
import com.pcloud.book.applet.entity.AppletBookClassify;
import com.pcloud.book.applet.entity.AppletBooklist;
import com.pcloud.book.applet.entity.AppletBooklistClassify;
import com.pcloud.book.applet.entity.AppletBooklistClassifyUser;
......@@ -28,16 +27,14 @@ import com.pcloud.book.book.dto.BookAdviserDto;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.wechat.entity.AccountSetting;
import com.pcloud.book.consumer.user.AgentConsr;
import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
......@@ -91,6 +88,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
private BookAdviserBiz bookAdviserBiz;
@Autowired
private ESBookAndAdviserBiz esBookAndAdviserBiz;
@Autowired
private AgentConsr agentConsr;
@Override
......@@ -164,16 +163,22 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
if (null != appletBooklist){
BeanUtils.copyProperties(appletBooklist,dto);
}
if (null != dto.getRelateAgentId()) {
String agentName = agentConsr.getNameById(dto.getRelateAgentId());
dto.setRelateAgentName(agentName);
}
return dto;
}
@Override
public PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId) {
Long firstClassify,Long secondClassify,Long gradeLabelId, Long subjectLabelId,
Long relateAgentId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("name", name);
paramMap.put("classifyId", classifyId);
paramMap.put("agentId", agentId);
paramMap.put("relateAgentId", relateAgentId);
if (null!=firstClassify){
BaseTempletClassify classify = new BaseTempletClassify();
classify.setFirstClassify(firstClassify);
......@@ -194,10 +199,11 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
if(null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>());
}
//填充书刊,分类,标签
//填充书刊,分类,标签,出版社
List<Long> booklistIds = new ArrayList<>();
List<Long> classifyIds = new ArrayList<>();
List<Long> labelIds = new ArrayList<>();
List<Long> relateAgentIds = new ArrayList<>();
for(AppletBooklistDTO appletBooklistDTO : pageBeanNew.getRecordList()){
booklistIds.add(appletBooklistDTO.getId());
if (null != appletBooklistDTO.getFirstClassify()){
......@@ -212,6 +218,9 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
if (null != appletBooklistDTO.getSubjectLabelId()) {
labelIds.add(appletBooklistDTO.getSubjectLabelId());
}
if (null != appletBooklistDTO.getRelateAgentId()){
relateAgentIds.add(appletBooklistDTO.getRelateAgentId());
}
}
List<BookDTO4Booklist> booklists = appletBooklistDao.getConfigByBooklistIds(booklistIds);
Map<Long,List<BookDTO4Booklist>> map = new HashMap<>();
......@@ -220,12 +229,16 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
Map<Long, AssistTempletDTO> classifyMap = new HashMap<>();
Map<Long, BookLabel> labelMap= new HashMap<>();
Map<Long, String> relateAgentNameMap = new HashMap<>();
if (!ListUtils.isEmpty(classifyIds)){
classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
}
if (!ListUtils.isEmpty(labelIds)){
labelMap = bookLabelDao.getMapByIds(labelIds);
}
if (!ListUtils.isEmpty(relateAgentIds)){
relateAgentNameMap = agentConsr.getNames(relateAgentIds);
}
for (AppletBooklistDTO booklistDTO: pageBeanNew.getRecordList()){
if (!MapUtils.isEmpty(map) && map.containsKey(booklistDTO.getId())){
List<BookDTO4Booklist> bookDTO4Booklists = map.get(booklistDTO.getId());
......@@ -243,6 +256,9 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(booklistDTO.getSubjectLabelId())){
booklistDTO.setSubjectLabelIdContent(labelMap.get(booklistDTO.getSubjectLabelId()).getName());
}
if (!MapUtils.isEmpty(relateAgentNameMap) && relateAgentNameMap.containsKey(booklistDTO.getRelateAgentId())) {
booklistDTO.setRelateAgentName(relateAgentNameMap.get(booklistDTO.getRelateAgentId()));
}
}
return pageBeanNew;
}
......@@ -659,8 +675,10 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
@Override
public List<AppletBooklistDTO> getRecommendBooklistByBook(Long bookId, Long adviserId, Long channelId) {
BookAdviserDto bookAdviserDto;
Long relateAgentId = null;
if (channelId != null && channelId>0 && adviserId != null && adviserId>0){
bookAdviserDto = bookAdviserBiz.getBase(bookId,channelId,adviserId);
relateAgentId = adviserConsr.getAgentIdByAdviser(adviserId);
}else {
bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId);
}
......@@ -673,7 +691,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
classify.setGradeLabelId(bookAdviserDto.getGraLabelId());
classify.setSubjectLabelId(bookAdviserDto.getSubLabelId());
rightsSettingBiz.setClassifyAndLabel(classify);
List<AppletBooklistDTO> list = appletBooklistDao.getByLabel(classify.getFirstClassify(), classify.getSecondClassify(), classify.getGradeLabelId(), classify.getSubjectLabelId(), 3);
List<AppletBooklistDTO> list = appletBooklistDao.getByLabel(classify.getFirstClassify(), classify.getSecondClassify(), classify.getGradeLabelId(), classify.getSubjectLabelId(), 3, relateAgentId);
if (!ListUtils.isEmpty(list)){
//带3本书
for (AppletBooklistDTO booklistDTO : list) {
......@@ -737,7 +755,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
appletBooklist.setSecondClassify(ListUtils.isEmpty(secondTempletIds)?null:secondTempletIds.get(0));
appletBooklist.setGradeLabelId(ListUtils.isEmpty(graLabelIds)?null:graLabelIds.get(0));
appletBooklist.setSubjectLabelId(ListUtils.isEmpty(subLabelIds)?null:subLabelIds.get(0));
appletBooklist.setDigest((int) esPage.getTotalElements()+"本"+assistTempletDTO.getTempletName()+"书单推荐");
appletBooklist.setDigest(esPage.getContent().size()+"本"+assistTempletDTO.getTempletName()+"书单推荐");
appletBooklist.setDisplayPic("https://oss.5rs.me/oss/uploadfe/png/39e36255426a66454037fcde86e19bf2.png");
appletBooklist.setClassifyId(1L);
appletBooklist.setIntroduceType(1);
......
......@@ -74,7 +74,7 @@ public interface AppletBooklistDao extends BaseDao<AppletBooklist> {
* @date:2020/8/10 10:37
* * @param null
*/
List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit);
List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit, Long relateAgentId);
......
......@@ -72,13 +72,15 @@ public class AppletBooklistDaoImpl extends BaseDaoImpl<AppletBooklist> implement
}
@Override
public List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit) {
public List<AppletBooklistDTO> getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer limit,
Long relateAgentId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("firstClassify", firstClassify);
paramMap.put("secondClassify", secondClassify);
paramMap.put("gradeLabelId", gradeLabelId);
paramMap.put("subjectLabelId", subjectLabelId);
paramMap.put("limit", limit);
paramMap.put("relateAgentId", relateAgentId);
return getSessionTemplate().selectList(getStatement("getByLabel"), paramMap);
}
......
......@@ -63,5 +63,8 @@ public class AppletBooklistDTO extends BaseDto {
private String gradeLabelIdContent;
@ApiModelProperty("科目标签")
private String subjectLabelIdContent;
@ApiModelProperty("书单所属出版社")
private Long relateAgentId;
@ApiModelProperty("书单所属出版社")
private String relateAgentName;
}
......@@ -40,5 +40,9 @@ public class AppletBooklist extends BaseTempletClassify {
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("书单所属出版社")
private Long relateAgentId;
}
......@@ -235,7 +235,8 @@ public class AppletHomeFacade {
@RequestParam(value = "firstClassify", required = false) @ApiParam("一级书刊分类") Long firstClassify,
@RequestParam(value = "secondClassify", required = false) @ApiParam("二级书刊分类")Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) @ApiParam("年级标签")Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId,
@RequestParam(value = "relateAgentId", required = false) @ApiParam("书单所属出版")Long relateAgentId
) throws PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
......@@ -243,7 +244,7 @@ public class AppletHomeFacade {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
}
return new ResponseDto<>(appletBooklistBiz.listBooklist(currentPage, numPerPage, name, classifyId, agentId, firstClassify,secondClassify,
gradeLabelId,subjectLabelId));
gradeLabelId,subjectLabelId, relateAgentId));
}
@ApiOperation("书单添加图书")
......
......@@ -4,6 +4,7 @@
package com.pcloud.book.consumer.user;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
......@@ -94,4 +95,15 @@ public class AgentConsr {
}
return agentMap;
}
@ParamLog("getNameById")
public String getNameById(Long agentId){
String name="";
try {
name = ResponseHandleUtil.parseResponse(agentService.getNameById(agentId),String.class);
}catch (Exception e){
LOGGER.error("调用getNameById获取出版社名称失败"+e.getMessage(),e);
}
return name;
}
}
......@@ -17,6 +17,7 @@
<result column="second_classify" property="secondClassify" jdbcType="BIGINT" />
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
<result column="relate_agent_id" property="relateAgentId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="BaseResultMap4DTO" type="com.pcloud.book.applet.dto.AppletBooklistDTO" >
......@@ -37,19 +38,19 @@
<sql id="Base_Column_List" >
id, booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url,
classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id
classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id, relate_agent_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletBooklist" useGeneratedKeys="true" keyProperty="id">
insert into applet_booklist (
booklist_name, user_name, digest, display_pic, introduce_type, introduce_content, introduce_url,
classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id
classify_id, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id,
relate_agent_id
)
values (
#{booklistName}, #{userName}, #{digest}, #{displayPic}, #{introduceType}, #{introduceContent}, #{introduceUrl},
#{classifyId}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{relateAgentId}
)
</insert>
......@@ -84,6 +85,7 @@
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
relate_agent_id = #{relateAgentId},
update_time=NOW()
</set>
where id = #{id,jdbcType=BIGINT}
......@@ -125,7 +127,8 @@
b.first_classify firstClassify,
b.second_classify secondClassify,
b.grade_label_id gradeLabelId,
b.subject_label_id subjectLabelId
b.subject_label_id subjectLabelId,
b.relate_agent_id relateAgentId
FROM applet_booklist b
LEFT JOIN applet_booklist_config c ON b.id=c.booklist_id
LEFT JOIN applet_booklist_classify a ON b.classify_id=a.id
......@@ -148,6 +151,9 @@
<if test="subjectLabelId != null">
AND b.subject_label_id = #{subjectLabelId}
</if>
<if test="relateAgentId != null">
AND b.relate_agent_id = #{relateAgentId}
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
......@@ -304,6 +310,9 @@
<if test="subjectLabelId != null">
AND b.subject_label_id = #{subjectLabelId}
</if>
<if test="relateAgentId != null">
AND b.relate_agent_id = #{relateAgentId}
</if>
GROUP BY
b.id
HAVING
......
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