Commit 9c44d947 by 田超

Merge branch 'feature/1003759' into 'master'

feat: [1003759] 添加书籍其他分类的年级科目,调整小睿权益配置页分类

See merge request rays/pcloud-book!1016
parents 551a622d 60ba8029
...@@ -918,16 +918,25 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -918,16 +918,25 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
return; return;
} }
List<Long> bookIds = rightsSettingBookRelations.stream().map(e -> e.getBookId()).collect(Collectors.toList()); List<Long> bookIds = rightsSettingBookRelations.stream().map(e -> e.getBookId()).collect(Collectors.toList());
List<Long> adviserIds = rightsSettingBookRelations.stream().map(e -> e.getAdviserId()).collect(Collectors.toList());
Map<Long, String> adviserNameMap = new HashMap<>();
if (!ListUtils.isEmpty(adviserIds)) {
adviserNameMap = adviserConsr.getNames(adviserIds);
}
Map<Long, BookDto> bookDtoMap = bookBiz.getListByIds(bookIds); Map<Long, BookDto> bookDtoMap = bookBiz.getListByIds(bookIds);
if (MapUtils.isEmpty(bookDtoMap)) { if (MapUtils.isEmpty(bookDtoMap)) {
return; return;
} }
rightsSettingBookRelations.forEach(rightsSettingBookRelation -> { for (RightsSettingBookRelation rightsSettingBookRelation : rightsSettingBookRelations) {
if (bookDtoMap.containsKey(rightsSettingBookRelation.getBookId()) && null != bookDtoMap if (bookDtoMap.containsKey(rightsSettingBookRelation.getBookId()) && null != bookDtoMap
.get(rightsSettingBookRelation.getBookId())) { .get(rightsSettingBookRelation.getBookId())) {
rightsSettingBookRelation.setBookName(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getBookName()); rightsSettingBookRelation.setBookName(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getBookName());
rightsSettingBookRelation.setIsbn(bookDtoMap.get(rightsSettingBookRelation.getBookId()).getIsbn());
} }
}); if (MapUtils.isNotEmpty(adviserNameMap) && null != adviserNameMap.get(rightsSettingBookRelation.getAdviserId())) {
rightsSettingBookRelation.setAdviserName(adviserNameMap.get(rightsSettingBookRelation.getAdviserId()));
}
}
rightsSetting.setRightsSettingBookRelations(rightsSettingBookRelations); rightsSetting.setRightsSettingBookRelations(rightsSettingBookRelations);
} }
...@@ -1625,6 +1634,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1625,6 +1634,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
rightsSettingDtoPageBeanNew = rightsSettingDAO rightsSettingDtoPageBeanNew = rightsSettingDAO
.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBookRightsSettingPage"); .listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBookRightsSettingPage");
//填充编辑名称
fillAdviserName(rightsSettingDtoPageBeanNew.getRecordList());
} else { } else {
paramMap.put("firstClassify", rightsSetting.getFirstClassify()); paramMap.put("firstClassify", rightsSetting.getFirstClassify());
paramMap.put("secondClassify", rightsSetting.getSecondClassify()); paramMap.put("secondClassify", rightsSetting.getSecondClassify());
...@@ -1642,6 +1653,35 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1642,6 +1653,35 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
return rightsSettingDtoPageBeanNew; return rightsSettingDtoPageBeanNew;
} }
private void fillAdviserName(List<RightsSettingDto> recordList) {
if (ListUtils.isEmpty(recordList) ) {
return;
}
List<Long> adviserIds = new ArrayList<>();
recordList.stream().forEach(rightsSettingDto -> {
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSettingDto.getRightsSettingBookRelations();
if (ListUtils.isEmpty(rightsSettingBookRelations)) {
return;
}
rightsSettingBookRelations.stream().forEach(rightsSettingBookRelation -> adviserIds.add(rightsSettingBookRelation.getAdviserId()));
});
if (ListUtils.isEmpty(adviserIds)) {
return;
}
Map<Long, String> adviserNameMap = adviserConsr.getNames(adviserIds);
if (MapUtils.isEmpty(adviserNameMap)) {
return;
}
recordList.forEach(rightsSettingDto -> {
List<RightsSettingBookRelation> rightsSettingBookRelations = rightsSettingDto.getRightsSettingBookRelations();
if (ListUtils.isEmpty(rightsSettingBookRelations)) {
return;
}
rightsSettingBookRelations.stream().forEach(rightsSettingBookRelation ->
rightsSettingBookRelation.setAdviserName(adviserNameMap.get(rightsSettingBookRelation.getAdviserId())));
});
}
private void setRelationBooks(List<RightsSettingDto> rightsSettingDtos) { private void setRelationBooks(List<RightsSettingDto> rightsSettingDtos) {
List<RightsSettingBookRelation> rightsSettingBookRelations = new ArrayList<>(); List<RightsSettingBookRelation> rightsSettingBookRelations = new ArrayList<>();
rightsSettingDtos.forEach(rightsSettingDto -> { rightsSettingDtos.forEach(rightsSettingDto -> {
......
...@@ -36,15 +36,6 @@ public class RightsSettingCheck { ...@@ -36,15 +36,6 @@ public class RightsSettingCheck {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!");
} }
if (RightsTypeEnum.BASE.code.equals(rightsSetting.getStepType())){ if (RightsTypeEnum.BASE.code.equals(rightsSetting.getStepType())){
if (StringUtil.isEmpty(rightsSetting.getIntroduce())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益简介为空!");
}
if (StringUtil.isEmpty(rightsSetting.getDetail())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益详情为空!");
}
if (null == rightsSetting.getCount()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益个数为空!");
}
if (null==rightsSetting.getRightsSettingType()){ if (null==rightsSetting.getRightsSettingType()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益类型为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益类型为空!");
} }
...@@ -206,16 +197,6 @@ public class RightsSettingCheck { ...@@ -206,16 +197,6 @@ public class RightsSettingCheck {
if (null == rightsSetting) { if (null == rightsSetting) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空!");
} }
if (StringUtil.isEmpty(rightsSetting.getIntroduce())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益简介为空!");
}
if (StringUtil.isEmpty(rightsSetting.getDetail())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益详情为空!");
}
if (null == rightsSetting.getCount()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益个数为空!");
}
if (null == rightsSetting.getRightsSettingType()) { if (null == rightsSetting.getRightsSettingType()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益类型为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益类型为空!");
} }
......
...@@ -17,11 +17,11 @@ public class RightsSettingConstant { ...@@ -17,11 +17,11 @@ public class RightsSettingConstant {
/** /**
* 所属k12教育的书刊分类id---有上下册分类 * 所属k12教育的书刊分类id---有上下册分类
*/ */
public static final Long[] K12_VOLUME_ID = {48L, 59L, 46L, 40L, 65L}; public static final Long[] K12_VOLUME_ID = {48L, 59L, 46L, 40L, 65L, 10L, 60L};
/** /**
* 所属k12教育/学前教育的书刊分类id---有版本分类 * 所属k12教育/学前教育的书刊分类id---有版本分类
*/ */
public static final Long[] K12_VERSION_ID = {48L, 59L, 46L, 40L, 65L, 73L}; public static final Long[] K12_VERSION_ID = {48L, 59L, 46L, 40L, 65L, 73L, 60L};
/** /**
* 医疗保健编辑书刊分类id * 医疗保健编辑书刊分类id
*/ */
......
...@@ -17,4 +17,9 @@ public class RightsSettingBookRelation { ...@@ -17,4 +17,9 @@ public class RightsSettingBookRelation {
private String bookName; private String bookName;
private Long adviserId;
private String adviserName;
private String isbn;
} }
\ No newline at end of file
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="book_name" property="bookName" jdbcType="VARCHAR" /> <result column="book_name" property="bookName" jdbcType="VARCHAR" />
<result column="adviser_id" property="adviserId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, rights_setting_id, book_id, create_time, update_time id, rights_setting_id, book_id, create_time, update_time, adviser_id
</sql> </sql>
<sql id="Base_Column_List_owm" > <sql id="Base_Column_List_owm" >
r.id, r.rights_setting_id, r.book_id, r.create_time, r.update_time r.id, r.rights_setting_id, r.book_id, r.create_time, r.update_time
...@@ -23,9 +24,11 @@ ...@@ -23,9 +24,11 @@
</select> </select>
<select id="selectByRithsSettingId" resultMap="BaseResultMap"> <select id="selectByRithsSettingId" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> r.id, r.rights_setting_id, r.book_id, r.create_time, r.update_time, ifnull(r.adviser_id, b.adviser_id) adviser_id
from rights_setting_book_relation from rights_setting_book_relation r
left join book_adviser b on r.book_id = b.book_id AND b.IS_DELETE=0
where rights_setting_id = #{rightsSettingId,jdbcType=BIGINT} where rights_setting_id = #{rightsSettingId,jdbcType=BIGINT}
group by r.book_id
</select> </select>
<select id="getAllBookIds" resultType="java.lang.Long"> <select id="getAllBookIds" resultType="java.lang.Long">
select book_id select book_id
...@@ -85,11 +88,11 @@ ...@@ -85,11 +88,11 @@
</insert> </insert>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation"> <insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation">
insert into rights_setting_book_relation (rights_setting_id, book_id, insert into rights_setting_book_relation (rights_setting_id, book_id,
create_time, update_time) create_time, update_time, adviser_id)
values values
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
(#{item.rightsSettingId,jdbcType=BIGINT}, #{item.bookId,jdbcType=BIGINT}, (#{item.rightsSettingId,jdbcType=BIGINT}, #{item.bookId,jdbcType=BIGINT},
now(),now()) now(),now(), #{item.adviserId})
</foreach> </foreach>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation" >
...@@ -120,9 +123,11 @@ ...@@ -120,9 +123,11 @@
</update> </update>
<select id="selectBookByRithsSettingId" resultMap="BaseResultMap"> <select id="selectBookByRithsSettingId" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List_owm" />,b.book_name <include refid="Base_Column_List_owm" />,b.book_name, b.isbn, ifnull(r.adviser_id,a.adviser_id) adviser_id
from rights_setting_book_relation r from rights_setting_book_relation r
left join book b on r.book_id = b.book_Id left join book b on r.book_id = b.book_Id
INNER JOIN book_adviser a ON b.BOOK_ID=a.BOOK_ID AND a.IS_DELETE=0
where rights_setting_id = #{_parameter} where rights_setting_id = #{_parameter}
group by r.book_id
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -260,7 +260,9 @@ ...@@ -260,7 +260,9 @@
select select
r.id,r.rights_number, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id, r.id,r.rights_number, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME, r.vol_label_id, r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME, r.vol_label_id,
r.ver_label_id, r.show_state r.ver_label_id, r.show_state,
b.isbn,
ifnull(s.adviser_id,a.adviser_id) adviser_id
from from
rights_setting r rights_setting r
left join rights_setting_book_relation s on r.id = s.rights_setting_id left join rights_setting_book_relation s on r.id = s.rights_setting_id
......
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